text:
Q: Integral of $\frac1{\cos^n x}$ Hi guys I have already proven for an assignment that:
$$\int\cos(x)^n dx=\frac{1}{n}\cos(x)^{n−1}\sin(x) + \frac{n-1}{n}\int\cos(x)^{n−2}dx$$
Now we have been asked to calculate $$\int_0^{\pi/4}\frac{1}{\cos^4(x)}dx$$ theoretically make $n=-4$, however the expression below will only work for $n\geq2$ right?
Halp please

A: The identity holds unless integer $n\ne0$
First set $n=-2$
$$\int\cos(x)^{-2} dx=\frac{1}{-2}\cos(x)^{-2−1}\sin(x) + \frac{-2-1}{-2}\int\cos(x)^{-2−2}dx$$
$$\iff\frac32\int\cos(x)^{-4}dx=\int\cos(x)^{-2} dx+\frac12\cos(x)^{-3}\sin(x)$$
Now, $$\int\cos^{-2}x\ dx=\int\sec^2x\ dx=\tan x+K$$


text:
Q: Disable everything in view components while invoking Below is My code in one of the view page (Details.Cshtml)
<div id="QAcomp" >
            @await Component.InvokeAsync("QuestionAnswers", new { activityQuestionAnswersList = Model.ActivityQuestionAnswers?.ToList() })
</div>

This above code invokes component question and answers based on the UI values.
My Question now is how to view the components in Details.cshtml page with only readonly or disabled. i mean what ever the content is , it should be disabled . and user should not be able change it.
Can any one help me on this ?
 public async Task<IViewComponentResult> InvokeAsync(IList<ActivityQuestionAnswersModel> activityQuestionAnswersList = null, bool readsonly = false)
    {
        var questions = await _context.FQuestions.AsNoTracking().OrderBy(s=>s.DisplayOrder)

            .ProjectTo<QuestionsViewModel>().ToListAsync();
        ViewData["readonly"] = readsonly;

        return activityQuestionAnswersList == null
            ? View(questions)
            : View("ActivityQuestionAnswers",GetActivityQuesetions(questions, activityQuestionAnswersList));
    }

A: The second parameter to InvokeAsync, which you're already utilizing, is the params that get passed to the InvokeAsync method on your view component. Just as you're already passing in your QA list, go ahead and pass a bool as well, indicating whether it's readonly or not.
public async Task<IViewComponentResult> InvokeAsync(
    List<ActivityQuestionAnswers> activityQuestionAnswersList, bool readonly = false)
{
    ViewData["readonly"] = readonly;
    ...

Then:
@await Component.InvokeAsync("QuestionAnswers", new { activityQuestionAnswersList = Model.ActivityQuestionAnswers?.ToList(), readonly = true })

Then, you can utilize this bool in your view to add the readonly attribute to your inputs:
@{
    var readonly = ViewData["readonly"] as bool? ?? false;
}

...

<input asp-for="Foo" readonly="@readonly">

If @readonly is false or null, Razor will omit the attribute.

A: For ViewComponent, it will be rendered as Html in the web browser. So, if you want disable everything in the ViewComponent, you will need to control the Contoller styles in the ViewComponent.
Without adding disabled on every tags, I suggest you try css to format your view.
You could try to add content below to wwwroot/css/site.css:
#QAcomp {
text-decoration: none;
pointer-events: none;
}

#QAcomp input {
    display: block;
}

If there are some controls not disabled, you could add extra styles to disable them.
Update
gray out
#QAcomp {
text-decoration: none;
pointer-events: none;

}
#QAcomp input {
    display: block;
    background-color: #eee;
}
#QAcomp select {
    display: block;
    background-color: #eee;
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Wordpress tinymce element selector I created a new button in tinymce editor, and I am trying to get the "a"  element from tinymce editor on click, I am using
tinymce.create('tinymce.link_tracking', {
    init : function(editor, url) {
        editor.addButton('link_tracking', {
            title : 'Link tracking',
            type: 'button',
            image : '/assets/img/show.svg',
            onclick : function() {
                content = tinymce.activeEditor.selection.getContent();
                $('#link_tracking').dialog('open');

            }
        });
    }

});

this returns the element if the whole word is selected, but if I set my pointer the the element is returns a empty string, I need the functionality like the link button has.


text:
Q: Is using sessions for single page rich web app an overkill? There is a rich web app with login form. Logged in user should be able to send some post request to server database, which modify database records. How do I track in the server if user has role to add/modify record in server database? Should I send username, password, data to place into db every time user wants to modify db or should I use sessions instead of resending username/password?
Sorry, I haven't used sessions before, so I am not comfortable with them... But as I see they are the way to go in multi page web apps, but will they make my life easier if I use them in one page web app? Or should I just resend username/password on every post request to server database?

A: If you are doing this only for username and password, do them every time. If you are using a standard HTTP authentication type, it does this - it sends the login credentials on every page access. If there is more information you need passed, and this information is to be used repeatedly on multiple accesses to the web page, look at using a per-session cookie instead.
Alternitivley, if it is easier - I have seen some web apps use a session (or longer) cookie for authentication information. In-fact, some Apache modules themselves do this.


text:
Q: Add Featured Image to Custom Post Type I have a plugin that creates a custom post type, named popup. But it does not add the Featured Image Meta Box on the edit page. I can go in the plugin and add it like this.
'supports' => apply_filters( 'popmake_popup_supports', array( 'title', 'editor', 'revisions', 'author', 'thumbnail' ) ),

This works, until the plugin is updated.
In My theme I have added this:
add_theme_support('post-thumbnails', array('post', 'page', 'popup'));

But that does not ad the Meta-Box to the Custom Post Type.
Question: Is it possible to add this feature outside of my plugin, maybe in my functions.php file, so I can update the plugin?
EDIT:
Ended up using the free plugin Advanced Custom Fields, which let med add more then one featured image. http://www.advancedcustomfields.com/

A: Now you are using the right code in functions.php file.It will works.
Please follow my instruction and use below line of code in functions.php file .
Here is the code.
function custom_theme_setup() {
    add_theme_support( 'post-thumbnails', array('post', 'page', 'popup') );
}

add_action( 'after_setup_theme', 'custom_theme_setup');

Now if still not works then please specify the priority of actions.
See here.
Like this :
add_action( 'after_setup_theme', 'custom_theme_setup',2 );


text:
Q: How do I apply a digital filter to points on a sphere Given a set of points on a sphere, how can I implement a higher order low pass filter on them?
At the moment, I am just multiplying the vectors from the input and output set by their weights and summing them, component-wise. While this works well when the angles are small, the filter response isn't right as the angles get larger than 30 degrees. It needs to perfectly compliment the response of a high pass filtered gyroscope, which works with angles, not vectors.
What I'm essentially looking for is an interpolation method for multiple (in my case 8) weighted points on a sphere. The sum of all weights is one. The algorithm needs to be such, that if it were applied to only two vectors $a$ and $b$, with the weights $(1 - t)$ and $(t)$ respectively, a constant rate of change in t would result in a constant angular rate of change in the output. Say, for example we had as our two vectors $a = (1, 0, 0)$ and $b = (0, 1, 0)$, the angle ab is 90 degrees. If we set $t$ to $1/3$, we should expect the result, $c$, to be 30 degrees away from $a$. If we use the standard vector multiplication rules to calculate $c$ as $a*(1 - t) + b*t$, the angle between $a$ and $c$ is closer to 22 degrees. This error gets worse as the angle $ab$ increases. I know that the slerp algorithm exists for just two points, but I need one that works on any number of points.
The problem is that standard linear interpolation between points on a sphere represented as vectors, does not interpolate correctly when you look at the angles.

A: I once researched the literature on related topics for an internal company report, but I no longer work at that company and I can't remember all the references. One which would at least serve as a good starting point is
Samuel R. Buss and Jay Fillmore
Spherical Averages and Applications to Spherical Splines and Interpolation
ACM Transactions on Graphics 20 (2001) 95-126.
In fact, skim-reading it I recognise that their spherical average is the one we ended up using, so you can consider this a recommendation.

A: I don't think you've actually specified the behaviour you want for more than two vectors. In that case, there's no obvious way to represent the vectors in terms of angles between them. One way to attempt to generalize your specification for two vectors would be to require that the interpolation works as if it were done two vectors at a time. Unfortunately, that doesn't work because the result would depend on the order in which you use the vectors.
For instance, take the three vectors $(1,0,0)$, $(0,1,0)$, $(0,0,1)$ and combine them with weight $1/3$ each. By symmetry, the result must be $(1,1,1)/\sqrt3$. If we do this two vectors at a time, we can first combine $(1,0,0)$ and $(0,1,0)$ with equal weight to get $(1,1,0)/\sqrt2$. For this to work, we should then get $(1,1,1)/\sqrt3$ by combining $(1,1,0)/\sqrt2$ and $(0,0,1)$ with weights $2/3$ and $1/3$, respectively. We don't however, as you can see by calculating the cosines of $(1,1,1)/\sqrt3$ with those vectors, which are $\sqrt{2/3}$ and $\sqrt{1/3}$, respectively, corresponding to angles of about $35.3^\circ$ and $54.7^\circ$, respectively, and not $30^\circ$ and $60^\circ$ as they would have to be.
So this isn't a well-defined problem so far, and I don't see how to naturally turn it into one.
[Edit:]
I'm wondering from your comment whether perhaps you're only interested in vectors that all lie on a great circle and don't care what the algorithm does otherwise. In that case, you could find the vector most nearly orthogonal to all the vectors, which is the eigenvector of the coordinate covariance matrix $\sum_ix_{i\alpha}x_{i\beta}$ with least eigenvalue, rotate that into the $z$ axis, find the polar coordinates $\theta_i,\phi_i$ of the vectors in the rotated system, take the weighted average of the $\theta$ values, do whatever you want with the $\phi$ values as if they were angles on a circle, and rotate the result back. If your vectors all lie on a great circle, they'll get rotated onto the equator and their $\phi$ angles will behave as you want them to.
Note that this will fail in the above example, since those three vectors would have $\phi$ values $2\pi/3$ apart, and there would be no sensible way to average those; so this is really only a solution for the case where the vectors approximately lie on a great circle and are concentrated in one half of it.


text:
Q: Page navigation in asp.net I have a asp.net web page where i will navigate pages on the click of the "Next" button
Page1 will got to Page 2 and then page 3 and page4
But in a selection of dropdown in page 1 it decides page 2 should go to page 3 or page 4
How can i know where they set this page navigation? if suppose i need to change the navigation order?

A: Perhaps you should consider the ASP.NET Wizard control.
Here are some links that can help you use it:
4guysfromrolla
ScottGu's blog
In a nutshell, the wizard control allows you to designate a discrete set of steps users need to follow. It allows for logic to programmatically decide what to display to the user based on previous choices
Hope this helps!

A: There is an event handler associated with the dropdown.  Typically the dropdown control is binded to a method declared in the code behind.
<asp:DropDownList ID="ddlTest" runat="server" onselectedindexchanged="ddlTest_SelectedIndexChanged" />

...
protected void ddlTest_SelectedIndexChanged(object sender, EventArgs e)
{
  // do some stuff here...
}

There might also be a client side (JavaScript) event handler associated with the control.

