text:
Q: Clarification on Construction of Tensor Product (Atiyah-Macdonald) For context: $M, N, P$ are $A$-modules, $C = A^{(M \times N)}$ is the free $A$-module on the cartesian product $M \times N$, $D$ is the submodule generated by all elements of the form $(x + x^{'}, y) - (x,y) - (x^{'}, y), (x, y + y^{'}) - (x, y) - (x, y^{'}), (ax,y) - a(x,y), (x,ay) - a(x,y)$.
From page 25,
"Any map $f: M \times N \rightarrow P$ extends by linearity to an $A$-module homomorphism $\bar{f}: C \rightarrow P$"
My question is how is this map $\bar{f}$ defined?  I would imagine that for any element in the direct sum $C$ we would sum the elements as elements of $M \times N$ and then apply the map $f$, but this doesn't exactly sound right.  Is there a more obvious way of extending this map by linearity?

A: That such an extension exists is basically the definition of $C$ being the free $A$-module over $M \times N$. Of course, this is not a very helpful thing to say so let's be explicit.
For ease of notation, let me write $S = M \times N$, so $C = A^{(S)}$.
An element of $A^{(S)}$ is a formal sum $\sum_{s \in S} a_s s$ where all but finitely many $a_s$ are zero. If you prefer something more concrete, elements of $A^{(S)}$ are functions $a: S \longrightarrow A$ with finite support. That is, for all but finitely many $s \in S$, $a(s) = 0$. Addition and scalar multiplication can be defined on these functions on each component. We can also define these operations on the representation $\sum_{s \in S} a_s s$ as follows:
$$
\sum_{s \in S} a_s s + \sum_{s \in S} b_s s = \sum_{s \in S} (a_s + b_s) s
$$
$$
a\left(\sum_{s \in S} a_s s \right) = \sum_{s \in S} (a a_s) s
$$
Now, how do we define such an extension $\widetilde f$ given $f: S \longrightarrow P$? Well we only know how to act on $f$, so how do we act on a formal sum $\sum_{s \in S} a_s s$? Let's apply formal reasoning. If we had such a map $\widetilde f$, then as it's an $A$ module homomorphism we'd have to have
$$
\widetilde f\left(\sum_{s \in S} a_s s\right) = \sum_{s \in S} \widetilde f(a_s s) = \sum_{s \in S} a_s \widetilde f(s)
$$
and if $\widetilde f$ is to extend $f$, then $\widetilde f(s) = f(s)$ for $s \in S$.
So we are led to take this as our definition of $\widetilde f$:
$$
\widetilde f\left(\sum_{s \in S} a_s s\right) := \sum_{s \in S} a_s f(s)
$$
Now, you can check that $\widetilde f$ is a well defined $A$ module homomorphism extending $f$.


text:
Q: AngularJS ui-chart not working in ui-bootstrap tabs I use ui-chart angularjs module to show a line graph, the thing is when I put it in ui-bootstrap tabs, it only show the line graph at the first tab, it wouldn't show at the second or third tab.
When I read the jqPlot documentation (ui-chart is a directive for jqPlot), it says it needs to use replot(), but I don't know how to implement this in ui-chart.
Can anyone give me a heads up on this?

A: Did you include all the plugins required ? You need to include the adequate plugin for each graph. I forgot it a lot of times. Otherwise, I think we might need the code to do more investigation. for example to draw a pie you have to include :
<script src=".../jqplot/plugins/jqplot.pieRenderer.js" type="text/javascript"></script>

in addition.

A: I've managed to accomplish that by modifying the ui-chart directive, adding the following to the end of it:
var plot = $.jqplot(elem.attr('id'), data, opts);

// search for a tabpanel (jquery-ui tabs) containing the chart
elem.closest('.tabpanel').bind('tabsactivate',
    function(event, ui) {
        if (plot._drawCount === 0) {
            plot.replot();
        }
});

The if _drawCount part is very important because reploting a chart is a heavy-weight operation.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to simulate a system output with a sine wave input? I wish to simulate the output of a certain gear system I have. How the gear system looks isn't particularly important to the problem, I managed to get the differential equation needed from the mechanical system.
Here is the code I have
% parameters
N2  = 90;
N1  = 36;
Jn1 = 0.5;
Jn2 = 0.8;
J2  = 2;
D   = 8;
K   = 5;
J   = (N2/N1)^2 * Jn1 + Jn2 + J2;

% define the system
sys = ss([0 1; -K/J -D/J], [0; N2/(N1*J)], [1 0], 0);

% initial state: (position, velocity) [rad; rad/s]
x0 = [0; 0];

% define the time span
t = linspace(0, 15, 10000)';

% define the input step
T1 = zeros(length(t), 1);
T1(t>=0) = 1;

% compute the system step response at once
theta1 = lsim(sys, T1, t, x0);

% compute the system response as aggregate of the forced and unforced
% temporal evolutions
theta2 = lsim(sys, T1, t, [0; 0]) + initial(sys, x0, t);

% plot results
figure('color', 'white');
hold on;
yyaxis left;
plot(t, T1, '-.', 'linewidth', 2);
ylabel('[N]');
yyaxis right;
plot(t, theta1, 'linewidth', 3);
plot(t, theta2, 'k--');
xlabel('t [s]');
ylabel('[rad]');
grid minor;
legend({'$T_1$', '$\theta_1$', '$\theta_2$'}, 'Interpreter', 'latex',...
       'location', 'southeast');
hold off;

This should work in generating a graph that shows the positions, my outputs, for a Heaviside/step input. My question is, how would I do this for a sine wave input. I figure I should have sin(w*t) instead of (t>=0), where w is my pulse frequency. Still, I can't seem to make this work. Any help would be really appreciated! :)

A: Here is the solution to my problem :)
function x = integrate(t, u, x0)
    % parameters
    N2  = 90;
    N1  = 36;
    Jn1 = 0.5;
    Jn2 = 0.8;
    J2  = 2;
    D   = 8;
    K   = 5;
    J   = (N2/N1)^2 * Jn1 + Jn2 + J2;

    % integrate the differential equation
    [t, x] = ode23(@fun, t, x0);

    % plot results
    figure('color', 'white');

    % plot position
    yyaxis left;
    plot(t, x(:, 1));
    ylabel('$x$ [rad]', 'Interpreter', 'latex');

    % plot velocity
    yyaxis right;
    plot(t, x(:, 2));
    ylabel('$\dot{x}$ [rad/s]', 'Interpreter', 'latex');

    grid minor;
    xlabel('$t$ [s]', 'Interpreter', 'latex');

    function g = fun(t, x)
        g = zeros(2, 1);
        g(1) = x(2);
        g(2) = (-K/J)*x(1) + (-D/J)*x(2) + (N2/(N1*J)*u(t));
    end
end

Now we can use an anonymous function for example:
t = linspace(0, 120, 10000)';
x0 = [0.1; 0];
x = integrate(t, @(t)(sin(1.5*t)), x0);

A: Test Run
These are the output results I currently get on MATLAB R2019b. As Luis' comment has suggested I have also declared a sinusoid as T1 to serve as the input. Currently not sure if this result is the expected output.

Code Snippet:
t = linspace(0, 15, 10000)';
f = 0.1;
phi = 0;
T1 = sin(2*pi*f*t + phi);

f → Frequency of sinusoidal input (0.1Hz in this example).
phi → Phase offset of sinusoidal input/initial phase (0 in this example).
t → Time vector dictating the samples of the sinusoid.
0 → Start time (0 seconds in this example).
15 → End time (15 seconds in this example).
10000 → Number of samples between the start time (0s) and end time (15s).

Implementation in Script:
% parameters
N2  = 90;
N1  = 36;
Jn1 = 0.5;
Jn2 = 0.8;
J2  = 2;
D   = 8;
K   = 5;
J   = (N2/N1)^2 * Jn1 + Jn2 + J2;

% define the system
sys = ss([0 1; -K/J -D/J], [0; N2/(N1*J)], [1 0], 0);

% initial state: (position, velocity) [rad; rad/s]
x0 = [0; 0];

% define the time span
t = linspace(0, 15, 10000)';

% define the input step
T1 = zeros(length(t), 1);
T1(t>=0) = 1;

f = 0.1; %Sinusoid frequency = 0.1Hz%
phi = 0; %Phase = 0%
T1 = sin(2*pi*f*t + phi);

% compute the system step response at once
theta1 = lsim(sys, T1, t, x0);

% compute the system response as aggregate of the forced and unforced
% temporal evolutions
theta2 = lsim(sys, T1, t, [0; 0]) + initial(sys, x0, t);

% plot results
figure('color', 'white');
hold on;
yyaxis left;
plot(t, T1, '-.', 'linewidth', 2);
ylabel('[N]');
yyaxis right;
plot(t, theta1, 'linewidth', 3);
plot(t, theta2, 'k--');
xlabel('t [s]');
ylabel('[rad]');
grid minor;
legend({'$T_1$', '$\theta_1$', '$\theta_2$'}, 'Interpreter', 'latex',...
       'location', 'southeast');
hold off;


text:
Q: AngularJS doesn't work with multiple controllers I am new to AngularJS and my code unfortunately doesn't work.
I want three dropdown fields, but I can only do one.
If I use the code as you see below, only the first dropdown works; the second and third are empty.
I have the apprehension that it is because of AngularJS which I don't know, or I forgot...
I already googled this thing, but I didn't find anything that could help me. I have tried a lot of different ways but nothing works.
This is the html:
<!DOCTYPE html>

//products

<select ng-model="choosenProduct" ng-options="x for x in products"></select>

//formats

<select ng-model="choosenFormat" ng-options="x for x in formats"></select>

//weights

<select ng-model="choosenWeight" ng-options="x for x in weights"></select>

And this is the JS:

A: Angularjs will bootstrap only the first occurrence of ng-app, you could bootstrap manually the other two, but multiple apps are most likely to bring you a lot of problems especially with sharing data between controllers and might be a source of duplicated code (formatters, some small common parts) if you want to separate some logic by modules you can do it and inject all of the specific modules into one module i.e.
var app = angular.module('app',['product-selection', 'weight-selection', 'format-selection']);
var product = angular.module('product-selection',[]);
var weight = angular.module('weight-selection',[]);
var format = angular.module('format-selection',[]);

//products
product.controller('product-controller', function($scope){
    $scope.products = ["Brief", "Postkarte", "Infopost", "Büchersendung", "Warensendung", "PZA" ,"Päckchen", "Blindensendung"];
    });

//formats
format.controller('format-controller', function($scope){
  console.log('format')
    $scope.formats = ["Standard", "Kompakt", "Groß", "Maxi", "Maxi bis 2kg"];
    });

//weights
weight.controller('weight-controller', function($scope){
  console.log('weight')
    $scope.weights = ["0-50g", "51-100g", "101-200g", "201-300g"];
});

working plunker
http://plnkr.co/edit/Rovgs3Ets6oNtrFlu9hi?p=preview

A: From angular docs:

Only one AngularJS application can be auto-bootstrapped per HTML document. The first ngApp found in the document will be used to define the root element to auto-bootstrap as an application. To run multiple applications in an HTML document you must manually bootstrap them using angular.bootstrap instead.

You can have multiple controllers in the same module and multiple modules having multiple controllers.


