text:
Q: Why is DMux4way operate like this? When the sel is 01 the b should be chosen, but why the operation is a = nsel1 b = sel[0]? After that the sel will become 00 from 01
CHIP DMux4Way {
IN in, sel[2];
OUT a, b, c, d;

PARTS:
// Put your code here:
Not(in = sel[0], out = nsel0);
Not(in = sel[1], out = nsel1);
And(a = nsel1, b = nsel0, out = s00);
And(a = in, b = s00, out = a);
And(a = nsel1, b = sel[0], out = s01);
And(a = in, b = s01, out = b);
And(a = sel[1], b = nsel0, out = s10);
And(a = in, b = s10, out = c);
And(a = sel[1], b = sel[0], out = s11);
And(a = in, b = s11, out = d);

}

A: In each pair of ANDs, the first one determines whether the output is activated, and the second one gates the input to that output.
So:
And(a = nsel1, b = nsel0, out = s00);
s00 is True only if both its inputs (nsel0 and nsel1) are True. Since they are the inverse of sel[0] and sel[1], s00 will only be true if both sel[0] and sel[1] are False.
And(a = in, b = s00, out = a);
The second And will only be true if both in and s00 are True. So it will only be True if in is True, and sel[0] and sel[1] are False.
Similar logic applies for the other cases. But the key point is that for the 01 and 10 cases, it is not enough to check that the right value is True, you also have to check that the other value is 0.
Edit: In addition, as the OP points out in a subsequent comment, the machine is little-endian, and you must keep this in mind when operating on a multi-bit bus (like sel).

A: I just figured it out because the hack uses little endian.


text:
Q: How do I compile with -g option in Netbeans? When debugging I get an warning message on exception saying 'variable info not available - compiled without -g' - how do I set to compile with -g in netbeans?
thanks

A: As far as I know your own code is compiled with debug information.  The Java runtime library, however, isn't.
Please double check that the location you see this message, is in your own code and not the runtime library.

A: In my Nb 7.4 there is a "generate Debuging info" flag on
project propertyes -> Build -> compile ;
but if you, like me, are using maven, you have to check in pom.xml too
let me show an example:
you can ave a production profile and in that profile you can have the maven compiler plugin with debug setting to false
        <profile>
        <id>production</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.5.1</version>
                    <configuration>
                        <encoding>UTF-8</encoding>
                        <source>1.6</source>
                        <target>1.6</target>
                        <showWarnings>true</showWarnings>
                        <debug>false</debug>
                        <optimize>true</optimize>
                    </configuration>
                </plugin>
            </plugins>
        </build>
 ...

see the false setting
if you have a similar setting on your pom.xml local variable on debug are not show.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Android app - user communication through Firebase I'm trying to add a feature in my Android app for users to be able to send custom objects (as JSONs I guess) between them. I am new to Firebase and user-to-user interactions and I've been reading through a few things and couple of codelabs about Firebase, but what I want is not a realtime database, nor a Whatsapp messaging styled implementation.
All I want to know, is what is the easiest way for user A to send something across to user B using Firebase? What Firebase product or practice should I be looking at?

A: You can use Firebase storage for this.
If User A wants to send a file to User B:

*

*User A will upload a file to firebase storage and get a link to the file.

*User A shares the link with User B.

*User B will then download the file from firebase storage.

You can check out the documentation here: Firebase storage docs


text:
Q: JavaFX bad logs - Invocation Target Exception Everytime I have an error related to my views (FXML) and controller actions, it ends up showing as a Invocation Target Exception.
e.g.:
java.lang.reflect.InvocationTargetException
file:/C:/Users/Renato%20Correa/Documents/NetBeansProjects/PartyRock/dist/run32339290/PartyRock.jar!/gear7/partyrock/view/IncluirConvidado.fxml
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2186)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2028)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2744)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2723)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2709)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2696)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2685)
  at gear7.partyrock.view.IncluirConvidadoView.<init>(IncluirConvidadoView.java:20)
  at gear7.partyrock.controller.IncluirConvidadoController.<init>(IncluirConvidadoController.java:84)
  at gear7.partyrock.controller.ListaConvidadosController.onBtnAddConvidadoClick(ListaConvidadosController.java:94)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:601)
  at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:55)
  at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:601)
  at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:269)
  at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1435)
  at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:69)
  at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
14044 [JavaFX Application Thread] DEBUG gear7.partyrock.view.MainView  - Erro: javafx.fxml.LoadException: java.lang.reflect.InvocationTargetException
  at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
  at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
  at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
  at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
  at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
  at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
  at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
  at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
  at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
  at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
  at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
  at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:28)
  at javafx.event.Event.fireEvent(Event.java:171)
  at javafx.scene.Node.fireEvent(Node.java:6863)
  at javafx.scene.control.Button.fire(Button.java:179)
  at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:193)
  at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:336)
  at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:329)
  at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:64)
  at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
  at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
  at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
  at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
  at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
  at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
  at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
  at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
  at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
  at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
  at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
  at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
  at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
  at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
  at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:33)
  at javafx.event.Event.fireEvent(Event.java:171)
  at javafx.scene.Scene$MouseHandler.process(Scene.java:3328)
  at javafx.scene.Scene$MouseHandler.process(Scene.java:3168)
  at javafx.scene.Scene$MouseHandler.access$1900(Scene.java:3123)
  at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1563)
  at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2265)
  at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:250)
  at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:173)
  at java.security.AccessController.doPrivileged(Native Method)
  at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:292)
  at com.sun.glass.ui.View.handleMouseEvent(View.java:528)
  at com.sun.glass.ui.View.notifyMouse(View.java:922)
  at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
  at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
  at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:73)
  at java.lang.Thread.run(Thread.java:722)

This is too hard to debug. In fact, I can't trace down this error and been struggling with it for the past couple of hours.  What am I doing wrong? How can I trap better the errors in JavaFX?

A: Caused by invoking a method via reflection.
public static Throwable shortThrowable(Throwable ex) {
    return ex instanceOf InvocationTargetException? ex.getCause() : ex;
}

...
catch (Exception ex) {
    shortThrowable(ex).printStackTrace(); // Or better logging.
}

InvokeTargetException wraps any original Exception in a InvocationTargetException.


text:
Q: How can i skip a specific menu within Nav Walker Wordpress this is my first question in StackOverflow . I hope you guys can help me on this one .
I'm working on a project that requires specific Wordpress Menu's for specific pages in specific languages .
In example , In English language , I have two type of menus , one for General Audience and one for Companies . So in each language i have two type of menus that i needed to create through Menu Dashboard in Wordpress with Ubermenu Plugin .
A single menu hierarchy is like this :

*

*Row

*

*Column

*

*Offers

*

*Offer one

*Offer two

*Offer Three

*Column

*

*Prices

*

*Price Category 1

*Price Category 2

*Price Category 3

*Row

*

*Column

*

*Subscriptions

*

*Subscription Package 1

*Subscription Package 2

*Subscription Package 3

*Column

*

*Products

*

*Product Categorie 1

*Product Categorie 2

Now I'm trying to create a responsive menu for each of them without using any plugin but with custom walkers . But the problem is that I don't want custom Ubermenu Object Classes to appear in the li's or ul's . In this case ROW and Column .
So whenever the walker sees Row or Column it should pass to a child and add the child as primary menu .
So in this case I wanted to be it like this .

*

*Offers

*

*Offer one

*Offer two

*Offer Three

*Prices

*

*Price Category 1

*Price Category 2

*

*Price Category 3

Any help on this it would be really appreciated .
Thanks in advance .


text:
Q: AngularJS ng-view Layout manage Hi I am working on a project using angularjs.
My roting logic is
.state( "authenticate", {
        url: '/',
        templateUrl : "views/login.html",
        controller  : "LoginCtrl",
        data : {
            requireLogin : false
        }
    })
    .state( "beats", {
        url: '/beats',
        templateUrl : "views/beats.html",
        controller  : "BeatsCtrl",
        data : {
            requireLogin : true
        }
    })

.state( "outlets", {
        url: '/outlets',
        templateUrl : "views/beats.html",
        controller  : "BeatsCtrl",
        data : {
            requireLogin : true
        }
    })

I have ng-view in index.html that includes login.html first (url '/'). after login in each state I want to include a navbar in each template using ng-include.
currently I am writing in each page this line

but I want to include only once and each view should be render below it. But the problem is this navbar template itself getting render in ng-view.
and as far as I know we can not have multiple ng-view in one app.
can anyone please tell me what should be the best approach of doing this.

A: You could potentially have this nav bar included in the index.html itself, but hide it using ng-if or ng-show till the user is logged in. Once the user is logged in you could have a flag that evaluates to true and this nav bar can appear on every subsequent page.
in index.html

    // nav bar code

And this 'isUserLoggedIn' will be set to true by your LoginCtrl on the scope.


text:
Q: Query performance after creating views in HIVE using get_json_object? Does Hive get_json_object function parse each JSON object for field resolution, even after we create a view on top of JSON data?
We are having issues reading our JSON Data with SERDE. For this reason we want to use this udf and create views on top of data.
Problem is about a concern that queries on data may be slow in future using this path.
It will be helpful if creating a view on top of hive table will parse the data only once at the time of View creation.
Does Hive Support this or not?
Any ideas from Hive experts on this?

A: I believe Hive does support views. If you're worried about the speed of it, though, you could load impala instead. It uses the same metadata and tables as hive, but is substantially faster for user querying.

A: The purpose of view is to hide complex query from user.Let say you did some complex join query to get all sales data.Now you want your end user to fire query like select * from sales to get all sales data so in that case you can go for view. Whenever you use view in query it will run map reduce job for that view.So it do not make any improvements for speed.
Regarding your question one way to get rid of issue is to store all parse data to another table if possible and then fire queries.It will reduce cost of calling serde every time. I've followed this approach for weblogs.


text:
Q: Clojure import java from file
Possible Duplicate:
Why does require in the ns form behave different from the require function