A: This is what I understand:
Page 1 sets a drop-down value, navigates to Page 2
Page 2 reads the drop-down value from Page 1 and decides to go to Page 3 or 4 based on that
In your postback method on Page 1, you can read the value set in your drop-down and pass it to page 2.  Store that value on page 2, and use it in the postback method of page 2 to decide which next page to navigate to.


text:
Q: Asp Mvc3 webgrid Paging and Filtering by ajax I Have a little problem with WebGrid control for Asp.Net MVC3. What I want is to perform a search view using ajax and webgrid; something like this:
Search Criteria  ______________________________
Subject: _____
Task Type: _____
SUBMIT SEARCH

WebGrid withPaging
.
When I click the button search it call the HTTPost action by ajax and apply the search criteria; however when I try to do paging it goes to the HTTPGet action; in this way, the filter according to the search criteria doesn't execute.
I put the grid inside a partial view; there is the code:
    @model IEnumerable<MVC3.Models.Task>
@{
    var grid = new WebGrid(null, rowsPerPage: 2, canPage: true, canSort: true, ajaxUpdateContainerId: "myGrid");
    grid.Bind(Model, rowCount: 3, autoSortAndPage: true);
    grid.Pager(mode: WebGridPagerModes.All);
    @grid.GetHtml(
    columns: grid.Columns(
            grid.Column(format: (item) => Html.ActionLink("Assign Notifications", "AssignNotifications", new { id = item.TaskId })),
            grid.Column(format: (item) => Html.ActionLink("Edit", "Edit", new { id = item.TaskId })),
            grid.Column(format: (item) => Html.ActionLink("Delete", "Delete", new { id = item.TaskId })),
            grid.Column("Subject"),
            grid.Column("Comment"),
            grid.Column(columnName: "Status", header: "Status", format: (item) => item.TaskStatu.Name),
            grid.Column(columnName: "StartDate", header: "Start Date", format: (item) => item.StartDate.ToString("MM/dd/yyy")),
            grid.Column(columnName: "Deadline", header: "Dead Line", format: (item) => item.Deadline.ToString("MM/dd/yyy"))
            )
    );
}

And my Index view looks like:
@model MVC3.ViewModel.TaskSearchViewModel
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

    Task Index

@using (Ajax.BeginForm(new AjaxOptions { InsertionMode = InsertionMode.Replace, UpdateTargetId = "myGrid" }))
{

        <fieldset>
            <legend>Search criteria</legend>

                        @Html.LabelFor(x => x.Subject)

                        @Html.TextBoxFor(x => x.Subject, new { style = "width: 255px;" })

                        @Html.LabelFor(x => x.TaskTypeId)

                        @Html.DropDownListFor(x => x.TaskTypeId, Model.GetTaskTypesSelectList(), "Select", new { style = "width: 260px;" })

                        @Html.LabelFor(x => x.ResponsableId)

                        @Html.DropDownListFor(x => x.ResponsableId, Model.GetResponsablesSelectList(), "Select", new { style = "width: 260px;" })

                        @Html.LabelFor(x => x.StatusId)

                        @Html.DropDownListFor(x => x.StatusId, Model.GetStatusSelectList(), "Select", new { style = "width: 260px;" })

        </fieldset>

    @Html.Hidden("page")
    <input id="btnSearch" type="submit" value="Search" />
}

    @Html.Partial("_TaskSearchResult", Model.ResultTask)

@Html.ActionLink("Create new Task", "NewTask")

So if anyone know how to solve my problem I'll be grateful.
Greeting
Arturo

A: Seeing as the grid generates an onclick call for each pager item (and column header) couldn't you just use jQuery to replace default values with a call to an Ajax method that passes the form back?

A: I think it's because you're replacing the grid each time you click the next page link. Maybe use it something like this:
@model IEnumerable<MVC3.Models.Task>
@{
    var grid = new WebGrid(null, rowsPerPage: 2, canPage: true, canSort: true, ajaxUpdateContainerId: "myGrid");
    grid.Bind(Model, rowCount: 3, autoSortAndPage: true);
    grid.Pager(mode: WebGridPagerModes.All);

    @grid.GetHtml(
    columns: grid.Columns(
            grid.Column(format: (item) => Html.ActionLink("Assign Notifications", "AssignNotifications", new { id = item.TaskId })),
            grid.Column(format: (item) => Html.ActionLink("Edit", "Edit", new { id = item.TaskId })),
            grid.Column(format: (item) => Html.ActionLink("Delete", "Delete", new { id = item.TaskId })),
            grid.Column("Subject"),
            grid.Column("Comment"),
            grid.Column(columnName: "Status", header: "Status", format: (item) => item.TaskStatu.Name),
            grid.Column(columnName: "StartDate", header: "Start Date", format: (item) => item.StartDate.ToString("MM/dd/yyy")),
            grid.Column(columnName: "Deadline", header: "Dead Line", format: (item) => item.Deadline.ToString("MM/dd/yyy"))
            )
    );

}


text:
Q: \copy PSQL command not working with POINT(...) geometry type I have been trying to find the solution for quite a while...
The \copy command in Postgres is not working with the datatype geography(Point,4326).
The error it gives is:
ERROR:  parse error - invalid geometry
HINT:  "ST" <-- parse error at position 2 within geometry
CONTEXT:  COPY data2, line 1, column loc: "ST_GeomFromText('POINT(62.0271954112486 87.9028962135794)')"

Here is the command I am using:
\copy data2(loc,d1,d2,d3,d4,d5,d6,d7,d8,d9,d10) from 'fake_data.csv' delimiter ',' csv;

I have inserted into the table using the exact same format as the csv file and it has been successful. It seems it is just something with the \copy command that doesn't like the format.
Here is an example row from my csv file:
ST_GeomFromEWKT('SRID=4326;POINT(28.872109890126964 160.10529558104636)'),24.237968,129.512386,227.032799,27.644993,60.959401,25.178026,201.229746,34.178728,250.975993,3.635878

A: You cannot use COPY to process an expression like this. Rather, the file has to contain the extended well-known binary (EWKB) format, which is what you get when you run
SELECT ST_GeomFromEWKT('SRID=4326;POINT(81.5538863138809 42.72341176405514)');

In your case, the CVS file will have to look like this:
0101000020E61000000C9D009842DF3C403DA0D6945E036440,24.237968,129.512386,227.032799,27.644993,60.959401,25.178026,201.229746,34.178728,250.975993,3.635878


text:
Q: Store 3 nearest coordinates I have an XML file that contains a number of points with their longitude and latitude.
My python code at the moment gets the nearest point by simply looping through the XML file, finding the nearest, in miles or whatever, then comparing it with the previous closest point. If its nearer then I assign the variable the value of this new point. So everything is working in that regard.
Now, what I want to do is actually store the closest 2 or 3 points.
How do I go about doing this? The XML file isn't ordered by closest, and besides, the users location will change each time a request is made. Can I do this with an XML file or will I perhaps have to look into storing the data is SQL Server or MySQL?
Thanks for the help.
PS, the sample code is available here if anyone is interested. This is part of a college project.

A: Here's a solution that will work for any number of points:
closest = points[:NUM_CLOSEST]
closest.sort()
for point in points[NUM_CLOSEST:]:
    if point.distance < closest[-1].distance:
        closest[-1] = point
        closest.sort()

Obviously, a bit pseudo-cody.  The sort() calls will probably need an argument so they are sorted in a useful way, and you'll probably want a function to calculate the distance to replace the distance member.

A: You should store in a list of tuples (for example) all the point pairs and their distances as you parse de xml file.
mypoints = [(distance12, x1, x2),...,(distancenm, xn, xm)]
mypoints.sort()
three_closer = mypoints[:3]

Adapting this to your code:
..............
mypoints = []
for row in rows:
     # Get coords for current record
     curr_coords = row.getAttribute("lat") + ',' + row.getAttribute("lng")
     # Get distance
     tempDistance = distance.distance(user_coords, curr_coords).miles
     mypoints.append((tempDistance, row))

mypoints.sort()
#the three closest points:
mythree_shorter = mypoints[0:3]
for distance, row in mythree_shorter:
    shortestStation = json.dumps(
                            {'number': row.getAttribute("number"),
                             'address': row.getAttribute("address"),
                             'lat': row.getAttribute("lat"),
                             'lng': row.getAttribute("lng"),
                             'open': row.getAttribute("open")},
                             sort_keys=True,
                             indent=4)
    save_in_some_way(shortestStation)   #maybe writing to a file?
..................


text:
Q: Google Compute engine and no files in bucket I have a client and whoever designed their site put it in Compute Engine.  I am totally lost, no clue about this.  I do see a bucket but there is only a footer.php in it.  The site is a multi wordpress and I can not find where the files are stored or how to access phpmyadmin to see the database.
I ask this because the site is having many issues, starting with ssl expired, php is out of date and now I can not login or see the site because it is giving a 500 error or white page of death.
Tried to find what caused the error but nothing.
Site is http://nextstudy.org
Can anyone help or direct me on what I can do to get to the files and maybe get it off of compute engine?
Appreciate you reading this............
Diana

A: GCE does not host files from a bucket, but it runs VM instances off disk images.
Unless being assigned an admin role in Cloud IAM, there's probably not much to do. And even with an admin role granted, it's still rather risky when having no clue, I mean, while it's only a single instance, Cloud Shell might help, but when it's an instance group, the deployment may work whole different (up until the point where the servers are spun up from nothing but a shell script, which subsequently makes editing individual instances quite meaningless).


text:
Q: Show, that ${\rm M}(n,\mathbb{K})={\rm S}(n,\mathbb{K})\oplus {\rm T}(n,\mathbb{K})$
The set ${\rm M}(n,\mathbb{K})$ of the $n\times n$ matrices over the field $\mathbb{K}$ together with the matrix addition and the scalar matrix multiplication form a vector space. An $n\times n$-matrix $A$ with the entries $a_{ij}\; 1\leq i,j\leq n$, means symmetrical, if for all $1\leq i\leq j\leq n$ applies that $a_{ij} = a_{ji}$. A matrix is called skew-symmetric, if for all $1\leq i\leq j\leq n$ it applies that $a_{ij} = -a_{ji}$. Let ${\rm S}(n,\mathbb{K})$ be the set of symmetric $n\times n$ matrices over $\mathbb{K}$ and ${\rm T}(n,\mathbb{K})$ be the set of skew symmetric $n\times n$ matrices over $\mathbb{K}$.

Show, that ${\rm M}(n,\mathbb{K})={\rm S}(n,\mathbb{K})\oplus {\rm T}(n,\mathbb{K})$
Does the $\oplus$  mean the addition over $\mathbb{K}$ or the direct sum?
EDIT:
Could I use the $\dim$ formula too? I already determined the dimension of skew symmetric matrices and symmetric matrices which are $\frac{n^2-n}{2}$ and $\frac{n^2+n}{2}$. The dimension of the set of all matrices is $n\cdot n = n^2 $ Because $\frac{n^2-n}{2}+\frac{n^2+n}{2}=n^2$ we can assume, that ${\rm M}(n,\mathbb{K})={\rm S}(n,\mathbb{K})\oplus {\rm T}(n,\mathbb{K})$ Therefore, $\dim({\rm S}\cap {\rm T})=0\implies {\rm S}\cap {\rm T} =\{0\}$

