text:
Q: Expand Primefaces Tree on selection I'm using Primefaces 6.1. The creation of the tree works fine, it also reacts on expanding the tree while clicking the triangle on the left. It also fires the event when clicking the node. But.... I would like to expand the tree when clicking the node. I'm not able to bring this to work.
This is the tree-code snippet:
<p:tree id="tree"
        value="#{managedBeanFolder.root}"
        var="node"
        styleClass="tree-noborder"
        selectionMode="single">
    <p:ajax update=":folderListe:docListLatest" event="select" listener="#{managedBeanFolder.onNodeSelectListe}"/>
    <p:treeNode>
        <h:outputText value="#{node}" style="border:none" />
    </p:treeNode>
</p:tree>

My ViewScoped ManagedBean looks like this
public void onNodeSelectListe(NodeSelectEvent event) {
    RequestContext context = RequestContext.getCurrentInstance();
    TreeNode selectedNode = (TreeNode) event.getTreeNode();
    if (selectedNode != null) {
        if (selectedNode.getChildCount() > 0) {
            if (selectedNode.isExpanded()) {
                selectedNode.setExpanded(false);
                context.update("folderListe:tree");
            } else {
                selectedNode.setExpanded(true);
                context.update("folderListe:tree");
            }
        }
    }
}

I have checked, the code is executed. When I expand the tree by clicking the triangle, selectedNode.isExpanded() is true, when I collapse by clicking the triangle, the value is false.  But the website is not updated.
What is wrong?
Many thanks

A: You need to update the tree:
<p:ajax update=":folderListe:docListLatest @this"

A: I was able to solve this issue. By changing the JSF-part and the managed bean.
This is my JSF-Part:
<p:tree id="tree"
        value="#{managedBeanFolder.root}"
        var="node"
        style="border: none; width:300px; float: left; color: red; font-size: 102%;line-height: 1.847;"
        styleClass="tree-noborder"
        selectionMode="single"
        >
        <p:ajax update="folderListe:docListLatest, folderListe:tree"
                event="select"
                listener="#{managedBeanFolder.onNodeSelectListe}"
                process="tree"/>
       <p:treeNode>
                <h:outputText value="#{node}" style="border: none" />
       </p:treeNode>
</p:tree>

The ID of my form is 'folderListe' and 'docListLatest' is a datatable being refreshed by clicking the node.
Within my managed bean I have this listener:
public void onNodeSelectListe(NodeSelectEvent event) {
    RequestContext context = RequestContext.getCurrentInstance();
    TreeNode selectedNodeLocal = (TreeNode) event.getTreeNode();

    selectedNode = selectedNodeLocal;

    if (selectedNode != null) {
        if (selectedNode.getChildCount() > 0) {
            if (selectedNode.isExpanded()) {
                selectedNode.setExpanded(false);
                context.update("folderListe:tree");
            } else {
                selectedNode.setExpanded(true);
                context.update("folderListe:tree");
            }
        }
    }
    int folder = (int) folderIden.get(selectedNode.getRowKey());
    setFolderID(folder);
    setFolderName(selectedNode.toString());
    context.update("folderListe:docListLatest");

    // application specific things to remember
    SharedObjects so = new SharedObjects();
    so.setFolderID(folder);
    getManagedBeanWebdokument().setFolderID(folderID);
    getManagedBeanWebdokument().setFolderName(getFolderName());

}

And all of a sudden, it did what I wanted it to do:-)


text:
Q: Running macro with a different number of rows and columns each time So I have a tedious task of separating/filtering data and changing the format and making a new sheet.
My question is that if i record a macro for one sheet will it work for another keeping in mind that the number of rows and columns will ALWAYS change.
There's no set number i would have to manually check that if i went into vba and changed the code accordingly.

A: Depends on how do you record it. If you use ctrl+arrows in the recording you may be lucky.
E.g. the following macro works on all rows, simply coloring them in yellow. independent, whether they are 4 or 400:
Option Explicit
Sub Makro2()
'
' Makro2 Makro
'

'
    Range("A1").Select
    Range(Selection, Selection.End(xlDown)).Select
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .Color = 255
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
End Sub

It is recorded with CTRL+Arrow, to select the last row.
However, for more complicated code you should not use the recorder.

A: There is a few ways to get the last row/column in a spreedsheet
Lastrow = ActiveSheet.Range("A" & Activesheet.Rows.Count).End(xlup).row
LastCol = ActiveSheet.Cells(1, ActiveSheet.Columns.Count).End(xlToLeft).column

This will return the last row in column A, you may need to change this depending where your data starts. The LastCol will return a number for the column (Note that .Cells goes .Cells([Row Index], [Column Index])). This is the way I get the last row/column, I find it easier to understand and can do any manipulation needed.

LastRow = Cells.SpecialCells(xlLastCell).Row
LastColumn = Cells.SpecialCells(xlLastCell).Column

This is another way to get the last row/column, this does have issues as Excel workouts the last row/column in an odd way. If you edit the last cell in the last row (XFD1048576 in my case) then that becomes the .SpecialCells(xlLastCell)s last cell.
Let me know if you need anything clarified

A: Recording will give you some basic idea of macro execution. But if you want that code need to work in all scenarios then you need to do some customization to your code.
To find the last row there are so many ways.
Source : http://www.vbausefulcodes.in/usefulcodes/finding-last-row-in-excel-vba.php
sub lastrow()
lastrow = Range("A" & Rows.Count).End(xlUp).Row
Msgbox lastrow
End sub

*************************************
Other ways
**************************************

Sub FindingLastRow()

'PURPOSE: Different ways to find the last row number of a range

Dim sht As Worksheet
Dim LastRow As Long

Set sht = ThisWorkbook.Worksheets("Sheet1")

'Ctrl + Shift + End
LastRow = sht.Cells(sht.Rows.Count, "A").End(xlUp).Row

'Using UsedRange
sht.UsedRange 'Refresh UsedRange
LastRow = sht.UsedRange.Rows(sht.UsedRange.Rows.Count).Row

'Using Table Range
LastRow = sht.ListObjects("Table1").Range.Rows.Count

'Using Named Range
LastRow = sht.Range("MyNamedRange").Rows.Count

'Ctrl + Shift + Down (Range should be first cell in data set)
LastRow = sht.Range("A1").CurrentRegion.Rows.Count

End Sub

but you need to use the best method which matches with your scenario.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to optimize hibernate method call in loop? I have a java web application built using spring+hibernate.
I have code like this:
for (Account account : accountList){

    Client client = clientService.findById(account.getFkClient());  // fkClient is foreign key to Client

    if (client != null) {
        ...
        anObject.setName(client.getName());
        anObject.setAccountNo(account.getAccountNo());
        ...
    }
    else {
        ...
        anObject.setAccountNo(account.getAccountNo());
        ...
    }

    ...
}

accountList is a List of Account entity that retrieved from hibernate call. Inside the for loop, a Client entity is retrieved from account using hibernate call inside clientService.findById method.
These are the class involved to the call:
public class ClientService implements  IClientService {
    private IClientDAO clientDAO;

    ...

    @Override
    public Client findById(Long id) throws Exception {
        return clientDAO.findById(id);
    }
}

public class ClientDAO extends AbstractHibernateDAO<Client, Long> implements IClientDAO {

    @Override
    public Client findById(Long id) throws Exception {
        return super.findById(id);
    }
}

public class AbstractHibernateDAO<T,Y extends Serializable> extends HibernateDaoSupport {

    protected Class<T> domainClass = getDomainClass();

    private Class<T> getDomainClass() {
        if (domainClass == null) {
            ParameterizedType thisType = (ParameterizedType) getClass().getGenericSuperclass();
            domainClass = (Class<T>) thisType.getActualTypeArguments()[0];
        }
        return domainClass;
    }

    public T findById(final Y id) throws SystemException {
        return (T) this.execute(new HibernateCallback<T>() {

            @Override
            public T doInHibernate(Session session) throws HibernateException, SQLException {
                return (T) session.get(domainClass, id);
            }
        });
    }
}

Note: clientService and clientDAO are spring beans object.
My question is how to optimize the clientService.findById inside the loop with hibernate? I feel the findById call make the looping process become slower.
The accountList usually contains 7000+ records, so I need something like pre-compiled query mechanism just like PreparedStatements in jdbc. Is it possible to do this with hibernate?
Note: the code above has been simplified by removing unrelated parts, the method, variable and class name are made fictious for privacy reason. If you find a typo, please let me know in the comment section since I typed the code manually.

A: In Hibernate/JPA you can write queries with Hibernate Query Language/ JPA query language and create NamedQueries. NamedQuery is compiled when server is started so you can consider it like some kind of prepared statement.
You can try to write HQL query which can get all entity instances with single query.
I will give you example in JPQL but you can write it with HQL as well.
@NamedQueries({
    @NamedQuery(name = "QUERY_BY_ID",
    query = "SELECT u from SomeEntity se WHERE se.id IN (:idList)"),
})
class SomeEntity {
}

class SomeEntityDao {
    public List<SomeEntity> findIdList(List<Long> idList) {
        Query query = entityManager.createNamedQuery("QUERY_BY_ID");
        query.setParameter("idList", idList);

        return query.getResultList();
    }
}

A: I found the best solution. I put the query that select columns from table Account and Client joined together into a View (VIEW_ACCOUNT_CLIENT), then I made entity class (AccountClientView) for the view and fetch it using hibernate, the result is wow, it boosts the performance drastically. Using the real code, it could takes about 15-20 minutes to finish the loop, but using View, it only takes 8-10 seconds
@Entity
@Table(name = "VIEW_ACCOUNT_CLIENT")
public class AccountClientView implements Serializable {

    ...

}

A: It's not clear what you want to achieve. I wouldn't do service calls in a loop. Why don't you use a NamedQuery?
Retrieve all Clients attached to the given Accounts, then iterate over that list of Clients.
SELECT c from Client c JOIN c.account a WHERE a.id IN (:accounIds)

But it really depends on the business requirement!
Also it's not clear to me why don't you just call:
Client client = account.getClient();

You might want to load your accountList with the clients already fetched in. Either use eager fetching, or fetch join. If the Account entity does not contain a Client, you should have a very good reason for it.