text:
Q: Hibernate advanced mappings correct use @OneToOne I have two Entities, Client and City. Client can be from one City only, and City can have many Clients from there.
But I want for my City table to be independent, I want a relation from Client to City (City city in class Client), but I don't want any relation from my City class to Client.
Basically, a uni-directional mapping. How can I achieve that? @OneToOne? I'm using Spring and Hibernate.

A: class Client {
    @ManyToOne
    @JoinColumn(name = "city_id", nullable = false)
    City city;
}

class City {
}


text:
Q: C++ data structures instead of database I have written a C++ program that using database with 5 tables(and thousands of row). But there is performance issue in that approach. Now, I will try to use C++ data types and functions for that. Which one is best for that situation. I am considering to use struct in vectors. Also I can use libraries for that if exists. Can they solve my problem?
By the way my DB is PostgreSQL.

A: Take a look at Berkeley DB, it is a popular embedded database that has good performance.
Latest versions offer a SQL-like API, this can simplify the migration of your code from your a classical SQL database.
However, be careful of the license terms of this library. It is available in both a GPL-like license and commercial license (i.e. no LGLP-like license is available). Depending of your application (and your wallet), this may be an issue.


text:
Q: How to merge JSON objects based on key/value pair? I need to combine results from two different documents in Mongo. I have a function like this:
async function getReviewsByUserId (req, res) {
  const { userId } = req.params

  const reviews = await Review.find({ userId }).lean() || []

  return res.status(200).send(reviews.reverse())
}

The reviews array looks like this:
{
    "_id" : ObjectId("1263b55ef2cdd3ebb0654d1dd"),
    "launchId" : "7fb83b40-7c6f-4099-aaed-fe9d0dc03111",
    "userId" : "1",
}
{
    "_id" : ObjectId("6355565cf5ef2cddebb065584"),
    "launchId" : "12b53940-136f-3399-aaed-fe9d0dc05473",
    "userId" : "7fb83b40-7c6f-4099-aaed-fe9d0dc03112",
}

I need to use the launchId from each review, look up a launch object from my mongo database, and combine that with the correct object in the reviews array.
Example of what I mean:
async function getReviewsByUserId (req, res) {
  const { userId } = req.params

  const reviews = await Review.find({ userId }).lean() || []

  const launches = await Launch.find(/* find all launches where launch._id is equal to reviews.launchId*/)

  return res.status(200).send(launches.reverse())
}

So if launches data looks like this (and launches is also an array of ALL launches):
{
    "_id" : "12b53940-136f-3399-aaed-fe9d0dc05473",
    "name" : "The Park",
}

Then how can I merge this with the reviews payload where the launch._id == reviews.launchId so that the final data looks like this:
{
    "_id" : ObjectId("1263b55ef2cdd3ebb0654d1dd"),
    "launchId" : "7fb83b40-7c6f-4099-aaed-fe9d0dc03111",
    "userId" : "1",
}
{
    "_id" : ObjectId("6355565cf5ef2cddebb065584"),
    "launchId" : "12b53940-136f-3399-aaed-fe9d0dc05473",
    "userId" : "7fb83b40-7c6f-4099-aaed-fe9d0dc03112",
    "launch": {
        "_id" : "12b53940-136f-3399-aaed-fe9d0dc05473",
        "name" : "The Park",
    }
}

A: This could be achieved by using aggregate pipelines.

*

*Filter reviews by userId in $match stage

*$lookup for launches

*$unwind the launch array to an object

The solution could be:
  async function getReviewsByUserId(req, res) {
    const { userId } = req.params;

    const launches = await Review.aggregate([
      {
        $match: {
          userId
        }
      },
      {
        $lookup: {
          from: "launches",
          localField: "launchId",
          foreignField: "_id",
          as: "launch"
        }
      },
      {
        $unwind: {
          path: "$launch",
          preserveNullAndEmptyArrays: true
        }
      }
    ]);

    return res.status(200).send(launches.reverse());
  }

A: You can map() your reviews, and for each item you can use find() on the launches array to check if the launch id matches the current review id.
If there is no match, just return the review unaltered; if you get a match, you add the launches property to the current review and return it.

function ObjectId(oid) {
  return oid
}

const reviews = [{
    "_id": ObjectId("1263b55ef2cdd3ebb0654d1dd"),
    "launchId": "7fb83b40-7c6f-4099-aaed-fe9d0dc03111",
    "userId": "1",
  },
  {
    "_id": ObjectId("6355565cf5ef2cddebb065584"),
    "launchId": "12b53940-136f-3399-aaed-fe9d0dc05473",
    "userId": "7fb83b40-7c6f-4099-aaed-fe9d0dc03112",
  }
]

const launches = [{
  "_id": "12b53940-136f-3399-aaed-fe9d0dc05473",
  "name": "The Park",
}]

const res = reviews.map(r => {
  const found = launches.find(l => l._id === r.launchId)

  if (found) {
    r.launch = {
      _id: found._id,
      name: found.name
    }
    return r
  } else {
    return r
  }
})

console.log(res)


text:
Q: Rewrite image request to sub-directory structure in Nginx Given a location like this:
location ~ ^/user-content/img/) {
  root /srv/foo/bar/uploads/;
  autoindex off;
  access_log off;
  expires 30d;
}

Is it possible using nginx to have a request for
/user-content/img/3AF1D3A69CE92ADAED8B0D25C2411595C7C798A5.png

To be actually served from directory /srv/foo/bar/uploads/3A/F1/D3 which would involve taking the first two characters from the request filename and use them as first subfolder, then using characters 3-4 for the next deeper folder and finally append characters 5-6 for the last subfolder?

A: You can try (not tested)
location /user-content/img/ {
    rewrite "^/user-content/img/(\w{2})(\w{2})(\w{2})(.*)" /$1/$2/$3/$1$2$3$4 break;
    root /srv/foo/bar/uploads;
    autoindex off;
    access_log off;
    expires 30d;
}

Update
Just give it a test. Can confirm that this approach works too. As OP noted, regex with curly braces should be quoted in nginx config.

A: This approach should work:
location ~ "^/user-content/img/([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})(.*)$" {
    root /srv/foo/bar/uploads;
    try_files /$1/$2/$3/$1$2$3$4 =404;
    autoindex off;
    access_log off;
    expires 30d;
}

In the location line, we capture parts of the filename to four different variables using regular expressions, first three parts being the directory and fourth part being the rest of the filename.
Variables are used in the try_files directive to create the path to the image name.


text:
Q: Android WebView Cookie issue I am trying to build a voting system using php-cookies on a Android Webview, so my php script inside webview checks if the cookie is set, if its not, new cookie will be set and vote will be incremented by 1 in mysql db, and the user who voted previously cant vote again for the same pic.
When I try the voting system on any browser, like chrome on phone,computer. It works great. But when I try it on android webview. The cookie is not properly managed and there seems to be a bug, that I can vote multiple times for a single pic. However, on Android L webview, this is working perfect. Kitkat and below flavours having this issue with cookies, the cookie is not properly managed.
How can this problem be solved?
And I know that using cookies is not a great idea, however want a solution for this.
Below is my java class for webview
public class Review extends Activity {
    WebView mWeb;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_review);
        mWeb = (WebView) findViewById(R.id.mWeb);
        mWeb.setBackgroundColor(0x00000000);
        mWeb.getSettings().setJavaScriptEnabled(true);
        mWeb.setWebViewClient(new WebViewClient());

        mWeb.loadUrl("http://somewebsite.com/review.php");
        CookieManager.getInstance().setAcceptCookie(true);
    }
}

Any help would be greatly appreciated.
Thanks.

A: I have a hunch that it might be because you aren't using some deprecated methods (sort of counter-intuitive) that are required for cookies to work prior to Lollipop. On Lollipop and beyond, the CookieManager singleton works fine by itself, however, prior to Lollipop it also required the use of an additional static method from CookieSyncManager. The code below works for me on all Android versions when setting the cookies on a WebView.
CookieManager cookieManager = CookieManager.getInstance();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
    CookieSyncManager.createInstance(this);
}
cookieManager.setAcceptCookie(true);

This initializes the CookieSyncManager and allows the cookies to properly work prior to Lollipop. Let me know if this works or not.


text:
Q: Why is this HTML form not submitting the parameters? I have just a quick question. Does someone know why this html page (a form) does not work?

<form method=POST action=show-query-params>

<input type=text name=foo id=foo size=20 value=nameee />

<input name=submit type=submit value=submit />
<input type=reset value=Reset />

</form>

When I click submit, the page "http://localhost:8080/show-query-params" is opened but with no parameters.
Thanks in advance!

A: Data gets added to the query string of the URL when you submit a form with method="GET" (the default).
You have set method="POST" so the data be will placed in the request body and not visible in the URL.
You can inspect it using the Network tab in your browser's Developer Tools.
See also: When should I use GET or POST method? What's the difference between them?.

A: You need to understand the difference between GET and POST parameters. A GET parameter appears after the URL in your browser window, as you expected. A POST parameter will not appear after the URL.
You can change your method to GET at your form tag to reach the behavior you desire.


text:
Q: Encrypt Configuration The code on the Site here (shown below) encrypts app.config. I ran this on a button press to encrypt my config.
When am i supposed to run the code - (e.g at application start-up in case it is not already encrypted)?
In my bin folder i have 2 xml configuration files (Applicationname.exe.config and Applicationname.vshost.exe - this code only encrypts the first one of them - When i deploy my program how do i ensure that the my customer doesn't accidentally get the unencrypted file also as this would be a major issue ?(Or does the windows installer take care of ensuring this)?
C# Code
Configuration config = ConfigurationManager.OpenExeConfiguration(
    ConfigurationUserLevel.None);

SectionInformation appSettingsSecInfo = config.GetSection(
   "appSettings").SectionInformation;
if (!appSettingsSecInfo.IsProtected)
{
    Console.WriteLine("The configuration file has NOT been protected!");

    // Encrypt this section by using security provider
    // (RsaProtectedConfigurationProvider or DpapiProtectedConfigurationProvider).
    appSettingsSecInfo.ProtectSection("RsaProtectedConfigurationProvider");
    appSettingsSecInfo.ForceSave = true;

    config.Save(ConfigurationSaveMode.Full);
}

A: Please follow steps at this page. Author of the code snippet that you reference also does mention this page. But he is wrong about it not working on app.config files. All you have to do is rename yourapp.exe.config file to web.config, encrypt the sections you want and rename back to yourapp.exe.config.
Now to your scenario. The page that I have referenced also states the following:

You can easily export and import RSA keys from server to server. This makes RSA encryption particularly effective for encrypting configuration files used on multiple servers in a Web farm.

And it has a section about exporting and importing RSA keys.
So you could encrypt the configuration on your PC, export RSA key used for encryption and put it in your installer. The installer would then import the RSA encryption key into machine or user store on PC on which the application is being deployed.
But you should realize that when the application is starting, encrypted configuration has to be decrypted using private part of RSA encryption key (that we imported or it originated on the PC). Therefore if the application can get access to the private key so might the customer (I presume that the customer has physical access to the PC with your application). What you could do is use a user key container of user that only the application will run under for RSA encryption key but if the customer has administrator rights you will not be able to forbid him from decrypting the configuration.
So much for standard solutions. But you can always put sensitive data in a custom xml file, encrypt it and the encryption key compile into you application. Then the application would have to implement a logic to decrypt the xml itself. The customer would have to decompile your application to get to the RSA encryption key.


text:
Q: How to use XSL variable in xsl:apply-templates? I have a reasonably complex call to xsl:apply-templates:
<xsl:apply-templates select="columnval[@id
                                       and not(@id='_Name_')
                                       and not(@id='Group')
                                       and not(@id='_Count_')]"/>