A: The notation says that any $n \times n$ matrix can be written uniquely as $S+T$ where $S$ is a symmetric matrix and $T$ is a skew symmetric matrix. To show this define $s_{ij}=\frac {m_{ij}+m_{ji}} 2$ and $t_{ij}=\frac {m_{ij}-m_{ji}} 2$. You can verify that this gives the desired form. If We have two such representations $M=S+T=M_1+T_1$ then $S-S_1=T_1-T$. Use the fact that if  a matrix is symmetric as well as skew symmetric then it is the zero matrix to show that $S=S_1$ and $T=T_1$. [$T_1-T$ is symmetric and $S-S_1$ is skew symmetric].


text:
Q: Select specific columns from table in SQLAlchemy I'm trying to select specific columns from a table like this:
users = Table('users', metadata, autoload=True)
s = users.select([users.c.email])
results = s.execute()
print results

and I'm getting this error:
> Traceback (most recent call last):   File "my_mailer.py", line 35, in
> <module>
>     s = users.select([users.c.email])   File "/task/__pips__/sqlalchemy/sql/selectable.py", line 175, in select
>     return Select([self], whereclause, **params)   File "/task/__pips__/sqlalchemy/sql/selectable.py", line 2082, in __init__
>     self._whereclause = _literal_as_text(whereclause)   File "/task/__pips__/sqlalchemy/sql/elements.py", line 2745, in
> _literal_as_text
>     "SQL expression object or string expected." sqlalchemy.exc.ArgumentError: SQL expression object or string
> expected.

So I tried this:
users = Table('users', metadata, autoload=True)
s = users.select('email')
results = s.execute()
print results

And got this in response:
> Traceback (most recent call last):   File "my_mailer.py", line 36, in
> <module>
>     results = s.execute()   File "/task/__pips__/sqlalchemy/sql/base.py", line 124, in execute
>     return e._execute_clauseelement(self, multiparams, params)   File "/task/__pips__/sqlalchemy/engine/base.py", line 1605, in
> _execute_clauseelement
>     return connection._execute_clauseelement(elem, multiparams, params)   File "/task/__pips__/sqlalchemy/engine/base.py", line 761,
> in _execute_clauseelement
>     compiled_sql, distilled_params   File "/task/__pips__/sqlalchemy/engine/base.py", line 874, in
> _execute_context
>     context)   File "/task/__pips__/sqlalchemy/engine/base.py", line 1023, in _handle_dbapi_exception
>     exc_info   File "/task/__pips__/sqlalchemy/util/compat.py", line 185, in raise_from_cause
>     reraise(type(exception), exception, tb=exc_tb)   File "/task/__pips__/sqlalchemy/engine/base.py", line 867, in
> _execute_context
>     context)   File "/task/__pips__/sqlalchemy/engine/default.py", line 388, in do_execute
>     cursor.execute(statement, parameters) sqlalchemy.exc.ProgrammingError: (ProgrammingError) argument of WHERE
> must be type boolean, not type character varying LINE 3: WHERE email

Sure enough, the first argument here is the 'whereclause', not 'columns' like everywhere else, this is reflected in the documentation:

This argument is not present on the form of select() available on
  Table.

Question: how can I select only specific columns using select on the table? And generally, why on earth the columns argument is not available on select on the table? I can't understand why somebody made the decision to make this different than the standard select.

A: Use general purpose select instead of Table.select:
stmt = select([users.c.email])
result = conn.execute(stmt)

A: With metadata you can do this:
metadata = MetaData(bind=engine)
tblusers = metadata.tables['users']
tblproducts = metadata.tables['products']
# example 1: only columns you want.
data_users = tblusers.select().with_only_columns([tblusers.c.id, tblusers.c.name]).execute()
# example 2: w/ where & order_by
data_products = tblproducts.select().with_only_columns([tblproducts.c.id, tblproducts.c.price, tblproductos.c.description]).where(tblproducts.c.stock > 0).order_by(tblproducts.c.brand).execute()

Be well...
SqlAlchemy Docs


text:
Q: Placement of the Autofac Module class in a solution I have been reading a lot of sample code for DI and autofac. One thing I noticed was that many people bundle the interfaces and implementations in the same project. From design point, I believe this is not correct and all interfaces should be in separate assembly. So I define my projects like this:
UI - Web App/Windows App/Both
  - Views
  - Models
  - Controllers/ ViewModels
Business
  - Services/Processes
  - Interfaces
  - Model
DataAccess
  - Repositories & UoW
  - Interfaces
  - Model
This way, my business services refer only to DataAccess interfaces and models but stay independent of actual implementation. Same way, the UI also refers to only business interfaces and model and there is clear separation. This also helps me in testing where I can independently test the layer.
My question is for Autofac Module declaration. I need to set up my build to copy the implementations into final deployment directory. My business modules need to refer to data access implementation and UI needs to access business modules.

*

*How should I handle this chain of dependencies in modules?

*Where should I place the module classes and how should startup code
discover all the modules in easiest possible manner?

I am considering Autofac's assembly scanning but not sure if that is only option. Also note that I am already following naming convention and in most cases, I am not going to write individual bindings.
My concern here is that

*

*since the projects referencing interfaces are unaware of implementations, I cannot write any specific bindings in the calling assembly such as the UI root assembly.

*Some sources talk about keeping the assemblies clean of any DI implementations and having separate assemblies for modules. Is that a good approach for all types of applications? (E.g. enterprise LOB app or Web App vs and ISV desktop app distributed to many independent users)

A: My opinion is that having interfaces and implementations in separate assemblies is overdoing it and doesn't provide value, because you'll have to deploy both assemblies for your project to work. I like to refer to this tweet from Paul Stovell where he states that namespaces are units of concerns whereas assemblies are units of deployment. I find this resonates a lot with me.
Back to your question: at the end of the day, your executable project (web app or Windows app) needs to know be aware of both the interfaces and the implementations.
My opninion is that the Autofac modules should live in the top-level project, hence it should have references to all the necessary projects. My reasoning behind this is that in addition to defining the service registrations, you'll also define the lifetime for each of them. That notion is dependent on the project that uses your dependencies; a web project might have somes services registered per HTTP request while a Windows app could have different lifetimes.
To me, modules are a great to group registrations together, but it doesn't mean they need to live in the same project as the services it contains registrations for.


text:
Q: Prove it is impossible for every male to be paired with their last choice in the stable marriage algorithm (male proposing) I'm trying to prove that it is impossible for every man to be paired with their last choice in the stable marriage algorithm.
I have a general idea of how to approach it, which is:
Suppose there exists a stable pairing T in which every man is paired with his least favorite woman, also suppose it took K days for the algorithm to halt. This means that on every day before the Kth day every man had been rejected by every woman. However, it is impossible for every woman to reject every n-1 men. If the algorithm halts on the Kth day then there has to be at least one woman who has not yet received a proposal on the K-1th day. Therefore, on the last day there is a woman who receives only one proposal and cannot reject it. Consequently, such stable pairing T does not exist.
Is this logically correct? I know I probably need to refine it a bit.

A: Suppose there is such a pairing for $n$ pairs of men and women. Let $d$ be the earliest round when there is a man to pair with his woman of his last choice. One of such men is thus rejected by his more favored $n-1$ women who having ever been proposed to are all engaged by the $d-1$'th round. All the other men are by this reason engaged. The woman of his last choice has not ever been proposed to by any man by the $d-1$'th round. Otherwise she would have been engaged by then and all women would have been engaged and the algorithm ends on round $d-1$ which is impossible. On round $d$ only that man is left to propose. He proposes to that woman. Since that woman is not engaged, it does not affect all the pairings having already formed by round $d-1$. Round $d$ is thus the ultimate round. All the other $n-1$ men favor the women they are paired to more than this woman last proposed to. We have a contradiction.


text:
Q: Remove (custom) spells from character One's magic book can get awfully busy if one buys all available spells and/or make your own. Can one remove spells that have become unwanted for one reason or another? I'm particularly interested in removing unwanted custom spells.

A: Deleting spells is not possible in vanilla game, however, there are mods and console commands to allow this.
First, here is a mod that will allow you to delete spells (custom spells included) with delete key.
http://oblivion.nexusmods.com/mods/23069
If you do not wish to use mods, you need to use console tools.
To enable the console, make sure the bAllowConsole is set to 1 in your oblivion.ini file. The console can then be accessed in-game by toggling the 'tilde key' (the actual key can be ~, º, ¬, |,^, \, §, etc.. depending on your keyboard layout), found near the "1" key on most keyboards. The console prompt will appear in the lower left-hand corner of your screen. You can scroll the console output using the "Page Up" and "Page Down" keys. The console is not case sensitive: entering any of "tdt" or "TDT" or "TdT" will toggle the debugging text.
Note: Removing the spells as described below will remove them from your list of spells, but you can not create new spells with names similar to those you have removed (you will still get the error message A spell with this name already exists). If you create a spell and realize you made an error, you can not remove it and create a correct one with the same name.
For default ingame spells use command: player.removespell [Form ID]
For example, to remove the spell Calming Touch, which has Form ID 000A97CA, you must write this in the console: player.removespell 000A97CA
You will then get a confirmation message saying "Spell 'Calming Touch' removed from "
Note: You should not remove the default player healing spell (aka DefaultPlayerSpell, aka "Heal Minor Wounds") -- this spell is treated specially by the game as the fall-back spell after the player casts a scroll based spell. If you don't like the spell, then use TESCS (The Elder Scrolls Construction Set) to redefine it to do something innocuous -- e.g., turn it into a lesser power which raises your mercantile by one point for one second.
For full list of Spell IDs, see this page:
http://www.uesp.net/wiki/Oblivion:Spells
Removing custom spells works just the same way, but finding the Form ID is a bit trickier.

*

*Create a custom save in-game by using the console command "save
savename 1", where savename can be anything you like.

*Go to your savegame directory (My Documents\My Games\Oblivion\Saves)
and look for savename.ess.txt

*In this text file, search for "SPELs", you should be able to find
your custom spell in a section that looks like this:
SPELs:
FF00470B   108 00000000  0 Custom Spell                      -
FF00470D   103 00000000  0 Unwanted Custom Spell             -
(...)

*Now you have the Form ID. Back in the game, the console command
"player.removespell FF00470D" will delete "Unwanted Custom Spell".

For versions of Oblivion not using the latest patch, try using this method:

*

*Go to your Oblivion installation directory (by default C:\Program
Files\Bethesda Softworks\Oblivion) and locate the file
LevelUpData_1.txt. This contains information about your characters'
statistics when you level up.

*Open it in Wordpad, not in Notepad.

*The thing we are looking for here are the spells, which can be found
far right. Locate your character, pick the appropriate level and
scroll right. Now you will see all of the spells, powers etc. you
had when you reached that level. The Form ID can be found in a
parentheses after the spell name.

*If you want to remove some spells you have created your current
level (the level you are playing), it has not yet been recorded in
this text file. Go back to your game, save it, and type advlevel in
the console to force a level-up. Now open the text file again, and
you'll find the spells (with their Form ID) at the latest level. Go
back to the game, load the save before you leveled (unless you want
to cheat) and remove the spells.

Source(s):

*

*http://www.uesp.net/wiki/Oblivion:Console

