text:
Q: How to install Tachograph (a monitoring tool of MonetDB Jul2015 release) in Ubuntu 14.04 I have installed the latest Jul2015 release, and I would like to use the
latest tools tachograph to determine the progress of query execution.
According to https://www.monetdb.org/Documentation/Manuals/MonetDB/Profiler/tachograph,
Tachograph is available as of Jul2015 release
But I do not know how to install it. My system is ubuntu 14.04.
I have tried to use sudo apt-get install monetdb-tools but failed to
locate the package monetdb-tools.
Any suggestion would be helpful. Thanks.

A: Tachograph is in monetdb-client-tools. Also, see https://dev.monetdb.org/downloads/deb/ for instructions on how to add the MonetDB repository to your system.


text:
Q: Optimization strategy for "get most recent comments from all posts" The goal of this query is to get the most recent comments that others users have made on someone's post. It should have the name of the user who commented, the title of the post they commented on, and the actual comment text.
There are three tables, MySQL myisam:
comment: id, author_fk, post_fk, text, date, ...
post: id, author_fk, content, date, ...
user: id, name, ...

This is how I'm getting the most recent comments made by people on a user's posts:
SELECT comment.text, user.name, post.title
FROM comments
JOIN user ON user.id = comment.author_fk
JOIN post ON post.id = comment.post_fk
WHERE post.author_fk = [id of the user who posted content]
ORDER BY comment.id
LIMIT 20

Here is a thread I've referenced when doing this: mysql/php: show posts and for each post all comments
The problem is that this is really slow. I'm working with a database that has over 2million posts, 15million comments, and about 500thousand users. What kind of indexing strategy should be applied? Is there a better way to write the query? Is it possible to get the query to return the results in a matter of seconds? It seems that how slow or fast this is is depending on the number of posts a user has.
Thank you very much.

A: FOLLOWUP
I noticed the comments added by OP 2 months after the question.  I'll resist reiterating the points I made in my original answer (preserved below), such as using EXPLAIN , creating appropriate covering indexes, and adding predicates to the query. Given that the OP has verified that.
An InnoDB buffer pool that is "too small" is going to cause performance issues, especially if there are concurrent queries competing for blocks in the pool, and causing disk reads. (As I noted earlier, "Using filesort" operations can be expensive (in terms of resources and time.)
Given the significant volume of rows, and the performance requirement, I'd be aiming for an query plan that accessed a single index, and avoided a "Using filesort" operation.
At this point, I'd be looking to denormalize the data model for performance, so that I could have an appropriate index.
Given that there's an equality predicate on post.author_fk, and (effectively) a descending range scan on comment.id, I'd be looking at getting these two columns into a single index.
And that means I'd be adding the value of post.author_fk as a column in the comments table.
ALTER TABLE comments ADD post_author ...

Of course, the code that does INSERT/UPDATE to the comments table will need to be modified, to maintain this column. (Getting the entire table updated would be painful, given the number of rows, I wouldn't attempt that in a one fell swoop. If I had to do that, I'd tackle that in smaller bunches.
Next, I'd add an index on that table:
CREATE INDEX comments_IX2 ON comments (post_author, id)

Then, I'd get a query that used that as a covering index, and get that LIMIT 20 applied as soon as possible. We are very cautious introducing inline views (since they can be performance killers), but in this case, given a limit of 20 rows, I'd start with a query that can quickly get just the rows from comments that are of interest, using an index scan.
   SELECT c.id
        , c.post_fk
        , c.author_fk
        , c.text
     FROM comments c
    WHERE c.post_author = [id of the user who posted content]
    ORDER BY c.post_author DESC, c.id DESC
   LIMIT 20

That query should be able to avoid a "Using filesort" operation, by making use of a descending range scan on the new index.  Ideally, we'd have a covering index, but given that we need to return the text column, maintaining a larger index would likely be more expensive. One I verified that this query performs well, I'd wrap that in parens, and include that as an inline view, in another query, like:
SELECT c.text
     , u.name
     , p.title
  FROM ( SELECT c.id
              , c.post_fk
              , c.author_fk
              , c.text
           FROM comments c
          WHERE c.post_author = [id of the user who posted content]  -- new col
          ORDER BY c.post_author DESC, c.id DESC                     -- new col
          LIMIT 20
       ) t
  JOIN user u
    ON u.id = t.author_fk
  JOIN post p
    ON p.id = t.post_fk
 ORDER BY t.id DESC

ORIGINAL ANSWER:  If the query is returning the results you want
(I suspect you mean to ORDER BY comment.id DESC, assuming that the id column is AUTO_INCREMENT, or similar ascending value where the latest comments have a "higher" id value.)
Here's how I'd go about making adjustments to the indexes and query plan.
First, and foremost, use an EXPLAIN to get the query plan MySQL is currently using.
Second, verify that statistics are up to date... use an ANALYZE TABLE on each table.
Looking at the query, it looks like we'd definitely want some indexes. We want an index with on the post table with author_fk as the leading column, since there's an equality predicate, and we'd expect some pretty good cardinality (we expect this predicate will usually eliminate a good number of rows, and return fewer than 10% of the rows.
(If this was InnoDB, and this was defined as a FOREIGN KEY constraint, then an appropriate index would already exist).  If the rows in post are fairly "large", and the "title" column is usually fairly small, then I'd be inclined to include that column in the index as well, so that we'd have a covering index.  (The EXPLAIN output will show "'Using index'" in the Extra column when the query is being satisfied from the index without referencing pages in the underlying table, and that can speed up performance significantly.)
Since the query also references the id column, that may also need to be included, although, if that's the PRIMARY KEY (cluster key), that column value may actually already be included in the index, as the "pointer" back to the row in the table.
... ON post (author_fk, title, id)

Since the predicate for the join to the comment table is on the post_fk column, we'd likely want
an index with that column leading. It may be beneficial to create a covering index for this table as well, though that may not benefit performance much, if the text column occupies the vast majority of space in the comment table.
... ON comment (post_fk)

I think the biggest performance killer in your query plan is going to be the sort operation. (The EXPLAIN output will likely show 'Using filesort' in the Extra column.)
MySQL is going to have to retreive every row from the comment table that satisfies the predicate, and then  perform a sort operation on that set of rows.
If you could add some other predicate, like you don't want comments with a date over 7 days ago, or soemthing like that, that would cut down the number of rows that need to be sorted.
That LIMIT clause gets applied nearly last in the query plan. So, even though you are asking for only 20 rows, MySQL may actually be sorting thousands and thousands of rows.
The join predicate to the user table is already on what looks to be a the primary key.
(I'm assuming the normative pattern that id column is defined as the PRIMARY KEY of each table.)

redpajama_set_name: RedPajamaStackExchange


text:
Q: Plugin link does not appear in my toolbar I haven't installed anything that would break the link, as far as I can tell it's just never been there. I have no idea what to do, please help.

A: Is the issue that you have no way to get to your plugins from the wordpress admin/dashboard  screen?
If this is the case, you may have set your user as something other than an administrator. Although, if your wordpress installation only has one account, then this likely is not the case.
In the admin area (yoursite.com/wp-admin or yoursite.com/[yourwordpressroot]/wp-admin) go to users > all users  and look at what role is next to your username. If you can't access "all users" and can only access "Your Profile" under "Users", then you definitely do not have your account set as an administrator.


text:
Q: Get-ChildItem vs. direct use of the .NET Framework's [System.IO.Directory]::GetFiles() method with UNC paths When using a UNC path (ex: \\machine\share\dir), I can get a file list when using the dir command (Get-ChildItem) from a UNC path, but if I try [System.IO.Directory]::GetFiles, I get an empty list (not an error, just no items).  I thought that PS was built on the .NET framework.  Does anyone know why Get-ChildItem would work with a UNC path while the .NET GetFiles method returns an empty list?

A: [System.IO.Directory]::GetFiles() returns only files, whereas Get-ChildItem (and its built-in alias dir) by default returns both files and directories.
Therefore, calling [System.IO.Directory]::GetFiles() on a directory that has sub-directories only (no files) yields "nothing" (an empty string array)).
Another way of putting it, loosely speaking: Get-ChildItem is the union of [System.IO.Directory]::GetFiles() (akin to Get-ChildItem -File, PSv3+) and [System.IO.Directory]::GetDirectories() (akin to Get-ChildItem -Directory, PSv3+), or, more directly, the counterpart to [System.IO.Directory]::GetFileSystemEntries().
Another option is to use the .NET 4+ (available in PSv3+) filesystem-item enumeration APIs, such as [System.IO.Directory]::EnumerateFileSystemInfos(). For an example, see this answer of mine.
There are many specific differences between Get-ChildItem and direct use of the [System.IO.Directory] type, however, notably that Get-ChildItem returns objects rather than strings and that Get-ChildItem skips hidden items by default (-Force must be used).
As is typical, choosing between using PowerShell's own cmdlets and direct use of the .NET Framework is a tradeoff between convenience and performance.
The latter will generally be faster, and in the case at hand, that is especially true with UNC paths in PowerShell versions 1 and 2 - see this blog post.
Tip of the hat to wOxxOm and Mike Sherrill 'Cat Recall' for supplemental information.


text:
Q: dump object to String with Jackson I'm using Gson to generate debug ouput in my application
Gson gson = new GsonBuilder().setPrettyPrinting().serializeNulls().create();
gson.toJson(myObject);

But Gson does complain about a circular reference error when attempting to serialize a data structure.
Can this be done with Jackson library?
UPD
Gson 2.3.1: Released Nov 20, 2014
Added support to serialize objects with self-referential fields. The self-referential field is set to null in JSON. Previous version of Gson threw a StackOverflowException on encountering any self-referential fields.
    The most visible impact of this is that Gson can now serialize Throwable (Exception and Error)

A: To serialize with Jackson:
public String serialize(Object obj, boolean pretty) {
    ObjectMapper mapper = new ObjectMapper();

    mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);

    if (pretty) {
        return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(obj);
    }

    return mapper.writeValueAsString(obj);
}

A: Jackson can deal with cycles in the object graph with:

*

*@JsonIgnore, where you omit the property entirely

*@JsonManagedReference and @JsonBackReference

*a custom Serializer which extends JsonSerializer
You would use JsonSerializer when you still wish to provide some information about the object but want to omit certain fields (the ones causing the cycle). For example:
import org.codehaus.jackson.map.JsonSerializer
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.SerializerProvider;

import java.io.IOException;

public class ParentReferenceSerializer extends JsonSerializer<Parent> {
    @Override
    public void serialize(Parent parent, JsonGenerator jgen,
        SerializerProvider provider)
            throws IOException, JsonProcessingException {
        jgen.writeStartObject();
        writeNumberField(jgen, "id", parent.getId());
        // ... other fields ...
        jgen.writeEndObject();
    }
}

Then in the class in which is being serialized, you'd use a @JsonSerialize annotation:
@JsonSerialize(using = ParentReferenceSerializer.class)
public Parent getParent() {
    return parent;
}


text:
Q: Use config file to connect in different database sql server Application in .NET I have an application running in different cities. Each city has a server with different host name (IP ADDRESS). My Application connects to a database using the connectionString configuration from the config file like the sample below:
 <add name="SAC_NG.My.MySettings.db_SACConnectionString" connectionString="Data Source=localhost;Initial Catalog=db_SAC;Persist Security Info=True;User

As the system is running in different servers, I would like to select witch database I want to connect to use the system.
So the point is, instead of DataSouce = localhost I would like to select an option in the system before start running to select witch database I want to run the system.
Thanks.

A: Add ipaddress of your server  with instance of sql server to the data source..
example: 192.168.1.251\PISDEV

Create Different connection strings for different ip..
IN the code behind try to get the country and choose the connection based on the selected country..
(If you are not clear about ip and instance just run your sql server in server machine,connect to database engine,server name will be there when you connect,just copy it and pass it to datasource)..

A: You can use connection string builder. Configure your connection string without data source, initialize builder with it and then add selected server to the DataSource property.
I suppose you will use SqlConnectionStringBuilder.

A: I suggest you do as Mr. MarkAnswer suggests first:
Set up three connection strings with appropriate names that indicate to you which city they are for.
After that is done, you can have the user select the city (from a Dropdownlist or Radiobuttonlist  for instance) and store it in a session variable, and in accordance with that variable you can select which connection string to use.
(Or even better, you can store the name of the connection string in a variable and point to that variable on each instance the connection string is needed)


text:
Q: memory consumption and lifetime of temporaries I've a python code where the memory consumption steadily grows with time. While there are several objects which can legitimately grow quite large, I'm trying to understand whether the memory footprint I'm observing is due to these objects, or is it just me littering the memory with temporaries which don't get properly disposed of --- Being a recent convert from a world of manual memory management, I guess I just don't exactly understand some very basic aspects of how the python runtime deals with temporary objects.
Consider a code with roughly this general structure (am omitting irrelevant details):
def tweak_list(lst):
    new_lst = copy.deepcopy(lst)
    if numpy.random.rand() > 0.5:
        new_lst[0] += 1  # in real code, the operation is a little more sensible :-)
        return new_lst
    else:
        return lst

lst = [1, 2, 3]
cache = {}

# main loop
for step in xrange(some_large_number):

    lst = tweak_list(lst)    # <<-----(1)

    # do something with lst here, cut out for clarity

    cache[tuple(lst)] = 42   # <<-----(2)

    if step%chunk_size == 0:
        # dump the cache dict to a DB, free the memory (?)
        cache = {}           # <<-----(3)

Questions:

*

*What is the lifetime of a new_list created in a tweak_list? Will it be destroyed on exit, or will it be garbage collected (at which point?). Will repeated calls to tweak_list generate a gazillion of small lists lingering around for a long time?

*Is there a temporary creation when converting a list to a tuple to be used as a dict key?

*Will setting a dict to an empty one release the memory?

*Or, am I approaching the issue at hand from a completely wrong perspective?

A: *

*new_lst is cleaned up when the function exists when not returned. It's reference count drops to 0, and it can be garbage collected. On current cpython implementations that happens immediately.
If it is returned, the value referenced by new_lst replaces lst; the list referred to by lst sees it's reference count drop by 1, but the value originally referred to by new_lst is still being referred to by another variable.

*The tuple() key is a value stored in the dict, so that's not a temporary. No extra objects are created other than that tuple.

*Replacing the old cache dict with a new one will reduce the reference count by one. If cache was the only reference to the dict it'll be garbage collected. This then causes the reference count for all contained tuple keys to drop by one. If nothing else references to those those will be garbage collected.

*Note that when Python frees memory, that does not necessarily mean the operating system reclaims it immediately. Most operating systems will only reclaim the memory when it is needed for something else, instead presuming the program might need some or all of that memory again soon.

A: You might want to take a look at Heapy as a way of profiling memory usage. I think PySizer is also used in some instances for this but I am not familiar with it. ObjGraph is also a strong tool to take a lok at.


text:
Q: COCOS 2d V2.x Menu Alignment Issue - Tested in iPhone Simulator 5.1 and iPhone 4 Device  Not sure why the menu is aligned to Top Left corner , previous version the menu was aligned perfectly to the center. Testing in iPhone 4.
I know the solution [menu setPosition:ccp( size.width/2, size.height/2)]; but wanted to understand why its Aligned to Top Left.
To get the same result please try this in AppDelegate
[director_ pushScene: [HelloWorldLayer scene]];

instead of
[director_ pushScene: [IntroLayer scene]];

My Result and my Code

UPDATED SOURCE
MenuLayer.h
#import <Foundation/Foundation.h>
#import "cocos2d.h"

@interface MenuLayer : CCLayer {

}

+(CCScene *) scene;

@end

MenuLayer.m
#import "MenuLayer.h"

@implementation MenuLayer

        +(CCScene *) scene
        {
            CCScene *scene = [CCScene node];

            MenuLayer *layer = [MenuLayer node];

            [scene addChild: layer];

            return scene;
        }

    -(id) init
    {
        if( (self=[super init]) ) {
            CCMenuItem *itemAchievement = [CCMenuItemFont itemWithString:@"Play" block:^(id sender) {}];
            CCMenuItem *itemLeaderboard = [CCMenuItemFont itemWithString:@"Settings" block:^(id sender) {}];

            CCMenu *menu = [CCMenu menuWithItems:itemAchievement, itemLeaderboard, nil];

            [menu alignItemsVertically];

            [self addChild:menu];
        }
        return self;
    }
    @end

AppDelegate.m
    [director_ pushScene: [MenuLayer scene]];

A: OK, I'll tell you the answer first:
You have something gone wrong :) .. You must have changed the position of the parent, or its grandparent, ... etc.
EDIT:
Your error is running CCDirector inside this method:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    ...
    // Remove this code !
    [director_ runWithScene:blah];
}