The expression is reused in other places like this:
<xsl:apply-templates select="someothernode[@id
                                           and not(@id='_Name_')
                                           and not(@id='Group')
                                           and not(@id='_Count_')]"/>

I want to generalize it somehow, so I can define it once and reuse it elsewhere. However, this doesn't seem to work:
<xsl:variable name="x">@id and not(@id='_Name_') and not(@id='Group') and not(@id='_Count_')</xsl:variable>
<xsl:apply-templates select="columnval[$x]"/>
<xsl:apply-templates select="someothernode[$x]"/>

Is there a better / different way of doing this? All I want is to reuse the xpath expression in multiple different calls to xsl:apply-templates (some of which select from different children).
This is going to be used in a client application, so I can't use any extensions or switch to XSLT 2 unfortunately. :(
Thanks.

A: You can't construct XPath dynamically in XSLT (at least, not XSLT 1.0).  But you can easily accomplish what you're trying to do using template modes:
<xsl:apply-templates select="columnval" mode="filter"/>
<xsl:apply-template select="someothernode" mode="filter"/>

...

<!-- this guarantees that elements that don't match the filter don't get output -->
<xsl:template match="*" mode="filter"/>

<xsl:template match="*[@id and not(@id='_Name_') and not(@id='Group') and not(@id='_Count_')]" mode="filter">
   <xsl:apply-templates select="." mode="filtered"/>
</xsl:template>

<xsl:template match="columnval" mode="filtered">
   <!-- this will only be applied to the columnval elements that pass the filter -->
</xsl:template>

<xsl:template match="someothernode" mode="filtered">
   <!-- this will only be applied to the someothernode elements that pass the filter -->
</xsl:template>

A: Refactoring @Robert Rossney and @Tomalak
<xsl:apply-templates select="columnval" mode="filter"/>
<xsl:apply-templates select="someothernode" mode="filter"/>

<xsl:template match="*" mode="filter">
   <xsl:param name="pFilter" select="'_Name_|Group|_Count_'"/>
   <xsl:apply-templates select="self::*
                                [not(contains(
                                        concat('|',$pFilter,'|'),
                                        concat('|',@id,'|')))
                                 and @id]"/>
</xsl:template>

A: I would take a look at using an extension to xslt. I don't think you can do it in "standard" xslt.
This extension can do what you want: http://www.exslt.org/dyn/functions/evaluate/index.html

A: With the extension exsl:nodeset, you can create a named template that accepts a nodeset $x and returns the filtered nodeset according to your static predicate.
You can also define a function, in XSLT 2.0.

A: How about:
<xsl:variable name="filter" select="_Name_|Group|_Count_" />

<xsl:apply-templates select="columnval" mode="filtered" />
<xsl:apply-templates select="someothernode" mode="filtered" />

<xsl:template match="someothernode|columnval" mode="filtered">
  <xsl:if test="not(contains(
    concat('|', $filter,'|'),
    concat('|', @id,'|'),
  ))">
    <!-- whatever -->
  </xsl:if>
</xsl:template>