*http://www.uesp.net/wiki/Oblivion:Spells

A: The mod I use to to hide/delete spells is Clean Spellbook. It also allows you to manage your spells.

With proceeding play time more and more spells are added to the spellbook, but not depending on whether you have use for them or not and there's no way to get rid of them. At worst the spell book is that clogged with spells you have trouble finding your preferred ones.
That's where this plugin steps in: It adds a spellbook to the game that sorts your spells by school. Also you can make your character 'forget' one single spell, all spells belonging to a certain category or even all spells in the player's spellbook. These forgotten spells won't be deleted. They are stored (you might say 'written down in the spellbook') and can be restored at any time. They are marked with a '(Hidden)' in the line after their name.


text:
Q: Time Complexity of substr inside a Recursive Function
In the function below, the time complexity of substr() is O(n) which is inside the recursive function and the recursive call being O(n), will the time complexity of the entire block be O(n^2) then?

void replacePi(string s) {
    if(s.length() == 0) {       // base case
        return;
    }
    if(s[0] == 'p' && s[1] == 'i') {
        cout << "3.14";
        string remaining = s.substr(2); //remaining substring
        replacePi(remaining);
    } else {
        cout << s[0];
        replacePi(s.substr(1));
    }
}

A: Your function replacePi is taking a string length of either n-2 or n-1 for n number of times. So if you have a string of length n - then the complexity would be :
o(n * ((n-2) or (n-1)))
=> o(n * n)
=> o(n^2)


text:
Q: What is the difference between ProjectionTransformMatrix of VTK and GL_PROJECTION of OpenGL? I am having profound issues regarding understanding the transformations involved in VTK. OpenGL has fairly good documentation and I was of the impression that VTK is verym similar to OpenGL (it is, in many ways). But when it comes to transformations, it seems to be an entirely different story.
This is a good OpenGL documentation about transforms involved:
http://www.songho.ca/opengl/gl_transform.html
The perspective projection matrix in OpenGL is:

I wanted to see if this formula applied in VTK will give me the projection matrix of VTK (by cross-checking with VTK projection matrix).
Relevant Camera and Renderer Parameters:
camera->SetPosition(0,0,20);
camera->SetFocalPoint(0,0,0);
double crSet[2] = {10, 1000};
renderer->GetActiveCamera()->SetClippingRange(crSet);
double windowSize[2];
renderWindow->SetSize(1280,720);
renderWindowInteractor->GetSize(windowSize);
proj = renderer->GetActiveCamera()->GetProjectionTransformMatrix(windowSize[0]/windowSize[1], crSet[0], crSet[1]);

The projection transform matrix I got for this configuration is:

The (3,3) and (3,4) values of the projection matrix (lets say it is indexed 1 to 4 for rows and columns) should be - (f+n)/(f-n) and -2*f*n/(f-n) respectively. In my VTK camera settings, the nearz is 10 and farz is 1000 and hence I should get -1.020 and -20.20 respectively in the (3,3) and (3,4) locations of the matrix. But it is -1010 and -10000.
I have changed my clipping range values to see the changes and the (3,3) position is always nearz+farz which makes no sense to me. Also, it would be great if someone can explain why it is 3.7320 in the (1,1) and (2,2) positions. And this value DOES NOT change when I change the window size of the renderer window. Quite perplexing to me.
I see in VTKCamera class reference that GetProjectionTransformMatrix() returns the transformation matrix that maps from camera coordinates to viewport coordinates.
VTK Camera Class Reference
This is a nice depiction of the transforms involved in OpenGL rendering:

OpenGL Projection Matrix is the matrix that maps from eye coordinates to clip coordinates. It is beyond doubt that eye coordinates in OpenGL is the same as camera coordinates in VTK. But is the clip coordinates in OpenGL same as viewport coordinates of VTK?
My aim is to simulate a real webcam camera (already calibrated) in VTK to render a 3D model.

A: Well, the documentation you linked to actually explains this (emphasis mine):

vtkCamera::GetProjectionTransformMatrix:
Return the projection transform matrix, which converts from camera
  coordinates to viewport coordinates. This method computes the aspect,
  nearz and farz, then calls the more specific signature of
  GetCompositeProjectionTransformMatrix

with:

vtkCamera::GetCompositeProjectionTransformMatrix:
Return the concatenation of the ViewTransform and the
  ProjectionTransform. This transform will convert world coordinates to
  viewport coordinates. The 'aspect' is the width/height for the
  viewport, and the nearz and farz are the Z-buffer values that map to
  the near and far clipping planes. The viewport coordinates of a point located inside the frustum are in the range
  ([-1,+1],[-1,+1], [nearz,farz]).

Note that this neither matches OpenGL's window space nor normalized device space. If find the term "viewport coordinates" for this aa poor choice, but be it as it may. What bugs me more with this is that the matrix actually does not transform to that "viewport space", but to some clip-space equivalent. Only after the perspective divide, the coordinates will be in the range as given for the above definition of the "viewport space".

But is the clip coordinates in OpenGL same as viewport coordinates of
  VTK?

So that answer is a clear no. But it is close. Basically, that projection matrix is just a scaled and shiftet along the z dimension, and it is easy to convert between those two. Basically, you can simply take znear and zfar out of VTK's matrix, and put it into that OpenGL projection matrix formula you linked above, replacing just those two matrix elements.


text:
Q: Laravel eloquent: how to use "where" when receive multiple ID? Assume I want to build a music playList page. Each of the playlist's item have music_name and album_picture.

something like this
But both music_name and album_picture are coming from different tables (etc. music, album ) and use album_id as key for one-to-many relationship.
How can I get those data in laravel?
I know that I can do the following, when I only need "one" :
$music = Music::where('album_id', $request->query('album_id'))->get();
$album = Album::where('album_id', $request->query('album_id'))->get();

But Now I need a play list, so I got "multiple" album_id.
Any Idea how to do this?

my table looks like:

music:

id, album_id, name, length, source, created_at, updated_at
album:
id, name, picture, year, description, author, created_at, updated_at

A: $data = Model::whereIn('album_id', $album_ids_array)->get();

A: You should try this:
$album = DB::table('album')
           ->select('album.picture as album_picture','music.name as music_name')
           ->leftJoin('music','album.id','=','music.album_id')
           ->get();

A: I think the best way is using relationships in your models, in this case you can create two models(music and album)
then in your music model add the next function
public function album(){
    return $this->belongsTo('App\Album');
}

and next in your controller you can do something like
$music = Music::with('album')->find(put_here_music_id);

You may also call the find method with an array of primary keys
$musics = Music::with('album')->find([1,2,3]);

and it will return a collection from music with their album.
Don't forget to add in your controller
use App\Music;

More about relationships
https://laravel.com/docs/5.5/eloquent-relationships#one-to-many


text:
Q: Ubuntu 16.04.2 LTS won't allow incoming ssh connections Going on a few days now I cant SSH into my Ubuntu 16.04.2 LTS server. Everything else is working fine as far as I can tell (it serves a few websites and they're all online no prob). When I try to SSH into it, I get a timeout. I'm using password authentication for now, which I have enabled in sshd_config.
I've tried everything I can think of:

*

*Completely reinstalled openssh-server

*Disabled UFW

*Flushed iptables and set it to ALLOW all incoming AND outgoing traffic

*Restarted the server a few times

*Restarted SSHd a few times and reloaded its config

What else can I try? I'm leaning towards just reinstalling the whole dang server, but that would mean backup and re-install a few websites that it runs as well..
Edit: After reading your comments:
relevant netstat -atnp output:
tcp    0    0    0.0.0.0:**port**    0.0.0.0:*    LISTEN    24268/sshd
tcp6    0    0    ::**port**    ::*    LISTEN    24268/sshd

Nothing else is listening on the same port; disabling ufw still doesn't change anything.
ssh command:
ssh user@server -p port

@tatsu: don't know how I could possibly do this wrong, but maybe I'm missing something. I'm using the right username, server address (also tried IP directly) and port.
ssh -vvv output (edited server & local info out for security reasons):
debug1: Reading configuration data **path to user-specific config**
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 20: Applying options for *
debug1: /etc/ssh/ssh_config line 56: Applying options for *
debug2: resolving "**server**" port **port**
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to **server** [**ip address**] port **port**.
debug1: connect to address **ip address** port **port**: Operation timed out
debug1: Connecting to **server** [**ip address**] port **port**.
debug1: connect to address **ip address** port **port**: Operation timed out

I think it is some kind of firewall or something that I'm not aware of in Ubuntu 16.04 LTS. I'm running the same exact config (not just ssh but just about everything) on a Ubuntu 14.04 LTS server and all is smooth there.
Also: I can SSH into all my other servers just fine. I can't SSH into this one using my laptop, a tunnel on one of my other servers, a friend's iMac or my phone on a 4G connection. So... I'm pretty sure the problem is with the server, not my methods or commands.
I have also asked the hosting company that provide the hardware for my server and they can't get it connected on the SSH port either, but are not blocking anything on their end.
Some other things I've tried in the meantime:

*

*Changed the SSH port

*Installed another SSH server package (changed nothing; reinstalled openssh-server)

*A few more restarts/reboots

*telnet   also times out

Any more ideas/things I can try?

A: Not a satisfying answer at all, but I managed to fix this. I completely uninstalled UFW and then it started working. Must have been a botched install or something. I reinstalled UFW and all is still working fine.


text:
Q: How to read a data from excel file and store into variable? I want to read a data from excel file and store into variable i also want to read index of excel file.I don't no how to do this.so please show the your example in c++ code.

A: Excel files are quite hard to read with C++.  They are stored as a binary file and need to be properly read and interpreted by your code.
There are libraries out there to do this. Maybe check this post out


text:
Q: getting bits out of a 32bit unsigned integer using bitshift in go lang I have a 32bit unsigned integer and I want to divide it in 3 uint16 values. I want first 15bits, then 2 bits and then last 15 bits.
I am trying something like -
val >> 17
val >> 2
val >> 15

apart from first value, other 2 are not right and I know that but now able to figure out how to fix that?
Go play ground

A: For example,
package main

import "fmt"

func decode(bits uint32) (uint16, uint16, uint16) {
    // first 15bits, then 2 bits and then last 15 bits.
    const mask2 = ^uint32(0) >> (32 - 2)
    const mask15 = ^uint32(0) >> (32 - 15)
    b1 := uint16(bits >> (32 - 15))
    b2 := uint16(bits >> (32 - 15 - 2) & mask2)
    b3 := uint16(bits & mask15)
    return b1, b2, b3
}

func main() {
    b := uint32(4628440)
    b1, b2, b3 := decode(b)
    fmt.Printf("%032b %015b %02b %015b\n", b, b1, b2, b3)
    fmt.Printf("%d %d-%d-%d\n", b, b1, b2, b3)
}

Output:
00000000010001101001111111011000 000000000100011 01 001111111011000
4628440 35-1-8152

A: A helper function to extract a range of bits makes this easy to understand (and test).
package main

import "fmt"

// extractUint16 extracts n bits of a from the given offset.
func extractUint16(a uint32, offset, n uint) uint16 {
    return uint16((a >> offset) & (1<<n - 1))
}