Instead, you must run the CCDirector like so:
// This method is part of the CCDirectorDelegate methods
// Add it below the - (BOOL)application: didFinishLaunchingWithOptions:
-(void) directorDidReshapeProjection:(CCDirector*)director
{
    if(director.runningScene == nil) {
        // Add the first scene to the stack. The director will draw it immediately into the framebuffer. (Animation is started automatically when the view is displayed.)
        // and add the scene to the stack. The director will run it when it automatically when the view is displayed.
        [director_ runWithScene: [HelloWorldLayer scene]];
    }
}

Evidence:
Read the cocos2d docs! They say that if you are running on iOS versions prior to iOS 6, you mustn't run the CCDirector inside the application: didFinishLaunching: method.
From the docs:

This is needed for iOS4 and iOS5 in order to ensure
  that the 1st scene has the correct dimensions
  This is not needed on iOS6 and could be added to the application:didFinish...

Here is your pic, dissected:

That's a total mess... There is no way cocos2d default behavior is like that. Create a new cocos2d v2.x, and clean up HelloWorldLayer.m, and here is the result:
// Achievement Menu Item using blocks
CCMenuItem *itemAchievement = [CCMenuItemFont itemWithString:@"Achievements" block:^(id sender) {}];
// Leaderboard Menu Item using blocks
CCMenuItem *itemLeaderboard = [CCMenuItemFont itemWithString:@"Leaderboard" block:^(id sender) {}];

CCMenu *menu = [CCMenu menuWithItems:itemAchievement, itemLeaderboard, nil];

[menu alignItemsVertically];

[self addChild:menu];

A: I have fixed this issue by finding -(void) makeTransition:(ccTime)dt in IntroLayer.m and add replace following code:
[[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:1.0 scene:[HelloWorldLayer scene] withColor:ccWHITE]];

by
[[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:1.0 scene:[YourLayer scene] withColor:ccWHITE]];

A: It works by modifying the MenuLayer.m - override onEnter and then add the Children to that layer
#import "MenuLayer.h"

@implementation MenuLayer

+(CCScene *) scene
{
    CCScene *scene = [CCScene node];

    MenuLayer *layer = [MenuLayer node];

    [scene addChild: layer];

    return scene;
}
-(void) onEnter
{
    [super onEnter];
    CCMenuItem *itemAchievement = [CCMenuItemFont itemWithString:@"Play" block:^(id sender) {}];
    CCMenuItem *itemLeaderboard = [CCMenuItemFont itemWithString:@"Settings" block:^(id sender) {}];

    CCMenu *menu = [CCMenu menuWithItems:itemAchievement, itemLeaderboard, nil];

    [menu alignItemsVertically];

    [self addChild:menu];

}
-(id) init
{
    if( (self=[super init]) ) {

    }
    return self;
}
@end


text:
Q: Java Android/Eclipse: how to get a screen with a canvas and some buttons? I'm making an app for Android with Java in eclipse, and it will have multiple screens. One screen will contain a canvas with 2D graphics, and some buttons below the canvas. But I'm a newbie at Android so it's still a little messy to me. Seems like a new Paint() in a class which extends View always is fullscreen (?) so I tried to solve it with Fragments where I put the canvas/newPaint() in one Fragment and the buttons in another one. But my app crashes when I try to add the Fragments in the xml file, and I don't know why.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<fragment
    android:id="@+id/game_fragment"
    android:name="com.example.tictactoe.GameFragment"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="3"
    android:background="#FF0000"
    tools:layout="@layout/game_view" />

<fragment
    android:id="@+id/game_fragment2"
    android:name="com.example.tictactoe.GameFragment"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:background="#FFFF00"
    tools:layout="@layout/game_view" />

Is there any other way of getting a 2D graphics canvas together with some buttons on a screen,
or can someone help me out with the fragment solution?
Thanks in advance!

A: Your stacktrace gives what the error is - GameFragment is not a class inheriting from Fragment. You need to ensure that you are placing Fragment classes appropriately in your layout.
Also from looking at your layout, you are placing GameFragment layout twice in the same root view. This looks wrong on some level. I mean if you have your buttons in a different layout, shouldn't you be using that layout? Also, as a tip, inflate the layout for the fragment by overriding the GamrFragment's onCreateView() method (you should see this method once you have inherited from the Fragment class appropriately).
And last but not the least, when using Fragments, ensure that you use the right version uniformly (if you use the fragments from the support package, stick to using it uniformly).