text:
Q: Statistics 2 sample t-proportion question I am slightly confused regarded the below problem:
I assume you have to do the 2 sample t proportion test, but don't I need two n values, one for each year? I only see the 2007 year, so I don't know what I would use for my $n_1$ value.
Could someone please walk me through the solution to this problem?
According to a study conducted in the United States in 2000, $13.6\%$ of all Americans 18-25 years old used marijuana or hashish. In 2007, a random sample of $1283$ Americans of the same age group was interviewed, out of which $205$ said that they used these drugs. At the $5\%$ significance level, test whether the data provides sufficient evidence to conclude that the proportion of Americans 18-25 years old that used marijuana and hashish in 2007 had changed since the study of 2000.
The possible answers are given below:
a) $H_0:p=0.136;H_a:p\neq0.136;z=2.49;=p-value=0.9872$. There is not enough evidence to conclude that the proportion of Americans 18-25 years old that used marijuana and hashish in 2007 had changed since the study of 2000.
b) $H_0:p=0.136;H_a:p\neq0.136;z=2.49;=p-value=0.0128$. There is sufficient evidence to conclude that the proportion of Americans 18-25 years old that used marijuana and hashish in 2007 had changed since 2000.
c) $H_0:p=0.136;H_a:p\neq0.136;z=2.49;p-value=0.0064$. There is sufficient evidence to conclude that the proportion of Americans 18-25 years old that used marijuana and hashish in 2007 had changed since 2000.
d) $H_0:p=0.136;H_a:p>0.136;z=2.49;p-value=0.0064$. There is sufficient evidence to conclude that the proportion of Americans 18-25 years old that used marijuana and hashish in 2007 had changed since 2000.
e) $H_0:p=0.136;H_ap\neq0.136;z=2.33;p-value=0.0198$. There is sufficient evidence to conclude that the proportion of Americans 18-25 years old that used marijuana and hashish in 2007 had changed since 2000.
Thanks in advance!

A: Hints:

*

*One or two-sided test?

*If population proportion $p=0.136$, what is the expected number or proportion from a sample of $1283$? What is the corresponding variance and standard deviation?

*What is the $z$-value corresponding to $205$ out of $1283$? (subtracting the mean and dividing the difference by the standard deviation)

*Using a normal approximation to the binomial, from the normal distribution what is the corresponding $p$-value?


text:
Q: Building core shop framework in Rails. Suitable or not? I work at an in-house IT department for company running 10 or so only shops of varying complexity. The shops code has been written over the last 8 years, each shop a new branch growing father and father away from the stem (I guess that makes it a bush?)
The need for more and more complex discounts, campaigns and user monitoring are growing rapidly - and changing rapidly as well (you never know what they come up with). So we have decided to write a new system from scratch and bring the different shops back together having them run on the same core code. We have considered .NET, but due to the fact that the design requirements change so fast we have more or less decided to give Rails a try. But we have some uncertainties/questions about rails.
Is Rails (stack) suitable to run to build a shop framework and who should this be organized?
We are running around 10 shops of which some are very much alike only differing in style, where others stands out in functionality, flow and content. But behind the business logic is all the same. The shops functionality is to a great extend the same as well. As an example the checkout page of one shop might display great details about VAT, discounts, P&P, etc. where as another might only show the necessary minimum.
Which approach would you take? Would you build and maintain a runable template shop with a functional superset of the shops. As new functionality is developed then merge the code with the other shops? Sounds a bit cumbersome.
In the example with the checkout page the views would differ from shop to shop, but the controllers and the models would remain the same, as long as you externalize  configurations, like payment method types, and so on.
From this perspective it would make more sense just to create a repository of the views and configurations for each shop and then maintain model and controller code in a separate repository.
Would be possible to arrange the views according to shop, keeping all resources in one repositoary /views/shopname/Product. Would this make sense?
What do you think? how would you do this? Will working with rails in this way bring to much trouble?
Our campaign/discount system is growing steadily complex, both GUI and business logic. (in this view Rails seems interesting with its fast turnaround). Our discounts are property based and these properties are stored in a database row.
Making changes in the requirements to the workings of a discount is a real headache. So we are slowly replacing this property based system with a system that for each discount attaches a class (PHP) and a configuration so that each discount type has its own class and each utilization of such discount could specify some values for this class to operate on given current context (basically: what is in the basket)
In rails what approach would you take?
In rails you can easily extend your model (discount) with yet another property, migrate and you are ready (maybe a bit simplified). Could you write a base discount class that relied on a few basic properties and then write modules that hook into (extends) this class in case you need more advanced functionality?
Specifically what would this be in Rails terms a helper?
Some of this post might be a bit unclear. Please do ask questions. Also I'm in the process of learning Rails so please excuse me if don't use the right terms or if I've missed some of the main ideas of Rails.
Thanks
 Michael

A:
Is Rails (stack) suitable to run to
  build a shop framework and how should
  this be organized?

Sure, it can be suitable see:

*

*http://www.shopify.com/

*http://www.liquidmarkup.org/
I would not recommend it as a first project though.

A: Dont forget Spree Commerce as a viable solution that may or not suid your needs.  On the other hand, if you want to roll your own solution, also check ActiveMerchant for payment gateway integration.


text:
Q: How do I plot a Lyapunov Exponent Graph with 2D array on MATLAB I have the following code to generate a 2d array but I can't seem to get the graph out. This is the graph I wish to get.

close all
clear all

rvalues = 20:1:200;
N=100;
fs=5;
r=rvalues;
x=rand(1);
a=1;
X=zeros(N,length(r));
for n=1:.3*N
    x=(1/a).*mod(r.*x.*(1-sin(x)),a);
    X(n,:)=x;
end
lyapExp = lyapunovExponent(X,fs)
figure (2), hold on
for n=.3*N:N
    x=(1/a).*mod(r.*x.*(1-sin(x)),a);
    X(n,:)=x;
    lyapExp = lyapunovExponent(X,fs)

end
hold off

Any help is highly appreciated.

A: Not sure if this is exactly want you want but, to avoid suppressing the plot you can call the function lyapunovExponent(X,fs); without a return/output variable. This will result in MATLAB opening a new figure and plotting the following:

clear
close all

rvalues = 20:1:200;
N = 100;
fs = 5;
r = rvalues;
x = rand(1);
a = 1;
X = zeros(N,length(r));

for n=1: 0.3*N
    x=(1/a).*mod(r.*x.*(1-sin(x)),a);
    X(n,:) = x;
end

lyapExp = lyapunovExponent(X,fs);
%Calling without a return variable so plot is not suppressed%
lyapunovExponent(X,fs);


text:
Q: Sketch the region enclosed by $y= \sqrt{x}$, $y=0$, $x=4$ and calculate its area I do not understand how this would work to find the area. Any help would be appreciated.

A: You can sketch the graph on paper. The required area is area under curve of $\sqrt{x}$ from $x=0$ to $x=4$.
$$\int_{0}^{4} \sqrt{x} dx = \frac{2}{3} \left(4^{3/2}-0^{3/2}\right) = \frac{16}{3}$$

A: Hint:
Won't that simply be $$\int _{0}^4 \sqrt x.  dx=?$$

A: I am sure you can sketch the graph.
Note that there are two different ways to find the area.
One way which is probably easier, is to avoid the square root and integrate in y direction.
Area =$ \int\limits_0^2(4-y^2)dy$= $16/3$
The other way is to integrate in x direction and remember to change your limits of integration to $0$ and $4$


text:
Q: VLC 3 interface looks "old" VLC 3 looks "old"/"unstyled" after installation with snap.
Here is a screenshot
As you can see the buttons are kind of unstyled.

A: To install the latest VLC :
Add repository :
sudo add-apt-repository ppa:jonathonf/vlc

Delete previous versions VLC :
sudo apt remove vlc vlc-nox

Update and install the latest VLC version :
sudo apt update && sudo apt install vlc

To install from snap, follow this link :
How to install the vlc 3.0 snap in linux


text:
Q: PDF in edit mode using iTextSharp i have a pdf and which has some editable fields. After filling the pdf using iTextSharp and i'll give the option to download the pdf to users. But i need the fields in pdf to be in editable mode after user download it so that he can make any changes required.
How to do it using iTextSharp.
i tried below code but not working
pdfStamper.FormFlattening = false;
Please advise.


text:
Q: CMD/ComObject: why this CMD window has zero content? I'm working on an autohotkey script which runs some CMD command. Considering other factors, at last I have to do it with ComObject, which I did not learn before. But at the end of the day this question is about CMD command.
abc is a varible string of 3 lines, standing for 3 commands. This code will run these 3 commands then exit.
Please take a look: Originally it's "exec := shell.Exec(ComSpec " /Q /K echo off")", so cmd window is totally hidden, so I changed it to " /K echo on", now I can see CMD window, with a title, and all 3 commands ran successfully, but in the whole process there's no text in this CMD window. How can I fix it?
abc := "xxxxxx"
RunWaitMany(abc)
RunWaitMany(commands) {
    shell := ComObjCreate("WScript.Shell")
    ; Open cmd.exe with echoing of commands disabled
    exec := shell.Exec(ComSpec " /K echo on")
    ; Send the commands to execute, separated by newline
    exec.StdIn.WriteLine(commands "`nexit")  ; Always exit at the end!
    ; Read and return the output of all commands
    return exec.StdOut.ReadAll()
}

A: So, what I think you're trying to do, is to get a cmd to appear with the output of your commands?
That example function from the AHK documentation you're using is for just reading the output of your command(s), and it successfully does that.
I think this is was you want:
Run, % A_ComSpec " /K echo Hello!"
(Run, %ComSpec% /K echo Hello! in legacy AHK)
For chaining more commands together, you can wrap them in " and use & (I'm no cmd expert, so not sure if & can be used in every case, but yeah):
Run, % A_ComSpec "
(Join
 /K ""echo Hi, lets list the IPv4 addresses in the ipconfig command.
& ipconfig | findstr IPv4
& echo Sweet, it worked
& echo Bye!""
)"

A continuation section is used there to break it into multiple lines and be more readable.
Same thing here without a continuation section:
Run, % A_ComSpec " /K ""echo Hi, lets list the IPv4 addresses in the ipconfig command. & ipconfig|findstr IPv4 & echo Sweet, it worked & echo Bye!"""

Or in legacy AHK:
Run, %ComSpec% /K "echo Hi`, lets list the IPv4 addresses in the ipconfig command. & ipconfig|findstr IPv4 & echo Sweet`, it worked & echo Bye!"