func main() {
    input := uint32(4628440)
    a := extractUint16(input, 17, 15)
    b := extractUint16(input, 15, 2)
    c := extractUint16(input, 0, 15)
    fmt.Println(a, b, c)
}


text:
Q: Flutter: show a loading widget only if it's still loading after n seconds I have a simple Loading widget that I display when I'm getting data from Firestore. I use Stateful widgets with a variable called _isLoading which is usually set to false but changes to true while I'm getting data, and if _isLoading == true I show the Loading widget.
setState(() {
   isLoading = true;
});

await someFunctionToUpdateData();

setState(() {
   isLoading = false;
});
.
.
.
// somewhere in the Build method
_isLoading ? Loading() : MainWidgetWithData()

This works perfectly fine but I'm finding that often the data comes back very quickly, so I get this effect where the loading widget flashes on the screen very briefly before the data is displayed (which I don't want). So I want to be able to wait a few seconds before showing the Loading widget, like this:
someFunctionToUpdateData();

// if someFunctionToUpdateData() is not done after n seconds, then:
setState(() {
   isLoading = true;
});

// once someFunctionToUpdateData() has finished:
setState(() {
   isLoading = false;
});

A: Being someFunctionToUpdateData() an async function I recommend using .timeout():
final response = await someFunctionToUpdateData().timeout(const Duration(seconds: 4));

If after 4 seconds the function did not return anything (or complete), it will throw a TimeoutException, or you can specify what to do as:
final response = await someFunctionToUpdateData().timeout(const Duration(seconds: 4),
onTimeout: myFunction());

Read more here > Documentation


text:
Q: C# DataTable Inner join with dynamic columns I'm trying to join two DataTables together in a similar way to this question:
Inner join of DataTables in C#
I'm trying to get the output to be a single 'combined' table, with columns from both of the original tables. They will both have a datestamp column in common.
The answer given is good for DataTables with fixed columns, but what if they are created dynamically, and can have any number of columns, how can I join them?
e.g.
T1 (datestamp, t1Column1, t1Column2, t1ColumnN...)
T2 (datestamp, t2Column1, t2Column2, t2ColumnN...)

I would like to join to create the following:
J1 (datestamp, t1Column1, t1Column2, t1ColumnN, ..., t2Column1, t2Column2, t2ColumnN...)

Is this possible?

A: I found a solution which doesn't rely on looping through the columns.
It uses the 'Merge' method, which I had previously dismissed as I thought both tables required the same structure.
First you need to create a primary key on the two data-tables:
// set primary key
T1.PrimaryKey = new DataColumn[] { T1.Columns["DateStamp"] };
T2.PrimaryKey = new DataColumn[] { T2.Columns["DateStamp"] };

Then add both tables to a data-set so a relationship can be added:
// add both data-tables to data-set
DataSet dsContainer = new DataSet();
dsContainer.Tables.Add(T1);
dsContainer.Tables.Add(T2);

Next add the relationship between the two key columns in the data-set:
// add a relationship between the two timestamp columns
DataRelation relDateStamp = new DataRelation("Date", new DataColumn[] { T1.Columns["DateStamp"] }, new DataColumn[] { T2.Columns["DateStamp"] });
dsContainer.Relations.Add(relDateStamp);

Finally you can now copy the first data-table into a new 'combined' version, and then merge in the second:
// populate combined data
DataTable dtCombined = new DataTable();
dtCombined = T1.Copy();
dtCombined.Merge(T2, false, MissingSchemaAction.Add);

Note: The Merge method requires the second argument to be false or else it copies the structure but not the data of the second table.
This would then combine the following tables:
T1 (2012-05-09, 111, 222)
T2 (2012-05-09, 333, 444, 555)

into a combined version based on the primary-key:
J1 (2012-05-09, 111, 222, 333, 444, 555)

A: I think you can adapt the answer in the linked question to use the index of the column, rather than the column name. Or you could just loop through the items in each Row, like this:
foreach(DataRow row in table.Rows)
{
    foreach(DataColumn column in table.Columns)
    {
        object value = row[column]; // add this to your combined table
    }
}

A: After getting tired of seeing all these inner join functions that don't reliably emulate SQL, I decided to make my own here:
private DataTable JoinDataTables(DataTable t1, DataTable t2, params Func<DataRow, DataRow, bool>[] joinOn)
{
    DataTable result = new DataTable();
    foreach (DataColumn col in t1.Columns)
    {
        if (result.Columns[col.ColumnName] == null)
            result.Columns.Add(col.ColumnName, col.DataType);
    }
    foreach (DataColumn col in t2.Columns)
    {
        if (result.Columns[col.ColumnName] == null)
            result.Columns.Add(col.ColumnName, col.DataType);
    }
    foreach (DataRow row1 in t1.Rows)
    {
        var joinRows = t2.AsEnumerable().Where(row2 =>
            {
                foreach (var parameter in joinOn)
                {
                    if (!parameter(row1, row2)) return false;
                }
                return true;
            });
        foreach (DataRow fromRow in joinRows)
        {
            DataRow insertRow = result.NewRow();
            foreach (DataColumn col1 in t1.Columns)
            {
                insertRow[col1.ColumnName] = row1[col1.ColumnName];
            }
            foreach (DataColumn col2 in t2.Columns)
            {
                insertRow[col2.ColumnName] = fromRow[col2.ColumnName];
            }
            result.Rows.Add(insertRow);
        }
    }
    return result;
}

An example of how you might use this:
var test = JoinDataTables(transactionInfo, transactionItems,
               (row1, row2) =>
               row1.Field<int>("TransactionID") == row2.Field<int>("TransactionID"));


text:
Q: Advice for someone who wants to start in Business Intelligence? What advice would you have for someone who wants to start in the BI (Business Intelligence) domain?
I where and what I should start with: Books, Blogs, WebCasts...
What I should pay attention to and what I should stay away from.
Are the Microsoft technologies worth while ?

A: I found the "project real" from microsoft really helpful while getting into the bi-world. Its a real world bi project, supported by microsoft, to develop and show best practices regarding to all the areas of bi like etl, data warehouse design, cube design, etc.

A: Business Objects http://www.businessobjects.com/ are quite a big player in this area and familiarity with their products will also help you break into B.I. roles.
For practise data, I would recommend something like the anonomised search records from aol that came out a couple of years back - http://www.techcrunch.com/2006/08/06/aol-proudly-releases-massive-amounts-of-user-search-data/ This is real world size and is an interesting database with some published search sets.

A: The MS technology stack is quite good and is by far the most accessible (try to get hold of a copy of Cognos Reportnet for self-learning).  Where you will run into trouble (and this is the main barrier to entry for gaining a B.I. skillset) is to actually get experience working with real data.  It's quite hard to come up with a realistic toy scenario for this sort of thing.
This means that you have to overcome the chicken-and-egg problem that this poses.  One option would be to try to get a job as a B.I. developer somewhere like a government department or other place that has trouble recruiting due to salary constraints.  Clear evidence of technical skills and a demonstrated interest in the business might get your foot in the door.
This will be a bit harder in a recession.  However there is still an ongoing skill shortage of good B.I. people.  The reason is (IMO) not the lack of technical skills (the technology isn't rocket science).  Instead, I think it is the aforementioned chicken-and-egg problem and the fact that the B.I. domain involves customer intimacy to do it well.  It lends itself to working in an analyst/programmer mode with direct customer contact (one of the reasons I do this type of work).  If you like working in this mode it might be a good line for you to get into.
Edit: Someone who's just had a job offer in this space asked whether he should take the job.

A: I would stress you to read this book; might seem kind of outdated but the same theory still applies today. It is probably the best starter for general BI.
The Data Warehouse Toolkit - Ralph Kimball
Regarding Microsoft's BI it is a medium-sized tool that can do the job in your first steps (I have more experience with Cognos though). Haven't used MS tools since 2005 so I can't tell much about it.
In case you happen to be interested in Cognos, I have a few videos which can be of help: Cognos Tutorials
Good luck with your project.

A: Get the Kimball Books (specially this one http://www.amazon.com/The-Data-Warehouse-Toolkit-Dimensional/dp/0471200247) and for starters you may want to start with the MS BI Framework The Microsoft Data Warehouse Toolkit and the SQL Server Enterprise (MS BI Bundle with the database, ETL and reporting), it's easy a readily available, specially if you are a student with the MSDNAA, you can get the enterprise version for free!!!

A: For general business intelligence, I found the Kimball Group as a great source for best practices.
If you would like to start building your own project, check out GoodData Platform. We have full BI stack Platform as a Service and you can start for free (evaluation period) with access to all resources and learn from Tutorials on our Developer Portal.

A: I would say try to find a few classes. Microsoft technologies are worth the time. There are many large companies running on the .Net framework.

A: We use this to get a feel of Microstrategy: http://www.teradatauniversitynetwork.com/apply-and-do


text:
Q: How to configure Xcode to fetch swift dependencies over ssh using a private key which is stored on a Yubikey ( HSM , gpg --card-status ) Problem currently is that I find no way to simply configure or instruct Xcode to check out source code or dependencies over git+ssh using ssh agent.
Does Xcode at all supports using the ssh-agent?
I have not found any possibility to configure it without refering to its private key. (usually referred to ~/.ssh/id_rsa etc around on the web)
Sadly I have no way of referring to the private key in Xcode when it is stored inaccessible for anyone else then the Yubikey (HSM).
Meta information:
My gpg-agent is configured into my environment and works flawless in the terminal with some simple setup:
export GPG_TTY=$(tty)
gpg-connect-agent updatestartuptty /bye
unset SSH_AGENT_PID
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)

(See https://www.engineerbetter.com/blog/yubikey-ssh/ for details on yubikey setup)
gpg --card-status lists that my keypair is available, and it works in the terminal as ssh-agent -L lists my public key and I can use it to ssh into remote hosts accepting my ssh key or issue git clone.. in the terminal.


text:
Q: moving elements inside a container using css I have an issue with a project I'm working on, I'm holding buttons inside a container, whenever I try to move them in css the buttons will disappear, and setting a top or right relative value of the container css will move the entire website, what I'm trying to achieve is have all the buttons lined up on the right side, I've included a small sample of the code which is my current work, and a link to the site so you can see the result.
I believe the issue might be with the size of the canvas, but increasing the size of the canvas stretches all the images to fit it, and I'm still unable to move them using the css. Thank you for any help you can provide.
HTML:

        <input type="image" id="intro" src="images/icon-intro.png"/>
        <input type="image" id="avatar" src="images/icon-avatar.png"/>
        <input type="image" id="news" src="images/icon-news.png"/>
        <input type="image" id="play" src="images/icon-play.png"/>
        <input type="image" id="stop" src="images/icon-stop.png"/>

CSS:
#container {
  width: 100px;
  height: 100px;
  position: relative;
}
#intro,
#intro {
  width: 10%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}
#intro {
  z-index: 10;
}

A link to the site that has the issue:
http://playground.eca.ed.ac.uk/~s1572393/
Thanks again for any help or explanations.

A: After following the recourse in the question comments I was able to solve the issue.
I removed the container and refactored the css for the input elements to the following:
#intro {
  position: absolute;
  right: 30px;
  top: 30px;
  z-index: 10;
}