text:
Q: Reinforcement Learning, Policy iteration terminal state issue The code of computing the state-value function $V^{\pi_{n}}$ is
def compute_vpi(mdp, policy, gamma):
    """
    Computes V^pi(s) FOR ALL STATES under given policy.
    :param policy: a dict of currently chosen actions {s : a}
    :returns: a dict {state : V^pi(state) for all states}
    """
    all_states, n = mdp.get_all_states(), len(mdp.get_all_states())
    state_index = {s: i for i, s in enumerate(all_states)}
    a, b = np.zeros((n, n)), np.zeros(n)
    for i, state in enumerate(all_states):
        vs = [1] + [0] * (n-1)  # current line of state
        next_state = mdp.get_next_states(state, policy[state])
        b[i] = sum([mdp.get_transition_prob(state, policy[state], next_s) *
                    mdp.get_reward(state, policy[state], next_s)
                    for next_s in next_state])
        for next_s in next_state:
            vs[state_index[next_s]]  = - mdp.get_transition_prob(state, policy[state], next_s)
        a[i] = vs
    return {state: v for v, state in zip(np.linalg.solve(a, b), all_states)}

And I found that some states are the terminal state that if agent steps into these states, current episode ends. But in the policy, I don't konw how to set actions, since in mdp, there are no possible actions in the terminal state.
How can I taking into consideration the terminal state when computing the state-value function $V^{\pi_{n}}$  at each iteration?

A: Answer my question
Recall that $V^{\pi}$ satisfies the following linear equation:
$$V^{\pi}(s) = \sum_{s'} P(s,\pi(s),s')[ R(s,\pi(s),s') + \gamma V^{\pi}(s')]$$
the code can be
def compute_vpi(mdp, policy, gamma, num_iter=1000, min_difference=1e-5):
    """
    Computes V^pi(s) FOR ALL STATES under given policy.
    :param policy: a dict of currently chosen actions {s : a}
    :returns: a dict {state : V^pi(state) for all states}
    """
    # YOUR CODE HERE
    index_s = {i: s for i, s in enumerate(mdp.get_all_states())}
    s_index = {s: i for i, s in enumerate(mdp.get_all_states())}

    ns = len(mdp.get_all_states())
    a, b = np.zeros((ns, ns)), np.zeros(ns)
    for i in range(ns):
        b_v = 0
        state = index_s[i]
        a[i][i] = 1 - mdp.get_transition_prob(state, policy[state], state) * gamma
        for s_prime in mdp.get_next_states(state, policy[state]):
            if s_prime == state: continue
            a[i][s_index[s_prime]] = \
                -mdp.get_transition_prob(state, policy[state], s_prime) * gamma
            b_v += mdp.get_transition_prob(state, policy[state], s_prime) *\
                mdp.get_reward(state, policy[state], s_prime)
        b[i] = b_v

    solution = np.linalg.solve(a, b)
    return {index_s[i]: v for i, v in enumerate(solution)}

The best practice to solve the equation is to build a matrix a and b and loop in each state and each entry of the matrix a, and b to update corresponding values.


text:
Q: Is there any way to Create Pull request to bitbucket git repository using intelliJ IDEA I have a git repository in bitbucket, is there any way to create a pull request using IntelliJ IDEA instead of doing it through web?
I found that this can be done from within IntelliJ for a github repository. But have not found anything similar for Bitbucket.

A: Summary: Currently not supported
(Details below)
This has just been confirmed. I raised a support ticket to ask about this and received a reply:

If you are interested in this feature, please vote for
https://youtrack.jetbrains.com/issue/IDEA-88198

Looking at this blog post, it appears that Bitbucket integration is not a plugin native to Intellij IDEA:

And the Atlassian team just did that! A new Bitbucket plugin is now
  available in our repository that offers a simple and well-working
  integration allowing you to:

*

*checkout your existing Bitbucket repository and auto-open it as a project, and

*share a project on Bitbucket instantly, without leaving the IDE.

The Atlassian plugin mentioned above is here, but it has not been updated since 2013 and even if it works for recent versions of Intellij, it does not have the functionality you are looking for.

Looking at other requests to add support to Intellij IDEA for 'Support Bitbucket functionality X', there hasn't been much traction. Examples:
Bitbucket Issue Trackers Integration (Created Aug, 2011)
Bitbucket Snippets support (Create Oct, 2015)
That would imply that the 'Bitbucket pull requests' functionality is unlikely to be supported in Intellij IDEA anytime soon.

There is another Jetbrains product, for code review, called Upsource but that does not have it either. From this jetbrains blog post:

Despite the pros listed above, there are still a few things missing
  that I am waiting for:

*

*Swift and Obj-C support (we are a mobile app development company and iOS app development is a large part of our services).

*More valuable code review analytics (with over 50 projects configured it is hard to track overall code review performance).

*Support for Bitbucket pull requests (only GitHub is currently supported).

A: The "Bitbucket Linky" plugin for IDEA supports this, binding it to Cmd+Shift+X P on Mac and Ctrl+Shift+X P on Windows.

A: Seems that the problem is in BitBucket API which doesn't expose pull request information, not in JetBrains IDE itself. Other projects like magit suffer from this too.
There's an issue on this topic at BitBucket, one can vote for it.

A: Atlassian
now build a plugin for integration with IntelliJ idea
https://marketplace.atlassian.com/apps/1221851/integration-with-jetbrains-ides?hosting=cloud&tab=overview


text:
Q: How do I confirm cmus is using alsa? I've searched the net and came up with the configuration below. but I don't think my cmus install is using alsa.
How do I know? Well, I installed strawberry and have configured it to use alsa. If I play youtube on the browser and then try playing on strawberry , I'll get a message that goes like "playback device is busy right now". I have to stop the Youtube playback first before strawberry starts playing music.
If I do same with cmus, I can hear sound from both cmus and Youtube.
Any ideas? Thanks
this is my configuration
[my-user@fedora ~]$ cat /etc/asound.conf
#
# Place your global alsa-lib configuration here...
#
defaults.pcm.card 1
defaults.ctl.card 1

[my-user@fedora ~]$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: HDMI [HDA ATI HDMI], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: HDMI [HDA ATI HDMI], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: HDMI [HDA ATI HDMI], device 8: HDMI 2 [Dell monitor]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: HDMI [HDA ATI HDMI], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: HDMI [HDA ATI HDMI], device 10: HDMI 4 [HDMI 4]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: HDMI [HDA ATI HDMI], device 11: HDMI 5 [HDMI 5]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Series [Mini-i Series], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

[my-user@fedora ~]$ cat ~/.config/cmus/rc
set output_plugin=alsa
set dsp.alsa.device=default
set mixer.alsa.device=default
set mixer.alsa.channel=Master


text:
Q: Form Responses (Google) - Email Trigger how do you create a email trigger on a google responses form?
There is a question on my form that says "would you like to be contacted by your Property Manager to discuss further?" Ideally if the answer is yes to this question, I would like to response sheet to fire an automatic email to the relevant PM as a notification to make contact.

A: There is a notification add-on which you can get for free from the Add-ons menu. Unfortunately it can't be triggered by a check-box, you can only specify after how many responses should he email you.


text:
Q: Question about implication and probablity Let $A, B$ be two event. My question is as follows:
Will the following relation holds:
$$A \to B \Rightarrow \Pr(A) \le\Pr(B) $$
And why?

A: In terms of intuition, the fact that some event $A$ implies some event $B$ means that whenever $A$ happens, $B$ happens. But if the event $B$ happens, we might not have event $A$. So in other words, we have that $\mathbb P(A) \le \mathbb P(B)$ because the probability that $A$ happens is also "the probability that $B$ happens because of $A$", which is less than "the probability that $B$ happens" with no constrains on it. (Note that there are cases with equality, for instance when $A \Rightarrow B$ and $B \Rightarrow A$. )
From a theoretical point of view though (this is a little bit more advanced for a beginner course in probability though), the expression "$A \Rightarrow B$" doesn't make much sense, since the way probabilities are defined is that the "$\mathbb P$" is actually a function from something we call an space of possible events to the interval of real numbers $[0,1]$. The possible events are sets, and the right way to say $A \Rightarrow B$ in this system would be that the set $A$ is included in the set $B$, i.e. $A \subseteq B$. (You need to think about those sets as "a regrouping of possibilities", for instance if the event space is all subsets of $\{1,2,3,4,5,6\}$ in the context where we roll a fair dice, an example of event would be the possibility that "the roll is even" or "the roll is a $1$ or a $4$".) Since in the construction of probabilities, one most common axiom is that a probability function is countably additive, or in other words
$$
\mathbb P \left( \bigcup_{i=0}^{\infty} A_i \right) = \sum_{i=0}^{\infty} \,\mathbb P (A_i)
$$
when the sets $A_i$ are pairwise disjoint, and another axiom would be that $P(\varnothing) = 0$, we can deduce from that that
\begin{align}
\mathbb P(B) = \mathbb P( (A \cap B) \cup (A^c \cap B))
& = \mathbb P( (A \cap B) \cup (A^C \cap B) \cup \varnothing \cup \dots) \\
& = \mathbb P(A \cap B) + \mathbb P(A^c \cap B) + \mathbb P (\varnothing) + \mathbb P (\varnothing) + \dots \\
& = \mathbb P(A)  + \mathbb P(A^c \cap B) + 0 + 0 + \dots \\
& \ge \mathbb P(A).
\end{align}
Note that the reason I added this is because I used the axiom "countably additive" and not "finitely additive". The way to show that countably additive implies finitely additive is by adding plenty of $\varnothing$'s after the finitely many sets.
There are many possible axioms you can add/choose that are equivalent though. I just took my favorite.
Hope that helps,

A: Yes. Since events are sets of states, $A\implies B$ means $A\subseteq B$, which is equivalent to $B=A\cup(B\backslash A)$, a disjoint union. So $P(B)=P(A)+P(B\backslash A)\geq P(A)$.


text:
Q: Calculate $\sum_{n\ge2}\log\left(1-\frac1{n^2}\right)$ This is the expression whose sum I have to calculate:

$$\sum_{n\ge2}\log\left(1-\frac1{n^2}\right)$$

I have tried to use the mengoli's series properties but I failed. The listed answer should be $-\log (2)$.
Can you please help me?