And if it's important to have it as a function, something like this would do the trick
MyCommands := "
(Join`n
echo Hi, lets list the IPv4 addresses in the ipconfig command.
ipconfig | findstr IPv4
echo Sweet, it worked
echo Bye!
)"

RunCommands(MyCommands)
return

RunCommands(commands)
{
    Run, % A_ComSpec " /K """ RegExReplace(commands, "`r?`n", "&") """"
}

So replace line breaks with an &.


text:
Q: How to set datacontext for each combobox? I'm having a problem about binding in combobox ( WPF, MVVM).
I have a combobox, which binds to AViewModel ( for example).
To do that, I did have:
- AModel
- AViewModel
- Xaml file :
<Window.DataContext>
    <ViewModel:AViewModel/>
</Window.DataContext>

It works fine.
But, now, I add one more combobox to the same form with combobox above. This combobox binds to diffirent ViewModel (BViewMoel for example, note that, this BViewModel located in diffirent file with AViewModel above).
And this is combobox xaml:
<ComboBox
    DataContext="BViewModel"
    ItemsSource="{Binding Path=MyList}" DisplayMemberPath="BName"/>

My problem is: the second combobox is not populated because it does not have datacontext.
But I cannot set datacontext for it because it is set above for AViewModel.
I did a lots of searching but I still stuck in this.
Should I merge all ViewModels into a ViewModel and set this to Datacontext of Window or any ideal?
Thank you.

A: Really, I wouldn't use a ViewModel for each combobox. Combobox is a simple control, you should bind the ItemsSource property to a public property (of type ObservableCollection<T> for instance) of the ViewModel of the owner view.
Sometimes it's useful to use a ViewModel for a specific and complex usercontrol. In this case, you can expose the viewModel as a public property of the ViewModel of the owner view:
public class UCViewModel : ViewModelBase
{
}

public class MyViewViewModel : ViewModelBase
{
    public MyViewViewModel()
    {
        this.UCViewModel = new UCViewModel();
    }

    public UCViewModel UCViewModel { get; set; }
}

<Window x:Class="MyView">

    <MyComplexUsercontrol DataContext="{Binding UCViewModel}" />

</Window>

public partial class MyView : Window
{
    public MyView()
    {
        InitializeComponent();
        this.DataContext = new MyViewViewModel();
    }
}

But again, for a simple combobox, just bind it to a property of the ViewModel associated with the owner view.

A: combobox1.DataContext = new AViewModel();
combobox2.DataContext = new BViewModel();

But I suggest using a ViewModel contains two properties.
public class ViewModel
{
    public AViewModel AViewModel{get;set;}
    public BViewModel BViewModel{get;set;}
}


text:
Q: Custom react hook to set input form not working I've tried creating a custom hook, following the examples an article about handling forms in react using hooks. I should also add I'm very new to react.
This is the content of hooks/useInput.js:
import { useState } from "react";

function useInput(initialValue) {
  const [value, setValue] = useState(initialValue);

  function handleChange(event) {
    console.log(event.target.name);
    console.log(event.target.value);
    setValue(event.target.value);
  }

  return [value, handleChange];
}

export default useInput;

In a component I have the following:
import useInput from "hooks/useInput";

export default function Address(props) {
  const [fullName, setFullName] = useInput("");

  return (
    <FormControl fullWidth>
      <CustomInput
        required
        labelText="Full name"
        id="fullName"
        formControlProps={{
          fullWidth: true
        }}
        value={fullName}
        onChange={setFullName}
      />
    </FormControl>
  );
}

When I try to input some text (or even if I try to change the default state), nothing happens.
Any breakpoint that I set in useInput.js are not hit and no logging appears in the console.
Where am I going wrong?

A: If you want to see your current input value with a button click you can see like this. I didn't even change your userInput.js file. I can see the updated value by doing this and console as well.
export default function Address(props) {
    const [fullName, setFullName] = useInput("");
    return (
        <>
            <input
                placeholder="Name"
                value={fullName}
                onChange={setFullName}
            />
            <button onClick={() => {
                console.log(fullName);
            }}>Submit</button>
        </>
    );
}

Since I don't know about your CustomInput, I have written this with default input and button. Please check your CustomInput correctly. Because default input is working.


text:
Q: Ellipse geometry bound points Is there an automatic way to get all the points of an ellipse stroke, without the filling points?

A: In WPF there are no actual "Points" in a geometry - it is infinitely smooth.  This can be seen by zooming in on an ellipse.  You can go to 1,000,000x zoom and you can still see curvature and no points.
Since WPF shapes aren't composed of points, your question can be interepted in several ways.  You may be looking for any of these:

*

*A list of points that approximates the boundary of the ellipse (polyline approximation)

*A set of pixels covered by the ellipse including the fill

*A set of pixels covered by the edge of the ellipse

Here are the solutions in each case:
If you're looking for an approximation of the ellipse as discrete points (ie. a dotted-line version that looks like an ellipse), use this code:
  PolyLineSegment segment =
    ellipse.DefiningGeometry
      .GetFlattenedPathGeometry(1.0, ToleranceType.Absolute)
      .Figures[0].Segments[0] as PolyLineSegment;

  foreach(Point p in segment.Points)
    ...

If you're looking for the pixels affected, you'll need to RenderTargetBitmap:
  RenderTargetBitmap rtb =
    new RenderTargetBitmap(width, height, 96, 96, PixelFormat.Gray8);
  rtb.Render(ellipse);
  byte[] pixels = new byte[width*height];
  rtb.CopyPixels(pixels, width, 0);

Any nonzero value in pixels[] is partially covered by the ellipse.  This will include points interior to the ellipse if the ellipse has a fill.
If you need to get only the pixels along the edge but your ellipse is filled, or vice versa, you can create a new Shape to pass to RenderTargetBitmap:
  var newEllipse = new Path
  {
    Data = ellipse.DefiningGeometry,
    Stroke = Brushes.Black,
  };
  RenderTargetBitmap rtb = ...
    [same as before]

A: By using Reflector I found out that there is a GetPointList() method in the EllipseGeometry class unfortunately it's private. Maybe you can invoke it through reflection but that's sounds like a very bad hack... I'll see if I find another way...


text:
Q: Refactoring templates in angular js I have a problem of big amount of bad readable html in my angular templates. The first idea what I have is to move validation messages from templates. What approaches do you use to handle this problems?
Here is example of my template with bad smell:

New word

  <form ng-submit='createWord()' name='create_word' class='create_word' novalidate>

      Word
      <input type='text' ng-model='wordResource.word.word_value' name='word_value' id='word_value' required>

      Invalid:
      Word is required.

      Invalid:
      Word is already taken.

Translation

            Translation name is required

            Speech part is required

          <input type='text' ng-model='translation.translation_value' name='translation_value' required>
          <select ng-model='translation.speech_part_id' ng-options='speech_part.id as speech_part.name for speech_part in wordResource.speech_parts' name='speech_part' required>
          </select>
          remove

Add translation

Phrasal verbs

            Phrasal verb name is required

          <input type='text' ng-model='phrasal_verb.name' required name='phrasal_verb_name'>
          remove

Add phrasal verb

      <button class='grey_button login add_word' type='submit'>Create word</button>

  </form>


text:
Q: Composer is slow on my windows machine, but fast on a VM (ubuntu) on the same machine So, I have windows on my machine, when I run composer commands; for this we will install a cached version of laravel, it is much much slower than a vm on the same machine with ubuntu (1/6 of the specs of my machine)
Windows: (I limited it to 25 seconds)

Ubuntu

As you can see, the ubuntu version is at least 4/5 times faster, I have even disabled windows defender on my machine, which sped it up, but nowhere near the speed of what it should be, so my question is, what can be causing this, and do you have an recomendations to fix it?


text:
Q: How can I assign a Func<> using the conditional ternary operator? Update
In C#10, this syntax is now valid and the compiler will infer a 'natural type' for a lambda Example here
C# 9 and Earlier
I am aware that Func<>s cannot be implicitly typed directly via the var keyword, although I was rather hoping that I could do the following assignment of a predicate:
Func<Something, bool> filter = (someBooleanExpressionHere)
   ? x => x.SomeProp < 5
   : x => x.SomeProp >= 5;

However, I get the error cannot resolve the symbol, 'SomeProp'
At the moment, I have resorted to the more cumbersome if branch assignment, which doesn't seem as elegant.
Func<Something, bool> filter;
if (someBooleanExpressionHere)
{
    filter = x => x.SomeProp < 5;
}
else
{
    filter = x => x.SomeProp >= 5;
}

Have I missed something, or will I need to stick with the if-branch assignment?

A: You should wrap them in a new Func since else it cannot convert the one lamdba to the other:
 Func<Something, bool> filter = (someBooleanExpressionHere)
   ? new Func<Something, bool>(x => x.SomeProp < 5)
   : x => x.SomeProp >= 5
   ;

If you remove the new Func... you will get:

Type of conditional expression cannot be determined because there is no implicit conversion between 'lambda expression' and 'lambda expression'

A: var filter = (someBooleanExpressionHere)
   ? new Func<Something, bool>(x => x.SomeProp < 5)
   : x => x.SomeProp >= 5;

A: You can explicitly mention the type as the hint to compiler
var filter = (condition)
    ? (Func<Something, bool>)(x => x.SomeProp < 5)
   : x => x.SomeProp >= 5;

A: If appropriate, you could assign these selectors to static fields.
private static readonly Func<Something, bool> _someFilter = x => x.SomeProp < 5;
private static readonly Func<Something, bool> _someOtherFilter = x => x.SomeProp >= 5;

You can then use them later.
var filter = (someBooleanExpressionHere) ? _someFilter : _someOtherFilter;


text:
Q: BQ Aquaris M10 will not detect MS Designer keyboard or mouse Brand new M10, done OTA upgrade. Trying to get it work with bluetooth keyboard and mouse.. Nothing detected in bluetooth manager when they in pairing mode. Keyboard and mouse both detcted by my Nexus 5 and 7. M10 detects the 5 and 7, just not keyboard or mouse.
Any suggestions?

A: As far as I know the Bluetooth facility of the phablet is restricted to connecting just one single device. As a result, you can connect either a BT keyboard or else a BT mouse. Another viable BT solution would be to connect one of those fancy BT keyboards with an integrated touchpad which figures as a single device.


text:
Q: How to atomically delete millions of keys matching a pattern using pure Redis? Say I have millions of prefix:<numeric_id> keys.
I want to purge them all atomically.
How to atomically delete keys matching a pattern using Redis shows many options. Some use redis-cli or Bash script but I need to do it using my client, programmatically.
A Lua script approach is promising, but solutions with KEYS command fail with "too many elements to unpack" error.
How to achieve this?

A: The following Lua script uses SCAN command, so it deletes in chunks within the script - avoiding the "too many elements to unpack" error.
local cursor = 0
local calls = 0
local dels = 0
repeat
    local result = redis.call('SCAN', cursor, 'MATCH', ARGV[1])
    calls = calls + 1
    for _,key in ipairs(result[2]) do
        redis.call('DEL', key)
        dels = dels + 1
    end
    cursor = tonumber(result[1])
until cursor == 0
return "Calls " .. calls .. " Dels " .. dels

It returns how many times SCAN was called and how many keys were deleted.
Use as:
EVAL "local cursor = 0 local calls = 0 local dels = 0 repeat    local result = redis.call('SCAN', cursor, 'MATCH', ARGV[1])     calls = calls + 1   for _,key in ipairs(result[2]) do       redis.call('DEL', key)      dels = dels + 1     end     cursor = tonumber(result[1]) until cursor == 0 return 'Calls ' .. calls .. ' Dels ' .. dels" 0 prefix:1

Note it will block the server while running, so it is not advised for production as is.
For production, consider changing DEL for UNLINK. You can also return the cursor (instead of repeating inside the script until it is zero) and add COUNT parameter to SCAN to throttle (see Is there any recommended value of COUNT for SCAN / HSCAN command in REDIS?). This way you do it in chunks instead of one go, similar to How can I get all of the sets in redis?
Or you can do something more sophisticated using the approach stated in this answer: Redis `SCAN`: how to maintain a balance between newcomming keys that might match and ensure eventual result in a reasonable time?

A: Lua is a great option as long as you are not using Redis Cluster or all the keys you want to delete are on the same shard.
If you need to delete keys from multi-shards you can still use Lua but you'll have to send the Eval command to all the shards "manually".
An alternative that does it for you, is using RedisGears (a Redis module), which allow you to write a cross cluster del command based on some criteria.
See example: https://oss.redislabs.com/redisgears/examples.html#delete-by-key-prefix


text:
Q: Snapshot'ing the event handler value as method argument in C# From this question (and others) there's this example of snapshoting the event handler value before invoking:
var tmp = _myEventHandler;
if(tmp != null) {
    tmp(sender, args);
}

However, if I pass in the event handler and args into a function does this do the same thing?
protected void Invoke(MyEventHandler handler, MyEventArgs args)
{
    if (handler != null)
        handler(this, args);
}

I would say yes, but after thinking about this I don't know if it is the same - like could an optimization process inline this function and remove the snapshot variable?

A: It indeed does the same thing.  The code is simply checking that the event handler is non-null and hence available for raising.  This code is no different for a field / parameter / local.  The C# compiler or JITer cannot inline this in such a way that the temporary is removed because it would change the semantics of the program.

A: The race condition is explained in your other links, such as Marc Gravell's answer.
As @JaredPar points out, your code effectively does the same thing. However, it violates the standard event conventions for .NET, which recommend the following:
protected virtual void OnAlarmRaised(AlarmRaisedEventArgs e)

You are free to violate the pattern, but doing so goes against the grain for minimal (if any) benefit.


text:
Q: Determine function using given sequence It is given that f(x) is a continous function and f(0)=2
$f(x)-f(x/23)=x/23$
How can I find f(484)
This is how far I got Using replacement
$f(x)-f(x/23^n)=x/23 + x/23^2 .......x/23^n$
I guess this would result in some series but I'm not able to get to the answer

A: Let's start from the relation
$$
f(x) - f(\alpha x) = \alpha x\,,
\qquad \text{with}\ \alpha\in (0,1)
$$
(In your case $\alpha = 1/23$.)
For every $n\in\mathbb{N}$, $n\geq 1$, it holds that
$$
f(x) - f(\alpha^n x) = \sum_{k=1}^n [f(\alpha^{k-1} x) - f(\alpha^k x)]
= \sum_{k=1}^n \alpha^k x = \frac{\alpha}{1-\alpha} (1-\alpha^n) \, x.
$$
Passing to the limit as $n\to \infty$, and taking into account that $f$ is continuous (only continuity at the origin is needed), we get
$$
f(x) - f(0) = \frac{\alpha}{1-\alpha}\, x\,.
$$

A: As suggested by @lulu
$F(x)=f(x/23^n)+x/23 +x/23^2+x/23^3.......$
For n tending to infinity
$F(x)=f(0)+x/23(1-x/23)$


text:
Q: Is it possible to parse dates with both TextStyle.SHORT and TextStyle.FULL for the month? A Java 8 DateTimeFormatter created from a pattern like d. MMM u can only parse dates with the month written in the style defined by TextStyle.SHORT (e.g. 13. Feb 2015), a DateTimeFormatter created from d. MMMM u can only parse dates with the month written in the style defined by TextStyle.FULL (e.g. 13. February 2015).
In the "old" SimpleDateFormat, the difference between "MMM" and "MMMM" was only important for formatting, not for parsing, so it was easily possible to create a parser that understood both the FULL and the SHORT form of month names.
Is it possible to create a Java 8 DateTimeFormatter that can also do this? Or do I always have to create two parsers, one with the FULL and one with the SHORT pattern?

A: You could make the different month patterns optional:
    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("d. [MMMM][MMM] u HH:mm:ss z", Locale.US);

    ZonedDateTime zdt1 = ZonedDateTime.parse("4. Jan 2015 00:00:00 UTC", formatter);
    ZonedDateTime zdt2 = ZonedDateTime.parse("4. January 2015 00:00:00 UTC", formatter);

    System.out.println(zdt1);
    System.out.println(zdt2);

Output:
2015-01-04T00:00Z[UTC]
2015-01-04T00:00Z[UTC]

EDIT
This formatter can only be used for parse(), you will have to use a different one for format().


text:
Q: c# and xml element query I'm trying to get an element called lat from a google url. Everything works when i get the xml file and load it but after i'm unable to get the content from the lat element and store it in a variable (preferably string, but not limited to). And obviously I would like to do the same thing for lng element. Could someone help me? Thx, much appreciated.
My Code:
var url = String.Format("http://maps.google.com/maps/api/geocode/xml?address={0}&sensor=false", Server.UrlEncode(Model.UserQuery));
XElement GoogFile = XElement.Load(url);
//Everything above works
var Lat = GoogFile.Element("lat"); //This returns null in the variable
var Lng = GoogFile.Element("lng");

XML File (I want to get the lat and lng from the file which is under geometry-location.It is this: 44.200797024.5022981.
 <?xml version="1.0" encoding="UTF-8" ?>
- <GeocodeResponse>
  <status>OK</status>
- <result>
  <type>administrative_area_level_1</type>
  <type>political</type>
  <formatted_address>Olt County, Romania</formatted_address>
- <address_component>
  <long_name>Olt County</long_name>
  <short_name>OT</short_name>
  <type>administrative_area_level_1</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>Romania</long_name>
  <short_name>RO</short_name>
  <type>country</type>
  <type>political</type>
  </address_component>
- <geometry>
- <location>
  <lat>44.2007970</lat>
  <lng>24.5022981</lng>
  </location>
  <location_type>APPROXIMATE</location_type>
- <viewport>
- <southwest>
  <lat>43.6897579</lat>
  <lng>23.8703090</lng>
  </southwest>
- <northeast>
  <lat>44.9093370</lat>
  <lng>24.8995099</lng>
  </northeast>
  </viewport>
- <bounds>
- <southwest>
  <lat>43.6897579</lat>
  <lng>23.8703090</lng>
  </southwest>
- <northeast>
  <lat>44.9093370</lat>
  <lng>24.8995099</lng>
  </northeast>
  </bounds>
  </geometry>
  </result>
- <result>
  <type>route</type>
  <formatted_address>Vía 40, Barranquilla, Atlantico, Colombia</formatted_address>
- <address_component>
  <long_name>Vía 40</long_name>
  <short_name>0</short_name>
  <type>route</type>
  </address_component>
- <address_component>
  <long_name>Barranquilla</long_name>
  <short_name>Barranquilla D.E.I y P.</short_name>
  <type>locality</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>Atlantico</long_name>
  <short_name>Atlantico</short_name>
  <type>administrative_area_level_1</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>Colombia</long_name>
  <short_name>CO</short_name>
  <type>country</type>
  <type>political</type>
  </address_component>
- <geometry>
- <location>
  <lat>11.0170300</lat>
  <lng>-74.7961300</lng>
  </location>
  <location_type>GEOMETRIC_CENTER</location_type>
- <viewport>
- <southwest>
  <lat>10.9854500</lat>
  <lng>-74.8266400</lng>
  </southwest>
- <northeast>
  <lat>11.0393100</lat>
  <lng>-74.7759300</lng>
  </northeast>
  </viewport>
- <bounds>
- <southwest>
  <lat>10.9854500</lat>
  <lng>-74.8266400</lng>
  </southwest>
- <northeast>
  <lat>11.0393100</lat>
  <lng>-74.7759300</lng>
  </northeast>
  </bounds>
  </geometry>
  </result>
- <result>
  <type>route</type>
  <formatted_address>Northeast 480, Andrews, TX 79714, USA</formatted_address>
- <address_component>
  <long_name>Northeast 480</long_name>
  <short_name>NE 480</short_name>
  <type>route</type>
  </address_component>
- <address_component>
  <long_name>Andrews</long_name>
  <short_name>Andrews</short_name>
  <type>locality</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>Andrews</long_name>
  <short_name>Andrews</short_name>
  <type>administrative_area_level_2</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>Texas</long_name>
  <short_name>TX</short_name>
  <type>administrative_area_level_1</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>United States</long_name>
  <short_name>US</short_name>
  <type>country</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>79714</long_name>
  <short_name>79714</short_name>
  <type>postal_code</type>
  </address_component>
- <geometry>
- <location>
  <lat>32.3283355</lat>
  <lng>-102.4862856</lng>
  </location>
  <location_type>GEOMETRIC_CENTER</location_type>
- <viewport>
- <southwest>
  <lat>32.3258400</lat>
  <lng>-102.4867120</lng>
  </southwest>
- <northeast>
  <lat>32.3305689</lat>
  <lng>-102.4774341</lng>
  </northeast>
  </viewport>
- <bounds>
- <southwest>
  <lat>32.3258400</lat>
  <lng>-102.4867120</lng>
  </southwest>
- <northeast>
  <lat>32.3305689</lat>
  <lng>-102.4774341</lng>
  </northeast>
  </bounds>
  </geometry>
  </result>
- <result>
  <type>route</type>
  <formatted_address>0, Cottonwood, IL 62440, USA</formatted_address>
- <address_component>
  <long_name>0</long_name>
  <short_name>0</short_name>
  <type>route</type>
  </address_component>
- <address_component>
  <long_name>Cottonwood</long_name>
  <short_name>Cottonwood</short_name>
  <type>administrative_area_level_3</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>Cumberland</long_name>
  <short_name>Cumberland</short_name>
  <type>administrative_area_level_2</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>Illinois</long_name>
  <short_name>IL</short_name>
  <type>administrative_area_level_1</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>United States</long_name>
  <short_name>US</short_name>
  <type>country</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>62440</long_name>
  <short_name>62440</short_name>
  <type>postal_code</type>
  </address_component>
- <geometry>
- <location>
  <lat>39.3603100</lat>
  <lng>-88.2434670</lng>
  </location>
  <location_type>GEOMETRIC_CENTER</location_type>
- <viewport>
- <southwest>
  <lat>39.3457376</lat>
  <lng>-88.2447235</lng>
  </southwest>
- <northeast>
  <lat>39.3603100</lat>
  <lng>-88.2420255</lng>
  </northeast>
  </viewport>
- <bounds>
- <southwest>
  <lat>39.3457376</lat>
  <lng>-88.2434670</lng>
  </southwest>
- <northeast>
  <lat>39.3603100</lat>
  <lng>-88.2432820</lng>
  </northeast>
  </bounds>
  </geometry>
  </result>
- <result>
  <type>route</type>
  <formatted_address>0, Cheyenne, WY 82009, USA</formatted_address>
- <address_component>
  <long_name>0</long_name>
  <short_name>0</short_name>
  <type>route</type>
  </address_component>
- <address_component>
  <long_name>Cheyenne</long_name>
  <short_name>Cheyenne</short_name>
  <type>locality</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>Laramie</long_name>
  <short_name>Laramie</short_name>
  <type>administrative_area_level_2</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>Wyoming</long_name>
  <short_name>WY</short_name>
  <type>administrative_area_level_1</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>United States</long_name>
  <short_name>US</short_name>
  <type>country</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>82009</long_name>
  <short_name>82009</short_name>
  <type>postal_code</type>
  </address_component>
- <geometry>
- <location>
  <lat>41.2555110</lat>
  <lng>-104.5239096</lng>
  </location>
  <location_type>GEOMETRIC_CENTER</location_type>
- <viewport>
- <southwest>
  <lat>41.2537342</lat>
  <lng>-104.5249831</lng>
  </southwest>
- <northeast>
  <lat>41.2573833</lat>
  <lng>-104.5221876</lng>
  </northeast>
  </viewport>
- <bounds>
- <southwest>
  <lat>41.2537342</lat>
  <lng>-104.5249831</lng>
  </southwest>
- <northeast>
  <lat>41.2573833</lat>
  <lng>-104.5221876</lng>
  </northeast>
  </bounds>
  </geometry>
  </result>
- <result>
  <type>route</type>
  <formatted_address>0, Bessemer City, NC 28016, USA</formatted_address>
- <address_component>
  <long_name>0</long_name>
  <short_name>0</short_name>
  <type>route</type>
  </address_component>
- <address_component>
  <long_name>Bessemer City</long_name>
  <short_name>Bessemer City</short_name>
  <type>locality</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>Crowders Mountain</long_name>
  <short_name>Crowders Mountain</short_name>
  <type>administrative_area_level_3</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>Gaston</long_name>
  <short_name>Gaston</short_name>
  <type>administrative_area_level_2</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>North Carolina</long_name>
  <short_name>NC</short_name>
  <type>administrative_area_level_1</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>United States</long_name>
  <short_name>US</short_name>
  <type>country</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>28016</long_name>
  <short_name>28016</short_name>
  <type>postal_code</type>
  </address_component>
- <geometry>
- <location>
  <lat>35.2801489</lat>
  <lng>-81.3082181</lng>
  </location>
  <location_type>GEOMETRIC_CENTER</location_type>
- <viewport>
- <southwest>
  <lat>35.2785860</lat>
  <lng>-81.3095352</lng>
  </southwest>
- <northeast>
  <lat>35.2812839</lat>
  <lng>-81.3068372</lng>
  </northeast>
  </viewport>
- <bounds>
- <southwest>
  <lat>35.2795895</lat>
  <lng>-81.3089594</lng>
  </southwest>
- <northeast>
  <lat>35.2802804</lat>
  <lng>-81.3074130</lng>
  </northeast>
  </bounds>
  </geometry>
  </result>
- <result>
  <type>route</type>
  <formatted_address>Zero Street, Sana'a, Yemen</formatted_address>
- <address_component>
  <long_name>Zero Street</long_name>
  <short_name>0</short_name>
  <type>route</type>
  </address_component>
- <address_component>
  <long_name>Sana'a</long_name>
  <short_name>Sana'a</short_name>
  <type>locality</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>Amanat Al Asimah</long_name>
  <short_name>Amanat Al Asimah</short_name>
  <type>administrative_area_level_1</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>Yemen</long_name>
  <short_name>YE</short_name>
  <type>country</type>
  <type>political</type>
  </address_component>
- <geometry>
- <location>
  <lat>15.3021640</lat>
  <lng>44.1953690</lng>
  </location>
  <location_type>GEOMETRIC_CENTER</location_type>
- <viewport>
- <southwest>
  <lat>15.2972988</lat>
  <lng>44.1938378</lng>
  </southwest>
- <northeast>
  <lat>15.3060185</lat>
  <lng>44.1970439</lng>
  </northeast>
  </viewport>
- <bounds>
- <southwest>
  <lat>15.2972988</lat>
  <lng>44.1938378</lng>
  </southwest>
- <northeast>
  <lat>15.3060185</lat>
  <lng>44.1970439</lng>
  </northeast>
  </bounds>
  </geometry>
  </result>
- <result>
  <type>route</type>
  <formatted_address>0, Sana'a, Yemen</formatted_address>
- <address_component>
  <long_name>0</long_name>
  <short_name>0</short_name>
  <type>route</type>
  </address_component>
- <address_component>
  <long_name>Sana'a</long_name>
  <short_name>Sana'a</short_name>
  <type>locality</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>Amanat Al Asimah</long_name>
  <short_name>Amanat Al Asimah</short_name>
  <type>administrative_area_level_1</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>Yemen</long_name>
  <short_name>YE</short_name>
  <type>country</type>
  <type>political</type>
  </address_component>
- <geometry>
- <location>
  <lat>15.3021640</lat>
  <lng>44.1953690</lng>
  </location>
  <location_type>GEOMETRIC_CENTER</location_type>
- <viewport>
- <southwest>
  <lat>15.2973087</lat>
  <lng>44.1939675</lng>
  </southwest>
- <northeast>
  <lat>15.3059751</lat>
  <lng>44.1970439</lng>
  </northeast>
  </viewport>
- <bounds>
- <southwest>
  <lat>15.2973087</lat>
  <lng>44.1939675</lng>
  </southwest>
- <northeast>
  <lat>15.3059751</lat>
  <lng>44.1970439</lng>
  </northeast>
  </bounds>
  </geometry>
  </result>
- <result>
  <type>route</type>
  <formatted_address>Río Fuerte, Juan José Ríos, General Juan José Ríos, Sinaloa, Mexico</formatted_address>
- <address_component>
  <long_name>Río Fuerte</long_name>
  <short_name>Río Fuerte</short_name>
  <type>route</type>
  </address_component>
- <address_component>
  <long_name>Juan José Ríos</long_name>
  <short_name>Juan José Ríos</short_name>
  <type>sublocality</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>General Juan José Ríos</long_name>
  <short_name>Gral Juan José Ríos</short_name>
  <type>locality</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>Sinaloa</long_name>
  <short_name>SIN</short_name>
  <type>administrative_area_level_1</type>
  <type>political</type>
  </address_component>
- <address_component>
  <long_name>Mexico</long_name>
  <short_name>MX</short_name>
  <type>country</type>
  <type>political</type>
  </address_component>
- <geometry>
- <location>
  <lat>25.7610486</lat>
  <lng>-108.8163917</lng>
  </location>
  <location_type>GEOMETRIC_CENTER</location_type>
- <viewport>
- <southwest>
  <lat>25.7553290</lat>
  <lng>-108.8275377</lng>
  </southwest>
- <northeast>
  <lat>25.7668749</lat>
  <lng>-108.8059156</lng>
  </northeast>
  </viewport>
- <bounds>
- <southwest>
  <lat>25.7553290</lat>
  <lng>-108.8275377</lng>
  </southwest>
- <northeast>
  <lat>25.7668749</lat>
  <lng>-108.8059156</lng>
  </northeast>
  </bounds>
  </geometry>
  </result>
  </GeocodeResponse>

A: You're asking for the elements directly in the document - whereas presumably you want the ones in the location element. So something like this:
var location = GoogFile.Descendants("location").First();
var lat = location.Element("lat");
var lng = location.Element("lng");

(That's assuming you really do want the location element - if you want a different one, either adapt the code above or be more precise.)

A: Try it with LINQ:
http://msdn.microsoft.com/de-de/library/bb342765.aspx
IEnumerable<XElement> elements =
from el in GoogFile.Elements("lat")
select el;
foreach (XElement el in elements)
    Console.WriteLine(el);

A:  is not an immediate descendant of GoogFile, that is why Element("lat") returns null.
You can use this instead:
var Lat = GoogFile.Descendants("lat").FirstOrDefault();

A: XmlDocument xml = new XmlDocument();
xml.Load(filename);

// then use xpath
string lat = xml.SelectSingleNode("/GeocodeResponse/geometry/location/lat").InnerText;
string lng = xml.SelectSingleNode("/GeocodeResponse/geometry/location/lng").InnerText;


text:
Q: reCAPTCHA 2.0 challenge type Does anyone know if is possible to choose the type of challenge that the new recaptcha will prompt to the user?
For instance in professional looking website the challenge "select the steak below" with a pool of images with steaks in it is not really good
I went through the docs but there is not such thing
https://developers.google.com/recaptcha/docs/display#config
any idea?
Thanks


text:
Q: How to make Height and Width of ScrollView Still The same Before ZoomIn on UIImage? Hello All iOS developer I'm new at iOS development. at the moment I work In the case I want to Zoom Picture, I use UIImageView in UIScrollView. Everything is Ok on ScrollView Height and Width but when I try to ZoomIn and ZoomOut to make to current Size of Image the UIScrollView has Increase the Height and Width. and I try to find out the solution but it's work.I need some help.thank you in advance.
This's The Problem
 Here is my code

override func viewDidLoad() {
    super.viewDidLoad()
    initializeLanguages()
    checkForm()
    scrollView.showsVerticalScrollIndicator = false
    scrollView.showsHorizontalScrollIndicator = false
    scrollView.bounces = false
    scrollView.delegate = self
    lblRetake.textColor = TrueColor.trueColorbrand()
    updateZoom()
    scrollView.layer.cornerRadius = 10
    scrollView.layer.masksToBounds = true
    setShadowView(view: viewContainer)
    imageView.isUserInteractionEnabled = true
    addViewGesture()
    displayImage()
}
//MARK: ZoomOut/ZoomIn Image
func updateZoom() {
    let fwidth = self.imageView.image?.size.width ?? 0
    let fheight = self.imageView.image?.size.height ?? 0
    var minZoom = min(fwidth, fheight);
    if (minZoom > 1) {
        minZoom = 1;
    }

    self.scrollView.minimumZoomScale = minZoom;
    self.scrollView.zoomScale = minZoom;
    scrollView.maximumZoomScale = 10.0
}


text:
Q: Using roll=TRUE with allow.cartesian=TRUE What is the best way to do a Cartesian join and use the roll forward feature, but applying the roll feature to each alternative series from the joining table, rather than the whole series.
Best explained with an example:
library(data.table)
A = data.table(x = c(1,2,3,4,5), y = letters[1:5])
B = data.table(x = c(1,2,3,1,4), f = c("Alice","Alice","Alice", "Bob","Bob"), z = 101:105)
setkey(B,x)
C = B[A, roll = TRUE, allow.cartesian=TRUE, rollends = FALSE]

A
B
C[f == "Alice"]
C[f == "Bob"]
C

So we have the two starting tables:
> A
   x y
1: 1 a
2: 2 b
3: 3 c
4: 4 d
5: 5 e
> B
   x     f   z
1: 1 Alice 101
2: 1   Bob 104
3: 2 Alice 102
4: 3 Alice 103
5: 4   Bob 105

And I want to join these so that I have for each x value in A I have both and Alice and Bob row, rolling forwards if either are missing (but not rolling past the end).  This doesn't quite work as I've currently got it:
> C[f == "Alice"]
   x     f   z y
1: 1 Alice 101 a
2: 2 Alice 102 b
3: 3 Alice 103 c
> C[f == "Bob"]
   x   f   z y
1: 1 Bob 104 a
2: 4 Bob 105 d
> C
   x     f   z y
1: 1 Alice 101 a
2: 1   Bob 104 a
3: 2 Alice 102 b
4: 3 Alice 103 c
5: 4   Bob 105 d
6: 5    NA  NA e

Because Alice is there for 2 and 3, it doesn't roll Bob's data forwards.  I need the extra rows for Bob so I want to get:
> C[f == "Alice"]
   x     f   z y
1: 1 Alice 101 a
2: 2 Alice 102 b
3: 3 Alice 103 c
> C[f == "Bob"]
   x   f   z y
1: 1 Bob 104 a
2: 2 Bob 104 b  # THESE ROWS ARE MISSING
3: 3 Bob 104 c  # THESE ROWS ARE MISSING
4: 4 Bob 105 d
> C
   x     f   z y
1: 1 Alice 101 a
2: 1   Bob 104 a
3: 2 Alice 102 b
4: 2   Bob 104 b  # THESE ROWS ARE MISSING
5: 3 Alice 103 c
6: 3   Bob 104 c  # THESE ROWS ARE MISSING
7: 4   Bob 105 d
8: 5    NA  NA e

A: Here you go:
setkey(B, f, x)

setkey(B[CJ(unique(f), unique(x)), allow.cartesian = T,
         roll = T, rollends = c(F,F)], x)[A, allow.cartesian = T]
#   x     f   z y
#1: 1 Alice 101 a
#2: 1   Bob 104 a
#3: 2 Alice 102 b
#4: 2   Bob 104 b
#5: 3 Alice 103 c
#6: 3   Bob 104 c
#7: 4 Alice  NA d
#8: 4   Bob 105 d
#9: 5    NA  NA e

And you can filter out the NA's to suit your needs.

A: I also found an alternative way of doing this. I've accepted the other answer as that produces a result more closely matching that requested by the question, but this might also be useful for some people.  The difference is what happens at the end of the series.
C = B[, .SD[A, roll = TRUE, rollends = FALSE], by = f]
setkey(C, x)

> C
        f x   z y
 1: Alice 1 101 a
 2:   Bob 1 104 a
 3: Alice 2 102 b
 4:   Bob 2 104 b
 5: Alice 3 103 c
 6:   Bob 3 104 c
 7: Alice 4  NA d
 8:   Bob 4 105 d
 9: Alice 5  NA e
10:   Bob 5  NA e

Row 9 & 10 are the only difference; in eddi's answer these are combined as a single row, with NA in both columns.
This solution is also slightly slower than eddi's when I tested on bigger data.tables (although both are quite fast).


text:
Q: Activity crashes the app after it starts I want to run "FakeActivity" class first instead of "MainActivity" but it keeps crashing every time i run it. Can anyone please tell me why the activity is crashing every time I load it. Following is my Java code:
package com.example.android.findbar;

import android.location.Location;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class FakeActivity extends AppCompatActivity {

    /*Global variables for user's Longitude and User's Latitude*/

    EditText Longitude, Latitude;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fake);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        Longitude = (EditText)findViewById(R.id.Longitude);
        Latitude = (EditText)findViewById(R.id.Latitude);

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

    }

    public void CheckLocation(View view){

        String Longi = Longitude.getText().toString();
        String Lati = Latitude.getText().toString();
        String type = "Locator";
        BackgroundWorker backgroundWorker = new BackgroundWorker(this);
        backgroundWorker.execute(type, Longi, Lati);
    }

}

then my xml file:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context="com.example.android.findbar.FakeActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay" />

    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/content_fake" />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"
        android:src="@android:drawable/ic_dialog_email" />

</android.support.design.widget.CoordinatorLayout>

and then my manifest file :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.android.findbar">

    <uses-permission android:name="android.permission.INTERNET" />

    <!--
         The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
         Google Maps Android API v2, but you must specify either coarse or fine
         location permissions for the 'MyLocation' functionality.
    -->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <activity android:name=".MainActivity">

        </activity>

        <activity
            android:name="com.facebook.FacebookActivity"
            android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:label="@string/app_name" />
        <activity
            android:name="com.facebook.CustomTabActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="@string/fb_login_protocol_scheme" />
            </intent-filter>
        </activity>

        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/facebook_app_id" />
        <!--
             The API key for Google Maps-based APIs is defined as a string resource.
             (See the file "res/values/google_maps_api.xml").
             Note that the API key is linked to the encryption key used to sign the APK.
             You need a different API key for each encryption key, including the release key that is used to
             sign the APK for publishing.
             You can define the keys for the debug and release targets in src/debug/ and src/release/.
        -->
        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="@string/google_maps_key" />

        <activity
            android:name=".MapsActivity"
            android:label="@string/title_activity_maps" />
        <activity android:name=".SecondActivity" />

        <activity
            android:name=".FakeActivity"
            android:label="@string/title_activity_fake"
            android:theme="@style/AppTheme.NoActionBar">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
                <category android:name="android.intent.category.DEFAULT" />

            </intent-filter>

        </activity>

    </application>

</manifest>

Logcat
03-22 13:23:41.923 761-1248/? W/ActivityManager:   Force finishing activity com.example.android.findbar/.FakeActivity
03-22 13:23:42.046 1943-1958/? W/GooglePlayServicesUtil: Google Play services is missing.
03-22 13:23:42.048 761-772/? W/ActivityManager: Unable to start service Intent { act=com.google.android.gms.ads.identifier.service.START pkg=com.google.android.gms } U=0: not found
03-22 13:23:42.134 761-1827/? I/OpenGLRenderer: Initialized EGL, version 1.4
03-22 13:23:42.135 761-1827/? D/OpenGLRenderer: Swap behavior 1
03-22 13:23:42.230 761-783/? I/Choreographer: Skipped 40 frames!  The application may be doing too much work on its main thread.
03-22 13:23:42.435 761-776/? W/ActivityManager: Activity pause timeout for ActivityRecord{dfb089c u0 com.example.android.findbar/.FakeActivity t4 f}
03-22 13:23:42.487 761-776/? I/WindowManager: Failed to capture screenshot of Token{52a62a5 ActivityRecord{dfb089c u0 com.example.android.findbar/.FakeActivity t4 f}} appWin=Window{e6b5ad2 u0 Starting com.example.android.findbar} drawState=3
03-22 13:23:42.640 761-783/? I/WindowManager: Destroying surface Surface(name=Starting com.example.android.findbar) called by com.android.server.wm.WindowStateAnimator.destroySurface:2014 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:881 com.android.server.wm.WindowState.removeLocked:1449 com.android.server.wm.WindowManagerService.removeWindowInnerLocked:2478 com.android.server.wm.WindowManagerService.removeWindowLocked:2436 com.android.server.wm.WindowManagerService.removeWindowLocked:2305 com.android.server.wm.WindowManagerService.removeWindow:2300 com.android.server.wm.Session.remove:193
03-22 13:23:42.932 761-777/? I/Choreographer: Skipped 39 frames!  The application may be doing too much work on its main thread.
03-22 13:23:44.635 761-1248/? W/ActivityManager:   Force finishing activity com.example.android.findbar/.FakeActivity
03-22 13:23:44.635 761-1248/? I/ActivityManager: Killing 1943:com.example.android.findbar/u0a63 (adj 900): crash
03-22 13:23:44.667 761-777/? W/InputEventReceiver: Attempted to finish an input event but the input event receiver has already been disposed.
03-22 13:23:44.669 761-1248/? W/InputMethodManagerService: Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@21574e8 attribute=null, token = android.os.BinderProxy@6d4495
03-22 13:23:45.008 761-783/? I/WindowManager: Destroying surface Surface(name=Application Error: com.example.android.findbar) called by com.android.server.wm.WindowStateAnimator.destroySurface:2014 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:881 com.android.server.wm.WindowState.destroyOrSaveSurface:2073 com.android.server.wm.WindowSurfacePlacer.performSurfacePlacementInner:429 com.android.server.wm.WindowSurfacePlacer.performSurfacePlacementLoop:232 com.android.server.wm.WindowSurfacePlacer.performSurfacePlacement:180 com.android.server.wm.WindowManagerService$H.handleMessage:8079 android.os.Handler.dispatchMessage:102
03-22 13:23:45.010 761-783/? W/AppOps: Finishing op nesting under-run: uid 1000 pkg android code 24 time=0 duration=0 nesting=0
03-22 13:23:51.792 482-499/? W/AudioFlinger: write blocked for 10367 msecs, 5 delayed writes, thread 0xf14032c0
03-22 13:25:07.227 485-715/? E/Netd: Failed to dump IPv4 sockets for UID: No such file or directory
03-22 13:25:07.228 761-775/? E/NetworkManagement: Error closing sockets after enabling chain standby: android.os.ServiceSpecificException: destroySockets: No such file or directory
03-22 13:25:38.127 761-809/? W/WifiMode: WiredSSID, Invalid SupportedRates!!!
03-22 13:25:38.128 761-811/? W/WifiMode: WiredSSID, Invalid SupportedRates!!!
03-22 13:25:38.129 761-809/? W/WifiMode: WiredSSID, Invalid SupportedRates!!!
01-01 00:00:00.000 0-0/? E/Internal: device '192.168.63.101:5555' not found

A: First of all, you need to check that Google Play services is available or not in your SDK. Because your crash report shows the error that "Google Play services is missing" in second line of your Logcat.
In Android Studio click: Tools > Android > SDK Manager > Launch stand alon sdk manager.
Find : Extras > Google Play Services.
if Google Play Services is not installed, than install it first and than run project again.

A:

*

*Replace all Longitude to longitude & all Latitude to latitude
  in XML file & Java File. It will fix your problem.

EditText longitude, latitude;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_fake);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    longitude = (EditText)findViewById(R.id.longitude);
    latitude = (EditText)findViewById(R.id.latitude);

*change ids of EditText also as per above JAVA code

A: /* add in manifest file ---- inside application tag like -   */
    android:usesCleartextTraffic="true"


text:
Q: How to change pagination position in table to center using antd for angular? I am on Antd vs.12.0.2 and I tried to implement datatable using Angular and Antd for Angular.
This is my nz-table code content.
  <nz-table
    #membersTable
    nz-show-pagination
    nzSize="default"
    nzTableLayout="fixed"
    nzPaginationType="default"
    nzPaginationPosition="bottom"
    [nzData]="members"
  >

        Name
        Email
        Phone number
        Accounts

      <ng-container *ngFor="let member of membersTable.data">

      </ng-container>

  </nz-table>

There wasn't a property to move pagination to center in table. So, I tried to override styles but nothing changed.
Here's what I tried in less file.
nz-table {
  nz-pagination {
    justify-content: center;
  }
}

Isn't it possible to override antd class styles?

A: Oh, I found an answer to solve this problem. To help the others who will run into the same problem with me, I am going to publish this answer to public.
Angular prefixes its styles which are used for component by its component id like this.
.header[_ngcontent-jjj-c93]   .user-dropdown[_ngcontent-jjj-c93] {
  cursor: pointer;
}
.content[_ngcontent-jjj-c93] {
  background-color: white;
}
.bottom-menu[_ngcontent-jjj-c93] {
  position: absolute;
  bottom: 0;
}

So, when I tried to override styles, they were prefixed like this.
nz-table[_ngcontent-jjj-c198] nz-pagination[_ngcontent-jjj-c198] {
  justify-content: center;
}

This was why overriding styles couldn't change pagination position, so I created overriding styles inside the custom.less file, which is inside src/app/styles folder and used for defining custom global styles inside the application.
The code is like below.
org-admin-members {
  .ant-table-pagination {
    justify-content: center !important;
  }
}

It changed pagination position successfully.
Note: You have to ensure that you included custom.less file in src/app/styles.less file and you should add '!important' rule to css style.


text:
Q: Localized multilingual wix installer Does not display the values of string in .wxl files in the correct language I created .msi installer using wix toolset 3.10 . I had localized the installer to be multi-language (just one .msi file that display the language depending on the region settings of windows).
I had created da-DK.mst file and I used wisubstg.vbs to embed the language into the english .msi file so I have one multilingual installer works for both Danish and English but I got two issues
any strings that gets its values from the language files which is
WixUI_da-DK.wxl , does not display the correct language it always displays the default language value which is english
the other problem is that the built in strings cut off in the Danish language in some forms .
what is the problem here and how to fix it ?

    This is My UI from the .wxs file
    <UI>

          <UIRef Id="WixUI_InstallDir"/>
          <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="2">1</Publish>
          <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">1</Publish>
          <Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
        </UI>

        <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
        <Icon Id="icon.ico" SourceFile=".....\Images\Img_app.ico"/>
        <Property Id="ARPPRODUCTICON" Value="icon.ico" />

        <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT"  Value="!(loc.LaunchApp)"  />
        <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1"  />

<!-- end snippet -->

A: If your text is getting cut off you need to change your UI's dimensions.
Whatever control you are using to display that text make its width a bigger number.
I can't comment on the "Launch App Name" text always being English since there is not enough information about that UI Control or what text it is displaying. You would need to add some more information about the UI you are using.

Here's a link to the default dialogs for wix
https://github.com/wixtoolset/wix3/tree/develop/src/ext/UIExtension/wixlib
In the browsedlg.wxs you have this control defined.
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.BrowseDlgDescription)" />

unfortunately, Danish is rather long for the description here and so the installer cuts off the text and uses an ellipses.
I think the easiest way to fix this is to add a new wxs file to your project called AppNameBrowseDlg.wxs and just copy in the whole xml from here https://github.com/wixtoolset/wix3/blob/develop/src/ext/UIExtension/wixlib/BrowseDlg.wxs . You will need to change the <Dialog> Id to be "AppNameBrowseDlg" as well. Now you can make the width of the Description control bigger so hopefully the Danish text fits properly.
To use this new dialog you also need to add another wxs file and you can call it AppName_InstallDir.wxs which will be a copy of this https://github.com/wixtoolset/wix3/blob/develop/src/ext/UIExtension/wixlib/WixUI_InstallDir.wxs . Here you need to change the <UI> Id to AppName_InstallDir
Just change the <DialogRef Id="BrowseDlg"> to <DialogRef Id="AppNameBrowseDlg">
You'll also need to modify these lines
<Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath" Order="3">1</Publish>
<Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>

<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>

to reference your AppNameBrowseDlg
This essentially replicates the dialog and UI definition that you were using in your installer. In your Product, you just need to change the UIRef to be "AppName_InstallDir" and it will use your defined UI that replaced the default browsedlg with one that can hopefully fit the Danish text. I would also consider submitting a wix improvement here https://github.com/wixtoolset/issues/issues asking that the WixUI's browsedlg's description control is wider.
For your Launch text you're getting stuck with english because you are using the English msi as a base for the other languages. The way this checkbox has been implemented means you are hardcoding the english text from the property that the checkbox control's text value is set to. The way you are localizing the msi is probably creating multiple strings tables and selecting strings from the appropriate table at runtime. But, the checkbox doesn't get its text value from the strings table. Instead, it is from the value of a property which was set at  to be the value of "LaunchApp". (Incidentally, if you used the Danish version of the msi as a base, this text would always be Danish).
We can fix this in much the same way we modified the Wix BrowseDlg. In this case we want to copy over the ExitDialog to AppNameExitDialog.wxs from here https://github.com/wixtoolset/wix3/blob/develop/src/ext/UIExtension/wixlib/ExitDialog.wxs
You will need to rename the Dialog Id to AppNameExitDialog and then we want to look at this control
<Control Id="OptionalCheckBox" Type="CheckBox" X="135" Y="190" Width="220" Height="40" Hidden="yes" Property="WIXUI_EXITDIALOGOPTIONALCHECKBOX" CheckBoxValue="1" Text="[WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT]">
    <Condition Action="show">WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT AND NOT Installed</Condition>
</Control>

you want to change it to the following
<Control Id="OptionalCheckBox" Type="CheckBox" X="135" Y="190" Width="220" Height="40" Property="WIXUI_EXITDIALOGOPTIONALCHECKBOX" CheckBoxValue="1" Text="!(loc.LaunchApp)" />

Additionally, windows installer is unable to display the background of a checkbox automatically as any other color than the grey-ish one you see in the screenshot you linked. If you want to get rid of this grey behind the text, you can actually modify the checkbox control's width and height to be about the size of the checkbox itself and set the text to "". Then you need to add another Text control to the UI that goes where the Check box's text used to go. This way you would have not have any grey background behind the text. The downside of this is that you must click the actual checkbox to toggle whether it is checked or not whereas before you could click anywhere in the grey area.
Again, to properly reference this new dialog you need to go to your AppName_InstallDir.wxs file and change the ExitDialog references to instead be AppNameExitDlg and also change the one <Publish> referencing the ExitDialog.
Hope this helps. The git repository is very useful for understanding how wix really works under the hood.


text:
Q: HTTP JSON API request responds "-1" I'm trying to make a REST API that an Arduino with an ESP8266 module can GET, but when I try to send a request to my server the HTTP Code that I get is -1, which I have not been able to find any documentation on anywhere (it's not in the list of HTTP status codes here).
My test-API that I get the -1 response from is here, while a this API works fine. My API is simple:
PHP API:
header('Content-Type: application/json; charset=utf-8');
header('Access-Control-Allow-Origin: *');

$array = array(
    "status" => true
);

echo json_encode($array);

The Arduino code is just one of the ESP8266 examples, and looks like this:
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>

const char* ssid = "Next-Guest";
const char* password = "";

void setup () {

  Serial.begin(115200);
  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {

    delay(1000);
    Serial.print("Connecting..");

  }

}

void loop() {
  if (WiFi.status() == WL_CONNECTED) {
    HTTPClient http;

    //http.begin("http://jsonplaceholder.typicode.com/users/1"); <- this works
    http.begin("https://makerspace.albe.pw/api/getDoorStatus.php"); // <- this doesn't
    int httpCode = http.GET();

    Serial.println(httpCode);
    if (httpCode > 0) {
      String payload = http.getString();
      Serial.println(payload);
    }
    http.end();
  }
  delay(30000);
}

I can do a GET request locally from any computer to my API using jQuery AJAX, so it must be somewhat open?
Is my host the problem, or are my files missing some headers?

A: When accessing a domain protected with a SSL certificate (https), you need to specify the SSL thumbprint as a second parameter in the http.begin function:
String thumbprint = "the_thumbprint";
http.begin("https://api.site/api/get_details.json", thumbprint);


text:
Q: A generalization of the Tietze theorem with respect to oscillation Let $X$ be a normal (or hereditarily normal) topological space, $Y\subset X$ a closed supspace, $f\colon Y\to\mathbb R$ an arbitrary function. Let $\omega_f(x)=\inf_U\sup_{y\in U}|f(x)−f(y)|$, $x\in Y$ (the inf is taken with respect to all $U\ni x$ open in $Y$), be the oscillation of $f$ at $x$.
I wonder if the following generalization of the Tietze extension theorem holds: "There is a continuous function $g\colon X\setminus Y\to\mathbb R$ such that for $f$ and $g$ taken together, that is, for $h=f\cup g$, at every $x\in Y$ one has $\omega_f(x)=\omega_h(x)$."


text:
Q: how can we avoid the cancellation error and condition number How can we avoid the cancellation error while computing $f(x)=\sqrt{1+x^2}-1$ for small $|x|$ values? In order to compute the condition number of the function, I found the derivative of the function but I cant simplify it for obtaining the condition number. How can I solve this?
$$
CN=\left|\frac{x f'(x)}{f(x)}\right|
$$

A: The usual binomial trick gives the alternative form
$$
f(x)=\frac{x^2}{\sqrt{1+x^2}+1}
$$
I think that catastrophic cancellation invalidates the computation of the condition number per derivative. The absolute error of the first formula is about $(\sqrt{1+x^2}+1)\mu$.
Taking the above formula as (almost) exact, one can compute the relative error of the first formula. This gives the following loglog plot.


text:
Q: Shared ViewModel in MVI How to use shared viewmodel in MVI architecture? Is it actually used to communicate between fragments, or do we use an interface, or a broadcast receiver? That part is not clear to me, and I can't find it anywhere. What is best practice? Thanks all

A: You should use MVVM architecture, Take a reference from below code it will help you.
//Fragment A
class FragmentA:Fragment {
private lateinit var viewModel:LoginViewModel

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)
    viewModel =
ViewModelProvider(requireActivity()).get(LoginViewModel::class.java)
}
}

//Fragment B
class FragmentB:Fragment {
private lateinit var viewModel:LoginViewModel

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)
    viewModel =
ViewModelProvider(requireActivity()).get(LoginViewModel::class.java)
}
}

//This is share viewModel class
class LoginViewModel: ViewModel{

}


text:
Q: Easy Differentiating Twice question? So, this is the question:

But, how can it be $\cos^2x?$ Doesn't it mean to be just $cosx$? Do you think it is a typo?

A: This is just the product rule. Try this:
Let $f(x) = \cos x,\quad g(x)=\frac{\mathrm d y}{\mathrm dz}.$ Then
$\frac{\mathrm d y}{\mathrm dx} = f(x)g(x)$ and so if we differentiate we get
\begin{align}
\frac{\mathrm d^2 y}{\mathrm dx^2} &= f'(x)g(x)+f(x)g'(x)\\
&=-\sin x\frac{\mathrm d y}{\mathrm dz} + \cos x \frac{\mathrm d }{\mathrm dx}\frac{\mathrm d y}{\mathrm dz}\\
&=-\sin x\frac{\mathrm d y}{\mathrm dz} + \cos x \frac{\mathrm d }{\mathrm dz}\frac{\mathrm d y}{\mathrm dx}\\
&=-\sin x\frac{\mathrm d y}{\mathrm dz} + \cos x \frac{\mathrm d }{\mathrm dz}\frac{\mathrm d y}{\mathrm dz}\cos x\\
&=-\sin x\frac{\mathrm d y}{\mathrm dz} + \frac{\mathrm d^2 y}{\mathrm dz^2}\cos^2 x\\
\end{align}


text:
Q: Linq using TakeWhile in a query Hi i just started learning linq and have been trying to understand the TakeWhile usage
here i have tried something like this
 using (  var db = new OrchestrateDataEntities())
        {

            var y = db.Set<Rulebook_Mapping>();
            var xyz = y.TakeWhile(x => x.ID == 2).AsQueryable();
            foreach (var item in xyz)
            {
                Console.WriteLine(item.ID);

            }

        }
        Console.ReadKey();

and then comes the error
 LINQ to Entities does not recognize the method 'System.Linq.IQueryable`1[ConFW.Rulebook_Mapping] TakeWhile[Rulebook_Mapping](System.Linq.IQueryable`1[ConFW.Rulebook_Mapping], System.Linq.Expressions.Expression`1[System.Func`2[ConFW.Rulebook_Mapping,System.Boolean]])' method, and this method cannot be translated into a store expression.

A: Check supported and unsupported methods in LINQ to Entity at http://blogs.msdn.com/b/wriju/archive/2009/01/02/linq-to-entity-skip-and-take-method-does-not-work.aspx. Then open paging method page, you will see that TakeWhile is not supported (at the bottom).

A: qxg is right, TakeWhile is not implemented by EF, but you can use it in LINQ to Object.
Old code:
var y = db.Set<Rulebook_Mapping>();

New code:
var y = db.Set<Rulebook_Mapping>().ToList();

New code should fix the error, it brings all records in RuleBook_Mapping table to local memory, if possible add where filter before ToList() will help the performance.


text:
Q: How do I undo a folder move I was trying to move around some files and got a result I didn't want to. How would I undo
sudo mv tmp/* usr/local/bin?

A: You'll have to distinguish which files in /usr/local/bin are actually binary files meant to stay there and which are temporary files moved accidentally with mv, anyway /tmp is used by applications to temporary store files which are to be deleted in any case upon the next reboot, so as long as you're not concerned with the applications running in the current session possibly crashing/losing data, the worst case scenario is you might have a handful of unuseful temporary files in /usr/local/bin, but still, such directory is always empty upon Ubuntu installation, so it might even have been still empty/almost empty before the mv unless some application installed some binary in there, plus temporary files should be easy distinguishable from binaries, in the end you should be able to easily restore everything back to normal manually moving the temporary files back to /tmp

A: Unfortunately the answer is a "NO". Only thing you can do is to be careful when you do something as root user. May be you can search the directory for that file and move it back using the same mv command

A: Linux doesn't natively provide an undo feature. The philosophy is that if it's gone, it's gone. If it was important, it should have been backed up.
There is a fuse filesystem that automatically keeps copies of old versions: copyfs, available in all good distributions. Of course, that can use a lot of resources.
The best way to protect against such accidents is to use a version control system (cvs, bazaar, darcs, git, mercurial, subversion,etc). It takes a little time to learn, but it pays off awesomely in the medium and long term.


text:
Q: django save imagefile in static dir I have some images i retrieve from http://image.eveonline.com/ that i want to save. Now part of those will be static, while others might change.
Instead of pulling all static images from their site, i want to do this when they are needed (if they are not saved yet)
How can i tell my model to save the imagefield in static or in media
Example model:
class ItemIcon(models.Model):
    item = models.ForeignKey("items.Item")
    size = models.IntegerField(choices=settings.IMAGE_SIZES)
    url = models.URLField(unique=True) #The url to the evesite
    image = models.ImageField(upload_to="static/images/items/")

(this model should be saved in static)

A: you need to set your MEDIA_URL and MEDIA_ROOT in your settings.py and then define your image field like this:
image = models.ImageField(upload_to="items")

Note that you dont need to add the whole path to upload_to attribute, Django will append the absolute path for you.  And you need to have a folder named items inside your media folder.
If you want to save images in STATIC_ROOT, try this:
from django.conf import settings

fs = FileSystemStorage(location=settings.STATIC_ROOT)

class ItemIcon(models.Model):
   item = models.ForeignKey("items.Item")
   size = models.IntegerField(choices=settings.IMAGE_SIZES)
   url = models.URLField(unique=True) #The url to the evesite
   image = models.ImageField(upload_to="items",storage=fs)


text:
Q: Should I include media type in my ETag? When adding an ETag to an HTTP response, should I include the media type? Of course, I understand that the ETag is opaque, but here is an example:

*

*Say I have a client that requests a Person in application/json.  I look it up and create my ETag and send back the JSON representation of the person

*Now the same client makes another request for the same person (which has not been modified) at the same URI but wants it in application/xml.

Clearly it is incorrect to simply return a 304, but my question is, in the second request, would I expect the ETags to match but no cache based on the Accept header (or the content header).  Also, is it even possible that the cache will have two representations from the same URI, or would you always  have an invalid cache every time your Content-Type switched?

A: Different representations need different entity tags.
See http://trac.tools.ietf.org/wg/httpbis/trac/ticket/39.

A: I believe that you can send the same Etag for different representations. As long as you specify, that they should be cached as two different entities, in your response.
This can be done using the Vary field, as described in RFC 2616
http://www.ietf.org/rfc/rfc2616.txt

14.44 Vary
The Vary field value indicates the set of request-header fields that
     fully determines, while the response is fresh, whether a cache is
     permitted to use the response to reply to a subsequent request
     without revalidation. For uncacheable or stale responses, the Vary
     field value advises the user agent about the criteria that were used
     to select the representation.

Using a Vary: Accept should be appropriate.


text:
Q: mpdf. создание нескольких файлов подряд Задача создать подряд 2 файла pdf с разным содержанием
Попробовал так:
$mpdf->WriteHTML($html, 2);
$mpdf->Output($file, 'F');
$mpdf->WriteHTML($html1, 2);
$mpdf->Output($file1, 'F');

Первый нормально записало, во второй засунуло первый и нет намека на $html1. Пробовал искать очистку файла или закрытие не нашел. Подскажите плиз что не вижу.

A: Вариант 1
function SavePDF($html, $file){
    $mpdf = new mPDF();
    //Тут остальная логика
    $mpdf->WriteHTML($html, 2);
    $mpdf->Output($file, 'F');
}

for($i=1;$i<5;$i++){
    SavePDF("
Hello
", __DIR__ . '/report_' . time() . '.pdf');
}

Вариант 2
$mpdf = new mPDF();
//Тут остальная логика

for($i=1;$i<5;$i++){
    $clonedMpdf clone $mpdf;
    $mpdf->WriteHTML("
Hello
", 2);
    $mpdf->Output(__DIR__ . '/report_' . time() . '.pdf', 'F');
    unset($clonedMpdf);
}

https://raw.githubusercontent.com/mpdf/mpdf/development/src/Mpdf.php
Вы же эту версию используете?
Покопавшись в коде заметил эти методы
$mpdf->Reset();
$mpdf->DeletePages(0);

Возможно они помогут.


text:
Q: OpenGL in live cards? I've been playing with the glass GDK and glass 'native' (Java) development in general.  I've got a open GL app that works well enough on Glass (using standard android conventions) and I'm looking to port it to the GDK to take advantage of voice triggers and what not.
While I can certainly use it easily enough as an Immersion (I think anyway) what I'd like to do is use it as a Live Card.  I'm just not sure how possible or practical this is.  The documentation seems to imply that with a high frequency rendering card this should be possible but before I dive in I was hoping someone with more experience could weigh in.
(Forgive me if this is obvious -- I'm new to Android having spent the last few years in IOS/obj-c land)

A: XE16 supports OpenGL in live cards.  Use the class GlRenderer: https://developers.google.com/glass/develop/gdk/reference/com/google/android/glass/timeline/GlRenderer

A: I would look at your app and determine if you want to have more user input or not and whether you want it to live in a specific part of your Timeline or just have it be launched when the user wants it.
Specifically, since Live Cards live in the Timeline, they will not be able to capture the swipe backward or swipe forwards gestures since those navigate the Timeline. See the "When to use Live Cards" section of: https://developers.google.com/glass/develop/gdk/ui/index
If you use an Immersion, however you will be able to use those swipe backwards and forwards gestures as well as these others: https://developers.google.com/glass/develop/gdk/input/touch This will give you complete control over the UI and touchpad, with the exception that swipe down should exit your Immersion.
The downside is that once the user exits your Immersion, they will need to start it again likely with a Voice Trigger, whereas a Live Card can live on in part of your Timeline.
You should be able to do your rendering in both a Surface, which a LiveCard can use or in whatever View you choose to put in your Activity which is what an Immersion is. GLSurfaceView for example may be what you need and that internally uses a Surface: http://developer.android.com/guide/topics/graphics/opengl.html Note that you'll want to avoid RemoteViews but I think you already figured that out.


text:
Q: Need to pass a ds(data structure) when Http server is being started, and to make that ds global across controllers So,
Here is the code setup.
There is a driver application, which starts the HTTP server(ASP.NET core Web API project).

The method called by driver application for starting HTTP server is
  this:

public class Http_Server
    {

        public static ConcurrentQueue<Object> cq = new ConcurrentQueue<Object>();

        public static void InitHttpServer(ConcurrentQueue<Object> queue)
        {
            cq = queue;
            var host = new WebHostBuilder()
                .UseKestrel()
                .UseContentRoot(Directory.GetCurrentDirectory())
                .UseIISIntegration()
                .UseStartup<Startup>()
                .UseApplicationInsights()
                .Build();

            host.Run();
        }
    }

Controller Action Task:

[HttpPost]
        [Route("XYZ")]
        public virtual IActionResult AddXYZ([FromBody]List<Resourcemembers> resourcemembers)
        {
            //add something to ds
            Http_Server.cq.Enqueue(new object());

            //respond back
            return new ObjectResult(example);
        }

The data structure(a concurrent queue) being passed is to be made visible at controller level(like a global variable accessible across all controllers).
Is it fine to make the ds a static variable and access it across controllers?
Or Is there a way to pass this ds across to different layers?

A: This is my go at a better solution for this. What you are trying to do doesn't seem like the best way to approach this.
First, you want to enable caching in the application by calling the AddMemoryCache in the application StartUp.ConfigureServices method.
public void ConfigureServices(IServiceCollection services)
{
    // Add framework services.
    services.AddMemoryCache();
    ...
}

Then, you want to use the cache. Something like this should get you going in the right direction.
public class XYZController : Controller {
    private IMemoryCache _memoryCache;
    private const string xyzCacheKey = "XYZ";

    public XYZController(IMemoryCache memoryCache)
    {
        _memoryCache = memoryCache;
    }

    [HttpPost("XYZ")]
    public IActionResult AddXYZ([FromBody]ResourceMember[] resourceMembers)
    {
        try
        {
            if (!_memoryCache.TryGetValue(xyzCacheKey, out ConcurrentQueue<Object> xyz))
            {
                xyz = new ConcurrentQueue<Object>();
                _memoryCache.Set(xyzCacheKey, xyz, new MemoryCacheEntryOptions()
                {
                    SlidingExpiration = new TimeSpan(24, 0, 0)
                });
            }
            xyz.Enqueue(resourceMembers);

            return Ok();
        }
        catch (Exception ex)
        {
            return BadRequest(ex);
        }
    }
}

public class ResourceMember { }

What this does is allow you to use a Memory Cache to hold your object(s), and what ever you Enqueue in the ConcurrentQueue object, should you stay with that as your main object within the Cache. Now, you can cache any object type in the MemoryCache, and pull the value when you need to based on the key you gave it when you added it to the cache. In the case above, I created a const named xyzCacheKey with a string value of XYZ to use as the key.
That static global variable thing you are trying is just not... good.
If this doesn't help, let me know in a comment, I will delete the answer.
Good luck!