text:
Q: Steam authentication with API Gateway and lambda I'm trying to create the authentication of my website using
https://github.com/LeeviHalme/node-steam-openid.
Steam OpenID: https://partner.steamgames.com/doc/features/auth
I have an API Gateway with these two endpoints:
/login
// the steamAuth file is the same module as node-steam-openid but for ts
import { SteamAuth } from "../utils/steamAuth";

export const login = async () => {
  const client = new SteamAuth(
      'http://localhost:3000',
      `${process.env.API_URL}/consume`,
      process.env.STEAM_API_KEY,
  );

  try {
    const redirectUrl = await client.getRedirectUrl();
    return {
      statusCode: 302,
      headers: { Location: redirectUrl }
    };
  } catch (e) {
    console.log(e);
    return {
      statusCode: 500,
      message: 'Internal server error'
    };
  }
}

/consume
import { APIGatewayEvent } from 'aws-lambda';
import { SteamAuth } from "../utils/steamAuth";

export const consume = async (event: APIGatewayEvent) => {
  const client = new SteamAuth(
      'http://localhost:3000',
      `${process.env.API_URL}/consume`,
      process.env.STEAM_API_KEY,
  );

  console.log(event);

  try {
    const user = await client.authenticate(event);
    console.log('success', user);
  } catch (e) {
    console.log('error', e);
  }

  return {
    statusCode: 302,
    headers: { Location: 'http://localhost:3000/' },
  };
}

The thing is I get this error in /consume endpoint
error TypeError: Cannot read property 'toUpperCase' of undefined
    at Object.openid.verifyAssertion (/var/task/node_modules/openid/openid.js:905:28)
    at openid.RelyingParty.verifyAssertion (/var/task/node_modules/openid/openid.js:68:10)
    at /var/task/src/utils/steamAuth.js:60:31
    at new Promise (<anonymous>)
    at SteamAuth.authenticate (/var/task/src/utils/steamAuth.js:59:16)
    at Runtime.consume [as handler] (/var/task/src/lambda/consume.js:9:35)
    at Runtime.handleOnceNonStreaming (/var/runtime/Runtime.js:73:25)

I believe this error occurs because the verifyAssertion is waiting for an express request while it is provided an API Gateway one.
Link to the code with the mentioned function is here
Should I use another module to do the authentication as I don't really want to modify the source code of the module? I didn't find anything at the moment
Thanks!

A: I found a workaround using express in lambda. As expected, the openid module used by node-steam-openid is expecting an express request and not a lambda event.
import { SteamAuth } from "../utils/steamAuth";

const express = require('express');
const serverless = require('serverless-http');

const app = express();

app.get('/verify', async (req: any, res: any) => {

  const client = new SteamAuth(
    process.env.HOSTNAME,
    `${process.env.API_URL}/verify`,
    process.env.STEAM_API_KEY,
  );
  try {
    const user: any = await client.authenticate(req);

  } catch (e) {
    throw new Error(e.message);
  }
});

module.exports.verify = serverless(app);


text:
Q: Uncaught Exception in PHPExcel_Writer When I am trying to export from PHP to excel,  PHPExcel is throwing an error called could not close zip file.
I have tried everything but it still doesn't work. Somebody please tell me the solution or any other alternative to export PHP to excel.
I tried this:
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=abc.xls");
header("Pragma: no-cache");
header("Expires: 0");
echo $value;

$value contains the content which I want to download.

A: [Solved]
I made use of session variable and redirected to another php page to export the data from variable.


text:
Q: Disabling sounds in KDE app (without KDE installed) I have an old-school X setup in Debian, mostly running WindowMaker with some Gnome applications. I have just installed the K3B cd burning package, which has pulled in some KDE infrastructure packages.
Burning CDs works fine, but every time it does something it makes a variety of incredibly stupid noises to let me know it's done it. How do I turn these off?
The standard instructions involve running systemsettings and changing a setting. Unfortunately, after installing and running systemsettings, all it does is tell me that it can't find any views to display and exits (and makes a stupid noise while doing so). This is presumably because I don't have a full KDE installation.
Help. I need to burn some CDs. If I have to put up with this for much longer I won't be responsible for my actions.

A: Here is how to disable notifications in K3b:

*

*Go to Settings → Configure K3b...

*Select Notifications

*Click on every list item and uncheck Play a sound
This works for most KDE applications, but usually they have a separate menu entry:
Settings → Configure notifications...


text:
Q: Strange Whitespace Under Display:block Element There is some strange whitespace that keeps appearing under all my display: block elements. It's for a meganavigation. I have no idea what is causing this. Basically, I have the code (plus some more that determines the column widths) below, and when it generates the meganav, the items that are rendered as "display:block" have a space below them. You can also see it when hovering over the items in the main navigation as well. I'm not quite sure what to do.
a {
font-family: "Frutiger LT Std 45 Light", sans-serif;
color: black;
text-decoration: none;
font-size: 10px;
display: block;
padding: 3px;

}

a:hover {

text-decoration: none;
color: white;
background-color: #c8a51b;

}

.nav {

background: #1b2c69;
width: 800px;
margin: 10px;
height: 30px;

}

.nav li {

list-style: none;

}

.nav > li {

padding: 0;
float: left;
position: relative;

}

.nav > li > a {

font-family: "Frutiger LT Std 45 Light", sans-serif;
float: left;
color: #fff;
font-size: 13px;
text-decoration: none;
line-height: 30px;
padding: 0 20px;
height: 43px;
text-transform: uppercase;

}

.nav > li:hover > a {
background: #FFF;
color: #1b2c69;

}

HTML:

Home

Our Company

 Business Reports

 Core Values

 Corp Priority Updates

 Critical Success Factors

 Daily Reports

 EBIT Chart

 HyVisability Scorecard

  Mission Statement

 Quality Vision

 Strategic Vision

A: See this link
I have added bgcolor to background to see the white space.
The fix is:
.nav > li > a {

font-family: "Frutiger LT Std 45 Light", sans-serif;
float: left;
color: #fff;
font-size: 13px;
text-decoration: none;
line-height: 30px;
padding: 0 20px;
height: 30px;
text-transform: uppercase;

}

In the above css I changed height: 43px; to height: 30px;
Because the height for all li tags should be same in tour case to achieve what you want. Hope you understand.


text:
Q: JQuery var is undefined at first click but defined after second I'm trying to call data using ajax but I only get the data after the second click. I have add console.log to realize that.
$(document).ready(function(){

    var target = "http://neoldes/cs/Satellite?pagename=SiteEntry_LT_EM/ConsumptionStatistics/ConsumptionPerHour";
    var component;

    $("header.mod_info_top").on("click", function() {
        $(this).siblings(".cs_consumption_hour").empty();
        loadConsPerHour( target ).success(function (data) {
            component = data;
        });
        console.log("component");
        console.log(component);
        $(this).next().append(component);
    });

});

function loadConsPerHour( dir ){
    return $.ajax({
        url: dir,
        data: { "accountNumber": $("#count_id").val(),"addressService": $("#addressService").val(), "department": $("#department").val(), "municipality": $("#municipality").val(), "borderTrade": $("#borderTrade").val() }
    });
}

This is the retun in the console
firs click:
component
undefined

second click:
component

 ... { more html } ...

Thanks in advance and let me know if I can improve my code.

A: Try move the append code to inside of success callback.
$("header.mod_info_top").on("click", function() {
    $(this).siblings(".cs_consumption_hour").empty();
    loadConsPerHour( target ).success(function (data) {
        component = data;
        console.log("component");
        console.log(component);
        $(this).next().append(component);
    });
});

A: Its because the console.log() function is executed before the AJAX is completed.
You will have to do call console.log() when AJAX is done, like this:
$(document).ready(function(){

    var target = "http://neoldes/cs/Satellite?pagename=SiteEntry_LT_EM/ConsumptionStatistics/ConsumptionPerHour";
    var component;

    $("header.mod_info_top").on("click", function() {
        var targetElement = $(this);
        $(this).siblings(".cs_consumption_hour").empty();
        loadConsPerHour( target ).success(function (data) {
            component = data;
            console.log("component");
            console.log(component);
            targetElement.next().append(component);
        });
    });

});

function loadConsPerHour( dir ){
    return $.ajax({
        url: dir,
        data: { "accountNumber": $("#count_id").val(),"addressService": $("#addressService").val(), "department": $("#department").val(), "municipality": $("#municipality").val(), "borderTrade": $("#borderTrade").val() }
    });
}

It will log:
component

 ... { more html } ...


text:
Q: Reference a class using a constant in scope resolution for PHP I am wondering how I can use a predefined constant as a class name with the scope resolution operator.
In the PHP documentation, they show an example using a variable, however, I wanted to know if its possible to use a constant.
Example:
class MyClass {
    function MyFunction(){
        return "hi";
    }
}

#This works (returns hi)
echo MyClass::MyFunction();
#This works too
$variable_class="MyClass";
echo $variable_class::MyFunction();

#This doestn work (returns Class 'constant_class' not found)
#define("constant_class", "MyClass");
#echo constant_class::MyFunction();
#This doestn work either
const constant_class="MyClass";
echo constant_class::MyFunction();


text:
Q: Backbone save with LocalStorage with fetched DB data? UPDATE
Ok, so I am still getting into the world of Backbone. But I have an issue with adding in localStorage into the Model.
So this is sorta off working, but I do not know what is going on?
var Model = Backbone.Model.extend({
    //localStorage: new Backbone.LocalStorage("SomeCollection"),
    url: "/GetMyData",
    defaults: {
        "id": "",
        "datatest1": "",
        "test2": ""
    }
});

var NewTest = new Model();
NewTest.fetch();

console.log ( NewTest ); //This as DB data
console.log ( NewTest.attributes ); //This is empty

How can the 'attributes' on the 1st console.log contain db data and then the second one be completely empty? The 1st console.log is also empty, if I uncomment the localStorage, so I am guesting I doing something wrong?

Ok, I am not sure what I am doing wrong, but I am using Backbone and on a fetch call, save that id using the LocalStorage plugin. Now I have the fetch call and LocalStorage working apart but can not get them working together.
So my LocalStorage Code
var Model = Backbone.Model.extend({
    localStorage: new Backbone.LocalStorage("SomeCollection"),
    defaults: {
        "id": "",
        "datatest1": "",
        "test2": ""
    }
});

var NewTest2 = new Model();

NewTest2.set({
    "id": "99",
    "datatest1": "TEST-1-Q22",
    "test2": "TEST-2-CL22"
});

NewTest2.save();

So this works, no problems with that. Now I add in a collection, and fetch data form my database. So my fetch code, with collection
var Model = Backbone.Model.extend({
    defaults: {
        "id": "",
        "datatest1": "",
        "test2": ""
    }
});

var Col = Backbone.Collection.extend({
    model: Model,
    url: "/GetMyData"
});

var NewTest3 = new Col();

NewTest3.fetch();

console.log( NewTest3 );

I should also say that I am using PHP Slim as the base. The /GetMyData path gets the data from a MySQL database via a PDO connection, which I then convert into a JSON object for Backbone.
Which I assume is good, as that all works, the console.log's list of attributes displays the right data form my DB.
Now when I put the two together, I can not seem to get it to work.
var Model = Backbone.Model.extend({
    defaults: {
        "id": "",
        "datatest1": "",
        "test2": ""
    }
});