I am dabbling in clojure and have run into a problem with importing. From the REPL
clojure.core=>(import '(java.io FileReader))
clojure.core=>(import 'java.io.FileReader)
clojure.core=>(import java.io FileReader)

each work perfectly, but from file only the following works:
(ns project.core
  (import java.io.FileReader))

These each fail
(ns project.core
  (import 'java.io.FileReader))

(ns project.core
  (import '(java.io FileReader))

with the following errors:
ClassNotFoundException quote.java.io.FileReader  java.net.URLClassLoader$1.run (URLClassLoader.java:366)

ClassNotFoundException quote.(java.io FileReader)  java.net.URLClassLoader$1.run (URLClassLoader.java:366)

respectively.
In reality I need to import more than just java.io.FileReader, but this is a distilled version of the problem.
Any ideas what might be going wrong? I can't seem to find the problem anywhere else

A: The solution is:
(ns project.core
  (:import [java.io FileReader BufferedReader FooBar]))

As to why this is necessary, the ns macro accepts several directives, including :import.  Due to the way the macro is implemented, it expects arguments to the import directive to be in a list-like form - hence, [java.io ...].  Incidentally, a list such as (java.io ...) would work just as well.
For a complete rundown of how to use ns, please take a look at the ClojureDocs page: http://clojuredocs.org/clojure_core/clojure.core/ns.  ClojureDocs is an invaluable resource for these sorts of problems.


text:
Q: How to put a fixed sized frame around traditional form expression The height of a 2D form of a polynomial changes depending on the existence of exponents, fractional coefficients, etc.  For use inside a Manipulate, I would like to put a frame around such an expression, but fix the frame size with the content centered in it. I was unable to find any Frame options to do this.  Is there a simple solution?  I tried.
PlotLabel -> Framed[Style[TraditionalForm[a x^2+b x+c], 16]], ImageMargins -> 5]

A: If I understand well, what you probably need is first Pane (with its ImageSize option) then Framed.
What about this :
expr1 = a x^2 + b x + c;
expr2 = expr1/d;

fixedframe[expr_]:=Framed@Pane[Style[TraditionalForm[expr1], 16],
    ImageSize -> {200, 50}, Alignment -> Center]

then
fixedframe[expr1]

fixedframe[expr2]

The size of the frame did not change.
Have a look also at the Pane option ImageSizeAction which tells what to do with the content (clip, shrink or enable scrolling inside the pane) if it's too big for the given ImageSize.


text:
Q: How to modify core applications I want to modify the core applications like Settings.apk and install on my own android phone.I don't want to publish it on market. I have following doubts

*

*Where can I get source code for core applications?

*What are the things I need  to do this?

*Please tell me steps to do this.

A: You can get the source code here:  https://android.googlesource.com
Keep in mind that the packages there might not be the ones on your phone as each vendor can provide a replacement of their own, the Camera for instance is almost never the google app.
You will also have to decide which version you want since each OS version has revisions that take advantage of newer API's etc.
As far as what you need pretty much the same thing you need to build android apps, eclipse, the sdk, tools etc. http://developer.android.com
You will of course have to remove the application from your phone before installing the new one since your signing certificate will not match.  There can be difficulties when you swap out your own version so be sure to save the original.


text:
Q: Keep checkstate of items in checkboxlist on search c# winforms So I'm working on a textbox based filter for a bunch of items in a Checked List Box in winforms using c#.
So far I have this code:
List<string> liscollection = new List<string>();
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBox1.Text) == false)
            {
                checkedListBox1.Items.Clear();

                foreach (string str in liscollection)
                {
                    if (str.Contains(textBox1.Text, StringComparison.OrdinalIgnoreCase))
                    {
                        checkedListBox1.Items.Add(str);
                    }
                }
            }
            else if (textBox1.Text == "")
            {
                checkedListBox1.Items.Clear();
                foreach (string str in liscollection)
                {
                    checkedListBox1.Items.Add(str);
                }
            }
        }

It works fine, when I enter the text in TextBox1 all items not containing the entered text disappear.
The problem comes to the checked state on each item. Every time checkedListBox1.Items.Clear(); is called, the checked state also gets cleared.
Is there a method I could use to keep the filter working but to not clear the checked state of the items?
I have been looking for a while now and can't find anything on this and I am a beginner and can't come up with a solution on my own.
Thank you so much in advance for your time!
And excuse my English, it is not my first language :)

A: CheckListBox.Items is of type ObjectCollection, which means that it will accept any object and not just string. By default, CheckedListBox will display the results of ToString as the item's text.
What this means is that you could write a class to represent the items stored in the CheckedListBox that track their own CheckedState property, then override the ToString method so that it displays the text that you want.
// CheckedListBoxItem.cs
public class CheckedListBoxItem
{
    /// <summary>
    /// The item's text - what will be displayed in the CheckedListBox.
    /// </summary>
    public string Text { get; set; }

    /// <summary>
    /// The item's check state.
    /// </summary>
    public CheckState CheckState { get; set; } = CheckState.Unchecked;

    /// <summary>
    /// Whether the item is checked or not.
    /// </summary>
    public bool Checked
    {
        get
        {
            return (CheckState == CheckState.Checked || CheckState == CheckState.Indeterminate);
        }
        set
        {
            if (value)
            {
                CheckState = CheckState.Checked;
            }
            else
            {
                CheckState = CheckState.Unchecked;
            }
        }
    }

    public bool Contains(string str, StringComparison comparison)
    {
        return Text.IndexOf(str, comparison) >= 0;
    }

    public override string ToString()
    {
        return Text;
    }
}

The behavior of CheckedListBoxItem.Checked is based on CheckedListBox.GetItemChecked which treats CheckState.Interetminate as checked, and CheckedListBox.SetItemChecked which treats true as CheckState.Checked and false as CheckState.Unchecked.
In your Form, you would then change the type of lstcollection to List<CheckedListBoxItem> and set the Text property of each item to the string that you have now.
CheckedListBox doesn't have any way to bind the CheckState of each item, so you'll have to manage that yourself. Fortunately, there is the CheckedListBox.ItemChecked event that will fire whenever the checked state of an item changes. So, you can handle the event with a function like...
private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e)
{
    // Since each item in the CheckedListBox is of type CheckedListBoxItem, we can
    // just cast to that type...
    CheckedListBoxItem item = checkedListBox1.Items[e.Index] as CheckedListBoxItem;

    // Then set the checked state to the new value.
    item.CheckState = e.NewValue;
}

Your filter function remains largely unchanged, but when you're adding the items to the CheckedListBox you have to pass the CheckedState as well...
private List<CheckedListBoxItem> liscollection;

private void textBox1_TextChanged(object sender, EventArgs e)
{
    checkedListBox1.Items.Clear();
    if (string.IsNullOrEmpty(textBox1.Text) == false)
    {
        foreach (var item in liscollection)
        {
            if (item.Contains(textBox1.Text, StringComparison.OrdinalIgnoreCase))
            {
                checkedListBox1.Items.Add(item, item.CheckState);
            }
        }
    }
    else
    {
        foreach (var item in liscollection)
        {
            checkedListBox1.Items.Add(item, item.CheckState);
        }
    }
}

EDIT
For a case like this, I wouldn't add the items to checkedListBox1 at design time. I'd add them to liscollection at runtime, then add liscollection to checkedListBox1.Items.
public class YourForm : Form
{
    public YourForm()
    {
        InitializeComponent();

        // You would add one item to liscollection for each item that you have in the checkedListBox1's designer and set the Text to whatever the item is now...
        liscollection = new List<CheckedListBoxItem>
        {
           new CheckedListBoxItem { Text = "The" },
           new CheckedListBoxItem { Text = "needs" },
           new CheckedListBoxItem { Text = "of" },
           new CheckedListBoxItem { Text = "the" },
           new CheckedListBoxItem { Text = "many" },
           new CheckedListBoxItem { Text = "outweigh" },
           new CheckedListBoxItem { Text = "the" },
           new CheckedListBoxItem { Text = "needs" },
           new CheckedListBoxItem { Text = "of" },
           new CheckedListBoxItem { Text = "the" },
           new CheckedListBoxItem { Text = "few" },
        };
        checkedListBox1.Items.AddRange(liscollection.ToArray());
    }
}

If you really prefer to populate checkedListBox1 from the designer, you can do that too. You just have to call checkedListBox1.Items.Clear() after populating liscollection and before calling checkedListBox1.Items.AddRange(...)
public class YourForm : Form
{
    public YourForm()
    {
        InitializeComponent();

        liscollection = new List<CheckedListBoxItem>();
        foreach(string str in checkedListBox1.Items)
        {
            liscollection.Add(new CheckedListBoxItem { Text = str });
        }
        checkedListBox1.Items.Clear();
        checkedListBox1.Items.AddRange(liscollection.ToArray());
    }
}

The important line there is checkedListBox1.Items.AddRange(liscollection.ToArray()). You want the Items to be instances of CheckedListBoxItem, that way in the ItemCheck event you can cast the item to an instance of CheckedListBoxItem. By populating checkedListBox1 from the designer, you're populating it with strings only, so when you try to cast to a CheckedListBoxItem in the ItemCheck event it fails. That's why you're getting that NullReferenceException.


text:
Q: get human readable AST from c++ code In order to get a better understanding of some of the details of the C++ language and grammer, I would love to be able to write a small C++ program, and see the AST that a compiler generates from that.
It looks like clang had this feature in the past (-emit-asm), but it has removed.
Is there an easy way to do this today?

A: Probably the best way is to write a program on your own with libclang. Check the API Documentation of libclang, specially the C++ AST introspection part.

A: Here's two examples, a simple one and a nasty one (C++'s "most vexing parse").
A simple Fibonacci program from http://talkbinary.com/programming/c/fibonacci-in-c/ parsed as C++ code:
int fib(int n) {
if ( n == 0 || n == 1 )
    return n;

int fib1 = 0;
int fib2 = 1;
int fib = 0;

for ( int i = 2; i < n; i++ )
{
    fib = fib1 + fib2;
    fib1 = fib2;
    fib2 = fib;
}

return fib;
}