A: Hint: $$\log\left(1-\frac{1}{n^2}\right)=\log\left(\frac{n^2-1}{n^2}\right)=\log\left(\frac{(n-1)(n+1)}{n\cdot n}\right)\\=\log(n+1)+\log(n-1)-2\log(n)=\left(\log(n+1)-\log(n)\right)-\left(\log(n)-\log(n-1)\right)$$
now use telescoping sum method.


text:
Q: ConstraintLayout equal height and width of textviews with drawable image and different texts I want to replicate the below LinearLayout parent and child views to ConstraintLayout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/constraintLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="com.xyz.constraintlayout.MainActivity$PlaceholderFragment">

    <TextView
        android:id="@+id/section_label"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/activity_vertical_margin"
        android:layout_marginEnd="@dimen/activity_horizontal_margin"
        android:layout_marginStart="@dimen/activity_horizontal_margin"
        android:layout_marginTop="@dimen/activity_vertical_margin"
        android:gravity="center"
        android:text="Section Number" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

        <TextView
            android:id="@+id/first_text"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:layout_margin="4dp"
            android:layout_weight="1"
            android:background="@drawable/border"
            android:drawablePadding="10dp"
            android:drawableTop="@drawable/ic_not_interested_black_48dp"
            android:fontFamily="sans-serif-smallcaps"
            android:gravity="center"
            android:padding="6dp"
            android:text="Book of first_text Language"
            android:textColor="@color/colorPrimaryDark"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/second_text"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:layout_margin="4dp"
            android:layout_weight="1"
            android:background="@drawable/border"
            android:drawablePadding="10dp"
            android:drawableTop="@drawable/ic_not_interested_black_48dp"
            android:fontFamily="sans-serif-smallcaps"
            android:gravity="center"
            android:padding="6dp"
            android:text="Book of second_text"
            android:textColor="@color/colorPrimaryDark"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/third_text"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:layout_margin="4dp"
            android:layout_weight="1"
            android:background="@drawable/border"
            android:drawablePadding="10dp"
            android:drawableTop="@drawable/ic_not_interested_black_48dp"
            android:fontFamily="sans-serif-smallcaps"
            android:gravity="center"
            android:padding="6dp"
            android:text="Book of third_text Topics and Miscellaneous"
            android:textColor="@color/colorPrimaryDark"
            android:textStyle="bold" />
    </LinearLayout>
</LinearLayout>

and the output is:
LinearLayout
I tried to replicate to ConstraintLayout with spread chains as below
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/constraintLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.sed.constraintlayout.MainActivity$PlaceholderFragment">

<TextView
    android:id="@+id/section_label"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginStart="@dimen/activity_horizontal_margin"
    android:layout_marginTop="@dimen/activity_vertical_margin"
    android:layout_marginEnd="@dimen/activity_horizontal_margin"
    android:layout_marginBottom="@dimen/activity_vertical_margin"
    android:gravity="center"
    android:text="Section Number"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintTop_toTopOf="@+id/constraintLayout"
    tools:layout_constraintLeft_creator="1"
    tools:layout_constraintTop_creator="1" />

<TextView
    android:id="@+id/first_text"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_margin="4dp"
    android:background="@drawable/border"
    android:drawableTop="@drawable/ic_not_interested_black_48dp"
    android:drawablePadding="10dp"
    android:fontFamily="sans-serif-smallcaps"
    android:gravity="center"
    android:padding="6dp"
    android:text="Book of first_text Language"
    android:textColor="@color/colorPrimaryDark"
    android:textStyle="bold"
    app:layout_constraintBottom_toBottomOf="@+id/barrier"
    app:layout_constraintEnd_toStartOf="@+id/second_text"
    app:layout_constraintHorizontal_bias="0.5"
    app:layout_constraintHorizontal_chainStyle="spread"
    app:layout_constraintHorizontal_weight="1"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@id/section_label"
    app:layout_constraintVertical_bias="0.0" />

<TextView
    android:id="@+id/second_text"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_margin="4dp"
    android:background="@drawable/border"
    android:drawableTop="@drawable/ic_not_interested_black_48dp"
    android:drawablePadding="10dp"
    android:fontFamily="sans-serif-smallcaps"
    android:gravity="center"
    android:padding="6dp"
    android:text="Book of second_text"
    android:textColor="@color/colorPrimaryDark"
    android:textStyle="bold"
    app:layout_constraintBottom_toBottomOf="@+id/barrier"
    app:layout_constraintEnd_toStartOf="@+id/third_text"
    app:layout_constraintHorizontal_bias="0.5"
    app:layout_constraintHorizontal_weight="1"
    app:layout_constraintStart_toEndOf="@+id/first_text"
    app:layout_constraintTop_toBottomOf="@id/section_label"
    app:layout_constraintVertical_bias="0.0" />

<TextView
    android:id="@+id/third_text"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_margin="4dp"
    android:background="@drawable/border"
    android:drawableTop="@drawable/ic_not_interested_black_48dp"
    android:drawablePadding="10dp"
    android:fontFamily="sans-serif-smallcaps"
    android:gravity="center"
    android:padding="6dp"
    android:text="Book of third_text Topics and Miscellaneous"
    android:textColor="@color/colorPrimaryDark"
    android:textStyle="bold"
    app:layout_constraintBottom_toBottomOf="@+id/barrier"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.5"
    app:layout_constraintHorizontal_weight="1"
    app:layout_constraintStart_toEndOf="@+id/second_text"
    app:layout_constraintTop_toBottomOf="@id/section_label"
    app:layout_constraintVertical_bias="0.0" />

<android.support.constraint.Barrier
    android:id="@+id/barrier"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:barrierDirection="bottom"
    app:constraint_referenced_ids="first_text, second_text, third_text" />

</android.support.constraint.ConstraintLayout>
The output is:
ConstraintLayout
As it is evident that the height of the views in the constraint layout is not even.
How to make it even?
Thanks for any help.
EDIT:
I added barrier to the layout as suggested by @StarterPack but still the same output.

A: > Try this:
    <?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:id="@+id/section_label"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="Section Number"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <TextView
        android:id="@+id/first_text"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_margin="4dp"
        android:background="@mipmap/ic_launcher"
        android:drawablePadding="10dp"
        android:drawableTop="20dp"
        android:fontFamily="sans-serif-smallcaps"
        android:gravity="center"
        android:padding="6dp"
        android:text="Book of first_text Language"
        android:textColor="@color/colorPrimaryDark"
        android:textStyle="bold"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toLeftOf="@+id/second_text"
        app:layout_constraintTop_toBottomOf="@id/section_label" />

    <TextView
        android:id="@+id/second_text"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="4dp"
        android:layout_marginRight="4dp"
        android:background="@mipmap/ic_launcher"
        android:drawablePadding="10dp"
        android:drawableTop="20dp"
        android:fontFamily="sans-serif-smallcaps"
        android:gravity="center"
        android:padding="6dp"
        android:text="Book of second_text"
        android:textColor="@color/colorPrimaryDark"
        android:textStyle="bold"
        app:layout_constraintLeft_toRightOf="@+id/first_text"
        app:layout_constraintRight_toLeftOf="@id/third_text"
        app:layout_constraintTop_toTopOf="@id/first_text" />

    <TextView
        android:id="@+id/third_text"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="4dp"
        android:layout_marginRight="4dp"
        android:background="@mipmap/ic_launcher"
        android:drawablePadding="10dp"
        android:drawableTop="20dp"
        android:fontFamily="sans-serif-smallcaps"
        android:gravity="center"
        android:padding="6dp"
        android:text="Book of third_text"
        android:textColor="@color/colorPrimaryDark"
        android:textStyle="bold"
        app:layout_constraintLeft_toRightOf="@id/second_text"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="@id/second_text" />

</android.support.constraint.ConstraintLayout>

A: Hint:

*

*The layout_height you given for the three TextView's are
wrap_content.

*If you apply match_parent then you can get even height but these
three TextView will occupy the complete space.

*Hope you know that the height of the TextView will extend depend upon
the content size in it.

*You can achieve the design what you want by assign same hardcore
height value (like 120dp) for that three TextView


text:
Q: New instance of class with a non-None class attribute? I have a Python class that has a class attribute set to something other than None. When creating a new instance, the changes made to that attribute perpetuates through all instances.
Here's some code to make sense of this:
 class Foo(object):
   a = []
   b = 2

 foo = Foo()
 foo.a.append('item')
 foo.b = 5

Using foo.a returns ['item'] and foo.b returns 5, as one would expect.
When I create a new instance (we'll call it bar), using bar.a returns ['item'] and bar.b return 5, too! However, when I initially set all the class attributes to None then set them to whatever in __init__, like so:
 class Foo(object):
   a = None
   b = None

   def __init__(self):
     self.a = []
     self.b = 2

Using bar.a returns [] and bar.b returns 2 while foo.a returns ['item'] and foo.b returns 5.
Is this how it's suppose to work? I've apparently never ran into this issue in the 3 years I've programmed Python and would like some clarification. I also can't find it anywhere in the documentation, so giving me a reference would be wonderful if possible. :)

A: Yes, this is how it is supposed to work.
If a and b belong to the instance of Foo, then the correct way to do this is:
class Foo(object):
   def __init__(self):
     self.a = []
     self.b = 2

The following makes a and b belong to the class itself, so all instances share the same variables:
class Foo(object):
   a = []
   b = 2

When you mix the two methods -- as you did in your second example -- this doesn't add anything useful, and just causes confusion.
One caveat worth mentioning is that when you do the following in your first example:
foo.b = 5

you are not changing Foo.b, you are adding a brand new attribute to foo that "shadows" Foo.b. When you do this, neither bar.b nor Foo.b change. If you subsequently do del foo.b, that'll delete that attribute and foo.b will once again refer to Foo.b.

A: Yes, that's exactly what you should expect.  When you define a variable on the class, then those attributes are attached to the class, not the instance.  You might not always notice that when you assign to an attribute on an instance, the instance picks up the new value, masking the class attribute.  Methods that modify in place, like list.append won't give the instance a new attribute, since they just modify existing object, which happens to be an attribute of the class.
Any time every instance of a class should have its own, unique value for an attribute, you should usually set that in the __init__ method, to be sure that it's different for every instance.
only when a class has an attribute that has a sensible default value, and that value is of an immutable type (that cannot be modified in place), such as int or str, should you set attributes on the class.