var Col = Backbone.Collection.extend({
    localStorage: new Backbone.LocalStorage("SomeCollection2"),
    model: Model,
    url: "/GetMyData"
});

var NewTest4 = new Col();
NewTest4.fetch();

console.log( NewTest4.save() );

This console.log returns, Uncaught TypeError: undefined is not a function. So I am not sure why? When I set the data in my 1st test, it works fine. Now I have also tried moving the localStorge var into the model but with the same effect.
The main aim for doing this is so I can log all the data coming from the server. When I set a few different data tests, I very much like the way in which this plugin saved the data.
Thanks.
*Please note, I am dyslexic, so I may not have explained myself right, please tell me if there is anything I can re-word to explain myself better. Thank you for your understanding.


text:
Q: Magento Cookie Issue When Logging Into Customer Account I have a server setup locally with Vagrant which is running nginx + php5-fpm + mysql + varnish. I've disabled varnish for now just to rule that out.
I've been having issues when trying to login into a customer account on the frontend - it redirects backs to the homepage. The domain is set as www.site.local. I can log in into the admin area fine.
It appears that when redirecting to a successful login, it's creating a new session but not updating the cookie.
When running it via Lynx on the server itself, the cookie is set to fine - the only difference I can see is that it's using 127.0.0.1 as the domain rather than www.site.local
I tried the suggestion on this article - http://www.novusweb.com/1340/e-commerce-technology/fix-for-passing-magento-session-ids - and it works, but I'd rather not have to modify code when there's likely something server-side that can be changed.
If you need any of the configurations of the server I can update the post.

A: Change the domain from 127.0.0.1 to something else, eg. site.local
There are reported issues of cookie problems when using localhost or 127.0.0.1 (or any variations of the loopback adapter) as the domain name.


text:
Q: What are narrowed generics function for in Typescript? let's suppose we have this interface:
interface MyInterface {
    content: string;
}

used by these three functions:
function fn1<T>(arg: T): void {
    let local = arg;
    console.log(local.content);
}

function fn2<T extends MyInterface>(arg: T): void {
    let local = arg;
    console.log(local.content);
}

function fn3(arg: MyInterface): void {
    let local = arg;
    console.log(local.content);
}

(Here on Playground)
The first one correctly gives an error accessing local.content: "Property 'content' does not exist on type 'T'".
So in fn2 I decide to narrow the generics type with extends MyInterface to be sure that local.content exists. But what about fn3? What's the difference beetween fn2 and fn3?
To me it's clear the usage of generics without constraints, while I don't understand why I should use narrowed generics even with union types:
function fn4<T extends MyInterface | MyInterface2>(arg: T): void {
    let local = arg;
    console.log(local.content);
}

vs.
function fn5(arg: MyInterface | MyInterface2): void {
    let local = arg;
    console.log(local.content);
}

Thank you.


text:
Q: Java Layout for scrollable panels I am trying to create a JPanel that is resizable & scrollable and contains x smaller inner panels. Each inner panel can be as wide as it wants/needs. BUT the depth should be a preferred size.
Like:

So far my code is:
public class TestSize {

    public static void main(String[] args) {

        JFrame F = new JFrame();
        F.setVisible(true);
        JPanel P = new JPanel();
        P.setLayout(new BorderLayout());
        JScrollPane scrollPane = new JScrollPane(P);
        scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
        scrollPane.setPreferredSize(new Dimension(900,900));//.setBounds(50, 30, 300, 50);

        JPanel S = new JPanel();
        S.setBackground(Color.GREEN);
        S.setPreferredSize(new Dimension(900,200));
            JPanel S2 = new JPanel();
        S2.setBackground(Color.GREEN);
        S2.setPreferredSize(new Dimension(900,200));
            P.add(S,BorderLayout.NORTH);
            P.add(S2,BorderLayout.NORTH);

        F.add(scrollPane);
        F.pack();
        F.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    }

}

But when I have added a single inner panel it fills all the space vertically - which is not what I want:

A: In BoxLayout, there are different methods of using invisible components as filler. I don't think you will want to use a "rigid area", since I think you want to have a variable number of inner panels. You may want to try using vertical glue or custom Box.Filler.
Another solution might be to put a JPanel between your JFrame and your ScrollPane that uses a BorderLayout, and put the scrollpane in the BorderLayout.NORTH of that panel. Components in BorderLayout.NORTH get resized horizontally, but they do not get resized vertically. Essentially, they just get pushed to the top of the panel.
Edit:
I think you will want something like this:
    JFrame F = new JFrame();
    F.setVisible(true);
    F.setLayout(new BorderLayout());
    JPanel P = new JPanel(new BoxLayout(P, BoxLayout.PAGE_AXIS));
    JScrollPane scrollPane = new JScrollPane(P);

    JPanel S = new JPanel();
    S.setBackground(Color.GREEN);
    JPanel S2 = new JPanel();
    S2.setBackground(Color.BLUE);
    P.add(S);
    P.add(S2);

    F.add(scrollPane, BorderLayout.NORTH);
    F.pack();
    F.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

You said you want it resizeable, so I don't see why you would set the preferred size of the frame. This way it will just fit to the panels inside.

A: //P.setLayout(new BorderLayout());

Why did you set the layout to a BorderLayout? You can only add 1 component to the NORTH. Is that what you want? Read the section from the Swing tutorial on Using Layout Managers and pick a more appropriate layout manager. Bookmark the tutorial link as it provides the basics for Swing programming.
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);

Why did you set these properties? These are the default values.
scrollPane.setPreferredSize(new Dimension(900,900));

Why would you set the height to be 900. You only want the scrollpane to contain components of height 200? In general you should NOT be setting the preferred size. Let the frame.pack() method do its job.
S.setBackground(Color.GREEN);

Why would you set the background color of both panels to be the same. How can you tell if the two panels get added? Make them different color for an easy visual.


text:
Q: Is this possible, GNOME (lib)Clutter with OpenGL ES & Vulkane? I'm planning to run an app based on (GNOME) libclutter on Android 9 (Pie). I'm quite new to these graphics related stuff, been wondering on these things, so seeking for guidance/direction whatever data that could help me to understand this thing better.
As per the documentation of Android Graphics, Android is using OpenGL ES & Vulkane at low level to render objects. And as per GNOME Clutter documentation, it could be only compiled with mentioned back-end only! (Please check embedded link to for platforms details.)
I don't see OpenGL ES or Vulkane support, So am I missing something on understanding part or it can't be done?!

A: [Clutter maintainer, here]
Yes, Clutter supports OpenGL ES—it uses Cogl, a library that abstracts GL and GLES concepts.
No, Clutter does not support Vulkan at the moment.
No, Clutter and Cogl do not support Android; there was an experimental port but it has been abandoned in 2012.
Additionally, Clutter is in deep maintenance mode: no new development releases, no new features, and only minimal/security/crasher bug fixes are allowed.
I would not recommend using Clutter in a newly written project.

A: OKay...after spending few more hours, I was able to figure out an answer! (Yayy..!!!)
As per Clutter Project website: (somehow I had missed this info previously! :p)

Clutter uses OpenGL for rendering (and optionally OpenGL ES for use on mobile and embedded platforms), but wraps an easy to use, efficient, flexible API around GL's complexity.

So, as per my requirement, I should be able to integrate and cross-compile Clutter lib source and compile it.
PS: I will try to integrate & build the libclutter on android 9. Will update this answer latter with additional set of information.
==========================================================================
Update:
As pointed out by @ebassi in another answer, I have dropped the idea of integration and looking forward to directly using Android Graphics stack for the implementation.
Thanks @ebassi...!


text:
Q: Display gridview only when matching ID's match I have applied a filter on dropdownlist selected value which matched the Project_id, Building_id and flat_id then gridview should display other wise  not.
Now what I want is if ALL the id matches then only display the gridview.
Here is my code below:-
DataTable dt = new DataTable();

    dt.Columns.Add("PROJECT_ID");
    dt.Columns.Add("BUILDING_ID");
    dt.Columns.Add("FLAT_ID");

    DataView dView = new DataView(dt);

    dView.RowFilter = "PROJECT_ID = " + ddlProject.SelectedValue + " AND BUILDING_ID = " + ddlBuilding.SelectedValue + " AND FLAT_ID = " + ddlUnit.SelectedItem.Text;
    GrdBookingStatus.DataSource = dView.ToTable();
    GrdBookingStatus.DataBind();

    DisplayGrid();
    GrdBookingStatus.Visible = true;

Currently it is showing if the ID's doesn't matches also
what condition should I check ?
DisplayGrid()
protected void DisplayGrid()
{
    OracleCommand cmd = new OracleCommand("SELECT pn.property_name, pn.building, cd.flat_id, ab.flat_status, ab.COMMENTS " +
                                           "FROM xxcus.xxacl_pn_projbuild_v pn INNER JOIN xxacl_pn_flat_status_his ab " +
                                           "ON pn.project_id = ab.project_id AND pn.building_id = ab.building_id " +
                                           "INNER JOIN xxacl_pn_flat_det_v cd ON cd.flat_id = ab.flat_id", ObjPriCon);
    DataTable dtfillgrid = new DataTable();
    OracleDataAdapter da = new OracleDataAdapter(cmd);
    da.Fill(dtfillgrid);
    GrdBookingStatus.DataSource = dtfillgrid;
    GrdBookingStatus.DataBind();
}

A: Your DisplayGrid() method reverts back the filter you had and displays all data.
Move the filter inside the DisplayGrid() method.
protected void DisplayGrid()
{
    OracleCommand cmd = new OracleCommand("SELECT pn.project_id AS project_id, pn.property_name, pn.building, pn.building_id AS building_id, cd.flat_id AS flat_id, ab.flat_status, ab.COMMENTS " +
                                           "FROM xxcus.xxacl_pn_projbuild_v pn INNER JOIN xxacl_pn_flat_status_his ab " +
                                           "ON pn.project_id = ab.project_id AND pn.building_id = ab.building_id " +
                                           "INNER JOIN xxacl_pn_flat_det_v cd ON cd.flat_id = ab.flat_id", ObjPriCon);
    DataTable dtfillgrid = new DataTable();
    OracleDataAdapter da = new OracleDataAdapter(cmd);
    da.Fill(dtfillgrid);

    DataView dView = new DataView(dtfillgrid);

    dView.RowFilter = "PROJECT_ID = " + ddlProject.SelectedValue + " AND  BUILDING_ID = " + ddlBuilding.SelectedValue + " AND FLAT_ID = " + ddlUnit.SelectedItem.Text;
    GrdBookingStatus.DataSource = dView.ToTable();
    GrdBookingStatus.DataBind();
    GrdBookingStatus.Visible = dView.ToTable().Rows.Count > 0;
}

I've also modified you SELECT statement to return pn.project_idand pn.building_id

A: protected void Button1_Click(object sender, EventArgs e)
    {
        if (ddl.SelectedIndex > 0)
        {
            int count = 0;
            int selectedcheckbox = 0;

            pfPL.Month = lblMonthId.Value;
            pfPL.Year = lblYear.Value;

            DataTable dt = pfBL.GetEmployeeCode(pfCPL);
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (i < dt.Rows.Count - 1)
                    {

                        for (int k = 0; k < grd.Rows.Count; k++)
                        {
                            string grdcode;
                            Label lbl = (Label)grd.Rows[k].FindControl("lblCode");
                            grdcode = lbl.Text;
                            CheckBox chk = (CheckBox)grd.Rows[k].FindControl("chkone");
                            e;

                            dbcode = dt.Rows[i][0].ToString();
                            if (dbcode.Trim() == grdcode.Trim())
                            {
                                chk.Checked = true;

                                count++;
                            }
                        }
                    }
                }
            }

        }

    }