You could make $filter a param, and pass it in from the outside for example.
What you cannot do (as you've noticed) is use variables to store XPath expressions.

A: Both XSLT 1.0 and XSLT 2.0 do not support dynamic evaluation.
One way to do this is using <xsl:function> in XSLT 2.0 or <xsl:call-template> in XSLT 1.0.
 <xsl:function name="my:test" as="xs:boolean">
  <xsl:param name="pNode" as="element()"/>

  <xsl:variable name="vid" select="$pNode/@id"/>

  <xsl:sequence select=
  "$vid and not($vid=('_Name_','Group','_Count_')"/>
 </xsl:function>

then you could use this function:
<xsl:apply-templates select="columnval[my:test(.)]"/>

Certainly, you could specify the test in specific match patterns as suggested by Robert Rossney, and this might be the best way.
In case you need to dynamically define which filtering function to use, one powerful tool is the FXSL library, which implements Higher-Order-Functions (HOF) in XSLT. HOF are functions that accept other functions as parameters and can return a function as their result.
Using this approach, you dynamically determine and pass to the my:test() as parameter a function that does the test.


text:
Q: Can I create one command for quoting? I would like to get this result:

I currently use this piece to get the result:
\glqq{\textit{Analysis II}}\grqq{}

Can I create a single command like the following to get the desired result?
\quoteitalic{Analysis II}

A: You can use:
 \newcommand{\quoteitalic}[1]{\glqq\textit{#1}\grqq}

Notes:

*

*As Qrrbrbirlbel commented, \glqq does not have a parameter, so I have corrected the definition of the \quoteitalic macro.

Code:
\documentclass{article}
\usepackage[english]{babel}

\newcommand{\quoteitalic}[1]{\glqq\textit{#1}\grqq}

\begin{document}
\glqq{\textit{Analysis II}}\grqq{}

\quoteitalic{Analysis II}
\end{document}

A: When dealing with quotes the csquotes package is most convenient. Then you won't have to use \glqq and \grqq at all. The basic usage would be:
\documentclass{article}
\usepackage{csquotes}

\begin{document}
\enquote{\textit{Analysis II}}
\end{document}

Of course you can make your italic quotes into a custom macro with
\newcommand\iquote[1]{\enquote{\textit{#1}}}

and use it as \iquote{Analysis II}. Personally I like to use unicode quotation marks. To enable them use \MakeAutoQuote{"}{"} and apply them as "\textit{Analysis II}". This way no custom macro is necessary. (When using PdfLaTeX, add \usepackage[utf8]{inputenc}.)
csquotes allows you to have language-specific quotes without changing the quotation itself. Furthermore you can nest those quotes, e.g.
Professor: "Use the book "\textit{Analysis II}" as a reference."

would show as

when using the default language setting.


text:
Q: how to get value from the nearest column? Training dataset
df_table = pd.DataFrame()
df_table["A"] = [0.2, 0.2, 0.2, 0.2, 0.2,
                 0.4, 0.4, 0.4, 0.4, 0.4,
                 0.6, 0.6, 0.6, 0.6, 0.6,
                 1.5, 1.5, 1.5, 1.5, 1.5,
                 2.5, 2.5, 2.5, 2.5, 2.5,
                 3.0, 3.0, 3.0, 3.0, 3.0]

df_table[450] = [1, 5, 20, 30, 40,
                 1, 5, 8, 10, 20,
                 1, 5, 10, 15, 25,
                 2, 7, 15, 20, 30,
                 2, 7, 15, 20, 35,
                 2, 8, 20, 30, 40]

df_table[500] = [3, 15, 25, 60, 80,
                 4, 10, 15, 20, 30,
                 5, 10, 15, 30, 40,
                 5, 10, 20, 30, 45,
                 7, 10, 20, 35, 50,
                 8, 15, 25, 60, 80]

if the input value of is A = 0.2, and temperature = 476, I want to get the value from the column closest to 476, in this case value from the 500 which will be 3.
Similarly, how can I get both values from 450 and 500. For this instance 1 and 3. So that would be value from the closest smaller column and closest higher column.

A: You need to calculate the correct columns to use based on the available columns and your value.
Then localize the first value of your dataframe where A fullfills your searched value and query the columns you just calculated:
import pandas as pd

df_table = pd.DataFrame()
df_table["A"] = [0.2, 0.2, 0.2, 0.2, 0.2, 0.4, 0.4, 0.4, 0.4, 0.4,
                 0.6, 0.6, 0.6, 0.6, 0.6, 1.5, 1.5, 1.5, 1.5, 1.5,
                 2.5, 2.5, 2.5, 2.5, 2.5, 3.0, 3.0, 3.0, 3.0, 3.0]

df_table[450] = [1, 5, 20, 30, 40, 1, 5, 8, 10, 20,
                  1, 5, 10, 15, 25, 2, 7, 15, 20, 30,
                  2, 7, 15, 20, 35, 2, 8, 20, 30, 40]

df_table[500] = [3, 15, 25, 60, 80, 4, 10, 15, 20, 30,
                  5, 10, 15, 30, 40, 5, 10, 20, 30, 45,
                  7, 10, 20, 35, 50, 8, 15, 25, 60, 80]

# integer columns harvested from the dataframe
T_values = [n for n in df_table.columns if isinstance(n,int)]

# what I want to query
myA = 0.2
myT = 476

# get the column names that are near myT
minColNear_myT = max(a for a in T_values if a <= myT)
maxColNear_myT = min(a for a in T_values if a >= myT)

# localize the first one where myA matches
first_one_matching_myA = df_table.loc[(df_table['A'] == myA).idxmax()]

# output the values of the columns near myT
print(minColNear_myT, myT, first_one_matching_myA[minColNear_myT])
print(maxColNear_myT, myT, first_one_matching_myA[maxColNear_myT])

Output:
450 476 1.0
500 476 3.0

To only output the closer column compare myT to the both columns that exists and use the one where the difference is lowest:
closest = sorted( (k for k in T_values), key = lambda x:abs(x - myT) )[0]
print(closest,  myT, first_one_matching_myA[closest])


text:
Q: cmd: Command failed with exit code 1, Error : No resource found that matches the given name (at 'icon' with value '@drawable/icon') So i have found a few questions that start the same, but none of them apply to my exact situation, as such neither do the answers.
i'm using cordova in VS studio 2015 and everything was fine 1 hour ago.
But for some reason the builds fail when deploying to device(or emulator) now, even though i have changed nothing in my code!
(i added 1 small IF statement, that i have since rolled back)
The error i get is :

cmd: Command failed with exit code 1 FriendFinder    C:\uni
  project\FriendFinder\FriendFinder\FriendFinder\ERROR building one of
  the platforms 1

reading full debug log, and finding the first instance of the word "failed" revealed it to be here :

C:\uni
  project\FriendFinder\FriendFinder\FriendFinder\platforms\android\build\intermediates\manifests\full\debug\AndroidManifest.xml:29:
  error: Error: No resource found that matches the given name (at 'icon'
  with value '@drawable/icon'). (TaskId:11)

All the fixes i've found say to remove that line, or use a different icon, or something similar. Yet i have never set any icons, nor do i plan to for some time, and the manifest is un-editable(it's re-generated each build by VS)
I'm truly baffled, because i effectively haven't changed anything since it was working fine 1h ago.

A: Turns out visual studio had deleted the resources from the project, all by itself.
Creating a new blank Cordova app and copying the generated ones across to this project fixed the problem.


text:
Q: intrinsicContentSize for UITableView centered in its superview I want to center a subclassed tableview (TSNInformationTableView) in its superview using xib file.

The height of the table is set using a custom intrinsic size:

The issue is the table can have a dynamic size/height, different number of cells with different text inside of them. So in the TSNInformationTableView I have defined the intrinsicContentSize method:
- (CGSize) intrinsicContentSize {

        return self.contentSize
}

The problem I have with the self.contentSize.height is it does not return the correct height of the table but something somewhat smaller. That is why I tried to compensate this with the multiplier 1.45. It does not scale properly with different number od the cells.
In the image there is a visible cut of the last cell because the height of the table defined by the intrinsicContentSize is not correct.

The table is initialized with the following code:
self.informationTableView.estimatedRowHeight = 80;
self.informationTableView.rowHeight = UITableViewAutomaticDimension;

[self.informationTableView setScrollEnabled:NO];

UPDATE
I had to add this method in the controller where the table view (TSNInformationTableView) is nested:
- (void) viewDidLayoutSubviews {

    [super viewDidLayoutSubviews];

    if(!self.isInformationTableViewLoaded) {
        self.isInformationTableViewLoaded = YES;

        [self.InformationTableView invalidateIntrinsicContentSize];
        [self.InformationTableView setNeedsLayout];
    }
}

isInformationTableViewLoaded is just a simple BOOL property in the controller indicating that the table has been created (so that we can get proper table view size). It works without any animation issue now.
Also the table's estimatedRowHeight should be set to e.g. 1000.

A: I had to add - (void) viewDidLayoutSubviews  in the controller where the table is nested. See the edit at the end of the original post.


text:
Q: Partitioned memory for writing a soft CPU of virtual machine I'm trying to write a simple soft CPU in C that will work on an imaginary machine for an embedded application. I'm new to this, so bear with me.
I've been trying to do this in an IDE, but run into an issue where I need to malloc the memory and am not getting a consistent memory address for allocating my registers, so I'm unable to run tests and debug. On an actual piece of hardware, I understand that the documentation would give me the addresses of specific registers, main memory, and hard disk memory, correct? I'd like to be able to define macros for my registers that I can then pass around to read/write, but this seems impossible without static memory addresses.
So it seems like I need a good way to allocate a static chunk of memory with static addresses, either in an IDE or on my own machine with a text editor. What would be the best way to do this? For reference, I'm using Cloud9 IDE but can't figure out how to do it in this platform.
Thanks!

A: You should do something like uint8_t* const address_space = calloc( memory_size, sizeof(uint8_t) );, check the return value of course, and then make all your machine addresses indices into the array, like address_space[dest] = register[src];.  If your emulated CPU can handle data of different sizes or has less strict alignment restrictions than your host CPU, you would need to use memcpy() or pointer casts to transfer data.
Your debugger will understand expressions like address_space[i] whether address_space is statically or dynamically allocated, but you can statically allocate it if you know the exact size in advance, such as to emulate a machine with 16-bit addresses that always has exactly 65,536 bytes of RAM.


text:
Q: Items in desktop folder to appear on desktop Somehow recently I managed to mess up my Desktop folder so the contents are no longer displayed on the actual desktop.  Anybody have any ideas how to get this back?  It's not a problem normally since I normally use spotlight, but it'd be nice to have.
Thanks

A: If you don't want to reinstall PathFinder, you can type this command in Terminal.app
defaults write com.apple.finder CreateDesktop -bool true

This will get them back. You might have to log in and out.

A: There is an option in path finder to hide finder's desktop and replace it with a version provided by path finder.
You might want to try reinstalling it and checking its preferences, particularly the general preferences section.


text:
Q: Server 2012 R2 Sitelinks Best Practices I am having trouble understanding exactly how to properly configure AD Sites and Services overall. I can find countless articles how to technically configure it, but I can't seem to find any article that really goes into detail into what exactly it should look like.
What I do know:

*

*Every remote location (remote site) should have its full subnet listed in the subnets folder in Sites and Services

*Every location that has a domain controller should have its own "site".

My Network
I have the primary network in in the united states. I have two other "main" locations, 1 in Europe, and 1 in Asia. Each "main" site has at least 2 domain controllers for redundancy. Spread throughout the world I have about 25 small remote office sites with no servers, just small buildings with groups less than 25 active users at any given time.
What I think I know

*

*Subnets should only be listed once, specifically under the "main" site they have the best connection to.

*I should have 3 main site links as follows. (US-Asia,US-Europe,Asia-Europe)

*I have no idea how to configure NTDS replication optimally.

A: A book could be written in answer to this question. That being said, I'll make a few comments:

*

*You're correct in that your subnets should be created and associated with the appropriate site in AD Sites and Services.

*You don't really need the Asia-Europe site link. Creating only the US-Europe and the US-Asia site links is enough to ensure a complete replication topology. This is effectively a hub and spoke design with the US site being the hub. This is a fairly common design.

*You don't have to and in most cases shouldn't try to manually create the replication topology. Create your sites, your site links, and your subnets and let the KCC and ISTG create the replication topology for you. You and I are not smarter than the KCC and the ISTG and in the majority of scenarios we should leave them to do the job they were designed to do and not interfere with that. The role of the KCC and the ISTG is to create a least cost, loop free replication topology and it is well designed to do just that.


text:
Q: Receive data firebase error - android
Code compiles ok - Problem is at showing data from server firebase
I need only one table from general table.
EXAMPLE:
Firebase database:
CLIENTE --> NAME: <--- ONLY SHOW THIS DATA
        TELEPHONE:
        etc...

CODE:
MainClass Show List Viewer.
public class ShowClienteFragment extends Fragment {

    ArrayList<ShowCliente> myList = new ArrayList<>();
    ArrayList<ShowCliente> mKeys = new ArrayList<>();

    private ListView newListView;

    private DatabaseReference gDatabase;

    public ShowClienteFragment() {
        // Required empty public constructor
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        gDatabase = FirebaseDatabase.getInstance().getReference();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
       View view = inflater.inflate(R.layout.fragment_show_cliente, container, false);
       newListView = view.findViewById(R.id.lvCliente);
       final ArrayAdapter<ShowCliente> arrayAdapter = new ArrayAdapter<>(getActivity(),android.R.layout.simple_list_item_1, myList);
       newListView.setAdapter(arrayAdapter);

        gDatabase.child("cliente").addChildEventListener(new ChildEventListener() {
            @Override
            public void onChildAdded(DataSnapshot dataSnapshot, String s) {
              ShowCliente show  = dataSnapshot.getValue(ShowCliente.class);
              myList.add(show);
              //ShowCliente key = dataSnapshot.getKey();
              //mKeys.add(key);
              arrayAdapter.notifyDataSetChanged();
            }

            @Override
            public void onChildChanged(DataSnapshot dataSnapshot, String s) {
              //  String data = dataSnapshot.getValue(String.class);
              //String key = dataSnapshot.getKey();
              // int index = mKeys.indexOf(key);
              //  arrayAdapter.notifyDataSetChanged();

            }

            @Override
            public void onChildRemoved(DataSnapshot dataSnapshot) {

            }

            @Override
            public void onChildMoved(DataSnapshot dataSnapshot, String s) {

            }

            @Override
            public void onCancelled(DatabaseError databaseError) {

            }
        });

         return view;
    }

}

Constructor Class
public class ShowCliente {

    private String razonsoc;

    public ShowCliente() {
    }

    public String getRazonsoc() {
        return razonsoc;
    }

    public void setRazonsoc(String razonsoc) {
        this.razonsoc = razonsoc;
    }
}

A: For each item from the database, you do this:
  ShowCliente show  = dataSnapshot.getValue(ShowCliente.class);
  myList.add(show);

This means that you decode the ShowCliente from the JSON data and then add it to the list that your ListView shows. The ListView dutifully does what you tell it to do: it takes each ShowCliente object and displays it.
Since it doesn't know how to display a ShowCliente, it shows the ShowCliente.toString(), which by default shows a hashcode of the object.
You have two options to get the behavior you want:

*

*Override toString() to return what you want. You do this by adding a toString() implementation to ShowCliente:
public String toString() {
  return razonsoc.toString();
}

*Don't add the ShowCliente to the list, but just the value you want to display. To do this, change what you add to the list in onChildAdded:
myList.add(show.getRazonsoc());


text:
Q: android: How to get data from other activity using share preference I want to get data from another activity using share preference and below is my LoginDao class where I have set data from json object sucessfully.
public class LoginDao implements LoginListner {
    private ArrayList<LoginModel> alLogin;
    @Override
    public ArrayList<LoginModel> getLoginDeatilFromJson(JSONObject jsonObject) {
        try {
            alLogin = new ArrayList<LoginModel>();
            if (jsonObject != null) {

                LoginModel model = new LoginModel();

                model.setStrShiftee_id(jsonObject.getString(WebField.LOGIN_USER.RESPONSE_SHIFTEE_ID));
                model.setStrFName(jsonObject.getString(WebField.LOGIN_USER.RESPONSE_FIRST_NAME));
                model.setStrLName(jsonObject.getString(WebField.LOGIN_USER.RESPONSE_LAST_NAME));
                model.setStrEmail(jsonObject.getString(WebField.LOGIN_USER.RESPONSE_EMAIL));
                model.setStrSkill(jsonObject.getString(WebField.LOGIN_USER.RESPONSE_SKILL));
                model.setStrAddress1(jsonObject.getString(WebField.LOGIN_USER.RESPONSE_ADDRESS1));
                model.setStrAddress2(jsonObject.getString(WebField.LOGIN_USER.RESPONSE_ADDRESS2));
                model.setStrCity(jsonObject.getString(WebField.LOGIN_USER.RESPONSE_CITY));
                model.setStrCountryName(jsonObject.getString(WebField.LOGIN_USER.RESPONSE_COUNTRY_NAME));
                model.setStrStateName(jsonObject.getString(WebField.LOGIN_USER.RESPONSE_STATE_NAME));
                model.setStrPinCode(jsonObject.getString(WebField.LOGIN_USER.RESPONSE_PINCODE));
                model.setStrContact(jsonObject.getString(WebField.LOGIN_USER.RESPONSE_CONTACT1));
                model.setStrDegree(jsonObject.getString(WebField.LOGIN_USER.RESPONSE_DEGREE));
                model.setStrCollege(jsonObject.getString(WebField.LOGIN_USER.RESPONSE_COLLEGE));
                model.setStrYear(jsonObject.getString(WebField.LOGIN_USER.RESPONSE_YEAR));
                model.setStrGrade(jsonObject.getString(WebField.LOGIN_USER.RESPONSE_GRADE));

                alLogin.add(model);

                Log.e("Checking Register Dao size", ">" + alLogin.size());
                Log.e("Checking Register Dao", ">" + alLogin);
                return alLogin;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return alLogin;
    }
}

Here is my model class.
public class LoginModel implements Serializable {
    private String strFName;
    private String strLName;

    public String getStrFName() {
        return strFName;
    }
    public void setStrFName(String strFName) {
        this.strFName = strFName;
    }
    public String getStrLName() {
        return strLName;
    }
    public void setStrLName(String strLName) {
        this.strLName = strLName;
    }
}

I have used share preference in the name of SessionManager class to save user datail.
    public class SessionManager {
    private static final String PREF_NAME = "Session";
    public static final String KEY_FIRSTNAME = "firstName";
    public static final String KEY_LNAME = "lastName";
    public static final String KEY_EMAIL = "emailAddress";
    public static final String KEY_ADDRESS1 = "address1";
    public static final String KEY_ADDRESS2 = "address2";

    public static void saveUsersDetails(Context context, String strFname, String strLname, String strEmail, String strAddress1, String strAddress2) {
        try {
            SharedPreferences preferences = context.getApplicationContext().getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
            SharedPreferences.Editor editor = preferences.edit();

            editor.putString(KEY_FIRSTNAME, strFname);
            editor.putString(KEY_LNAME, strLname);
            editor.putString(KEY_EMAIL, strEmail);
            editor.putString(KEY_ADDRESS1, strAddress1);
            editor.putString(KEY_ADDRESS2, strAddress2);

            editor.commit();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static LoginModel getUserDetail(Context context) {
        LoginModel loginModel = new LoginModel();
        SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);

        loginModel.setStrFName(preferences.getString(SessionManager.KEY_FIRSTNAME, ""));
        loginModel.setStrLName(preferences.getString(SessionManager.KEY_LNAME, ""));
    }
}

I have used common SessionManager class to store data and I want to retrive all data from another activity.

A: You can get Data from any Class Or Activity like
LoginModel userData = new LoginModel();
userData =SessionManager.getUserDetail(MainActivity.this);
String UserName=userData.getStrFName();


text:
Q: is it posible to button constrained with navigation drawer on android? I want to add button left side of navigation drawer and when navigation drawer animated left the button should be move with navigation button and constained with navigation button

A: You can do it programmatically with your own logic. Like you can set a listener for your NavigationDrawer and detect position of the drawer, Here is the helping link.
Then you can reposition your button by setting its margins dynamically. You can do it in this way.


text:
Q: Edit Particular Google Sheet from Android App I'm currently attempting to create an app which uses a Google Sheet as a database of users and subscription dates - I have found how to add new users to the database via hooking into Google Forms, however this does not let me edit the value of user subscription dates after they've already been set once, so I am trying to figure out how I could edit the sheet from within the app.
The problem is, that all information I can find on editing Google Sheets (all using the Sheets API) covers how to edit/create a sheet of the user, rather than the specific sheet of mine that I want to change (as far as I can tell)
Does anybody know how I can just edit my one specific sheet from within an Android app?


text:
Q: How to get GPG working with Outlook 2013? My OS is Windows 8.1 Update 1 x64. I have Outlook 2013 and just installed GPG4Win (latest, 2.2.2, full version).
When I now launch Outlook 2013, I still don't see any UI/options to setup certificates and send encrypt an encrypted email (perhaps to myself as a test message). How do I get started?
I must use Outlook, so suggesting another mail client is a non-starter.

A: Take a look at gpg4o (enter link description here).
It is not free but it just does the job.
IMHO the best PGP solution for Outlook.
They also offer a trial which persuaded us to 100%.

A: My company, Encryptomatic.com, has released a new open pgp encryption addon for MS Outlook 2016 thru 2007. It supports both 64 and 32 bit versions of Outlook. Installer is signed. Supports key servers, signing, etc.  We think its important that email encryption is accessible and easy, so we made it completely free for personal use. Can't post the link here but you can get it on our website.
Sorry for the plug, but it seemed quite relevant to the subject.

A: For Outlook 2010 and 2013 you need to install  Outlook Privacy Plugin with Gpg4win (OpenPGP encryption plugin). I believe that above will fix your issue


text:
Q: Use scala List and Enumeration in Java i couldn't find a solution for this problem:
i have this scala code
package testScala

import scala.collection.JavaConversions._
import collection.mutable._

object TypeEnum extends Enumeration {
  type TypeEnum=Value
  val A, B, C, D, E = Value
}

import TypeEnum._

case class Foo(param1: TypeEnum, param2: List[Int]) {
  def length: Int = param2.length
}

Java code:
package testJava;

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

import scala.collection.JavaConversions;

import testScala.TypeEnum;
import testScala.Foo;

public class testJava {
    public static void main (String[] args)
    {

        List<Object> l1 = new ArrayList<>();
        l1.add(1);
        l1.add(2);

        //Error here
        Foo f = new Foo(TypeEnum.A(), JavaConversions.asScalaBuffer(l1).toList());

    }
}

i get the error "The constructor Foo(Enumeration.Value, List) is undefined".
how can i instantiate a new object from type Foo (with a non-empty list)? Thanks in advance.

A: Here is how you can do this
scala file:
package test

object TypeEnum extends Enumeration {
  type TypeEnum=Value
  val A, B, C, D = Value
}

import TypeEnum._

case class Foo(param1: TypeEnum, param2: List[Int])

java file:
import scala.collection.immutable.List;
import test.TypeEnum;
import test.Foo;

public class Test {
    public static void main(String[] args) {
        Foo foo = new Foo(TypeEnum.A(), null);
        System.out.println(foo.param1());
    }
}

But maybe better don't. Using scala from java can be a pain, expecially when you put scala collections in the api.
Note that by convention you should start name of your classes with capital letter, and you shouldn't put val for fields of case classes as they are added implicitly anyway.
Edit
To answer the comment, I extended Foo with sum method for test.
case class Foo(param1: TypeEnum, param2: List[Int]) {
  def sum = param2.sum
}

You were converting it right but from javas point of view, Foo needs List<Object>, so you need your ArrayList to contain Objects.
List<Object> list = new ArrayList<>();
list.add(2);
list.add(4);
Foo foo = new Foo(TypeEnum.A(), JavaConversions.asScalaBuffer(list).toList());
System.out.println(foo.param1());
System.out.println(foo.sum());

So to get your way from ArrayList<Integer> to ArrayList<Object> I think you need to create a new ArrayList<Object> and readd all elements. As I said earlier very dirty stuff. Better just create a scala wrapper that takes java type and converts and delegates the list.
Edit
As the code you presented works for me maybe you have something else causing the problem. I simply created sbt project with 2 files, using scala 2.11.8 and it compiles.
Here is the adapter class I mentioned before
import scala.collection.JavaConverters._
class FooAdapter(param1: TypeEnum, param2: java.util.List[Integer])
  extends Foo(param1, param2.asScala.map(_.intValue).toList)

it will let you to pass just an ArrayList<Integer> from java.

A: The Scala enumeration is an object. Like any object it can be used from Java using the suffix $.MODULE$
TypeEnum$.MODULE$.A()


text:
Q: Rational equivalence hyperbola and union of two lines in $\mathbb{P}^2$ We say that two subschemes are rationally equivalent if their associated cycles are rationally equivalent. Two cycles are rationally equivalent if their difference is in $Rat(X)$. If $X$ is a scheme, we define $Z(X)$ the group generated by the reduced irreducible subschemes of $X$. I denote with $Rat(X) \subset Z(X)$ the subgroup generated by differences of the form
$$ \langle \Phi \cap (\{t_0\} \times X) \rangle - \langle \Phi \cap (\{t_1\} \times X) \rangle ,$$
where $t_0,t_1 \in \mathbb{P}^1$ and $\Phi$ is a subvariety of $\mathbb{P}^1 \times X$ not contained in any fiber ${t} \times X$ (I took this definition from Intersection theory in algebraic geometry of Harris). Now I have to prove rigorously that in $\mathbb{P}^2$ an hyperbola and the union of two lines are rationally equivalent. How can I do it? Thanks in advance.

A: Hint: Take the family of hyperbolae (I checked the plural of hyperbola and apparently hyperbolas works as well)
$$p(t)=x^2-y^2-tz^2=0$$
for $t\in\mathbb{A}^1$. For $t\neq 0$, $p(t)$ is an actual hyperbola, but for $t=0$ we get the lines $x=y$ and $x=-y$.


text:
Q: Equivalent %username% for VB script I am looking to delete OfficeFileCache folder from the current user's computer. Currently I have..
Option Explicit
Dim obj : Set obj =CreateObject ("wscript.shell")
Dim fso : Set fso =CreateObject ("scripting.FileSystemObject")

obj.Run "taskkill /f /im msouc.exe.exe",0
obj.Run "taskkill /f /im msosync.exe.exe",0

fso.DeleteFolder "C:\Users\%username%\AppData\Local\Microsoft\Office\16.0\OfficeFileCache"

The last part is what I am having trouble with. Just looking for an equivalent to usernames within a VB script.

A: When in doubt, read the documentation:

ExpandEnvironmentStrings Method
Returns an environment variable's expanded value.

In your case:
fso.DeleteFolder obj.ExpandEnvironmentStrings("C:\Users\%username%\AppData\Local\Microsoft\Office\16.0\OfficeFileCache")

A: If you're using some path like
C:\Users\%username%\AppData\Local\...

This is better:
%LocalAppData%\...

So
Fso.DeleteFolder Obj.ExpandEnvironmentStrings("%LocalAppData%\Microsoft\Office\16.0\OfficeFileCache")

does it better, in case the user set their %UserProfile% to another directory.


text:
Q: Conflicting REST urls So I'm building a REST api and need to make some urls. The problem is, I'm running into some conflicting paths. For example:

*

*GET <type>/<id> gets the details of an object of a given type and id

*GET <type>/summary gets the summary of objects of a given type

This simplified example shows a problem occurs when an object has id "summary". What is the best way to solve this? From a REST puritan perspective, what should be the solution?
Here's some of my ideas:

*

*Put the <id> in query parameters. From what I understand this is against standards

*Put a keyword at the start of the url. Also against standards?

*Disallow certain id values. Not something I want to enforce for all my users and use cases and different entrances into my system

A: I may have an alternative to this. What if we have both book as wel as the plural books. Then you can have:
/book/{id}

and
/books/summary

or
/books/count

A: The URL structure is not quite right to begin with so it's difficult to solve it in a clean way.
For the sake of discussion, let's assume <type> is a books resource. So the first URL is fine - you get a book of the given ID:
GET /books/<id>

However this is not:
GET /books/summary

Because it's a bespoke URL, which I guess has a use in your application but is not restful. A GET call should return one or more resources. However a "summary" is not a resource, it's a property of a resource and that's why you end up in this situation of having IDs mixed up with book properties.
So your best option would be to change this URL to something like this:
GET /books?fields=summary

By default GET /books would return all the resources, while GET /books?fields=<list_of_fields> will return the books but with only the chosen properties.
That will be similar to your previous URL but without the ID/property conflict, and will also allow you later on to retrieve resources with specific fields (without having to create new custom URLs).
Edit:
Regarding the count of books, it's still useful to reason in terms of resources. /books gives you one or more books, but it should not be used for meta-information about the collection, such as count, but also things like "most read book", or "books that start with the letter 'A'", etc. as that will make the resource more and more complex and difficult to maintain.
Depending on what you want to achieve I think there'd be two solutions:

*

*Create a new resource that manages the collection of books. For example:
GET /bookcase
And that will give you information about the collection, for example:
{
    "count": 1234,
    "most_read": "<isbn>",
    // etc. - any information that might be needed about the book collection
}

*Or a search engine. You create a resources such as:
GET /book_search_engine/?query=
which would return a search result such as:
{
    "count": 123,
    "books": [
        // Books that match the query
    ]
}

then a query like this would give you just the count:
// Search all the books, but provide only the "count" field
GET /book_search/?query=*&fields=count

Obviously that's a more involved solution and maybe not necessary for a simple REST API, however it can be useful as it makes it easier to create queries specific to a client.

A:
This simplified example shows a problem occurs when an object has id "summary". What is the best way to solve this? From a REST puritan perspective, what should be the solution?

As far as REST is concerned, the URI are opaque.  Spelling is absolutely irrelevant.  You could use URI like
/a575cc90-2878-41fe-9eec-f420a509e1f0
/f871fff6-4c4e-48f7-83a4-26858fdb3096

and as far as REST is concerned, that's spot on.  See Stefan Tilkov's talk REST: I Don't Think It Means What You Think It Does.
What you are asking about is URI design, how to adapt conventions/best practices to your particular setting.
One thing that will help is to recognize is that summary is a resource, in the REST/HTTP sense -- it is a document that can be represented as a byte sequence.  All you need to do is figure out where that resource belongs (according to your local spelling conventions).
Continuing to borrow the "books" example used by others
# Here's the familiar "URI that identifies a member of the books collection"
/books/<id>

# Here's the summary of the /books collection
/summaries/books

Put the  in query parameters. From what I understand this is against standards

Not as much as you might think.  REST doesn't care.  The URI spec expresses some views about hierarchical vs non hierarchical data.  HTTP supports the notion of a redirect, where one resource can reference another.
GET /books?id=12345

302 Found
Location: /books/12345

You also have options for skipping a round trip, by returning the representation you want immediately, taking advantage of Content-Location
GET /books?summary

200 OK
Content-Location: /summaries/books

...

A: I have the same issue. And all the solutions seem a little off b/c REST best practices seem to suggest none of them are ideal.
You could have just one off-limit id, like all.

*

*GET <type>/<id>

*GET <type>/all/summary
It might even be possible to use a single symbol instead, such as ~ or _.

*

*GET <type>/<id>

*GET <type>/~/summary
How satisfying this solution seems is of course very subjective.
The singular/plural approach seems more elegant to me but despite most REST best practice guides saying not to do this. Unfortunately some words don't have distinct singular and plural forms.

A: This isn't perfectly conventional for how some like to define their rest endpoints.
But I would would enforce a pattern where "id" cannot be any string. Instead I would use a uuid and define my routes as such.
GET /books/{id:uuid}
GET /books/{id:uuid}/summary
And if you really want a verb in the URL without an identifier it is still technically possible because we know the {id:uuid} in the path must conform to the uuid pattern.
With that GET /books/summary is still distinct from GET /books/{id:uuid}


text:
Q: Google BiqQuery Unstable, Query Execution Failure on Almost all Table Queries : "Error: Error preparing subsidiary query: null" Google BiqQuery Query Execution is failing on Almost all Table Queries. The Table Queries were working initially when we initially deployed our application. When the dataset started growing we started seeing below Errors. We have huge number of tables in each dataset . I am not sure whether it is linked with this error. However when we run this query on smaller dataset in a different biqquery account it is succeeding.
"Error: Error preparing subsidiary query: null"
Below Are some sample Queries which we are trying to Execute both from our application and Google Biq Query Web console  and all our attempts were unsuccessful with above error.
SELECT * FROM  (TABLE_DATE_RANGE([sampledataset.location],
            TIMESTAMP('2016-07-10'),
            TIMESTAMP('2016-07-11')))

Reference Biq Query  JOB ID :bquijob_286a4921_155dd7d8868
SELECT count(*) FROM (TABLE_QUERY(sampledataset,'table_id CONTAINS "location201606"'))

Reference Biq Query JOB ID : bquijob_531d0e3_155dda8f7dc
Even When I am executing a Table Summary Query I am getting Error's . I am not sure whether this error is related.
SELECT * FROM sampledataset.__TABLES_SUMMARY__
WHERE MSEC_TO_TIMESTAMP(creation_time)  <
   DATE_ADD(CURRENT_TIMESTAMP(), -7, 'DAY')

Resources exceeded during query execution: Too many tables in dataset metatable :sampledataset.TABLES_SUMMARY, exceeded 500000 limit.
Because of these issues we think Gogole Biq Query is pretty Unstable and there are not much resources available to resolve our issues.
Before even proceeding with smaller table partitions we did enquire in stackoverflow
Is there a limit to the number of tables allowed in bigquery ?
and we received a positive answer confirming that there are no limits from  @jordan-tigani https://stackoverflow.com/users/1366527/jordan-tigani
Because of this issue we are even forced to migrate from Google Biq Query to AWS Redshift.
Update 1: As per the update from @Felipe Hoffa , it seems like  TABLE_DATE_RANGE function provided from Big Query has issues when large number of tables are present in the given data set. At present there is no fix for this issue from Google Big Query Platform and Projects which were relying on TABLE_DATE_RANGE Functionality needs to migrate to  "Partitioned Tables" (New Feature rolled out by Google) inorder for the application to be functional. I thought to highlight since it might help people while designing their schema for Biq Query since the limitations of TABLE_DATE_RANGE and similar functions are not documented elsewhere

A: as Jordan says there is no limit of number of tables allowed in BigQuery - but there is a limit on how many tables can be queried in one query. How many tables are you hitting with one query here?
To work over the limit of tables permitted in one query, BigQuery rolled the new feature "partitioned tables". Here you can have a unique table - partitioned by day - that will allow you to query only the desired days, thus only incurring the proportional costs (instead of the whole table):
https://cloud.google.com/bigquery/docs/creating-partitioned-tables


text:
Q: JS - Получить значение из select На сайте есть несколько select, которые выводятся в цикле:

$(".selectOptions").change(function() {
  var href = $(".selectOptions :selected").val();
  console.log(href);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select size="6" class="color form-control ocf-target selected selectOptions" name="color">

       <option class="ir_Все" value="http://.../index.php?route=product/category&path=59" id="v-cancel-1">Все</option>
       <option class="ir_3597ae" value="" id="v-12" disabled="disabled">Синий</option>
       <option class="ir_ffffff" value="http://.../index.php?route=product/category&path=59&filter_ocfilter=1:22" id="v-122">Белый</option>

    </select>

<select size="6" class="color form-control ocf-target selected selectOptions" name="color">

       <option class="ir_fbaf00" value="http://.../index.php?route=product/category&path=59&filter_ocfilter=1:3" id="v-13" selected="selected">Желтый</option>
       <option class="ir_ff0000" value="" id="v-11" disabled="disabled">Красный</option>

    </select> ...

Необходимо при выборе какого-либо поля, получить значение этого поля.
Но почему то берет значение только из первого select.

A: $(".selectOptions").change(function()
{
    var href = $(this).val();
    console.log(href);
});


text:
Q: Flag duplicate "what have you tried" comments? There are often comments which asks "what have you tried" in different flavors. Even if this applies to somehow bad questions only I think this is just spam (if repeated). Also this takes the focus from the question and maybe reasonable comments. So I think they should be removed, how do think about this? Should such duplicate comments be flagged?
A recent example:


text:
Q: Error 1023 Stack overflow with as3-signals-v0.9-BETA I am using as3-signals-v0.9-BETA in a simple slide application. In my signal handler, I am dispatching the same signal again based on some conditions.
The application throws an exception after a couple of hours on the signals dispatch method. Below is a stack trace:
Error:
Error #1023: Stack overflow occurred.
     at com.chetansachdev.components::SlideDeck/onNextSlidePleaseEvent()[D:\cb-trunk\Solutions\Components\Slidelib\src\com\chetansachdev\components\SlideDeck.as:75]
     at org.osflash.signals::Slot/execute()[C:\Users\Robert\Documents\Flash\OSFlash\signals\as3-signals\src\org\osflash\signals\Slot.as:87]
     at org.osflash.signals::OnceSignal/dispatch()[C:\Users\Robert\Documents\Flash\OSFlash\signals\as3-signals\src\org\osflash\signals\OnceSignal.as:125]
     at com.chetansachdev.components::SlideDeck/onNextSlidePleaseEvent()[D:\cb-trunk\Solutions\Components\Slidelib\src\com\chetansachdev\components\SlideDeck.as:89]
     at org.osflash.signals::Slot/execute()[C:\Users\Robert\Documents\Flash\OSFlash\signals\as3-signals\src\org\osflash\signals\Slot.as:87]
     at org.osflash.signals::OnceSignal/dispatch()[C:\Users\Robert\Documents\Flash\OSFlash\signals\as3-signals\src\org\osflash\signals\OnceSignal.as:125]
     ...
     ...

Method:
mysignal.add(mySignalHandler);

function mySignalHandler():void
{
    if(condition)
    {
       // do something here..
    }
    else
    {
        mysignal.dispatch();
    }
}

Can some one point me, what is wrong. When I am dispatching from the signal handler, is the stack getting created? (I am not calling the method directly, I am dispatching a signal).

A: It's an infinite loop. It's like writing this:
function inifityAndBeyond(){
    infinityAndBeyond();
}

In other words it doesn't make sense to dispatch the same signal in the handler of the signal.


text:
Q: Lost instances of services on Sharepoint Foundation 2010 Server after a VM Clone I needed a new Sharepoint Foundation 2010 server (on server 2008 R2 X64), so I cloned it to save time.  It screwed up my production server.  The clone worked, and I renamed the server, but it added extra App Pools and screwed up the Central admin link on my production server, and appears to have added new SQL databases on our separate SQL server (also 2008 R2 x64.)
The production sharepoint server still works and is accessible by users.  However, the problem is that the services don't exist on our Sharepoint server anymore.  When I go into Central Admin -> Application Management -> Manage service Apps, I can see them all in there and "Started"... but the Status are all greyed out.  When I go to "manage services on server" and select ALL services for the Sharepoint's IP, there are NO services at all!  These used to be there before the clone, and I had to go in there before to restart the Timer service, as our email alerts stopped working.  So our email alerts aren't working (and don't know what else), but this time there is no service managed by the server for me to restart!  I shut down and am not using the clone as it was a miserable failure, but am thinking it may have taken over these services.
I don't know how to get those services back on the production server.  I tried to redo the configuration wizard, but it acted as if I wasn't part of the farm anymore, and I don't have the original sharepoint setup admin password.
It's been like this for a while now, and the only recurring errors I see in event log are
"The SharePoint 2010 Timer service terminated unexpectedly.  It has done this 3564 time(s).  The following corrective action will be taken in 30000 milliseconds: Restart the service."
"The SharePoint 2010 Timer service terminated with service-specific error %%-2147467259."
Any guidance on how to fix would be GREATLY appreciated!

A: Honestly, at this point it would be faster and more stable to create a new Production server from the ground up (NOT a clone!!!) and then copy your actual content databases there.  Otherwise, you will likely be battling the quirks introduced by this process for years to come.
Some tips for creating your new server: use a SQL Alias for the database connection, and never change the machine name of a server that is running SharePoint.

A: Cloning Prod was a bad idea, at this point you have couple of strategies:
1. Restore from backup, but the thing is that your config DB got screwed and MS doesn't officially support restoring from backup. Although they agreed with me on couple of occasions that this is best course of action to get system back to life.

*Rebuild the farm and reattach the content DBs. That is probably the safest way. Use autoSPInstaller makes your admin life a breeze.


text:
Q: Deploying matlab app on the web using python Hi I want to deploy a matlab application on the web using python. Is there a way to do it.I have converted my application into jar files (java classes) as per the documentation on math works site. Can someone point me in the right direction to go ahead

A: The fact that your Matlab code is packaged up as Jars may not help that much here, at least not with pure Python.
There are a few ways you can take code written in Java and expose it to Python.
Jython
If you are willing to give Jython a shot this may be a really easy way to provide a Django interface to your jars.
Basically you'll get to write a normal Django App and also use Jython to work natively with your Jars.  This could be the best of both worlds assuming you aren't tied to CPython.
Django-Jython
Java Compatibility Interfaces
On CPYTHON either of the following projects will help you work with the code in your Jar files:

*

*JCC: Create a Python extension module that wraps your Jar file

*JPype: Provides an API for running the JVM and calling into code running in that JVM from Python.

Separate Process:
If you have a standalone program written in Matlab (really any language) you could execute it as a child process of your Django application.  You'd look into a simple web form in Django that allowed you to submit values to be inputs to this process and then in your view (after validating the form) you'd do something like:
command = "mymatlabprogram.exe %s"%(arg1,)
process = subprocess.Popen(command.split())
stdout, stderr = process.communicate()

Assuming that worked you could pull answers out of stdout or error messages out of stderr.  You could serve an image created by that process, etc.  Once something like this is working you could look into celeryd to extract the subprocess stuff from your web app.
The advantage of working with a separate process is that you isolate bugs in your Matlab code from breaking your web application and vice versus.  The disadvantage is you have to serialize everything and work with multiple times between the client's browser and your web app, between the web app and the executable, and back to the client.


text:
Q: How to add subfigures in a loop I have a loop in which I would like to create three subfigures. Here is some code with the function definitions removed.
n = 14
dets = []
entropies = []

N = 1000

fig = plt.figure()

# The loop.
for h in xrange(2,8,2):
    for i in xrange(N):
        A = (np.random.randint(2, size=(h,n)))*2-1
        detA_Atranspose = np.linalg.det(np.dot(A, A.transpose()))
        logdetA_Atranspose = math.log(detA_Atranspose + 1,2)
        H = compute_entropy(A)
        entropies.append(H)
        dets.append(logdetA_Atranspose)

    ax1 = fig.add_subplot(311)
    ax1.plot(dets, entropies, 'ro')

plt.show()

However, there is something I don't know how to do.

*

*In the code above, I need ax2 = fig.add_subplot(312)
ax2.plot(dets, entropies, 'ro') in the second iteration and ax3 = fig.add_subplot(313)
ax3.plot(dets, entropies, 'ro') in the third to create the three subfigures. How should I do that?

A: You can make use of plt.subplots and do something like:
fig, ax = plt.subplots(nrows = 3, ncols = 1)

hs = [2,8,2]

for p in xrange(3):
    h = hs[p]
    for i in xrange(N):

        # skip other code

    ax[p].plot(dets, entropies, 'ro')


text:
Q: How to make text show up after a checkbox with JS and without modifying HTML manually? I am having trouble ... How do I create a new node and insert it AFTER the checkbox that is titled "Special Order"?
But it replaces my checkbox with the text.  Also I cannot change HTML as it is created for me by a 3rd party library.  Any changes to HTML are to be done via i.e. JS/jQuery.
Also, for some reason my particular HTML is not always showing the text, when it should be.  I can edit text with Firefox Developer Tools but it doesn't show after the checkbox which is weird... I am probably doing something wrong.
I tried doing

var textnode = document.createTextNode("TEST");
$( "input[name='submittal[special_order]']" ).parent().html(textnode);

<fieldset id="submittal_form_info">

  XXX:
  <input name="submittal[xxx]" value="0" type="hidden">
  <input name="submittal[xxx]" value="1" type="checkbox">

  Special Order:
  <input name="submittal[special_order]" value="0" type="hidden">
  <input name="submittal[special_order]" title="Is this a special order?" value="1" type="checkbox">

</fieldset>

What I am trying to do is to add text of my choosing after the square checkbox icon in my HTML.

A: You need to .append() it to the html instead of using .html() as that replaces the html.

var textnode = document.createTextNode("TEST");
$( "input[name='submittal[special_order]']" ).parent().append(textnode);

<fieldset id="submittal_form_info">

  XXX:
  <input name="submittal[xxx]" value="0" type="hidden">
  <input name="submittal[xxx]" value="1" type="checkbox">

  Special Order:
  <input name="submittal[special_order]" value="0" type="hidden">
  <input name="submittal[special_order]" title="Is this a special order?" value="1" type="checkbox">

</fieldset>

A: Can target the :last input and use after()

var textnode = document.createTextNode("TEST");
$( "input[name='submittal[special_order]']:last" ).after(textnode);

<fieldset id="submittal_form_info">

  XXX:
  <input name="submittal[xxx]" value="0" type="hidden">
  <input name="submittal[xxx]" value="1" type="checkbox">

  Special Order:
  <input name="submittal[special_order]" value="0" type="hidden">
  <input name="submittal[special_order]" title="Is this a special order?" value="1" type="checkbox">

</fieldset>

A: I'm not sure what you wanna do exactly, but this script will go to each input type=checkbox with a title attribute, and append the text in title="" next to it

$('input[type="checkbox"][title]').each(
    function(i, input) {
        $(input).after($(input).attr('title'))
    }
)

<fieldset id="submittal_form_info">

  XXX:
  <input name="submittal[xxx]" value="0" type="hidden">
  <input name="submittal[xxx]" value="1" type="checkbox">

  Special Order:
  <input name="submittal[special_order]" value="0" type="hidden">
  <input name="submittal[special_order]" title="Is this a special order?" value="1" type="checkbox">

</fieldset>


text:
Q: Como usar uma imagem (ou caractere) de borda via CSS? Eu tenho uma tag
 com texto dentro que eu gostaria de usar os caracteres de chaves [ ] como borda para esse texto.
Código:

.indicacoes {
font-family: 'AmaticBold';
font-size: 40px;
margin-top: 30px;
text-align: center; }

texto de teste!

                TEXTO TEXTO TEXTO TEXTO.

                TEXTO TEXTO TEXTO.

O objetivo é ficar como na imagem em anexo:

A: Como diz esta resposta do SO você pode desenhar as chaves sem o uso de qualquer pseudo elemento em CSS puro.
Passos:

*

*Crie um elemento como <div ou span e utilize inline-block para que o tamanho seja dependente do conteúdo;

*Aplique as bordas na direita e esquerda;

*Use linear-gradient() para criar 4 imagens de fundo com altura e largura específicas e desenhe em cada canto da caixa com background-position. A propriedade height do background-size deve ser igual a espessura da borda esquerda.

div.chaves {
  background-image: linear-gradient(#000000, #000000),
                    linear-gradient(#000000, #000000),
                    linear-gradient(#000000, #000000),
                    linear-gradient(#000000, #000000);
  border: solid #000000;

  background-repeat: no-repeat;
  /* O segundo valor deve ser igual à largura das bordas */
  background-size: 8px 4px;
  border-width: 0 4px;
  background-position: top left, top right, bottom left, bottom right;
  display: flex;
  align-items: center;
  justify-content: center;
}

        texto de teste!
 TEXTO TEXTO TEXTO TEXTO.
 TEXTO TEXTO TEXTO.

A: Fiz um modelo usando pseudo-elemento mesmo, pois assim eu consigo controlar melhor o contorno e as curvaturas. Sei que não ficou exatamente igual, mas as vezes te atende...
Não precisei mexer em nada no seu HTML, apenas no box onde o texto está dentro eu crie um ::before e ::after Essas "chaves" [ ] sempre vão ter a altura do conteúdo, então não importa se tem muito ou pouco texto, as "chaves" sempre vão se ajustar com o conteúdo.
O macete aqui foi construir um retângulo de cada lado do box do texto e remover a borda de dentro desse quadrado, para deixa arredondado os cantos é só usar border-radius. Porém como falei no início não fica exatamente igual a imagem

.indicacoes {
    font-family: 'AmaticBold';
    font-size: 40px;
    margin-top: 30px;
    text-align: center;
}
.texto-principal {
    padding: 1rem;
    width: 50%;
    margin: 1rem auto;
    position: relative;
}
.texto-principal::after,
.texto-principal::before {
    content: "";
    position: absolute;
    top: 0;
    width: 4em;
    height: 100%;
    border: .5em solid currentColor;
    border-radius: .5em;
}
.texto-principal::after {
    left: 0;
    border-right: 0;
}
.texto-principal::before {
    right: 0;
    border-left: 0;
}

            texto de teste!

            TEXTO TEXTO TEXTO TEXTO.

            TEXTO TEXTO TEXTO.


text:
Q: Can a sub class overload a method of a superclass that has been declared abstract I"m having an issue overloading a method that has been declared in an abstract superclass. Below is the superclass
public abstract class UserTask {
    public abstract void applyToBorrowABook(User user, Map<String,PriorityQueue<User>>listOfApplicants, List<Books>booksList);

below is also the subclass I'm having problems implementing
public class UserQueueImpl extends UserTask  {

    @Override
    public void applyToBorrowABook(User user, Map<String, Queue<User>> listOfApplicants, List<Books> booksList) {
        if(booksList.size()>0){
            for(Books b:booksList){
                if(b.getBookTitle().equalsIgnoreCase(user.getBookRequested())){
                    if(listOfApplicants.containsKey(user.getBookRequested())){
                        listOfApplicants.get(user.getBookRequested()).add(user);
                    }
                    else{
                        PriorityQueue<User>applicants=new PriorityQueue<>();
                        applicants.add(user);
                        listOfApplicants.put(user.getBookRequested(),applicants);
                    }
                }
            }
        }
        else {
            throw new BookNotFoundException("No book present in the library");
        }

    }
    }
}


text:
Q: Music player sometimes skips all songs and won't play I have a problem on my iPhone 5s (running iOS 10).
Sometimes my music player doesn't play music and just skips all of my songs, but after I reset my iPhone, it works well again.
At first I thought this was just a regular crash, but as this problem became more frequent, it's become annoying to me.
Is this a bug on iOS 10 or does my iPhone have a problem?

A: This appears to be a bug that was fixed in iOS 10.3. My Music app started behaving as expected after I updated my iPhone.


text:
Q: Why doesn't "base is derivedA || base is derivedB" work as expected? if (state is NoteInitial || state is NewNote)
              return ListView.builder(
                  itemCount: state.notes.length,
                  padding: EdgeInsets.symmetric(vertical: 10),
                  itemBuilder: (BuildContext context, int index) {
                    return _NoteCard(state.notes[index], key: UniqueKey(),);
                  });

NoteInitial and NewNote are both derived from the abstract class NoteState, state is a NoteState. If I only write if(state is NoteInitial) then the code can compile, same if I write it with new NewNote, but if I write both, the compiler complains that The getter 'notes' isn't defined for the type 'NoteState'.  notes is defined in both of them, is this a problem with the compiler, or I'm doing something wrong?

A: The compiler can only make sure that the property notes exists if it narrows down the type of variable to a specific type that has those properties.
I guess both of your types have this property but independently of each other? But the compiler cannot really know this. It has not narrowed it down to a specific type.
If so, then you may want to create another base class or interface, implement it for both of them and then make your if statement depend on that. Or maybe one of your states is a superset of the other, that would work too.
What I do is i have an abstract state called NoteWithNotesState that has a property notes and then both NewNote and InitialNote derive from that. Then you ifcould be if(state is NoteWithNotesState) and then you should be able to access the property with no problems.


text:
Q: How can I start the coroutine with time? using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

public class PlayerMouthSpeechController : MonoBehaviour
{
    public TMP_Text[] texts;
    public bool startTalking = false;
    public float talkTime;
    public float duration;
    [Range(0, 100)]
    public float valueRange;
    private SkinnedMeshRenderer bodySkinnedMeshRenderer;
    //private bool isTalking = true;

    // Start is called before the first frame update
    void Start()
    {
        bodySkinnedMeshRenderer = GetComponent<SkinnedMeshRenderer>();
    }

    // Update is called once per frame
    void Update()
    {
        /*if (startTalking && isTalking)
        {
            StartCoroutine(AnimateMouth());
            StartCoroutine(TalkTime());

            isTalking = false;
        }

        if(startTalking == false && isTalking == false)
        {
            isTalking = true;
        }*/
    }

    //Lerp between startValue and endValue over 'duration' seconds
    private IEnumerator LerpShape(float startValue, float endValue, float duration)
    {
        float elapsed = 0;
        while (elapsed < duration)
        {
            elapsed += Time.deltaTime;
            float value = Mathf.Lerp(startValue, endValue, elapsed / duration);
            bodySkinnedMeshRenderer.SetBlendShapeWeight(0, value);
            yield return null;
        }
    }

    //animate open and closed, then repeat
    public IEnumerator AnimateMouth()
    {
        while (startTalking == true)
        {
            yield return StartCoroutine(LerpShape(0, valueRange, duration));
            yield return StartCoroutine(LerpShape(valueRange, 0, duration));
        }
    }

    public IEnumerator TalkTime()
    {
        yield return new WaitForSeconds(talkTime);

        startTalking = false;
    }
}

I messed it all before with too many flags and in the Update() messed it too.
I want to make something simple. To be able to call from any other script to the method AnimateMouth and that the method AnimateMouth will also get a float will be the time the mouth will be animated. something like :
StartCoroutine(AnimateMouth(4f));

but I messed it all. maybe to make the AnimateMout public static or when calling from another script first to make a reference to the PlayerMouthSpeechController and then call it something like :
playerMouthSpeechController.AnimateMouth();

and something will start the AnimatedMouth coroutine. but again I messed it too much.
Update :
This is working almost perfectly as I wanted still I need to use StartCoroutine each time I want the player to start talking but it's working.
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

public class PlayerMouthSpeechController : MonoBehaviour
{
    public TMP_Text[] texts;
    public float duration;
    [Range(0, 100)]
    public float valueRange;

    private bool startTalking = false;
    private SkinnedMeshRenderer bodySkinnedMeshRenderer;

    // Start is called before the first frame update
    void Start()
    {
        bodySkinnedMeshRenderer = GetComponent<SkinnedMeshRenderer>();
    }

    // Update is called once per frame
    void Update()
    {

    }

    //Lerp between startValue and endValue over 'duration' seconds
    private IEnumerator LerpShape(float startValue, float endValue, float duration)
    {
        float elapsed = 0;
        while (elapsed < duration)
        {
            elapsed += Time.deltaTime;
            float value = Mathf.Lerp(startValue, endValue, elapsed / duration);
            bodySkinnedMeshRenderer.SetBlendShapeWeight(0, value);
            yield return null;
        }
    }

    //animate open and closed, then repeat
    public IEnumerator AnimateMouth(float TimeToTalk)
    {
        startTalking = true;

        StartCoroutine(TalkTime(TimeToTalk));

        while (startTalking == true)
        {
            yield return StartCoroutine(LerpShape(0, valueRange, duration));
            yield return StartCoroutine(LerpShape(valueRange, 0, duration));
        }
    }

    private IEnumerator TalkTime(float TalkTime)
    {
        yield return new WaitForSeconds(TalkTime);

        startTalking = false;
    }
}

And using it for example in another script :
At the top :
public PlayerMouthSpeechController blendShapeController;

And
StartCoroutine(blendShapeController.AnimateMouth(10f));

I wish I could do somehow that I will not start a coroutine each time and that it will start the coroutine automatic and I will only do :
blendShapeController.AnimateMouth(10f);

And it will start the coroutine in the PlayerMouthSpeechController.

A: Working solution as I wanted :
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

public class PlayerMouthSpeechController : MonoBehaviour
{
    public TMP_Text[] texts;
    public float duration;
    [Range(0, 100)]
    public float valueRange;

    private bool startTalking = false;
    private SkinnedMeshRenderer bodySkinnedMeshRenderer;

    // Start is called before the first frame update
    void Start()
    {
        bodySkinnedMeshRenderer = GetComponent<SkinnedMeshRenderer>();
    }

    // Update is called once per frame
    void Update()
    {

    }

    //Lerp between startValue and endValue over 'duration' seconds
    private IEnumerator LerpShape(float startValue, float endValue, float duration)
    {
        float elapsed = 0;
        while (elapsed < duration)
        {
            elapsed += Time.deltaTime;
            float value = Mathf.Lerp(startValue, endValue, elapsed / duration);
            bodySkinnedMeshRenderer.SetBlendShapeWeight(0, value);
            yield return null;
        }
    }

    //animate open and closed, then repeat
    public void AnimateMouth(float TimeToTalk)
    {
        StartCoroutine(StartAnimating(TimeToTalk));
    }

    private IEnumerator StartAnimating(float TimeToTalk)
    {
        startTalking = true;

        StartCoroutine(TalkingTime(TimeToTalk));

        while (startTalking == true)
        {
            yield return StartCoroutine(LerpShape(0, valueRange, duration));
            yield return StartCoroutine(LerpShape(valueRange, 0, duration));
        }
    }

    private IEnumerator TalkingTime(float TalkTime)
    {
        yield return new WaitForSeconds(TalkTime);

        startTalking = false;
    }
}

In other script/s making a reference :
public PlayerMouthSpeechController blendShapeController;

And starting
blendShapeController.AnimateMouth(10f);


text:
Q: Make different editions of an application with single code base I have developed an application for Windows desktop (in WPF). Let's assume this application has 50 features and let's call it ULTIMATE application.
I have another client which demands application with 30 features. Let's call this PROFESSIONAL
Application with 20 features, let's call it BASIC
Now, all I want is to maintain a single source code for all the editions.
My intention is that users with the BASIC edition can't use/see features available in PROFESSIONAL edition, and so on.
How can I achieve this? Do I need to use conditional compilation or something else?

A: Generally this is handled based on the product key. The algorithms for generating and reading the version depends developer to developer.
Lets take a simple example your product keys start by prefixing it's version e.g. -
Ultimate version starts with "U" and will look like - Uxxxxxxxxxxxx
Professional version starts with "P" and will look like - Pxxxxxxxxxxxx
and so on.
Now when your application is loaded, you need to Enable/Disable OR Show/Hide the menus based on the product key version.
This is helpful, when your customer wan't to upgrade their version, you just need to release new product key which will be updated in the application & your software will work with the unlocked features.


text:
Q: Trigger complete stack dump programmatically? When I send a SIGQUIT command to my java process (using kill -3  or kill -QUIT ), it prints a trace of all stacks to stderr, with information about locks held, and deadlock detection. Can I trigger this from inside the program somehow? I want to do this automatically every time a certain operation takes too long.
I know it's possible to get a stack trace (see Is there a way to dump a stack trace without throwing an exception in java?, Thread dump programmatically /JDI (Java Debugger Interface)). But I want to see the whole everything: stack traces, thread states, locks held, locks blocked on, deadlock detection, etc., i.e. everything I get when I sent a SIGQUIT; not just the stack trace.

A: Yes you can. I've been using this code successfully to debug randomly triggered concurrency bugs:
package utils.stack;

import java.io.IOException;
import java.io.UncheckedIOException;
import java.lang.management.ManagementFactory;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.LocalDateTime;
import java.util.function.Supplier;
import javax.management.JMX;
import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;

public interface DiagnosticCommand {
    String threadPrint(String... args);

    DiagnosticCommand local = ((Supplier<DiagnosticCommand>) () -> {
        try {
            MBeanServer server = ManagementFactory.getPlatformMBeanServer();
            ObjectName name = new ObjectName("com.sun.management",
                "type", "DiagnosticCommand");
            return JMX.newMBeanProxy(server, name, DiagnosticCommand.class);
        } catch(MalformedObjectNameException e) {
            throw new AssertionError(e);
        }
    }).get();

    static void dump() {
        String print = local.threadPrint();
        Path path = Paths.get(LocalDateTime.now() + ".dump.txt");
        try {
            byte[] bytes = print.getBytes("ASCII");
            Files.write(path, bytes);
        } catch(IOException e) {
            throw new UncheckedIOException(e);
        }
    }
}

It requires Java 8 and HotSpot as the JVM as it mimics what jstack is doing, except from within the same process.

A: I found this option
ThreadMXBean threadMxBean = ManagementFactory.getThreadMXBean();

for (ThreadInfo ti : threadMxBean.dumpAllThreads(true, true)) {
    System.out.print(ti.toString());
}

A: Not a complete solution, but it should give you the direction:
public StringBuffer getInfoXmlString() {
StringBuffer serverInfo = new StringBuffer(3000);

serverInfo.append("<ServerInfo>");
ThreadGroup rootGroup = Thread.currentThread().getThreadGroup();
ThreadGroup parent;
while ((parent = rootGroup.getParent()) != null) {
  rootGroup = parent;
}

serverInfo.append("<Threads>\r\n");
serverInfo.append(listThreads(rootGroup, "  "));
serverInfo.append("</Threads>\r\n");

serverInfo.append("</ServerInfo>\r\n");
}

private StringBuffer listThreads(ThreadGroup group, String indent) {
StringBuffer threadInfo = new StringBuffer(5000);
threadInfo.append(indent);
threadInfo.append("<ThreadGroup name=\"");
threadInfo.append(group.getName());
threadInfo.append("\" class=\"");
threadInfo.append(group.getClass().getName());
threadInfo.append("\">\r\n");

int nt = group.activeCount();
Thread[] threads = new Thread[nt * 2 + 10];
nt = group.enumerate(threads, false);

// List every thread in the group
for (int i = 0; i < nt; i++) {
  Thread t = threads[i];
  threadInfo.append(indent);
  threadInfo.append("  <Thread name=\"");
  threadInfo.append(t.getName());
  threadInfo.append("\" class=\"");
  threadInfo.append(t.getClass());
  threadInfo.append("\" alive=\"");
  threadInfo.append(t.isAlive());
  threadInfo.append("\"/>\r\n");
}
// Recursively list all subgroups
int ng = group.activeGroupCount();
ThreadGroup[] groups = new ThreadGroup[ng * 2 + 10];
ng = group.enumerate(groups, false);
for (int i = 0; i < ng; i++) {
  threadInfo.append(listThreads(groups[i], indent + "  "));
}
threadInfo.append(indent);
threadInfo.append("</ThreadGroup>\r\n");

return threadInfo;
}

A: I use this code to get string with tread dump info
    public static String generateThreadDump() {
        final StringBuilder dump = new StringBuilder();
        final ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
        final ThreadInfo[] threadInfos = threadMXBean.getThreadInfo(threadMXBean.getAllThreadIds(), 100);
        for (ThreadInfo threadInfo : threadInfos) {
            dump.append('"');
            dump.append(threadInfo.getThreadName());
            dump.append("\" ");
            final Thread.State state = threadInfo.getThreadState();
            dump.append("\n   java.lang.Thread.State: ");
            dump.append(state);
            final StackTraceElement[] stackTraceElements = threadInfo.getStackTrace();
            for (final StackTraceElement stackTraceElement : stackTraceElements) {
                dump.append("\n        at ");
                dump.append(stackTraceElement);
            }
            dump.append("\n\n");
        }
        return dump.toString();
    }