A: Yes, it seems surprising in the begining, but it is the way python works, as said in other answers. Three years of python without being slashed by this? You are lucky, very lucky. If I were you I'd check sensitive past code for little animals...
Be also careful with function calls: def func(list=[]) has a similar behavior, that can be surprising.
And, if possible, plug a pylint parse in your commit hooks. Or at least run pylint sometime on your code, it is very instructive, and would probably have told you about this trick (which is not a trick, in fact, it is very logic and orthogonal, just the python way).

A: You're confusing a class attribute with an instance attribute. In your first example, there are only the class attributes a and b, but in the second you also have instance attributes with the same names.
It appears that Python will pass through references to an attribute from an instance to a class if there is not instance attribute (I learned something new today!).
You may find this code instructive:
class Foo:
  a = 1
  b = 2

  def __init__(self):
    self.a=3

print Foo.a   # => 1
print Foo().a # => 3
print Foo.b   # => 2
print Foo().b # => 2


text:
Q: Generics runtime check of 'instanceof' I have an object called Node<Value>. Objects NodeInternal<Value> and NodeLeaf<Value> inherit from Node<Value>.
I am trying to test what is the type of the object using instanceof as follows:
if (node instanceof NodeInternal). I did not add <Value> because upon runtime, the type is dropped. Without <Value> on NodeInternal however, I get the following warning: NodeInternal is a raw type. References to generic type NodeInternal<Value> should be parameterized.
What should I do in this case?

A: Use an unbounded wildcard:
if (node instanceof NodeInternal<?>)
  node = ((NodeInternal<Value>) node).SE();

A: http://www.java2s.com/Code/Java/Language-Basics/Usetheinstanceofoperatorwithagenericclasshierarchy.htm
Use <?>.
You can also play games:
Java: instanceof Generic


text:
Q: ADLDS USER MANAGMENT I have created an ADLDS Instance for an asp.net application to create/Maintain user objects.
CN=CN=UserInstance,CN=Users,DC=test,DC=Com
  +CN=Lostandfound
  +CN=NTDSQuots
  +CN=Roles
  +CN=UserS
  +CN=TESTUSER

when i create a user from application it is creating in root instead of should create inside the "Users" Container in the mentioned image.
"LDAP://localhost:7389/CN=UserInstance,CN=Users,DC=test,DC=Com"
Please assist how to make configuration so that when user is created it should create inside the "Users" Container instead of in root

A: Finally i found the solution ,
In my LDAP Connection string i need to add the container name which i need to insert the users.and need to put create my ADAM Administrator inside that container.Reset it works smoothly


text:
Q: Query_String / Query_String_Decoded don't hold Post Parameters I have an Agent which should accept Post parameters, sent from An App in Titanium,
In the App i send a httprequest, e.g:
var params = {
"Param1":"Test",
"Param2":"Sth"
}
var http = Ti.Network.createHTTPClient()
  http.open("POST","server/db.nsf/agent?OpenAgent",true);
  http.setRequestHeader('Authorization', 'Basic ' + Ti.Utils.base64encode(username + ':' + password));

  http.send(params)
    http.onreadystatechange = function () {
      var response = http.responseData
          callback(response)
    }

And in the Agent i have the following Code:
Dim session As NotesSession
Dim doc As NotesDocument

Set doc = session.DocumentContext

Print (doc.Query_String(0))
Print (doc.Query_String_Decoded(0))