text:
Q: rich:fileUpload submits whole form Consider this snippet of code, which relies on JSF2 with RichFaces 4.5.0 as a used component library.
// some non-relevant attributes are omitted
<rich:fileUpload fileUploadListener="#{bean.uploadListener}">
      <a4j:ajax event="uploadcomplete" render="imagePanel" immediate="true" />
</rich:fileUpload>

The given tag within a form submits the whole form. For instance, this is not the expected behaviour for me. I'd prefer that the component submits only the form properties of itself and skips the other form values within the same form, like ajaxSingle in RichFaces 3.
I did some research on this topic but did not find any conclusion how to manage the partial form submit for the fileUpload component, especially because there is no execute attribute for this tag, like in several other jsf ajax components.
I would appreciate any help on this case, especially how to manage that the fileUpload component only submits its own form values to the server.

A: Try execute attribute of a4j:ajax.
From docs:

execute: Ids of components that will participate in the "execute" portion of the Request Processing Lifecycle. Can be a single id, a space or comma separated list of Id's, or an EL Expression evaluating to an array or Collection. Any of the keywords "@this", "@form", "@all", "@none", "@region" may be specified in the identifier list. Some components make use of additional keywords

I think that is exactly what you need.
More info: Richfaces docs


text:
Q: QJsonDocument to object is empty I'm trying to parse a simple JSON data in Qt5.
Code looks like this :
    ...
    socket->readDatagram(Buffer.data(),Buffer.size(),&sender,&senderPort);

    QJsonParseError jsonError;
    QJsonDocument dataJson = QJsonDocument::fromJson(Buffer.data(),&jsonError);
    if (jsonError.error != QJsonParseError::NoError){
        qDebug() << jsonError.errorString();
    }
    QJsonObject map = dataJson.object();
    //map["x"].toDouble()

But for some reason my map is empty, here is a debugging snap :

How can I resolve this ?
Data :
'{\"x\":1,\"y\":2,\"z\":3}'

A: Assuming that you're reading correctly, you should test with a command like this:
echo -n \{\"x\":1,\"y\":2,\"\z\":3\} > /dev/udp/127.0.0.1/8080
So, get rid of single quotes and escape curly brackets.
Even better: put your json data in a myfile file and use cat myfile > /dev/udp/127.0.0.1/8080


text:
Q: Template Specification
Possible Duplicate:
What does 'double spacing' mean?

What does "12 point type and 1.5 or double spacing" means and how could I make sure that the template am I using here is complied with this requirement?

A: If you have a look into file thesis.tex located in your given link you can see that this thesis.tex fullfill the requirements.
12 pt type means the size of your font for normal text in your document. LaTeX builds the headings with greater fonts automaticly. With "double spacing" is a special distance between two lines of text ment. Have a look to the question marked as duplicate (David Carlisle mentioned it in a noe deleted comment).


text:
Q: Proving $X_n \rightarrow X$ in distribution implies $a+bX_n \rightarrow a+bX$ in distribution by definition As stated in the title, I am trying to prove that if  $X_n \Rightarrow X$ in distribution, then $a+bX_n \Rightarrow a+bX$ ( where $a,b\in\mathbb{R}$) in distribution using the definition as follows: $X_n$ converges in distribution to $X$ if $F_{X_n}(x) \Rightarrow F_X(x)$ for all $x$ such that $F_X(x)$ is continuous at $x$.
I have been able to prove this using characteristic functions, but now I am attempting it using only definitions.
My main idea is to use the definition of $F_X(x)=\{\omega:X(\omega)\leq x \}$ for $\omega\in\Omega$ (on $(\Omega,\mathcal{F},P)$, so then $F_{X_n}(x) \rightarrow F_X(x) \implies P\{\omega: X_n(\omega)\leq x\} \rightarrow P\{\omega : X(\omega) \leq x\} \Rightarrow P\{\omega: a+bX_n(\omega) \leq a+bx\} \rightarrow P\{\omega: a+bX(\omega) \leq a+bx\}$,
so then $a+bX_n\rightarrow a+bX$ in distribution. However, I am unsure of that last step; and feel like the continuity portion of the definition needs to be addressed.

A: It is probably worth labelling $Y_n=a+bX_n$ and $Y=a+bX$ and looking at the sign of $b$

*

*If $b\gt 0$ then $F_{Y_n}(y) = F_{X_n}\left(\frac{y-a}{b}\right) \to F_{X}\left(\frac{y-a}{b}\right) = F_{Y}(y)$, with the continuity condition carrying across naturally

*If $b\lt 0$ then the continuity condition becomes a little more important; essentially you are considering those parts of the distribution where $\mathbb P\left(X=\frac{y-a}{b}\right) =0$ and so  $\mathbb P(Y = y)=0$ and so $\mathbb P(Y \le y) = \mathbb P(Y \lt y) = 1-\mathbb P(Y \ge y) = 1-\mathbb P(Y \gt y)$. For such $y$s, you have $F_{Y}(y) = 1-F_{X}\left(\frac{y-a}{b}\right)$ though not necessarily for $X_n$ and $Y_n$, and thus $F_{Y_n}(y) = 1 - F_{X_n}\left(\frac{y-a}{b}\right) + \mathbb P\left(X_n = \frac{y-a}{b}\right) \to 1 - F_{X}\left(\frac{y-a}{b}\right) + 0 = F_{Y}(y)$

*If $b=0$, then $Y_n=Y=a$ surely, so trivially you have convergence of all types.  In particular $F_{Y_n}(y)= F_Y(y)$ as this is $0$ when $y \lt a$ and $1$ when $y \ge a$


text:
Q: Dynamic ConnectionString for MySlaveContext in Asp.Net MVC 3 using Repositories and Unity My structure of database (domain, data and services) are the same as : This application (MyFinance on CodePlex)
The problem is, that i have 2 database contexts (1 MyMasterContext) and 1 MySlaveContext.
And suppose that MySlaveContext can always be a different database / providerName / server.
(I know Entity Framework only supports MS SQL Server in EF 4.1)
MyMasterContext ALWAYS stays the same, this is where all the custom connectionstrings are saved.
So, my connectionstring can always change when i address the MySlaveContext, depending on which user is logged in.
In the current situation, MyMasterContext is always being auto-generated when it's used, so is the MySlaveContext.
Now i have to add "dynamic connectionstring" support, the only problem is, that i don't know where to add this functionality...
I have already implemented the ConnectionString in my UserIdentity (UserData), so it is always available when doing:
 DirectCast(User.Identity,MyCustomUserIdentity).ConnectionString

Same with the ProviderName.
Also, my DataBaseFactory and UnitOfWork are "duplicated", because i have one for the Master and one for the Slave (just to be sure).
Could someone help me how to add the "ConnectionString-detection" support?
I thought i could add it as a PropertyInjection or ParameterInjection in Unity, but i don't have enough experience in this field to know it's right or how to do it :)
Thanks in advance for anyone who could bring me on the right track :)

A: Fixed it myself by using an InjuctionConstructor..
In global.asax
 GetUnityContainer.RegisterType(GetType(ISlaveConnectionString), GetType(SlaveConnectionString), New HttpContextLifetimeManager(Of ISlaveConnectionString), New InjectionConstructor(IIf(HttpContext.Current.User IsNot Nothing, DirectCast(HttpContext.Current.User, UserIdentity).ConnectionString, "")))

It's a parameter that can be supplied to a method. In this case, i'm updating my ConnectionString.


text:
Q: How to express structural equality between trees in Alloy? I have defined the following Alloy model that
uses a single State object to point to the roots of two trees State.a and State.b.
sig N {
  children: set N
}

fact {
  let p = ~children |
    ~p.p in iden
    and no iden & ^p
}

one sig State {
  a: one N,
  b: one N
}

fun parent[n:N] : N {
  n.~children
}

fact {
  no State.a.parent
  no State.b.parent
  State.a != State.b
  State.a.^children != State.b.^children
}

pred show {}

run show for 4

Among the solutions I get:
                 +-----+
              +--+State|+-+
             a|  +-----+  |b
              |           |
              v           v
             +--+       +--+
             |N2|       |N3|
             ++-+       +-++
              |           |
             +v-+       +-v+
             |N0|       |N1|
             +--+       +--+

So I get two trees N2 -> N0 and N3 -> N1 that are
structurally equal.
How can I further constraint this model so that State.a and State.b
are not equal in this sense?
I am afraid that this can only be done with a recursive predicate and
recursion is only possible to a limit of depth 3 (I think).
Therefore, I would favour a non-recursive solution if this is possible.

A: You said everything right about the recursion the recursion depth.  I just tried the following recursive predicate, which did work fine for small trees
pred noniso[n1, n2: N] {
  #n1.children != #n2.children or
  some nn1: n1.children, nn2: n2.children | noniso[nn1, nn2]
}

Another way to achieve this, which doesn't require recursion, is to model the noniso relationship as an Alloy relation, and then assert for all nodes that this relation contains all non-isomorphic pairs.  You could do that like this
one sig G {
  noniso: N -> N
} {
  all n1, n2: N {
    (n1 -> n2 in noniso) iff
      (#n1.children != #n2.children or
       some nn1: n1.children, nn2: n2.children | nn1 -> nn2 in noniso)
  }
}

To put this to test, I created show_noniso and show_iso predicates that create trees with 4 levels of nesting.
// differ at level 4 only
pred show_noniso[n1, n2, n3, n4, n5, n6, n7: N] {
  children = n1 -> n2 + n2 -> n3 + n3 -> n4 + n5 -> n6 + n6 -> n7
  State.a = n1
  State.b = n5
}

pred show_iso[n1, n2, n3, n4, n5, n6, n7, n8: N] {
  children = n1 -> n2 + n2 -> n3 + n3 -> n4 + n5 -> n6 + n6 -> n7 + n7 -> n8
  State.a = n1
  State.b = n5
}

and then ran various combinations
// USING RECURSION_DEPTH SET TO 2
run noniso_recursion_fails {
  some disj n1, n2, n3, n4, n5, n6, n7: N | show_noniso[n1, n2, n3, n4, n5, n6, n7]
  noniso[State.a, State.b]
} for 8 expect 0

run noniso_relation_works {
  some disj n1, n2, n3, n4, n5, n6, n7: N | show_noniso[n1, n2, n3, n4, n5, n6, n7]
  State.a -> State.b in G.noniso
} for 8 expect 1

run iso_relation_works {
  some disj n1, n2, n3, n4, n5, n6, n7, n8: N | show_iso[n1, n2, n3, n4, n5, n6, n7, n8]
  State.a -> State.b in G.noniso
} for 8 expect 0

The results of these analyses were as expected
   #1: no instance found. noniso_recursion_fails may be inconsistent, as expected.
   #2: instance found. noniso_relation_works is consistent, as expected.
   #3: no instance found. iso_relation_works may be inconsistent, as expected.