Our DMS Software Reengineering Toolkit (with full C++11/17 parser) produces the following AST:
C:\DMS\Domains\Cpp\GCC4\Tools\Parser\Source>run ..\DomainParser ++AST "C:\temp\fibonacci.cpp"
Cpp~GCC4 Domain Parser Version 2.5.15
Copyright (C) 1996-2013 Semantic Designs, Inc; All Rights Reserved; SD Confidential
Powered by DMS (R) Software Reengineering Toolkit
118 tree nodes in tree.
(translation_unit@Cpp~GCC4=2#4dc3a00^0 Line 1 Column 1 File C:/temp/fibonacci.cpp
 (function_definition@Cpp~GCC4=1615#4dc39e0^1#4dc3a00:1 Line 1 Column 1 File C:/temp/fibonacci.cpp
  (function_head@Cpp~GCC4=1627#4d89de0^1#4dc39e0:1 Line 1 Column 1 File C:/temp/fibonacci.cpp
   (simple_type_specifier@Cpp~GCC4=1109#4d89920^1#4d89de0:1 Line 1 Column 1 File C:/temp/fibonacci.cpp
   |('int'@Cpp~GCC4=2760#4d898c0^1#4d89920:1[Keyword:0] Line 1 Column 1 File C:/temp/fibonacci.cpp)'int'
   )simple_type_specifier
   (noptr_declarator@Cpp~GCC4=1401#4d89a80^1#4d89de0:2 Line 1 Column 5 File C:/temp/fibonacci.cpp
   |(IDENTIFIER@Cpp~GCC4=2645#4d89900^1#4d89a80:1[`fib'] Line 1 Column 5 File C:/temp/fibonacci.cpp)IDENTIFIER
   |('('@Cpp~GCC4=2885#4d89ac0^1#4d89a80:2[Keyword:0] Line 1 Column 8 File C:/temp/fibonacci.cpp)'('
   |(parameter_declaration@Cpp~GCC4=1590#4d89e00^1#4d89a80:3 Line 1 Column 9 File C:/temp/fibonacci.cpp
   | (simple_type_specifier@Cpp~GCC4=1109#4d89b20^1#4d89e00:1 Line 1 Column 9 File C:/temp/fibonacci.cpp
   |  ('int'@Cpp~GCC4=2760#4d89d60^1#4d89b20:1[Keyword:0] Line 1 Column 9 File C:/temp/fibonacci.cpp)'int'
   | )simple_type_specifier
   | (IDENTIFIER@Cpp~GCC4=2645#4d89b00^1#4d89e00:2[`n'] Line 1 Column 13 File C:/temp/fibonacci.cpp)IDENTIFIER
   |)parameter_declaration
   |(')'@Cpp~GCC4=2886#4d89bc0^1#4d89a80:4[Keyword:0] Line 1 Column 14 File C:/temp/fibonacci.cpp)')'
   |(function_qualifiers@Cpp~GCC4=1417#4d89dc0^1#4d89a80:5 Line 1 Column 16 File C:/temp/fibonacci.cpp)function_qualifiers
   )noptr_declarator
  )function_head
  (compound_statement@Cpp~GCC4=872#4dc39c0^1#4dc39e0:2 Line 1 Column 16 File C:/temp/fibonacci.cpp
   ('{'@Cpp~GCC4=2938#4d89f20^1#4dc39c0:1[Keyword:0] Line 1 Column 16 File C:/temp/fibonacci.cpp)'{'
   (statement_seq@Cpp~GCC4=876#4dc3060^1#4dc39c0:2 Line 2 Column 5 File C:/temp/fibonacci.cpp
   |(statement_seq@Cpp~GCC4=876#4dc3920^1#4dc3060:1 Line 2 Column 5 File C:/temp/fibonacci.cpp
   | (statement_seq@Cpp~GCC4=876#4dc2880^1#4dc3920:1 Line 2 Column 5 File C:/temp/fibonacci.cpp
   |  (statement_seq@Cpp~GCC4=876#4dc2700^1#4dc2880:1 Line 2 Column 5 File C:/temp/fibonacci.cpp
   |   (statement_seq@Cpp~GCC4=876#4dc2640^1#4dc2700:1 Line 2 Column 5 File C:/temp/fibonacci.cpp
   |   |(selection_statement@Cpp~GCC4=892#4dc25c0^1#4dc2640:1 Line 2 Column 5 File C:/temp/fibonacci.cpp
   |   | ('if'@Cpp~GCC4=2753#4d89f40^1#4dc25c0:1[Keyword:0] Line 2 Column 5 File C:/temp/fibonacci.cpp)'if'
   |   | ('('@Cpp~GCC4=2885#4d89f60^1#4dc25c0:2[Keyword:0] Line 2 Column 8 File C:/temp/fibonacci.cpp)'('
   |   | (logical_or_expression@Cpp~GCC4=763#4dc2220^1#4dc25c0:3 Line 2 Column 10 File C:/temp/fibonacci.cpp
   |   |  (equality_expression@Cpp~GCC4=696#4d89fa0^1#4dc2220:1 Line 2 Column 10 File C:/temp/fibonacci.cpp
   |   |   (IDENTIFIER@Cpp~GCC4=2645#4d89d80^1#4d89fa0:1[`n'] Line 2 Column 10 File C:/temp/fibonacci.cpp)IDENTIFIER
   |   |   ('=='@Cpp~GCC4=2918#4d89da0^1#4d89fa0:2[Keyword:0] Line 2 Column 12 File C:/temp/fibonacci.cpp)'=='
   |   |   (INT_LITERAL@Cpp~GCC4=2809#4d89fe0^1#4d89fa0:3[0] Line 2 Column 15 File C:/temp/fibonacci.cpp)INT_LITERAL
   |   |  )equality_expression
   |   |  ('||'@Cpp~GCC4=2922#4d89f80^1#4dc2220:2[Keyword:0] Line 2 Column 17 File C:/temp/fibonacci.cpp)'||'
   |   |  (equality_expression@Cpp~GCC4=696#4dc2200^1#4dc2220:3 Line 2 Column 20 File C:/temp/fibonacci.cpp
   |   |   (IDENTIFIER@Cpp~GCC4=2645#4dc2180^1#4dc2200:1[`n'] Line 2 Column 20 File C:/temp/fibonacci.cpp)IDENTIFIER
   |   |   ('=='@Cpp~GCC4=2918#4dc21a0^1#4dc2200:2[Keyword:0] Line 2 Column 22 File C:/temp/fibonacci.cpp)'=='
   |   |   (INT_LITERAL@Cpp~GCC4=2809#4dc21c0^1#4dc2200:3[1] Line 2 Column 25 File C:/temp/fibonacci.cpp)INT_LITERAL
   |   |  )equality_expression
   |   | )logical_or_expression
   |   | (')'@Cpp~GCC4=2886#4dc21e0^1#4dc25c0:4[Keyword:0] Line 2 Column 27 File C:/temp/fibonacci.cpp)')'
   |   | (jump_statement@Cpp~GCC4=983#4dc2440^1#4dc25c0:5 Line 3 Column 9 File C:/temp/fibonacci.cpp
   |   |  ('return'@Cpp~GCC4=2778#4dc2340^1#4dc2440:1[Keyword:0] Line 3 Column 9 File C:/temp/fibonacci.cpp)'return'
   |   |  (IDENTIFIER@Cpp~GCC4=2645#4dc2360^1#4dc2440:2[`n'] Line 3 Column 16 File C:/temp/fibonacci.cpp)IDENTIFIER
   |   |  (';'@Cpp~GCC4=2937#4dc2400^1#4dc2440:3[Keyword:0] Line 3 Column 17 File C:/temp/fibonacci.cpp)';'
   |   | )jump_statement
   |   |)selection_statement
   |   |(simple_declaration@Cpp~GCC4=1033#4dc2620^1#4dc2640:2 Line 5 Column 5 File C:/temp/fibonacci.cpp
   |   | (simple_type_specifier@Cpp~GCC4=1109#4dc23c0^1#4dc2620:1 Line 5 Column 5 File C:/temp/fibonacci.cpp
   |   |  ('int'@Cpp~GCC4=2760#4dc2520^1#4dc23c0:1[Keyword:0] Line 5 Column 5 File C:/temp/fibonacci.cpp)'int'
   |   | )simple_type_specifier
   |   | (init_declarator@Cpp~GCC4=1380#4dc23a0^1#4dc2620:2 Line 5 Column 9 File C:/temp/fibonacci.cpp
   |   |  (IDENTIFIER@Cpp~GCC4=2645#4dc2460^1#4dc23a0:1[`fib1'] Line 5 Column 9 File C:/temp/fibonacci.cpp)IDENTIFIER
   |   |  (initializer@Cpp~GCC4=1639#4dc2380^1#4dc23a0:2 Line 5 Column 14 File C:/temp/fibonacci.cpp
   |   |   ('='@Cpp~GCC4=2893#4dc23e0^1#4dc2380:1[Keyword:0] Line 5 Column 14 File C:/temp/fibonacci.cpp)'='
   |   |   (INT_LITERAL@Cpp~GCC4=2809#4dc2680^1#4dc2380:2[0] Line 5 Column 16 File C:/temp/fibonacci.cpp)INT_LITERAL
   |   |  )initializer
   |   | )init_declarator
   |   | (';'@Cpp~GCC4=2937#4dc26a0^1#4dc2620:3[Keyword:0] Line 5 Column 17 File C:/temp/fibonacci.cpp)';'
   |   |)simple_declaration
   |   )statement_seq
   |   (simple_declaration@Cpp~GCC4=1033#4dc25a0^1#4dc2700:2 Line 6 Column 5 File C:/temp/fibonacci.cpp
   |   |(simple_type_specifier@Cpp~GCC4=1109#4dc26c0^1#4dc25a0:1 Line 6 Column 5 File C:/temp/fibonacci.cpp
   |   | ('int'@Cpp~GCC4=2760#4dc2600^1#4dc26c0:1[Keyword:0] Line 6 Column 5 File C:/temp/fibonacci.cpp)'int'
   |   |)simple_type_specifier
   |   |(init_declarator@Cpp~GCC4=1380#4dc2560^1#4dc25a0:2 Line 6 Column 9 File C:/temp/fibonacci.cpp
   |   | (IDENTIFIER@Cpp~GCC4=2645#4dc2660^1#4dc2560:1[`fib2'] Line 6 Column 9 File C:/temp/fibonacci.cpp)IDENTIFIER
   |   | (initializer@Cpp~GCC4=1639#4dc2540^1#4dc2560:2 Line 6 Column 14 File C:/temp/fibonacci.cpp
   |   |  ('='@Cpp~GCC4=2893#4dc26e0^1#4dc2540:1[Keyword:0] Line 6 Column 14 File C:/temp/fibonacci.cpp)'='
   |   |  (INT_LITERAL@Cpp~GCC4=2809#4dc2740^1#4dc2540:2[1] Line 6 Column 16 File C:/temp/fibonacci.cpp)INT_LITERAL
   |   | )initializer
   |   |)init_declarator
   |   |(';'@Cpp~GCC4=2937#4dc2760^1#4dc25a0:3[Keyword:0] Line 6 Column 17 File C:/temp/fibonacci.cpp)';'
   |   )simple_declaration
   |  )statement_seq
   |  (simple_declaration@Cpp~GCC4=1033#4dc2860^1#4dc2880:2 Line 7 Column 5 File C:/temp/fibonacci.cpp
   |   (simple_type_specifier@Cpp~GCC4=1109#4dc27c0^1#4dc2860:1 Line 7 Column 5 File C:/temp/fibonacci.cpp
   |   |('int'@Cpp~GCC4=2760#4dc2580^1#4dc27c0:1[Keyword:0] Line 7 Column 5 File C:/temp/fibonacci.cpp)'int'
   |   )simple_type_specifier
   |   (init_declarator@Cpp~GCC4=1380#4dc2820^1#4dc2860:2 Line 7 Column 9 File C:/temp/fibonacci.cpp
   |   |(IDENTIFIER@Cpp~GCC4=2645#4dc2720^1#4dc2820:1[`fib'] Line 7 Column 9 File C:/temp/fibonacci.cpp)IDENTIFIER
   |   |(initializer@Cpp~GCC4=1639#4dc2800^1#4dc2820:2 Line 7 Column 13 File C:/temp/fibonacci.cpp
   |   | ('='@Cpp~GCC4=2893#4dc27e0^1#4dc2800:1[Keyword:0] Line 7 Column 13 File C:/temp/fibonacci.cpp)'='
   |   | (INT_LITERAL@Cpp~GCC4=2809#4dc28c0^1#4dc2800:2[0] Line 7 Column 15 File C:/temp/fibonacci.cpp)INT_LITERAL
   |   |)initializer
   |   )init_declarator
   |   (';'@Cpp~GCC4=2937#4dc28e0^1#4dc2860:3[Keyword:0] Line 7 Column 16 File C:/temp/fibonacci.cpp)';'
   |  )simple_declaration
   | )statement_seq
   | (iteration_statement@Cpp~GCC4=941#4dc3980^1#4dc3920:2 Line 9 Column 5 File C:/temp/fibonacci.cpp
   |  ('for'@Cpp~GCC4=2749#4dc2840^1#4dc3980:1[Keyword:0] Line 9 Column 5 File C:/temp/fibonacci.cpp)'for'
   |  ('('@Cpp~GCC4=2885#4dc28a0^1#4dc3980:2[Keyword:0] Line 9 Column 9 File C:/temp/fibonacci.cpp)'('
   |  (simple_declaration@Cpp~GCC4=1033#4dc2a20^1#4dc3980:3 Line 9 Column 11 File C:/temp/fibonacci.cpp
   |   (simple_type_specifier@Cpp~GCC4=1109#4dc2940^1#4dc2a20:1 Line 9 Column 11 File C:/temp/fibonacci.cpp
   |   |('int'@Cpp~GCC4=2760#4dc2900^1#4dc2940:1[Keyword:0] Line 9 Column 11 File C:/temp/fibonacci.cpp)'int'
   |   )simple_type_specifier
   |   (init_declarator@Cpp~GCC4=1380#4dc29e0^1#4dc2a20:2 Line 9 Column 15 File C:/temp/fibonacci.cpp
   |   |(IDENTIFIER@Cpp~GCC4=2645#4dc2920^1#4dc29e0:1[`i'] Line 9 Column 15 File C:/temp/fibonacci.cpp)IDENTIFIER
   |   |(initializer@Cpp~GCC4=1639#4dc29c0^1#4dc29e0:2 Line 9 Column 17 File C:/temp/fibonacci.cpp
   |   | ('='@Cpp~GCC4=2893#4dc2960^1#4dc29c0:1[Keyword:0] Line 9 Column 17 File C:/temp/fibonacci.cpp)'='
   |   | (INT_LITERAL@Cpp~GCC4=2809#4dc2a40^1#4dc29c0:2[2] Line 9 Column 19 File C:/temp/fibonacci.cpp)INT_LITERAL
   |   |)initializer
   |   )init_declarator
   |   (';'@Cpp~GCC4=2937#4dc29a0^1#4dc2a20:3[Keyword:0] Line 9 Column 20 File C:/temp/fibonacci.cpp)';'
   |  )simple_declaration
   |  (relational_expression@Cpp~GCC4=684#4dc2b60^1#4dc3980:4 Line 9 Column 22 File C:/temp/fibonacci.cpp
   |   (IDENTIFIER@Cpp~GCC4=2645#4dc2a00^1#4dc2b60:1[`i'] Line 9 Column 22 File C:/temp/fibonacci.cpp)IDENTIFIER
   |   ('<'@Cpp~GCC4=2899#4dc2a80^1#4dc2b60:2[Keyword:0] Line 9 Column 24 File C:/temp/fibonacci.cpp)'<'
   |   (IDENTIFIER@Cpp~GCC4=2645#4dc2aa0^1#4dc2b60:3[`n'] Line 9 Column 26 File C:/temp/fibonacci.cpp)IDENTIFIER
   |  )relational_expression
   |  (';'@Cpp~GCC4=2937#4dc2b40^1#4dc3980:5[Keyword:0] Line 9 Column 27 File C:/temp/fibonacci.cpp)';'
   |  (postfix_expression@Cpp~GCC4=406#4dc2b20^1#4dc3980:6 Line 9 Column 29 File C:/temp/fibonacci.cpp
   |   (IDENTIFIER@Cpp~GCC4=2645#4dc2e60^1#4dc2b20:1[`i'] Line 9 Column 29 File C:/temp/fibonacci.cpp)IDENTIFIER
   |   ('++'@Cpp~GCC4=2897#4dc2ae0^1#4dc2b20:2[Keyword:0] Line 9 Column 30 File C:/temp/fibonacci.cpp)'++'
   |  )postfix_expression
   |  (')'@Cpp~GCC4=2886#4dc2b00^1#4dc3980:7[Keyword:0] Line 9 Column 33 File C:/temp/fibonacci.cpp)')'
   |  (compound_statement@Cpp~GCC4=872#4dc38e0^1#4dc3980:8 Line 10 Column 5 File C:/temp/fibonacci.cpp
   |   ('{'@Cpp~GCC4=2938#4dc2b80^1#4dc38e0:1[Keyword:0] Line 10 Column 5 File C:/temp/fibonacci.cpp)'{'
   |   (statement_seq@Cpp~GCC4=876#4dc3900^1#4dc38e0:2 Line 11 Column 9 File C:/temp/fibonacci.cpp
   |   |(statement_seq@Cpp~GCC4=876#4dc2f20^1#4dc3900:1 Line 11 Column 9 File C:/temp/fibonacci.cpp
   |   | (expression_statement@Cpp~GCC4=869#4dc3080^1#4dc2f20:1 Line 11 Column 9 File C:/temp/fibonacci.cpp
   |   |  (assignment_expression@Cpp~GCC4=809#4dc33a0^1#4dc3080:1 Line 11 Column 9 File C:/temp/fibonacci.cpp
   |   |   (IDENTIFIER@Cpp~GCC4=2645#4dc2ba0^1#4dc33a0:1[`fib'] Line 11 Column 9 File C:/temp/fibonacci.cpp)IDENTIFIER
   |   |   ('='@Cpp~GCC4=2893#4dc2bc0^1#4dc33a0:2[Keyword:0] Line 11 Column 13 File C:/temp/fibonacci.cpp)'='
   |   |   (additive_expression@Cpp~GCC4=593#4dc3000^1#4dc33a0:3 Line 11 Column 15 File C:/temp/fibonacci.cpp
   |   |   |(IDENTIFIER@Cpp~GCC4=2645#4dc2be0^1#4dc3000:1[`fib1'] Line 11 Column 15 File C:/temp/fibonacci.cpp)IDENTIFIER
   |   |   |('+'@Cpp~GCC4=2902#4dc2e80^1#4dc3000:2[Keyword:0] Line 11 Column 20 File C:/temp/fibonacci.cpp)'+'
   |   |   |(IDENTIFIER@Cpp~GCC4=2645#4dc2ea0^1#4dc3000:3[`fib2'] Line 11 Column 22 File C:/temp/fibonacci.cpp)IDENTIFIER
   |   |   )additive_expression
   |   |  )assignment_expression
   |   |  (';'@Cpp~GCC4=2937#4dc2ec0^1#4dc3080:2[Keyword:0] Line 11 Column 26 File C:/temp/fibonacci.cpp)';'
   |   | )expression_statement
   |   | (expression_statement@Cpp~GCC4=869#4dc2f00^1#4dc2f20:2 Line 12 Column 9 File C:/temp/fibonacci.cpp
   |   |  (assignment_expression@Cpp~GCC4=809#4dc3740^1#4dc2f00:1 Line 12 Column 9 File C:/temp/fibonacci.cpp
   |   |   (IDENTIFIER@Cpp~GCC4=2645#4dc2ee0^1#4dc3740:1[`fib1'] Line 12 Column 9 File C:/temp/fibonacci.cpp)IDENTIFIER
   |   |   ('='@Cpp~GCC4=2893#4dc3400^1#4dc3740:2[Keyword:0] Line 12 Column 14 File C:/temp/fibonacci.cpp)'='
   |   |   (IDENTIFIER@Cpp~GCC4=2645#4dc3340^1#4dc3740:3[`fib2'] Line 12 Column 16 File C:/temp/fibonacci.cpp)IDENTIFIER
   |   |  )assignment_expression
   |   |  (';'@Cpp~GCC4=2937#4dc2fa0^1#4dc2f00:2[Keyword:0] Line 12 Column 20 File C:/temp/fibonacci.cpp)';'
   |   | )expression_statement
   |   |)statement_seq
   |   |(expression_statement@Cpp~GCC4=869#4dc2fe0^1#4dc3900:2 Line 13 Column 9 File C:/temp/fibonacci.cpp
   |   | (assignment_expression@Cpp~GCC4=809#4dc3940^1#4dc2fe0:1 Line 13 Column 9 File C:/temp/fibonacci.cpp
   |   |  (IDENTIFIER@Cpp~GCC4=2645#4dc38a0^1#4dc3940:1[`fib2'] Line 13 Column 9 File C:/temp/fibonacci.cpp)IDENTIFIER
   |   |  ('='@Cpp~GCC4=2893#4dc37a0^1#4dc3940:2[Keyword:0] Line 13 Column 14 File C:/temp/fibonacci.cpp)'='
   |   |  (IDENTIFIER@Cpp~GCC4=2645#4dc3700^1#4dc3940:3[`fib'] Line 13 Column 16 File C:/temp/fibonacci.cpp)IDENTIFIER
   |   | )assignment_expression
   |   | (';'@Cpp~GCC4=2937#4dc38c0^1#4dc2fe0:2[Keyword:0] Line 13 Column 19 File C:/temp/fibonacci.cpp)';'
   |   |)expression_statement
   |   )statement_seq
   |   ('}'@Cpp~GCC4=2939#4dc2fc0^1#4dc38e0:3[Keyword:0] Line 14 Column 5 File C:/temp/fibonacci.cpp)'}'
   |  )compound_statement
   | )iteration_statement
   |)statement_seq
   |(jump_statement@Cpp~GCC4=983#4dc3040^1#4dc3060:2 Line 16 Column 5 File C:/temp/fibonacci.cpp
   | ('return'@Cpp~GCC4=2778#4dc3960^1#4dc3040:1[Keyword:0] Line 16 Column 5 File C:/temp/fibonacci.cpp)'return'
   | (IDENTIFIER@Cpp~GCC4=2645#4dc3500^1#4dc3040:2[`fib'] Line 16 Column 12 File C:/temp/fibonacci.cpp)IDENTIFIER
   | (';'@Cpp~GCC4=2937#4dc3540^1#4dc3040:3[Keyword:0] Line 16 Column 15 File C:/temp/fibonacci.cpp)';'
   |)jump_statement
   )statement_seq
   ('}'@Cpp~GCC4=2939#4dc3560^1#4dc39c0:3[Keyword:0] Line 17 Column 1 File C:/temp/fibonacci.cpp)'}'
  )compound_statement
 )function_definition
)translation_unit
Exiting with final status 0.

C:\DMS\Domains\Cpp\GCC4\Tools\Parser\Source>

DMS can produce an XML version of this.
For a truly vexing example of C++:
template<bool> struct a_t;

template<> struct a_t<true> {
    template<int> struct b {};
};

template<> struct a_t<false> {
   enum { b };
};

typedef a_t<sizeof(void*)==sizeof(int)> a;

enum { c, d };
int main() {
    a::b<c>d; // declaration or expression?
}

... DMS produces the following tree, with multiple interpretations
of the last statement (drawn with Dot; your browser probably has a "view image" to let you see a larger version):

The examples shown happen to be for the GCC dialect of C++.  DMS can also parse Microsoft Visual Studio C++ (as of June 2015, handles C++14, and all of MSVC 2013, we're checking compatibility with MSVC 2015).
[Edit June 2018: Now handles C++17.  The number of dark corners in the standard is just stunning.]
Getting a parse tree by itself isn't generally very useful.  You also need other artifacts such as a symbol table and control/data flow facts.  The DMS C++ front end produces all of this as tool-accessible data attributes of the AST.
(Using those symbol tables, the C++ front end resolves which of the sub-parses in the above example is valid, and removes the invalid subtree.)
Sometimes it is useful to parse (well-formed) substrings of a language.  The DMS parsing engines can do that; you don't have parse an entire compilation unit.

A: clang still has that functionality:
The commands are -ast-dump and -ast-dump-xml
Note: -ast-dump-xml will only work when you build clang in debug mode.
http://clang.llvm.org/docs/IntroductionToTheClangAST.html
For example:
## cat test.cpp
int main()
{
return 0;
}

##clang++ -cc1 -ast-dump-xml test.cpp
<TranslationUnit ptr="0x4e42660">
 <Typedef ptr="0x4e42bd0" name="__builtin_va_list" typeptr="0x0">
  <PointerType ptr="0x4e42b90" canonical="0x4e42b90">
   <BuiltinType ptr="0x4e426f0" canonical="0x4e426f0"/>
  </PointerType>
 </Typedef>
 <Function ptr="0x4e42c70" name="main" returnzero="true" prototype="true">
  <FunctionProtoType ptr="0x4e42c20" canonical="0x4e42c20">
   <BuiltinType ptr="0x4e42750" canonical="0x4e42750"/>
   <parameters/>
  </FunctionProtoType>
  <Stmt>
CompoundStmt 0x4e42d78 <test.cpp:2:1, line:4:1>
`-ReturnStmt 0x4e42d58 <line:3:1, col:8>
  `-IntegerLiteral 0x4e42d38 <col:8> 'int' 0

  </Stmt>
 </Function>
</TranslationUnit>


text:
Q: Overridden edits show wrong action label ("SuggestedEditOverrideToRejected") on network profile activity page The network profile activity page shows a wrong label for when a post owner/moderator overrides a suggested edit:

The proper label is found on the per-site profile:


text:
Q: filling dynamic array in struct in C Hi i want to fill a struct with data so i wrote this code but when i try to run it it crush and close i don't know why :
#include <stdio.h>
#include <stdlib.h>

struct rectangle{
    float length ;
    float width ;
};

void main()
{
   printf("enter the size of both arrays \n");
   int x ;
   scanf("%d",&x);

struct rectangle *r ;
r = (int *) malloc(x*sizeof(int));
int j ;
 for (j = 0 ; j < x ; j++){
    printf("enter rectangle length \n");
    scanf("%d",r[j].length);
    printf("enter rectangle width \n");
    scanf("%d",r[j].width);

   }
   printf("%d \n",max(r,x));

}

but when i try to run it it crushes .

A: You are allocating an array of int data, yet trying to use it as if it was an array of of rectangle data. Both types are not the same size.
Allocate your array like this:
struct rectangle* r = malloc(x*sizeof(struct rectangle));

To clarify:
sizeof(int) != sizeof(struct rectangle)

Also scanf expects a pointer to each variable you are scanning in.
%d is the format specifier for integers but length and width are floats.
Use:
scanf("%f",&r[j].length);
scanf("%f",&r[j].width);

A: There are a number of subtle issues in your code, primarily pertaining to scanf, however, your use of malloc need not include a cast. malloc returns the starting address to a newly allocated block of memory. It is simply an address (not an int address or a float address, just an address which is type void). When you allocate memory, get in the habit of freeing the memory when no longer needed. Good habits developed now go a long way.
Putting those pieces together, you could implement your code in the following way:
#include <stdio.h>
#include <stdlib.h>

struct rectangle {
    float length;
    float width;
};

int main (void)
{
    size_t j = 0, x = 0;
    struct rectangle *r = NULL;

    printf ("\nenter the size of both arrays: ");
    scanf ("%zu", &x);

    r = malloc (x * sizeof *r);
    if (!r) {    /* validate each and every allocation */
        fprintf (stderr, "error: virtual memory exhausted.\n");
        return 1;
    }

    printf ("\nenter rectangle values:\n\n");
    for (j = 0; j < x; j++)
    {
        printf ("  enter rectangle length [%zu]: ", j);
        scanf ("%f", &r[j].length);
        printf ("  enter rectangle width  [%zu]: ", j);
        scanf ("%f", &r[j].width);

    }
    /* printf ("%d \n", max (r, x)); */

    printf ("\n rectangle  length  width\n");
    for (j = 0; j < x; j++)
        printf ("  r[%2zu]    %6.2f  %6.2f\n", j, r[j].length, r[j].width);

    free (r);   /* free allocated memory */

    return 0;
}

note: the return from all calls to scanf must be validated to confirm the expected number of type conversions took place as specified in the format specifier to insure that neither an input or matching failure occurred. (they are omitted above for brevity)
Compile (with Warnings enabled)
gcc -Wall -Wextra -O3 -o bin/struct_dyn struct_dyn.c

Use/Output
$ ./bin/struct_dyn

enter the size of both arrays: 4

enter rectangle values:

  enter rectangle length [0]: 1
  enter rectangle width  [0]: 12
  enter rectangle length [1]: 2
  enter rectangle width  [1]: 6
  enter rectangle length [2]: 3
  enter rectangle width  [2]: 4
  enter rectangle length [3]: 4
  enter rectangle width  [3]: 3

 rectangle  length  width
  r[ 0]      1.00   12.00
  r[ 1]      2.00    6.00
  r[ 2]      3.00    4.00
  r[ 3]      4.00    3.00

Memory Error/Leak Check
In any code your write that dynamically allocates memory, you have 2 responsibilites regarding any block of memory allocated: (1) always preserves a pointer to the starting address for the block of memory so, (2) it can be freed when it is no longer needed. It is imperative that you use a memory error checking program to insure you haven't written beyond/outside your allocated block of memory and to confirm that you have freed all the memory you have allocated. For Linux valgrind is the normal choice. There are so many subtle ways to misuse a block of memory that can cause real problems, there is no excuse not to do it. There are similar memory checkers for every platform. They are all simple to use. Just run your program through it.
$ valgrind ./bin/struct_dyn
==18380== Memcheck, a memory error detector
==18380== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==18380== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==18380== Command: ./bin/struct_dyn
==18380==

enter the size of both arrays: 4
<snip>
 rectangle  length  width
  r[ 0]      1.00   12.00
  r[ 1]      2.00    6.00
  r[ 2]      3.00    4.00
  r[ 3]      4.00    3.00
==18380==
==18380== HEAP SUMMARY:
==18380==     in use at exit: 0 bytes in 0 blocks
==18380==   total heap usage: 1 allocs, 1 frees, 32 bytes allocated
==18380==
==18380== All heap blocks were freed -- no leaks are possible
==18380==
==18380== For counts of detected and suppressed errors, rerun with: -v
==18380== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)

Let me know if you have any questions.


text:
Q: Windows 10 windows all return to main monitor on sleep Running Windows 10 Enterprise RTM. With two monitors, after the computer goes to sleep all windows return to main monitor. When only locking the computer and waking it up again windows stay where they should be. The system has two non-sli graphics cards, however both monitors are plugged into the same card.
EDIT: the two monitors are hooked up with DP -> DP on the main monitor and DVI -> HDMI on the second monitor (monitor -> PC).
EDIT2: switched the second monitor to DVI -> DVI, problem still persists.
EDIT3: put the monitors on different, non SLI GPU's, problem still persists

A: By sleep, do you mean the hard drive goes to sleep, or the monitors go to sleep?
Couple things I would check. I would turn the secondary monitor off by the power button and see if the same thing happens. If the issue doesn't persist. That would mean that Windows 10 has a setting where it turns off all the monitors to conserve power (keep in mind windows 10 was also designed for tablets as well).
You could also change the power settings from power saver to balanced or create your own power settings. (Bear in mind this may or may not work depending on if your IT allows you access to these settings).


text:
Q: Duplicate Perl installation on CENTOs 64 bit I insatlled perl on my machine and on giving follows command
 perl -e 'print("@INC\n");'

I get this output
/usr/local/lib/perl5/site_perl/5.18.1/x86_64-linux /usr/local/lib/perl5/site_perl/5.18.1
/usr/local/lib/perl5/5.18.1/x86_64-linux /usr/local/lib/perl5/5.18.1 .

But the MACHINE that is working properly gives follows output for the
  same command

/usr/local/lib64/perl5 /usr/local/share/perl5/usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl/usr/lib64/perl5 /usr/share/perl5 .

YOU CAN SEE THE DIFF INT PATH for lib & lib64
How can i correct the above ??
please help

A: Perl comes pre-installed on every Linux machine - maybe the machine that is working properly uses the stock perl. You can identify the location of the perl executable issuing which perl in the command line.
Also, you can check the perl version by running perl -v - if the perl on the machine that is working is older, it might be the OS perl.
Regarding the ways to manipulate the lib path, have a look at the tutorial that Gabor Szabo wrote regarding How to change @INC to find Perl modules in non-standard locations


text:
Q: .click() execute does not work in mozilla firefox I have this simple piece of code that for some reason works on all browsers except for Mozilla.
This is my HTML:

Here is my code:
$(document).ready(function(){
    $("#menu_button").click(function(event){
    show();
    });
    $("#exit").click(function(event){
    hide();
    });
});

function show(element){
      event.preventDefault();
    $('#background_mobile_portrait').addClass('blur');
    $('#background_mobile_landscape').addClass('blur');
    $('.links').css('opacity', '1');
    $('#menu_button').css('opacity', '0');
    $('#exit').css('opacity', '1').css('z-index', '999');

}

function hide(){
      event.preventDefault();
         $('#background_mobile_portrait').removeClass('blur');
         $('#background_mobile_landscape').removeClass('blur');
         $('.links').css('opacity', '0');
         $('#exit').css('opacity', '0').css('z-index', '-1');
         $('#menu_button').css('opacity', '1');
      }

When clicking on the image in Firefox, nothing happens. All other browsers works like a charm.
I have been following this post that refer to problems with  onclick execution:
Div onclick event not called in Mozilla
I have applied the changes suggested but with no success.
Any ideas?
Thanks,
Matan

A: Your issue is that you're not passing on the event object to the function.
It works in IE and chrome because they define a window.event. Firefox does not.
$(document).ready(function(){
    $("#menu_button").click(function(event){
        show(event);
    });
    $("#exit").click(function(event){
        hide(event);
    });
});

and then define the first parameter to each function to receive the event object.
function show(event) {
    // ...
}

function hide(event) {
    // ...
}

And FYI, you could do this instead:
$(document).ready(function(){
    $("#menu_button").click(show);
    $("#exit").click(hide);
});

Now this will be your element, and the first parameter will receive event.

A: Probably won't solve it, but in any case the image tag should be closed with a /> (or just.  >) see How to close  tag properly?


text:
Q: setTimeout and synchronization Having the code:
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript" src="script2.js"></script>

script.js:
setTimeout(function(){
    console.log("first");
}, 15);

script2.js:
setTimeout(function(){
    console.log("second");
}, 10);

while running it I got different results. One time the output is:
second
first

but another time:
first
second

Shouldn't it be always in the "second, first" order due to given time delay?

A: You have a simple race condition.
The spec guarantees that the script files run in order.  That means that the browser is free to attempt to download the files at the same time, but even if script2.js loads before script.js, script.js will run first.
However, if script.js loads quickly and is executed while script2.js is still downloading from the server, there is a chance that at least 5ms will pass before script2.js is executed.  If that happens, the timeout in script.js will be executed first, and the output will be first, second.

A: I have three way to solve your question.

*

*Call first function in second function.
function first(){
    second();
    setTimeout(function(){
        console.log("first");
    }, 10);
}

function second(){
    setTimeout(function(){
        console.log("second");
    }, 10);
}

*Just give a more interval to First function.
function first(){
    setTimeout(function(){
        console.log("first");
    }, 11);
}

function second(){
    setTimeout(function(){
        console.log("second");
    }, 10);
}

*Use Flag.
var flag = false; //global variable

function first(){
    setTimeout(function(){
        if(flag){
            console.log("first");
        }else{
            first();
        }
    }, 10);
}

function second(){
    flag = true;
    setTimeout(function(){
        console.log("second");
    }, 10);
}


text:
Q: postgresql configuration gives a blank page in Codeigniter (fail connection) I just created my PHP Application using CodeIgniter framework and PostgreSQL for the database, it run well on localhost. Then I moved the application into the server (xxx.xxx.1.77), but it gave a blank page when I try to run.
I removed all libraries and packages in autoload.php it run well. So I put it one by one and run it after I put each libraries/packages. Finally, I found the problem : Database.
This one will show welcome page (default), but when I call one of my controller that connect to a model, it will show a blank page.
$autoload['libraries'] = array('session', 'form_validation');

This one will show a blank page at the first (welcome/default page won't show).
$autoload['libraries'] = array('session', 'form_validation', 'database');

So, this is my database configuration:
$db['default']['hostname'] = '192.168.1.4';
$db['default']['port'] = '8432';
$db['default']['username'] = 'postgres';
$db['default']['password'] = '';
$db['default']['database'] = 'gstseminar';
$db['default']['dbdriver'] = 'postgre';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

That configuration has no problem when I try to run my application on localhost.
Anyone knows about my problem? Any answer is appreciated.

A: I don't know how and why my project run well when I try to run it today. I looked at the config/database.php, and I found the configuration such as:
$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = '192.168.1.4';
$db['default']['port'] = '8432';
$db['default']['username'] = 'postgres';
$db['default']['password'] = '';
$db['default']['database'] = 'gstseminar';
$db['default']['dbdriver'] = 'postgre';
$db['default']['dbprefix'] = 'tb_';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

and on my config/autoload.php are:
$autoload['libraries'] = array('session', 'form_validation', 'database');

It runs well now. Thank you.

A: i think the port you use was wrong
try this :
$db['default']['port'] = '5432';

i think its the default port for postgre


text:
Q: Undefined reference to err_exit ,berr_exit..etc in openssl socket programming in ubuntu This is my first openssl socket program
refer this link
First I compile with  gcc -g server.c -o server
but gets  this error

/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/../../../crt1.o: In function _start':
  (.text+0x18): undefined reference tomain'
  /tmp/ccxiY18C.o: In function tcp_listen':
  /home/usr/Desktop/c-examples/server.c:11: undefined reference toerr_exit'
  /home/usr/Desktop/c-examples/server.c:20: undefined reference to berr_exit'
  /tmp/ccxiY18C.o: In functionload_dh_params':
  /home/usr/Desktop/c-examples/server.c:33: undefined reference to BIO_new_file'
  /home/usr/Desktop/c-examples/server.c:34: undefined reference toberr_exit'
  /home/usr/Desktop/c-examples/server.c:36: undefined reference to PEM_read_bio_DHparams'
  /home/usr/Desktop/c-examples/server.c:37: undefined reference toBIO_free'
  /home/usr/Desktop/c-examples/server.c:38: undefined reference to SSL_CTX_ctrl'
  /home/usr/Desktop/c-examples/server.c:39: undefined reference toberr_exit'
  /tmp/ccxiY18C.o: In function generate_eph_rsa_key':
  /home/usr/Desktop/c-examples/server.c:47: undefined reference toRSA_generate_key'
  /home/usr/Desktop/c-examples/server.c:49: undefined reference to SSL_CTX_ctrl'
  /home/usr/Desktop/c-examples/server.c:50: undefined reference toberr_exit'
  /home/usr/Desktop/c-examples/server.c:52: undefined reference to `RSA_free'

then  i compile it with  gcc -g server.c -o server -lssl -lcrypt
It gives

/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/../../../crt1.o: In function _start':
  (.text+0x18): undefined reference tomain'
  /tmp/ccPlisKL.o: In function tcp_listen':
  /home/usr/Desktop/c-examples/server.c:11: undefined reference toerr_exit'
  /home/usr/Desktop/c-examples/server.c:20: undefined reference to berr_exit'
  /tmp/ccPlisKL.o: In functionload_dh_params':
  /home/usr/Desktop/c-examples/server.c:34: undefined reference to berr_exit'
  /home/usr/Desktop/c-examples/server.c:39: undefined reference toberr_exit'
  /tmp/ccPlisKL.o: In function generate_eph_rsa_key':
  /home/usr/Desktop/c-examples/server.c:50: undefined reference toberr_exit'
  collect2: ld returned 1 exit status

How can i overcome this problem .. please give me a solution..

A: It's -lcrypto, not -lcrypt. Just add the o


text:
Q: How to update a program (exe) from internet using win32 I've written a Win32 program that at regular intervals retrieves content from a dedicated server on the internet.
Sometimes the Win32 program itself needs to be updated. What I do is exit the said program and run a download-program which replaces the main exe I need to uopdate. This works for users running in Administrator mode but not other mode that has sufficent rights for most tasks. The program runs on it own directory which is not under "c:\Windows\program files\".
I've set a manifest file to no avail.
Is there a workable workaround solution for this (any)?

A: For security reasons you cannot place files in Program Files without admin rights. If you would be able to this you could in theory change Windows files and place malware as well.
Same goes for Linux and OSX systems.
However you could prompt the user for an Administrator password and gain the admin rights in that way.

A: You need your updater program to have admin rights. You achieve that by adding the requireAdministrator option in the requestedExecutionLevel section of the application manifest. You said that you have tried this to no avail. Well, you must have got something wrong because this is the solution. You just need to persevere until you get the manifest correct.
I presume that when you say that the [program is not under the Program Files directory you refer to the updater. If the program being updated is not under the Program Files directory then there would seem to be no obvious reason that the updater needs admin rights. If that is so then you need to investigate further.


text:
Q: Is the weak limit of a sequence of translation-invariant measures itself translation-invariant?

Let $(X,\mathcal{B})$ be a measure space and $(\mu_n)_{n\in\mathbb{N}}$ be a sequence of translation-invariant measures on it that converges weakly to the measure $\nu$ on $(X,\mathcal{B})$. Is then $\nu$ translation-invariant, too?

Weak limit means that for all $f\in C_b(X)$ it is
$$
\lim_n\int_Xf\, d\mu_n=\int_Xf\, d\nu
$$
and translation-invariance for each $\mu_n,n\in\mathbb{N}$, means that
$$
\mu_n(T^{-1}(B))=\mu(B)
$$
for a translation $T\colon X\to X$ and $B\in\mathcal{B}$.
But I do not see exactly if then
$$
\nu(T^{-1}(B))=\nu(B).
$$

A: Consider the characteristic function $f = \chi_A$ for some $A\in\mathcal B$ and the same for $\chi_{T^{-1}A}$. Then
$$\nu(T^{-1}A) = \lim_{n\to\infty} \mu_n (T^{-1}A) = \lim_{n\to\infty} \mu_n(A) = \nu(A)$$
Because $\nu(A) = \int_X \chi_A \mathrm d\nu$ for any measure.


text:
Q: RegEx for MetaMap in Java MetaMap files have following lines:
mappings([map(-1000,[ev(-1000,'C0018017','Objective','Goals',[objective],[inpr],[[[1,1],[1,1],0]],yes,no)])]).

The format is explained as
mappings(
      [map(negated overall score for this mapping,
            [ev(negated candidate score,'UMLS concept ID','UMLS concept','preferred name for concept - may or may not be different',
                 [matched word or words lowercased that this candidate matches in the phrase - comma separated list],
                 [semantic type(s) - comma separated list],
                 [match map list - see below],candidate involved with head of phrase - yes or no,
                 is this an overmatch - yes or no
               )
            ]
          )
      ]
    ).

I want to run a RegEx query in java that gives me the Strings 'UMLS concept ID', semantic type and match map list.
Is RegEx the right tool or what is the most efficent way to accomplish this in Java?

A: Here's my attempt for a regex solution. This replace "meta-regexing" methodology is something I'm experimenting with; I hope it reads to a more readable code.
String line = "mappings([map(-1000,[ev(-1000,'C0018017','Objective','Goals',[objective],[inpr],[[[1,1],[1,1],0]],yes,no)])]).";
String regex =
    "mappings([map(number,[ev(number,<quoted>,quoted,quoted,[csv],[<csv>],[<matchmap>],yesno,yesno)])])."
    .replaceAll("([\\.\\(\\)\\[\\]])", "\\\\$1") // escape metacharacters
    .replace("<", "(").replace(">", ")") // set up capture groups
    .replace("number", "-?\\d+")
    .replace("quoted", "'[^']*'")
    .replace("yesno", "(?:yes|no)")
    .replace("csv", "[^\\]]*")
    .replace("matchmap", ".*?")
;
System.out.println(regex);
// prints "mappings\(\[map\(-?\d+,\[ev\(-?\d+,('[^']*'),'[^']*','[^']*',\[[^\]]*\],\[([^\]]*)\],\[(.*?)\],(?:yes|no),(?:yes|no)\)\]\)\]\)\."

Matcher m = Pattern.compile(regex).matcher(line);
if (m.find()) {
    System.out.println(m.group(1)); // prints "'C0018017'"
    System.out.println(m.group(2)); // prints "inpr"
    System.out.println(m.group(3)); // prints "[[1,1],[1,1],0]"
}

This replace meta-regexing allows you to accomodate whitespaces between symbols easily by just setting the appropriate replace (instead of sprinkling it all into one unreadable mess).

A: That's a truly hairy format.  Regex sounds like the way to go, but you're going to have a truly hairy regex:
mappings\(\[map\(-?[0-9.]+,\[ev\(-?[0-9.]+,'(.*?)','.*?','.*?',\[.*?\],\[(.*?)\],\[(.*)\],(?:yes|no),(?:yes|no)\)\]\)\]\)\.

It gets worse when you have to express the regex as a Java String -- as always, you'll replace every \ with \\.  But this should get you what you want; matching groups 1, 2, and 3 are the Strings that you wanted to pull out.  Note that I haven't rigorously tested it against malformed input because I haven't the stomach for it. :)
For educational purposes: Despite its appearance, this wasn't actually hard to construct at all -- I just took your sample line and replaced the actual values with the appropriate wildcards, making sure to escape out the parens and brackets and the dot at the end.

A: It's possible, yes.
Something like (assuming that the values you've quoted are the only places quotes are legal, that the values you've added [] to are the only places those are legal, that '[' and ']' characters can't be present inside values, that the match map list can't have ]] in it apart from at the end. You get the picture -- lots of assumptions . . .)
^[^']+?'([^']*+)'[^\[]+\[[^]]+\],\[([^\]]*?)\],\[\[(.*?)\]\].*$

Which should give you those three fields as the three matched groups (tested on your example with http://www.regexplanet.com/simple/index.html)
Which is-
"^[^']+?'([^']*+)'[^\\[]+\\[[^]]+\\],\\[([^\\]]*?)\\],\\[\\[(.*?)\\]\\].*$"

as a Java string . . .
But that isn't very maintainable. Would probably be better to be a bit more verbose with this one!


text:
Q: Excel Index Match return most recent date I am trying to set up an index match function, which returns the most recent value, instead of the first one in the list. So date should be another constraint for the row number, which I am not able to set up.
Excel screenshot
In the screenshot , the date constraint is not included, but I tried the following formulas, without any luck:
=INDEX($B$3:$E$11,MATCH(1,($H4=$B$3:$B$11)\*(AGGREGATE(4,4,C3:C11),0),MATCH(I$3,$B$3:$E$3,0))

=INDEX($B$3:$E$11,MATCH(1,($H4=$B$3:$B$11)*(MAXIFS(C3:C11,H4=B3:B11),0),MATCH(I$3,$B$3:$E$3,0))

I would very much appreciate if someone can help me here.
Thanks in advance!

A: Try
=INDEX(D$4:D$11,MATCH(AGGREGATE(14,4,($B$4:$B$11=$H4)*$C$4:$C$11,1),$C$4:$C$11,0))

in I4 and copy across and down
(you may have to enter it as an array formula)


text:
Q: Self-organizing map: How to identify clusters from plots? I've been learning about neural networks and most recently been trying out different clustering methods. But unlike KNN, GMM, or DBSCAN, there isn't a feature (in Matlab that I'm aware of) that identifies clusters for you. So I've been reading articles of how to interpret these plots, but I'm still confused. For my example, in the weight positions plot, I see one cluster. For the neighbor weight differences, I see one, maybe two clusters (yellow/bright - similar, red/dark - dissimilar). That seems to be confirmed when looking at the densities in the hits plot. There might be more, but I honestly I can't tell (I'm new at this) because of the gradient instead of a solid boundary between clusters. How many clusters do you see, and what's your logic? Thank you]1[]2[]3
selforgmap([5 5]
[net,tr] = train(net,x)
figure, plotsomnd(net)
figure, plotsomhits(net,x)
figure, plotsompos(net,x)

A: You may construct a new paradigm in relation with what the SOM nodes represent, i.e. they produce a new dataset. The new dataset is independent from the original dateset. Nevertheles, it is arranged somehow so that the underlying structure imitates that of the original dataset. Therefore, it is often found that people perform SOM with clustering algorithms such as K-means, Hierarchical Clustering, etc subsequently. This can be regarded as: instead of clustering directly from a huge amount of the original data, the clustering procedure is performed on a new version of the original dataset which is smaller but still inherits the topology of the original dataset. AFAIK, SOM is different from KNN in the sense that SOM is unsupervised whereas KNN is supervised.


text:
Q: R Programming v R Analysis I sometimes see job descriptions where R is posted as analytical tool while   others mention R as programming language.
What is the difference between programming in R and performing analysis in R?
UPDATE as of 10/17/2020:
lately, new elements popping in job descriptions made me realize that my old question was too vague. Now I see jobs where "programming languages (e.g.Python) are required as well as statistical packages (e.g. R)".
In many cases, the job actually requires scripts in either language.
So it may be that the difference between scripting and programming eludes some of the job posters.
I have read somewhere a while ago that - regardless of language - scripting associates with specificity while programming with generality.
In data analysis the distinction can be clear: scripting requires access to specific example of dataset structure and specified outcome while programming is more relaxed in this respect; a program is supposed to cover a wide variety of structures, eventually using the experience gathered through scripted analyses. The options for outcome follow logically.

A: "analysis" (in the context of R users) typically means "statistical analysis" whereas "programming" (esp. for more general-purpose languages) could mean web, frontend, backend, database, visualization, networking, security etc.
You can get away with this assumption in R only because it and its programming audience are oriented to statistics and on average have a very high level of education both in general and statistical literacy in particular... but you can't get away with this (since the generalization is not true of) with most other languages: e.g. PHP, JavaScript, SQL, VBA, C#... even MATLAB/Octave users will tend to be knowledgeable about linear algebra and probably vector calculus, but not necessarily of statistics (beyond basics like "what is standard deviation? normal distribution?").

A: R is both, its a statistical tool but there is no drop and click interface you have to use the R programming language to perform the analysis you want to do. I would assume performing analysis in R and R programming are synonymous unless the context states otherwise: for example, if someone wants a R package built they are looking for someone who can program in R rather than an analyst per se.

A: There really is not much of a difference. Or it is a difference that does not matter much.
One could say that programming is writing a set of steps to do some process, while analysis is actually doing the process. So strictly, you could say you are programming R when you design a function or procedure that can be used on many data sets, while analysis would be using such functions on a given data set.
That said, the boundary is not hard and trying to make it hard is generally not useful. I suspect that most people saying stuff like this are really trying to draw a distinction between using a language to analyze data (like in R) or using a graphical user interface that just lists all of the options for any analysis. For better and for worse, both of these are ways of analyzing data, although only the former (coding) is really useful for building new procedures for general use.


text:
Q: Google map Panorama Street View Zoom in & Zoom out buton no Events available I want to set the pitch pov of streetview panorama when a user presses the zoom in or zoom out buttonns embeeded in streetview panorama but there are no events firing for that while there is when I scroll the mouse middle wheel (scroll).
In the official documentation of Google:
https://developers.google.com/maps/documentation/javascript/examples/streetview-events
there is no way to update the pitch pov using these buttons.
Is there any workaround in order to achieve that?

A: The zoom_changed event works for me:
panorama.addListener('zoom_changed', function() {
  console.log(panorama.getZoom());
});

proof of concept fiddle
code snippet:

function initPano() {
  var panorama = new google.maps.StreetViewPanorama(
    document.getElementById('pano'), {
      position: {
        lat: 37.869,
        lng: -122.255
      },
      pov: {
        heading: 270,
        pitch: 0
      },
      visible: true
    });

  panorama.addListener('pano_changed', function() {
    var panoCell = document.getElementById('pano-cell');
    panoCell.innerHTML = panorama.getPano();
  });

  panorama.addListener('zoom_changed', function() {
    var zoomCell = document.getElementById('zoom-cell');
    zoomCell.innerHTML = panorama.getZoom();
    console.log(panorama.getZoom());
  });

  panorama.addListener('links_changed', function() {
    var linksTable = document.getElementById('links_table');
    while (linksTable.hasChildNodes()) {
      linksTable.removeChild(linksTable.lastChild);
    }
    var links = panorama.getLinks();
    for (var i in links) {
      var row = document.createElement('tr');
      linksTable.appendChild(row);
      var labelCell = document.createElement('td');
      labelCell.innerHTML = 'Link: ' + i + '';
      var valueCell = document.createElement('td');
      valueCell.innerHTML = links[i].description;
      linksTable.appendChild(labelCell);
      linksTable.appendChild(valueCell);
    }
  });

  panorama.addListener('position_changed', function() {
    var positionCell = document.getElementById('position-cell');
    positionCell.firstChild.nodeValue = panorama.getPosition() + '';
  });

  panorama.addListener('pov_changed', function() {
    var headingCell = document.getElementById('heading-cell');
    var pitchCell = document.getElementById('pitch-cell');
    headingCell.firstChild.nodeValue = panorama.getPov().heading + '';
    pitchCell.firstChild.nodeValue = panorama.getPov().pitch + '';
  });
}
#map {
  height: 100%;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

#floating-panel {
  position: absolute;
  top: 10px;
  left: 25%;
  z-index: 5;
  background-color: #fff;
  padding: 5px;
  border: 1px solid #999;
  text-align: center;
  font-family: 'Roboto', 'sans-serif';
  line-height: 30px;
  padding-left: 10px;
}

#pano {
  width: 50%;
  height: 100%;
  float: left;
}

#floating-panel {
  width: 45%;
  height: 100%;
  float: right;
  text-align: left;
  overflow: auto;
  position: static;
  border: 0px solid #999;
}

      Position

      Zoom

      POV Heading
      270

      POV Pitch
      0.0

      Pano ID


text:
Q: Posting value through form hidden field in PHP I have the following code:
<?php
$student_no = $_GET['student_no'];
echo '<form  name="student" action="PROCESS_FEE007.php" method="POST">';
echo '

';
echo '**<input name="student_no" type="hidden" value="$student_no"  />**';
echo 'Amount: 	'.'<input name="amount" type="text" />
';
echo '
 Remarks: 	'.'<input name="remarks" type="text"  /> 	';
echo '
 ';
echo ''.'<input type="submit" value="Save"/>
';
echo '
';
echo '</form>';
?>

On the next page PROCESS_FEE007.PHP the value is not received.

A: Variables are not parsed by interpreter inside single quotes. You should use double quotes or explicit string concatenation.
In your example the value of $_POST['student_no'] will be string '$student_no', not the value of the $student_no variable.
Besides if you're using method="POST" in your form, you can only get the inputs value through the $_POST array.
<?php
$student_no = $_POST['student_no'];
echo '<form  name="student" action="PROCESS_FEE007.php" method="POST">';
echo '

';
echo '**<input name="student_no" type="hidden" value="'.$student_no.'"  />**';
echo 'Amount: 	'.'<input name="amount" type="text" />
';
echo '
 Remarks: 	'.'<input name="remarks" type="text"  /> 	';
echo '
 ';
echo ''.'<input type="submit" value="Save"/>
';
echo '
';
echo '</form>';
?>

A: parse student_no in form as
<?php
$student_no = $_GET['student_no'];

echo '<form  name="student" action="PROCESS_FEE007.php" method="POST">';
echo '

';
echo '**<input name="student_no" type="hidden" value="'.$student_no.'"  />**';
echo 'Amount: 	'.'<input name="amount" type="text" />
';
echo '
 Remarks: 	'.'<input name="remarks" type="text"  /> 	';
echo '
 ';
echo ''.'<input type="submit" name="submit_save" value="Save"/>
';
echo '
';
echo '</form>';
?>

and on the PROCESS_FEE007.php page use
<?php
 if ($_POST['submit_save']){
    var_dump($_POST);die();
}

?>

A: check the attribute "VALUE" of hidden input field. The value is not put in the field.
First make the input field a text box and after fixing the bug make it a hidden field.
 may be useful. (I forgot cuz I am out of PHP long time).

A: try using $_REQUEST instead of get example $student_no = $_REQUEST['student_no'];


text:
Q: MongoDB Aggregation join array of strings to single string We're trying to 'join' an array of strings to a single string within an aggregation.
Given is the following dataset:
Collection 1:
{
  id: 1234,
  field: 'test'
}

Collection 2:
{
  id: 1111,
  collection1_id: 1234,
  name: 'Max'
},
{
  id: 1112,
  collection1_id: 1234,
  name: 'Andy'
}

The current result (after lookup etc.):
{
  id: 1234,
  field: 'test',
  collection2: ['Max', 'Andy']
}

The desired result:
{
  id: 1234,
  field: 'test',
  collection2: 'Max, Andy'
}

Is it somehow possible to join the 'collection2' to a single string? We've tried with $concat but it only accepts strings.

A: You were on the right track.
Just add $reduce over $concat in your $project stage.
'collection2': {
    '$reduce': {
        'input': '$collection2',
        'initialValue': '',
        'in': {
            '$concat': [
                '$$value',
                {'$cond': [{'$eq': ['$$value', '']}, '', ', ']},
                '$$this']
        }
    }
}

Note: We use $cond to prevent a leading , in the concatenation.
You could also use $substrCP before $reduce as an alternative to $cond.

A: To flatten this array, you need to shift process to client.
mongo will provide some new flattening options in new edition, but afaik it will be arithmetic ones (avg, min, max....).

A: Starting Mongo 4.4, the $group stage has a new aggregation operator $accumulator allowing custom accumulations of documents as they get grouped:
// { "collectionId" : 1234, "name" : "Max"  }
// { "collectionId" : 876,  "name" : "Rob"  }
// { "collectionId" : 1234, "name" : "Andy" }
db.collection.aggregate([
  { $group: {
    _id: "$collectionId",
    names: {
      $accumulator: {
        accumulateArgs: ["$name"],
        init: function() { return [] },
        accumulate: function(names, name) { return names.concat(name) },
        merge: function(names1, names2) { return names1.concat(names2) },
        finalize: function(names) { return names.join(",") },
        lang: "js"
      }
    }
  }}
])
// { "_id" : 876,  "names" : "Rob"      }
// { "_id" : 1234, "names" : "Max,Andy" }

The accumulator:

*

*accumulates on the field name (accumulateArgs)

*is initialised to an empty array (init)

*accumulates by concatenating new names to already seen names (accumulate and merge)

*and finally joins all names as a string (finalize)

A: Sometimes it's easiest to use JavaScript:
db.getCollection('Collection1').aggregate([
{
   $lookup:
     {
       from: 'Collection2',
       localField: 'id',
       foreignField: 'collection1_id',
       as: 'col2'
     }
}]).map((e) => ({
  id: e.id,
  field: e.field,
 collection2: Array.isArray(e.col2) &&
   e.col2.reduce((arr, el) => {
     arr.push(el.name);
    return arr;
  }, []).join(', ')
}))


text:
Q: React-Native Navigator: Can't add a component using Navigator I am trying to build a small app with a few different screens using Navigator. The problem I am running into is importing different components in my view.  Here is my index.android.js
           index.ANDROID.JS
 import React, { Component } from 'react';
 import {
   AppRegistry,
   StyleSheet,
   Text,
   View,
   Navigator,
   TouchableHighlight
 } from 'react-native';

 import Menu from './src/menu';
 import Home from './src/addWord';
 var JapaneseProjectShare2 = React.createClass({

   renderScene(route, navigator) {
    console.log(route);
     if(route.name == 'menu') {
       return <Menu navigator={navigator} {...route.passProps}  />
     }
     if(route.name == 'Home') {
       return <Home navigator={navigator} {...route.passProps}  />
     }
     if(route.name == 'AddWords') {
      console.log('display add words');
       return <Home navigator={navigator} {...route.passProps}  />
     }
   },
   render() {
       return (
         <Navigator

           initialRoute={{ name: 'menu' }}
           renderScene={ this.renderScene } />
       )
     }
   });

var styles = StyleSheet.create({
  container: {
    flex: 1,
    marginTop: 80
  },
   heading: {
    fontSize:22,
    marginBottom:10
  },
  button: {
    height:60,
    justifyContent: 'center',
    backgroundColor: '#efefef',
    alignItems: 'center',
    justifyContent: 'center'
  },
  buttonText: {
    fontSize:20
  }
});

AppRegistry.registerComponent('JapaneseProjectShare2', () => JapaneseProjectShare2);

This next class is my Menu class. My menu class has a list of options that a user can click. For example a user clicks on Addwords option and he should be navigated to that page. It throws an error here: Minified React error #130.
import React, { Component} from 'react';
import { Container, Header,TouchableHighlight, Title,StyleSheet, Content,Icon,Card,CardItem, InputGroup, Input,Text,View} from 'native-base';

var Menu  = React.createClass({

    getInitialState(){
        return({
            menu:['AddWords','View List','DeleteWords','EditWords','Dictionary']
        })
    },
    _navigate(name) {
        this.props.navigator.push({
        name: name,
         passProps: {
            name: name
         }
       })
     },
    displayMenu(menu){
            let intro = 'Please select an option';
            return(
                menu.map((menu,index)=>{
                    return(
                     <Container style={{backgroundColor:'#565051'}}>
                                <Content>
                                    <Card>
                                      <CardItem button onPress={ () => this.navigateToMenu(this.state.menu[index])}>
                                            <Icon name='ios-list'/>
                                           <Text style={{textAlign:'center'}}>{menu}</Text>
                                      </CardItem>

                                 </Card>
                               </Content>
                    </Container>

                    )

                })
            )

        },
        navigateToMenu(index){
            this._navigate(index)

        },
    render(){
        return(
        <Container style={{backgroundColor:'#565051'}}>
            <Header>
                 <Title>Menu</Title>
            </Header>
            <Content>
                {this.displayMenu(this.state.menu)}
            </Content>
        </Container>
        // <View>
        // {this.displayMenu(this.state.menu)}
        // </View>

        )
    }

    })

module.exports = Menu;

My goal is to have the user click on the menu class and be brought to the correct screen. For example, the user would click on AddWord which then he would be navigated to that screen. I am able to successfully do this if I keep everything in the same file. If I put AddWord class inside of index.android.js then it works as I would suspect. The problem is that when I try to separate the files I get the error message. Can anyone point out any mistakes I am making in my first attempt at this. Thanks.
   **AddWord.js**

import React, { Component} from 'react';
import { Container, Header,TouchableHighlight, Title,StyleSheet, Content,Icon,Card,CardItem, InputGroup, Input,Text,View} from 'native-base';

var addWords = React.createClass({
         render(){
           return(){
             <View>
           <Text>Testing</Text>
             <View>
           }
        }

            })

module.exports = addWords;

A: You can do this using the react-native router flux library.
https://github.com/aksonov/react-native-router-flux
To use this create your component scenes in the landing page like index.ios/android.js create scenes like
 <Router>
    <Scene key="landing_page" component={LandingPage} initial={true}> </Scene>
   <Scene key='firstPage' component={FirstPage} ></Scene>
   <Scene key='secondPage' component={SecondPage} ></Scene>
 </Router>

In your menu.js file create a touchable component as
 <TouchableHighligh onPress={()=>{Actions.first()}}>
   <View>
     <Text>Click here to go to first page
     </Text>
   </View>
 </TouchableHighlight>

Similarly you can go to the second page.
Its very easy to use. Good Luck


text:
Q: On invertibility of $A+E$ where $||E||_2<$ smallest singular value of $A$ and $||A^{-1}E||_2<1$ Let $A,E \in M_n(\mathbb C)$ . Suppose $\sigma_\min >0$ be the smallest singular value of $A$ and $||E||_2 < \sigma_\min$. Suppose $||A^{-1}E||_2 <1$. Then how to show that $A+E$ is invertible ?
My work : Going by contradiction; assume ,if possible, $\det (A+E)=0$, then $\det (I+A^{-1}E)=0$. So $-1$ is an eigenvalue of $A^{-1}E$, so $1=|-1|\le ||I+A^{-1}E||_2$, so $||A^{-1}E||_2 <1 \le ||I+A^{-1}E||_2$ ; but I am unable to proceed further.
Please help.
NOTE: Here $||M||_2:=\sup_{||x||_2=1}||Mx||_2=\sigma_\max$

A: Suppose that $(A+E)(x)=0$, $x\neq 0$, this implies that $A(x)=-E(x)$ and $x=-A^{-1}E(x)$, we deduce that $\|x\|=\|A^{-1}E(x)\|\leq \|A^{-1}E\|\|x\|<\|x\|$. Contradiction. This implies that $Ker(A+E)=\{0\}$ and $A+E$ is invertible.


text:
Q: Unable to create windows nodepool on GKE cluster with google terraform GKE module I am trying to provision a GKE cluster with windows node_pool using google modules, I am calling module
  source  = "terraform-google-modules/kubernetes-engine/google//modules/beta-private-cluster-update-variant"
  version = "9.2.0"

I had to define two pools one for linux pool required by GKE and the windows one we require, terraform always succeeds in provisioning the linux node_pool but fails to provision the windows one and the error message
module.gke.google_container_cluster.primary: Still modifying... [id=projects/uk-xxx-xx-xxx-b821/locations/europe-west2/clusters/gke-nonpci-dev, 24m31s elapsed]
module.gke.google_container_cluster.primary: Still modifying... [id=projects/uk-xxx-xx-xxx-b821/locations/europe-west2/clusters/gke-nonpci-dev, 24m41s elapsed]
module.gke.google_container_cluster.primary: Still modifying... [id=projects/uk-xxx-xx-xxx-b821/locations/europe-west2/clusters/gke-nonpci-dev, 24m51s elapsed]
module.gke.google_container_cluster.primary: Modifications complete after 24m58s [id=projects/xx-xxx-xx-xxx-b821/locations/europe-west2/clusters/gke-nonpci-dev]
module.gke.google_container_node_pool.pools["windows-node-pool"]: Creating...

Error: error creating NodePool: googleapi: Error 400: Workload Identity is not supported on Windows nodes. Create the nodepool without workload identity by specifying --workload-metadata=GCE_METADATA., badRequest

  on .terraform\modules\gke\terraform-google-kubernetes-engine-9.2.0\modules\beta-private-cluster-update-variant\cluster.tf line 341, in resource "google_container_node_pool" "pools":
 341: resource "google_container_node_pool" "pools" {

I tried many places to set this metadata values but I coldn't get it right:
From terraform side :
I tried many places to add this metadata inside the node_config scope in the module itself or in my main.tf file where I call the module I tried to add it to the windows node_pool scope of the node_pools list but it didn't accept it with a message that setting WORKLOAD IDENTITY isn't expected here
I tried also setting enable_shielded_nodes = false but this didn't really help much.
I tried to test this if it is doable even through the command line this was my command line
C:\>gcloud container node-pools --region europe-west2 list
NAME                    MACHINE_TYPE   DISK_SIZE_GB  NODE_VERSION
default-node-pool-d916  n1-standard-2  100           1.17.9-gke.600

C:\>gcloud container node-pools --region europe-west2 create window-node-pool --cluster=gke-nonpci-dev --image-type=WINDOWS_SAC --no-enable-autoupgrade --machine-type=n1-standard-2
WARNING: Starting in 1.12, new node pools will be created with their legacy Compute Engine instance metadata APIs disabled by default. To create a node pool with legacy instance metadata endpoints disabled, run `node-pools create` with the flag `--metadata disable-legacy-endpoints=true`.
This will disable the autorepair feature for nodes. Please see https://cloud.google.com/kubernetes-engine/docs/node-auto-repair for more information on node autorepairs.
ERROR: (gcloud.container.node-pools.create) ResponseError: code=400, message=Workload Identity is not supported on Windows nodes. Create the nodepool without workload identity by specifying --workload-metadata=GCE_METADATA.

C:\>gcloud container node-pools --region europe-west2 create window-node-pool --cluster=gke-nonpci-dev --image-type=WINDOWS_SAC --no-enable-autoupgrade --machine-type=n1-standard-2 --workload-metadata=GCE_METADATA --metadata disable-legacy-endpoints=true
This will disable the autorepair feature for nodes. Please see https://cloud.google.com/kubernetes-engine/docs/node-auto-repair for more information on node autorepairs.
ERROR: (gcloud.container.node-pools.create) ResponseError: code=400, message=Service account "874988475980-compute@developer.gserviceaccount.com" does not exist.

C:\>gcloud auth list
                       Credentialed Accounts
ACTIVE  ACCOUNT
*       tf-xxx-xxx-xx-xxx@xx-xxx-xx-xxx-xxxx.iam.gserviceaccount.com

This service account from running  gcloud auth list is the one I am running terraform with but I don't know where is this one in the error message coming from, even though trying to create the windows nodepool through command line as shown above also didn't work I am a bit stuck and I don't know what to do.
As module 9.2.0 is a stable module for us through all our linux based clusters we setup before, hence I thought this may be an old version for a windows node_pool I used the 11.0.0 instead to see if this would make it any different but ended up with a different error
module.gke.google_container_node_pool.pools["default-node-pool"]: Refreshing state... [id=projects/uk-tix-p1-npe-b821/locations/europe-west2/clusters/gke-nonpci-dev/nodePools/default-node-pool-d916]

Error: failed to execute ".terraform/modules/gke.gcloud_delete_default_kube_dns_configmap/terraform-google-gcloud-1.4.1/scripts/check_env.sh": fork/exec .terraform/modules/gke.gcloud_delete_default_kube_dns_configmap/terraform-google-gcloud-1.4.1/scripts/check_env.sh: %1 is not a valid Win32 application.

  on .terraform\modules\gke.gcloud_delete_default_kube_dns_configmap\terraform-google-gcloud-1.4.1\main.tf line 70, in data "external" "env_override":
  70: data "external" "env_override" {

Error: failed to execute ".terraform/modules/gke.gcloud_wait_for_cluster/terraform-google-gcloud-1.3.0/scripts/check_env.sh": fork/exec .terraform/modules/gke.gcloud_wait_for_cluster/terraform-google-gcloud-1.3.0/scripts/check_env.sh: %1 is not a valid Win32 application.

  on .terraform\modules\gke.gcloud_wait_for_cluster\terraform-google-gcloud-1.3.0\main.tf line 70, in data "external" "env_override":
  70: data "external" "env_override" {

This how I set node_pools parameters

  node_pools = [
    {
      name               = "linux-node-pool"
      machine_type       = var.nodepool_instance_type
      min_count          = 1
      max_count          = 10
      disk_size_gb       = 100
      disk_type          = "pd-standard"
      image_type         = "COS"
      auto_repair        = true
      auto_upgrade       = true
      service_account    = google_service_account.gke_cluster_sa.email
      preemptible        = var.preemptible
      initial_node_count = 1
    },
    {
      name               = "windows-node-pool"
      machine_type       = var.nodepool_instance_type
      min_count          = 1
      max_count          = 10
      disk_size_gb       = 100
      disk_type          = "pd-standard"
      image_type         = var.nodepool_image_type
      auto_repair        = true
      auto_upgrade       = true
      service_account    = google_service_account.gke_cluster_sa.email
      preemptible        = var.preemptible
      initial_node_count = 1

    }
  ]

  cluster_resource_labels = var.cluster_resource_labels

  # health check and webhook firewall rules
  node_pools_tags = {
    all = [
      "xx-xxx-xxx-local-xxx",
    ]
  }

  node_pools_metadata = {
    all = {
//      workload-metadata = "GCE_METADATA"
    }

    linux-node-pool = {
      ssh-keys = join("\n", [for user, key in var.node_ssh_keys : "${user}:${key}"])
      block-project-ssh-keys = true
    }

    windows-node-pool = {
      workload-metadata = "GCE_METADATA"
    }

  }

*

*this is a shared VPC where I provision my cluster  with cluster version: 1.17.9-gke.600

A: Checkout https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/632 for the solution.
Error message is ambiguous and GKE has an internal bug to track this issue. We will improve the error message soon.


text:
Q: Validad y forzar a que se ejecute una consulta mysql Tengo un comando mysql que actualiza un campo restando su actual cantidad menos 1 numero en especifico:
$bd->query("update productos set stock = stock - 10 where id = 1");

ahora bien, ahy veces en que el sistema esta saturado o no se ejecuta esta accion por x motivos.
quisiera ver si existe alguna forma de validad que se ejecuto esta sentencia y si no es hacer volverlo a ejecutar hasta lograr que se ejecute.
Lo que yo intente es:
if($bd->query("update productos set stock = stock - 10 where id = 1")){.....
pero asi se ejecute o no igual me sale true esa condicional


text:
Q: Parse.com, underscore templates, View's model and current user I am failing to fill my user profile template using Parse.User.Current() as my model. Without further ado, here is what I have :
HTML


text:
Q: How to get ActionResult from ActionExecutingContext? I'm looking to get the action that caused OnActionExecuting() in an overridden ActionFilterAttribute. The idea is to save this in the session so the user can be redirected to their intended page after entering an interim "Change Password" page.
My current attempt is:
public override void OnActionExecuting(ActionExecutingContext actionExecutingContext)
{
    // ...
    ActionResult originatingActionResult = new RedirectToRouteResult(
        new RouteValueDictionary
        {
            { "controller", actionExecutingContext.ActionDescriptor.ControllerDescriptor.ControllerName },
            { "action", actionExecutingContext.ActionDescriptor.ActionName }
        });
    // ...

But this seems rather complex for what is being done - is there a simpler way?

A: Turned out it could be simplified as:
ActionResult originatingActionResult = new RedirectToRouteResult(
        new RouteValueDictionary(filterContext.RouteData.Values));

However...
The project uses T4MVC and RedirectToAction couldn't be used as it is overridden on the controller and expects GetT4MVCResult() to be present on the ActionResult.
So I ended up doing it like this instead:
RouteValueDictionary originatingRouteValues = new RouteValueDictionary(
    actionExecutingContext.RouteData.Values);

// ... followed by ...

return this.RedirectToRoute(routeValues);