I also added 2 hidden, computed forms Query_String and Query_String_Decoded with its name as value
Just to make sure.
And tried `@UrlQueryString``
But the responseData is only the
OpenAgent
parameter from the Url
Could anyone help me to find the right way to get the Post Data, sent from the httprequest
Thanks for your help in Advance

A: You need to use the Request_Content CGI variable and not Query_string.

You could also use XPages and create an XAgent instead. Values posted to XPages can be read using param.get(). I have written a blog post about a HTTP request consumer in XPages that you can use as inspiration.


text:
Q: (if, else) question check number equal or greater in Realtime database How can I implement if-else to check if the value of the money field is equal or greater (pre defined value in code) checking on the Realtime database money field? Only after this verification runs the code? I did a web search but all the methods I have searched but none were successful in the implementation.
ref.child("users").child(user.getUid()).addListenerForSingleValueEvent(new ValueEventListener() {
                    @Override
                    public void onDataChange(DataSnapshot dataSnapshot) {
                        for (DataSnapshot ds : dataSnapshot.getChildren()) {

                            DatabaseReference ref = FirebaseDatabase.getInstance().getReference()
                                    .child("users").child(user.getUid()).child("money");

                            ref.runTransaction(new Transaction.Handler() {
                                @Override
                                public Transaction.Result doTransaction(MutableData mutableData) {
                                    Object currentMoney = mutableData.getValue();
                                    int totalMoney = 0;
                                    if (currentMoney == null) {
                                        totalMoney = moneyToRemove;
                                    } else {
                                        totalMoney = Integer.parseInt(String.valueOf(currentMoney)) - moneyToRemove;
                                    }

                                    mutableData.setValue(totalMoney);
                                    return Transaction.success(mutableData);
                                }

                                @Override
                                public void onComplete(DatabaseError databaseError, boolean b,
                                                       DataSnapshot dataSnapshot) {
                                    // Transaction completed

                                }
                            });

Db structure

A: To get all users that have the value of money property greater than or equal to 7 for example, you should definitely use a query that looks like this:
DatabaseReference rootRef = FirebaseDatabase.getInstance().getReference();
DatabaseReference usersRef = rootRef.child("users");
Query moneyQuery = usersRef.orderByChild("money").startAt(7);
ValueEventListener valueEventListener = new ValueEventListener() {
    @Override
    public void onDataChange(DataSnapshot dataSnapshot) {
        for(DataSnapshot ds : dataSnapshot.getChildren()) {
            ds.child("money").getRef().setValue(ServerValue.increment(money));
        }
    }

    @Override
    public void onCancelled(@NonNull DatabaseError databaseError) {
        Log.d("TAG", databaseError.getMessage()); //Don't ignore potential errors!
    }
};
moneyQuery.addListenerForSingleValueEvent(valueEventListener);

However, if you only want to do this operation only on the logged-in user, please use the following lines of code:
String uid = FirebaseAuth.getInstance().getCurrentUser().getUid();
DatabaseReference rootRef = FirebaseDatabase.getInstance().getReference();
DatabaseReference uidRef = rootRef.child("users").child(uid);
ValueEventListener valueEventListener = new ValueEventListener() {
    @Override
    public void onDataChange(DataSnapshot dataSnapshot) {
        if(ds.child("money").getValue(Long.class) >= 7)) {
            dataSnapshot.child("money").getRef().setValue(ServerValue.increment(money));
        }
    }

    @Override
    public void onCancelled(@NonNull DatabaseError databaseError) {
        Log.d("TAG", databaseError.getMessage()); //Don't ignore potential errors!
    }
};
uidRef.addListenerForSingleValueEvent(valueEventListener);

In which the money variable can be any positive number for an increment operation or a negative number for a decrement operation. Besides that, there is no need to run a transaction for a simple increment/decrement operation. We can simply use the simpler newly added ServerValue.increment(value) option. The transactions are used only when we need to read the value of the property first.
Both solutions will work, only if you change the type of your money property in the database from String to number. So please do the following change:
money: "7" //See the quotations marks?

To:
money: 7 //No quotations marks


text:
Q: How can I trigger an action after displaying results in Select2? I'd like to trigger an action after select2 display the results.
The 'select2:open' event triggers the action AFTER the select2 is opened but BEFORE it displays the results.
Does anyone know how to do it?

A: The Select2 will trigger a few different events when different actions are taken using the component, allowing you to add custom hooks and perform actions.
As far as I understand you need something like select2:loaded action. Unfortunately there is no such event right now, according the documentation.
Try to use select2:select - This is triggered before the drop-down is opened, this event can be prevented or select2:closing.


text:
Q: Journal name missing if paper is cited again in another refsection (biblatex chicago) EDIT: We have found this is an issue specific to Overleaf.
I have multiple refsections and multiple bibliographies in my document. When I cite the same paper in a different refsection the journal name is missing in the reference list.
In the MWE below the bibliography in the Introduction would be correct. In the Discussion I would see the full reference to Jones, but the Journal of the Smith paper is missing.
I have tried noibid and the ibidtracker=false option but to no avail. I think I need some sort of option to completely clear the memory between chapters. Changing the citekey for duplicate papers solves this issue but I would prefer  not having to do that.
This is the updated version of the MWE that replicates the described problem
\documentclass{book}
\usepackage[natbib, authordate,backend=biber,doi=false,isbn=false,url=false,    ibidtracker=false,noibid]{biblatex-chicago}
\usepackage{filecontents}

\begin{filecontents}{Introduction.bib}
@article{Spruijt2006b,
title = {{Advanced behavioural screening: automated home cage ethology}},
year = {2006},
journal = {Drug Discovery Today: Technologies},
author = {Spruijt, Berry M. and DeVisser, Leonie},
number = {2},
month = {6},
pages = {231--237},
volume = {3},
url = {http://linkinghub.elsevier.com/retrieve/pii/S1740674906000345},
doi = {10.1016/j.ddtec.2006.06.010},
issn = {17406749},
pmid = {24980412}
}
@article{Gerlai2002a,
title = {{Phenomics: fiction or the future?}},
year = {2002},
journal = {Trends in Neurosciences},
author = {Gerlai, Robert},
number = {10},
month = {10},
pages = {506--509},
volume = {25},
url = {http://linkinghub.elsevier.com/retrieve/pii/S0166223602022506},
doi = {10.1016/S0166-2236(02)02250-6},
issn = {01662236},
pmid = {12220878}
}
\end{filecontents}
\begin{filecontents}{Discussion.bib}
@article{Spruijt2006b,
title = {{Advanced behavioural screening: automated home cage ethology}},
year = {2006},
journal = {Drug Discovery Today: Technologies},
author = {Spruijt, Berry M. and DeVisser, Leonie},
number = {2},
month = {6},
pages = {231--237},
volume = {3},
url = {http://linkinghub.elsevier.com/retrieve/pii/S1740674906000345},
doi = {10.1016/j.ddtec.2006.06.010},
issn = {17406749},
pmid = {24980412}
}
@article{Gerlai2002a,
title = {{Phenomics: fiction or the future?}},
year = {2002},
journal = {Trends in Neurosciences},
author = {Gerlai, Robert},
number = {10},
month = {10},
pages = {506--509},
volume = {25},
url = {http://linkinghub.elsevier.com/retrieve/pii/S0166223602022506},
doi = {10.1016/S0166-2236(02)02250-6},
issn = {01662236},
pmid = {12220878}
}
\end{filecontents}
\addbibresource{Introduction.bib}

\begin{document}
\begin{refsection}[Introduction.bib]
\chapter[General Introduction]{General Introduction}
this is a sentence
\citep{Spruijt2006b}
\printbibliography
\end{refsection}

\chapter[General Discussion]{General Discussion}
\begin{refsection}[Discussion.bib]
\citep{Spruijt2006b}
\citep{Gerlai2002a}
\printbibliography[heading=subbibliography]
\end{refsection}
\end{document}

The results for the second chapter are
Chapter 2
General Discussion
(Spruijt and DeVisser 2006) (Gerlai 2002)
References
Gerlai, Robert. 2002. "Phenomics: fiction or the future?" Trends in             Neurosciences
25, no. 10 (October): 506–509.
Spruijt, Berry M., and Leonie DeVisser. 2006. "Advanced behavioural screening:
automated home cage ethology." 3, no. 2 (June): 231–237.

A: Your MWE works for me with biblatex 3.10/Biber 2.10. On Overleaf I can indeed reproduce the problem (https://www.overleaf.com/read/zdnpmspxkkyr, a simpler MWE would be https://www.overleaf.com/read/sdgcvxmnvjhw), this seems to be a Biber bug that was fixed a while ago.
The work-around is to use journaltitle instead of journal
@article{Spruijt2006b,
  title = {{Advanced behavioural screening: automated home cage ethology}},
  year = {2006},
  journaltitle = {Drug Discovery Today: Technologies},
  author = {Spruijt, Berry M. and DeVisser, Leonie},
  number = {2},
  month = {6},
  pages = {231--237},
  volume = {3},
  url = {http://linkinghub.elsevier.com/retrieve/pii/S1740674906000345},
  doi = {10.1016/j.ddtec.2006.06.010},
  issn = {17406749},
  pmid = {24980412}
}

See https://www.overleaf.com/read/zzrfttnshsdc
So the problem seems to be that Biber failed to execute certain source mapping steps for .bib files other than the first file loaded.


text:
Q: Need inputs to write a SQL query I need help with oracle SQL. The data in the table is as given below.'
For given data I need to create a bands based on COB dates range and Values.
COB         VALUE
-----------------
4/5/2012    20
4/6/2012    20
4/7/2012    22
4/8/2012    21
4/9/2012    20
4/10/2012   21
4/11/2012   21
4/12/2012   22
4/13/2012   20

The output I am expecting is as given below:

START_DT    END_DT          VALUE
----------------------------------
4/5/2012    4/7/2012    20
4/7/2012    4/8/2012    22
4/8/2012    4/9/2012    21
4/9/2012    4/10/2012   20
4/10/2012   4/12/2012   21
4/12/2012   4/13/2012   22
4/13/2012   null        20

Can someone help please?

A: lag and lead are your friends in this case
select cob start_dt
,      lead(cob) over (order by cob) end_dt
,      value
from
(
    select cob
    ,      value
    ,      lag(value) over (order by cob) prev_value
    from   tmp
)
where prev_value is null
or    value <> prev_value

edit: fixed query :)
Edit by Rob van Wijk: here is some proof that the query works:
SQL> create table mytable(cob,value)
  2  as
  3  select date '2012-04-05', 20 from dual union all
  4  select date '2012-04-06', 20 from dual union all
  5  select date '2012-04-07', 22 from dual union all
  6  select date '2012-04-08', 21 from dual union all
  7  select date '2012-04-09', 20 from dual union all
  8  select date '2012-04-10', 21 from dual union all
  9  select date '2012-04-11', 21 from dual union all
 10  select date '2012-04-12', 22 from dual union all
 11  select date '2012-04-13', 20 from dual
 12  /

Table created.

SQL> select cob start_dt
  2  ,      lead(cob) over (order by cob) end_dt
  3  ,      value
  4  from
  5  (   select cob
  6      ,      value
  7      ,      lag(value) over (order by cob) prev_value
  8      from   mytable
  9  )
 10  where prev_value is null
 11  or    value <> prev_value
 12  /

START_DT            END_DT                   VALUE
------------------- ------------------- ----------
05-04-2012 00:00:00 07-04-2012 00:00:00         20
07-04-2012 00:00:00 08-04-2012 00:00:00         22
08-04-2012 00:00:00 09-04-2012 00:00:00         21
09-04-2012 00:00:00 10-04-2012 00:00:00         20
10-04-2012 00:00:00 12-04-2012 00:00:00         21
12-04-2012 00:00:00 13-04-2012 00:00:00         22
13-04-2012 00:00:00                             20

7 rows selected.

A: In pseudo-code it can be done with something like this:
startDate = min(COB) from table
actualDate = min(COB) from table
lastDate = max(COB) from table

lastValue = value from actualDate

while actualDate <= lastDate
  actualValue = value from actualDate

  if actualValue <> lastValue
    insert in temptable startdate, actualdate, actualValue
    startdate = actualdate

  actualdate = actualdate + 1 day

insert in temptable startdate, null, actualValue

select * from temptable


text:
Q: Hide and show element in auto layout If i click the search button in navigation bar then shown a uisearchbar and uitable need to down, then unclick the search button in navigation bar then hide the uisearchbar and table need to move top.
Please find the screenshot of my requirement
Before clicking search icon
After clicking search icon

A: Considering it is a table, I would implement that search panel as a custom UITableViewCell, and add a new section to tableView with just this cell. Then you'll have two sections in table: first with this cell, and second with the rest.
Then you can use insertRows(at:with:) and deleteRows(at:with:) to show and hide that panel (animation supported). You just need to have some data model to make sure that the state of tableView is always consistent (I will leave the appropriate cellForRowAt implementation on you):
var isCurrentlyShowingSearchBar: Bool = false

func numberOfSections(in tableView: UITableView) -> Int {
    return 2
}

override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    switch section {
    case 0:
        return isCurrentlyShowingSearchBar ? 1 : 0
    case 1:
        return items.count
    default:
        fatalError()
    }
}

func showSearchBar() {
    // update model
    isCurrentlyShowingSearchBar = true
    // add cell
    tableView.insertRows(at: [IndexPath(row: 0, section: 0)], with: .automatic)
}

func hideSearchBar() {
    // update model
    isCurrentlyShowingSearchBar = false
    // remove cell
    tableView.deleteRows(at: [IndexPath(row: 0, section: 0)], with: .automatic)
}

A: Here is code of hide and show search bar.
you need to take reference of the top constrain like
@IBOutlet weak var SearchTop: NSLayoutConstraint!
@IBOutlet weak var bar: UISearchBar!

set constant in viewdidload like
override func viewDidLoad()
{
    super.viewDidLoad()
    SearchTop.constant = bar.frame.size.height * -1
    self.view.layoutIfNeeded()
}

Then after implement the click event of the search button like
@IBAction func onclickSearch(_ sender: Any) {
        if SearchTop.constant == 0
        {
            SearchTop.constant = bar.frame.size.height * -1;
        }
        else
        {
            SearchTop.constant = 0;
        }
        UIView.animate(withDuration: 1) {
            self.view.layoutIfNeeded()
        }
    }


text:
Q: Erro com deploy de Vue.js api.min.js:2 GET https://api.opmnstr.com/v1/optin/13439/673828 410
(anonymous) @ api.min.js:2
Ye.send @ api.min.js:2
getCampaigns @ api.min.js:2
t.init @ api.min.js:2
o.onload.o.onreadystatechange @ pag:180
load (async)
(anonymous) @ pag:180
(anonymous) @ pag:180
api.min.js:2 [OptinMonster] The campaign could not be retrieved. The following error was returned: A campaign with the ID 673828 does not exist.

Essa é a mensagem de erro que aparece no console quando atualizo a página, pois bem, usei o "npm run build" pra criar uma versão pra fazer o deploy no 000webhost, fiz o upload dos arquivos e abri o link, até ai tudo certo, navega entre páginas e tudo, o problema é ao abrir diretamente a url da página, da erro, se for usando os botões o site navega, mas ao atualizar da erro e diz que a página não existe.
example.com assim funciona, e se clicar pra ir pra página 1 ele vai
example.com/pagina1 porém assim, o site não acha a página
Edit 1:
Vue router:
import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import pagina from '@/components/pagina'

Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      name: 'HelloWorld',
      component: HelloWorld
    }, {
      path: '/pag',
      name: 'pagina',
      component: pagina
    }
  ]
})

A: Creio que era um problema com o servidor, ele não estava reconhecendo a configuração.
Então procurei no vuejs docs e achei algo que resolveu.
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.html [L]
</IfModule>

https://router.vuejs.org/guide/essentials/history-mode.html#example-server-configurations


text:
Q: vector with trivial stabilizer in $ SO_3 $ representation Consider the standard representation of $ SU_2 $ on $ \mathbb{C}^2 $. For any nonzero vector $ v \in \mathbb{C}^2 $, $ v $ has trivial stabilizer.
Finding such a representation and such a vector seems natural and I would like to do it for $ SO_3(\mathbb{R}) $.
By contrast, in the standard representation of $ SO_3(\mathbb{R}) $ on $ \mathbb{R}^3 $ every nonzero vector has stabilizer $ SO_2(\mathbb{R}) $.
EDIT: Lspice points out that every element in the standard representation of $ SO_3(\mathbb{R}) $ has stabilizer a maximal torus ( just a circle $ SO_2(\mathbb{R} $) and intersecting two maximal tori here will give the center (which is trivial). So if we consider the 6d reducible rep of $ SO_3(\mathbb{R}) $ on $ \mathbb{R}^3 \oplus \mathbb{R}^3 $ (just two copies of the standard rep) then the stabilizer of a vector like $ (e_1,e_3) $ must be trivial. This is not totally surprising because $ \mathbb{R}^6 $ is known to contain a copy of $ \mathbb{R}P^3 $ realized as the unit tangent bundle of the sphere $ S^2 $.
I am looking for an irreducible representation $ \pi$ of $ SO_3(\mathbb{R}) $ on a finite dimensional vector space $ V $ and a vector $ v \in V $ such that the stabilizer of $ v $ is trivial.
The five dimensional irrep of $ SO_3(\mathbb{R}) $ will not help since we can identify it with the action by conjugation on the traceless symmetric $ 3 \times 3 $ real matrices, which are all orthogonally diagonalizable, and then by inspecting the diagonal form conclude that every element has stabilizer $ S(O_1(\mathbb{R}) \times O_1(\mathbb{R}) \times O_1(\mathbb{R})) \cong O_1(\mathbb{R}) \times O_1(\mathbb{R}) $ if all eigenvalues are distinct or stabilizer $ S(O_2(\mathbb{R}) \times O_1(\mathbb{R})) \cong O_2(\mathbb{R}) $ if there is a repeated eigenvalue.
To summarize, the stabilizers from the 3d, and 5d irreps are $ SO_3(\mathbb{R}), SO_2(\mathbb{R}),O_1(\mathbb{R}) \times O_1(\mathbb{R}), O_2(\mathbb{R}) $. None are trivial.
Maybe the 7d irrep has a vector with a trivial stabilizer? So far I know the 7d irrep has vectors with stabilizer: three element cyclic $ C_3 $, six element dihedral $ D_6 $, and the tetrahedral subgroup $ A_4 $.
I think it is very likely that the 9d irrep has a vector with a trivial stabilizer. For example it is a necessary condition that $ \mathbb{R}^9 $ contains an equivariantly isometrically embedded $ \mathbb{R}\mathbb{P}^3 $ and that is known to be the case for example by looking at $ SO_4(\mathbb{R}) $ acting by conjugation on the nine dimensional vector space of traceless symmetric $ 4 \times 4 $ real matrices and then considering the orbit of a matrix with a triple repeated eigenvalue.
I also know this must be possible for some finite dimensional rep of $ SO_3(\mathbb{R}) $ by Mostow-Palais theorem (since $ SO_3(\mathbb{R}) $ compact and trivial group is closed).

A: Let $\mathcal{P}_3$ denote the space of homogeneous cubics in three variables, and let $\mathcal{H}_3$ denote the (seven-dimensional) subspace of harmonic cubics, an irreducible $\mathrm{SO}(3)$-module. Let $H : \mathcal{P}_3 \to \mathcal{H}_3$ denote the orthogonal projection map. Then it turns out that any unit norm $p \in \mathcal{H}_3$ can be factorized as $p = H( \ell_1 \ell_2 \ell_3),$ where the $\ell_i$ are linear functions on $\mathbb{R}^3$ of unit norm. The linear factors $\ell_i$ are unique up to permutation and replacing two of them at a time by their negatives. Denote this equivalence relation by $\sim.$
The resulting map $(S^2 \times S^2 \times S^2) / {\sim} \to S^6$ is $\mathrm{SO}(3)$ equivariant, where $\mathrm{SO}(3)$ acts diagonally on $(S^2 \times S^2 \times S^2) / {\sim}.$ Therefore, to find an element $v \in \mathcal{H}_3$ with trivial $\mathrm{SO}(3)$-stabiliser, it suffices to find a collection of three points on $S^2$ for which there are no nontrivial $\mathrm{SO}(3)$ elements sending these elements to another member of their equivalence class under $\sim.$ The generic triple of points on $S^2$ should fit this requirement.


text:
Q: How do I convert date mm/dd/yyyy to yyyy-mm-ddT00:00:00.000Z format in javascript var dateType = $filter('date')($scope.datalist[0].OVERRIDE_DATE, "MM/dd/yyyy");

I have the output : 05/07/1992
I want to change above date to  yyyy-mm-ddT00:00:00.000Z format ?

A: toISOString() should do what you want.
e.g.
new Date('05/07/1992').toISOString();
will give you
"1992-05-07T07:00:00.000Z"

A: The Date.prototype.toISOString() method may be what you want:
const rawDate = $filter('date')($scope.datalist[0].OVERRIDE_DATE, "MM/dd/yyyy");
const formattedDate = new Date(rawDate).toISOString();

or, if $scope.datalist[0].OVERRIDE_DATE is already a date object, you could just do:
const formattedDate = $scope.datalist[0].OVERRIDE_DATE.toISOString();

Link to Date.prototype.toISOString docs


text:
Q: HTML form if one radio condition is selected then force an input I have a simple HTML form with two inputs. One is a radio input and the other is a numeric input.
Using a Javascript function, if the radio option is selected as Insurance - YES(1), then the script must force a numeric value input on the Insurance Value ins_value input. If the radio input is selected as NO, then no input to be entered in the text input.
I have tried to find a similar example but have only found simple examples where an alert is triggered.
I am learning Javascript and have been through tutorials - but also no similar examples.
<script>
    function INSURANCE() {
        var insurance = document.forms["RegForm"]["optradio"];
        var ins_value = document.forms["RegForm"]["ins_value"];

        if (insurance.value == 0) {
            "";
            return false;
        } else  {
        if (ins_value.value == "") {
            window.alert("Please insert Insurance value.");
            ins_value.focus();
            return false;
        }

        return true;
    }
</script>

I expect once the form is submitted, it should either force an insurance value input or not, based on the radio input selection.

A: First of all, you need a checkbox for you're use case. Radio buttons force a selection of one in many. You only have a "is numeric" flag meaning you're value is either true or false.
Well I guess you can achieve you're goal by changing you're input type according to user selection:
<input id="optcheckbox" type="checkbox" onclick="HandleCheckboxClick();" />
<input id="ins_value" type="text" onclick="HandleCheckboxClick();" />

<script>
  function HandleCheckboxClick() {
    var type = 'text';
    var checkbox = document.getElementById('optcheckbox');
    if(checkbox.checked) {
      type = 'number';
    }
    document.getElementById('ins_value').type = type;
  }
</script>

I hope that helps.
Best regards

A: Only seeing the Javascript it's difficult to figure out what's going on, including the HTML would help a lot. Also, this question is a big vague which is makes it hard to answer.
First, when are you trying to trigger the forcing the numeric value? When the user clicks on the radio button? If so, then call that function on the change event. If you're going to change it on the submit, then put the code in the submit function.
I recommend building an array of numeric values and matching that up with the 0, 1, 2, ... values of the radio buttons. When you set the text input, plug that value into your numeric array.
Here's a JS fiddle of using an array in conjunction with the radio button values.
https://jsfiddle.net/Chris_Hayes/coxta1bw/1/
var form = document.querySelector("form");

var numbers = [30, 20, 80];

form.addEventListener("submit", function(event) {
  form["textinput"].value = numbers[form["contact"].value]
  event.preventDefault();
}, false);

If the user skips the radio buttons, just make that check in the on submit function before filling in the numerical input.

A:

var radio = document.getElementById('optradio');
                var input = document.getElementById('ins_value');
                radio.addEventListener("click", function(){
                    if(radio.value == 0){
                        radio.value = 1;
                        this.checked = true;
                        input.removeAttribute('disabled')
                        input.value = radio.value;
                    }
                    else{
                        radio.value = 0;
                        input.setAttribute('disabled','disabled');
                        input.value = '';
                        this.checked = false;
                    }
                });
<input type="radio" name="optradio" id="optradio" value="0">
            <input type="number" name="ins_value" id="ins_value" value="" disabled>

add disabled attribute to your numeric input like so
html:
<input type="radio" name="optradio" id="optradio" value="0">
<input type="number" name="ins_value" id="ins_value" value="" disabled>

javacript:
<script type="text/javascript">
            var radio = document.getElementById('optradio');
            var input = document.getElementById('ins_value');
            radio.addEventListener("click", function(){
                if(radio.value == 0){
                    radio.value = 1;
                    this.checked = true;
                    input.removeAttribute('disabled')
                    input.value = radio.value;
                }
                else{
                    radio.value = 0;
                    input.setAttribute('disabled','disabled');
                    input.value = '';
                    this.checked = false;
                }
            });
        </script>

add the script below your html code


text:
Q: How ACL is maintaned internally by Symfony2? The documentation lacks some details about ACL. It' simple as invoking createAcl on the domain object after persisting it. Then putting a mask with insertObjectAce on the user/object.
But how internally Symfony2 manage ACL? Are some extra columns added to the table?
$entityManager = $this->get('doctrine.orm.default_entity_manager');
$entityManager->persist($comment);
$entityManager->flush();

// creating the ACL
$aclProvider = $this->get('security.acl.provider');
$objectIdentity = ObjectIdentity::fromDomainObject($comment);
$acl = $aclProvider->createAcl($objectIdentity);

// retrieving the security identity of the currently logged-in user
$securityContext = $this->get('security.context');
$user = $securityContext->getToken()->getUser();
$securityIdentity = UserSecurityIdentity::fromAccount($user);

// grant owner access
$acl->insertObjectAce($securityIdentity, MaskBuilder::MASK_OWNER);
$aclProvider->updateAcl($acl);

A: It creates bunch of new tables,

The tables are ordered from least rows to most rows in a typical
  application:

*

*acl_security_identities: This table records all security identities    (SID) which hold ACEs. The default implementation ships with two
  security identities: RoleSecurityIdentity, and UserSecurityIdentity

*acl_classes: This table maps class names to a unique id which can be    referenced from other tables.

*acl_object_identities: Each row in this table represents a single    domain object instance.

*acl_object_identity_ancestors: This table allows us to determine all    the ancestors of an ACL in a very efficient way.

*acl_entries: This table contains all ACEs. This is typically the    table with the most rows. It can contain tens of millions without significantly impacting performance.

in fact this chapter explains to you a lot of things about how ACL are managed internally by Symfony2 :
http://symfony.com/doc/current/cookbook/security/acl_advanced.html


text:
Q: PL/SQL: Cursor doubles the last record from the table I created the following PL/SQL anonymous block. The cursor below retrieves data from the select statement:
select mod_benutzer, count(*)
  from dok_auspraegung
 where parent_objekt_id = 1093
 group by mod_benutzer;

This statement displays exactly two records:
DDMS_USER |  8
HU2MAMU   | 14

But when I want to display these two records by cursor, it displays "HU2MAMU|14" two times like below:
Modifications:
DDMS_USER, 8x
HU2MAMU, 14x
HU2MAMU, 14x

declare
    my_exception_1          exception;
    var_parent_objekt_id    dok_auspraegung.parent_objekt_id%TYPE := 1093;
    var_date                varchar(30);
    var_mod_benutzer        varchar2(10);
    var_benutzer_modifs     number;

    cursor cursor_dok_auspraegung
    is select mod_benutzer, count(*) from dok_auspraegung
    where parent_objekt_id = 10935797565
    group by mod_benutzer;
begin
    select distinct to_char(mod_datum,'YYYY-MON-DD') into var_date from dok_auspraegung where parent_objekt_id = var_parent_objekt_id;

    IF var_date is not null THEN
        dbms_output.put_line('Parent Object ID' || ': ' || var_parent_objekt_id);
        dbms_output.put_line('Date: ' || '            ' || var_date);
    ELSE RAISE my_exception_1;
    END IF;

    open cursor_dok_auspraegung;

    dbms_output.put_line('Modifications:');
    loop
        fetch cursor_dok_auspraegung into var_mod_benutzer, var_benutzer_modifs;
            dbms_output.put(var_mod_benutzer);
            dbms_output.put_line(', ' || var_benutzer_modifs || 'x');
        exit when cursor_dok_auspraegung%notfound;
    end loop;
    dbms_output.put_line(cursor_dok_auspraegung%rowcount);

    close cursor_dok_auspraegung;
exception
    when NO_DATA_FOUND then
        dbms_output.put_line('Parent Object ID not found!');
    when my_exception_1 then
        dbms_output.put_line('');
end;

What is the reason of that?

A: Because exiting from the cursor occurs after printing the value of the variables in the current case, this repeats the last value to be printed. So, it should occur before printing as follows
loop
    fetch cursor_dok_auspraegung into var_mod_benutzer, var_benutzer_modifs;
    exit when cursor_dok_auspraegung%notfound;
        dbms_output.put(var_mod_benutzer);
        dbms_output.put_line(', ' || var_benutzer_modifs || 'x');
end loop;


text:
Q: SonarQube configuration JUnit Coverage - Surefire I have a problem with the configuration of SonarQube. During the day the Jenkins server builds parts of my software but didn't start the JUnit tests. Every night starts the server a big build for all modules and starts the JUnit test for this.
I using the surefire plugin for the Maven jobs.
Now I want that only the big build "sends coverage results" to SonarQube. Has anyone an idea to solve this problem? I found nothing like this on the internet.
My software versions:
SonarQube 5.2 + Clover,
Jenkins v1.629,
Maven 3.0.4

A: I am guessing your project is a java project.
SonarQube plugins will only import coverage reports. So you would have to configure your "big build" to generate a coverage report with the engine you want to use (I would recommend JaCoCo as it is supported out of the box by the sonar java plugin, if you want to use another engine (clover, cobertura, etc...), you would have to install a dedicated plugin).
When there is a report, coverage measures will be sent to sonarqube during the analysis. If there is none, no measure will be sent.

A: Use this link http://docs.sonarqube.org/display/PLUG/Cobertura+Plugin to setup code coverage in SonarQube
In addition to this you need to add cobertura-plugin in sonarqube-x.x\lib\core-plugins


text:
Q: Is there a natural mechanism to implement synthesized attributes or inherited attributes in an LR(1) parser? I think it is simple to implement the synthesized attributes in LR(1) parser. Becuase it is also Bottom-up.
But how to implement inherited attributes in LR(1) parser?
And for comparing those two things in LR(1). For both synthesized attributes and inherited attributes in LR(1). Can you give me an example?

A: To do arbitrary attribute grammars, you need need to build a full tree, because synthesized attributes from "right" children may be used as inherited attributes by "left" children of a node.
So you can't do the evaluation as you parse; you need the full AST. (If you are willing to limit inherited attributes only to "right" children, you could evaluate attributes as you parse).
Once you decide to capture the full AST before running the evaluation, it doesn't matter what your parsing technology is, as long as it produces the AST.
You can see what such attibute grammars look like for a production program transformation tool that uses AG results.  The parser is a GLR parser, which is a generalization of LR parsing.


text:
Q: How to put part of my Controller logic outside my Controller? (one "big" service or multiple services) Maybe it's a trivial question but I'm beginner with Silex and I don't know how to do it...so here is my situation :
I have a Silex app, everything works but I'm not a big fan of my Controller because there is a lot of code and I reapeat this code two times :
First controller :
$app->match('/', function (Request $request) use ($app) {
    // 1/ I get data from a form
    // 2/ I check if User is logged
    // 2.1 / If not logged -> I created new User (Entity User) + send email
    // 3/ I create a new Event (Entity Event) + put some file on AWS s3
    // 4/ I create a new Product (Entity Product)
    // 5/ I activate some add-on to my Event (request to an other BDD)

    return $app['twig']->render('home.html.twig');

})->bind('home');

Second controller
$app->match('/manage-my-product', function (Request $request) use ($app) {
    if ($app['security.authorization_checker']->isGranted('IS_AUTHENTICATED_FULLY')) {

    // 1/ I get data from a form
    // 2/ If user is here he must be logged so no need to check one more time
    // 3/ I create a new Event (Entity Event) + put some file on AWS s3
    // 4/ I create a new Product (Entity Product)
    // 5/ I activate some add-on to my Event (request to an other BDD)

    } else {
        return $app->redirect($app["url_generator"]->generate("login"));
    }
})->bind('product');

As you can see I do almost the same with few difference, so my question : Is to possible to put that logic outside the Controller and use it twice? How should I put that logic outside my Controller?
I don't really know how to do it because I have lot of different things inside :

*

*I use 3 Entity that use 1 database connection (User, Event, Product)

*Those Entities works the same : I have one Class Name with the attributes + getter / setter, one Class NameDAO where I have all my methods (findByEmail($email), find($id), ...) that extends an abstract DAO class (my database connection + one abstract method to return a Class Name)

*Each Class NameDAO have a dedicated service (eg. $app['dao.user'])

*I use an other database connection to activate the add-on

*I use AWS s3 Class to put file on a server

EDIT :
According to the anwser I get I think my question wasn't very clear about my real problem...I had the intuition I need to use Service but I have trouble to build it so :

*

*Should I build ONE big Service that uses multiple services?
OR

*Should I build one service by question and repeat my logic in both my Controller?

As I said before, I already have services $app['user.dao'] and $app['event.dao'] for example that I use to create a new User or a new Event for example, so should I do :
$app->match('/', function (Request $request) use ($app) {
    // 1/ Service 1 to create new user
    // 2/ Service 2 to create new event
    // 3/ Service 3 to create new add-on
    // and so on...

    return $app['twig']->render('home.html.twig');

})->bind('home');

OR
$app->match('/', function (Request $request) use ($app) {
    // Use ONE big service that use all the services I need

    return $app['twig']->render('home.html.twig');

})->bind('home');

END EDIT
As I said it works right now, but I'd like to know if it's possible to mix all this inside one method / function / service that I could use multiple time, could be nice for my future app !
Thanks

A: You can use Services which you add to the Service Container as documented here:
https://symfony.com/doc/current/service_container.html#creating-configuring-services-in-the-container
(check the Symfony version that you are using)


text:
Q: Converting diagnostic code for Autofac from V5 to V6 We use Autofac lifetime scopes significantly enough in our own code that being able to trace the lifetime scopes of various objects as they activate was important enough that I wrote a custom module that would do just that (compiles and works for V5):
    public class LogRequestModule : Module
    {
        public int depth = 0;

        protected override void AttachToComponentRegistration(IComponentRegistry componentRegistry,
                                                              IComponentRegistration registration)
        {
            registration.Preparing += this.RegistrationOnPreparing;
            registration.Activating += this.RegistrationOnActivating;
            base.AttachToComponentRegistration(componentRegistry, registration);
        }

        private string GetPrefix()
        {
            return new string('-', depth * 2);
        }

        private void RegistrationOnPreparing(object sender, PreparingEventArgs preparingEventArgs)
        {
            var lifetimeScopeTag = "*Unknown*";

            if (preparingEventArgs.Context is IInstanceLookup instanceLookup)
                lifetimeScopeTag = instanceLookup.ActivationScope.Tag.ToString();

            Console.WriteLine($"{this.GetPrefix()} {lifetimeScopeTag} {preparingEventArgs.Component.Activator.LimitType}");
            depth++;
        }

        private void RegistrationOnActivating(object sender, ActivatingEventArgs<object> activatingEventArgs)
        {
            var lifetimeScopeTag = "*Unknown*";

            if (activatingEventArgs.Context is IInstanceLookup instanceLookup)
                lifetimeScopeTag = instanceLookup.ActivationScope.Tag.ToString();

            depth--;
            Console.WriteLine($"{this.GetPrefix()} {lifetimeScopeTag} Activating {activatingEventArgs.Component.Activator.LimitType}");
        }
    }

Were attempting to update to V6 and are finding that this code does not compile.
My question is simply how would this be implemented in V6?
Could the new 'System.Diagnostics.DiagnosticSource' class be used to implement the equivalent functionality?
I looked at this document but could not figure out how to access features like the 'LimitType' property nor could I figure out how to handle 'OnPreparing' vs 'OnActivating':
https://autofaccn.readthedocs.io/en/latest/whats-new/upgradingfrom5to6.html?highlight=Activating#

A: It sounds like you may want to either use the new built-in diagnostic listeners added in v6 (https://autofaccn.readthedocs.io/en/latest/advanced/debugging.html#diagnostics), or write your own (https://autofaccn.readthedocs.io/en/latest/advanced/debugging.html#custom-tracers) if you want to capture specific information (like lifetime scope tags).
Adding a diagnostic listener to the resolve path does slow things down slightly; if you need runtime diagnostics that are faster (but less granular), you can probably follow something similar to our log4net example (https://autofaccn.readthedocs.io/en/latest/examples/log4net.html), which should let you port your module to use the pipeline rather than events.


text:
Q: Case Articles Tool in the Sidebar of Case Feed Page Layout I have created a visualforce page (code given below) to show articles related to Case and keyword search for articles. This component is displayed as a sidebar in the case feed page layout.
The sidebar is displayed and works in the Case detail page and edit page. But, when I click the New Case button in the console and choose a record Type, it displays "This component is only supported for Case objects." in the New Case page layout sidebar (both developer and enterprise editions). Any ideas on what's causing this issue?
Visualforce Page
<apex:page standardController="Case">

            Articles Sidebar

        <support:caseArticles caseId="{!case.id}"
                              bodyHeight="auto"
                              attachToEmailEnabled="true"
                              titlebarStyle="none"
                              searchButtonName="Search"
                              searchFieldWidth="200px"
                              defaultSearchType="lastPublished"
                              />

</apex:page>

Case Detail Page

New Case Page Layout (Sidebar Error)

A: This is happening because the  component is looking for a case ID to use. Because it's on a New Case tab there is no ID so it fails. This is the resulting, and somewhat confusing, error message.
If you continue to save the case record the sidebar will refresh and work properly.
I've logged a bug and you can track its status on the Known Issues page
https://success.salesforce.com/issues_view?id=a1p300000008cREAAY