text:
Q: Как вытащить строку из onResponse? Как сделать так, чтобы serverAnswer передавался вне onResponse?
А то получается так, что в onResponse в serverAnswer кладутся данные, но вне onResponse переменная serverAnswer пустая.
Допустим, если выводить Toast с serverAnswer в onResponse, то выведется нужный текст, а если, допустим, выводить Toast вне onResponse, то выведется пустота.
И addUser передает пустую строку.
public String addUser(final String username, final String email, final String password, final Context context) {

    StringRequest request = new StringRequest(Request.Method.POST,
            REGISTER_URL,
            new Response.Listener<String>() {
                @Override
                public void onResponse(final String response) {
                    try {
                        JSONObject jsonObject = new JSONObject(response);
                        final JSONObject status = jsonObject.getJSONObject("Result");
                        serverAnswer = status.getString("Server answer");
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                }
            },
            new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    serverAnswer = error.getMessage();
                }
            }){
        @Override
        protected Map<String, String> getParams() throws AuthFailureError {
            Map<String, String> params = new HashMap<>();
            params.put(KEY_USERNAME, username);
            params.put(KEY_EMAIL, email);
            params.put(KEY_PASSWORD, password);
            return params;
        }
    };
    RequestQueue requestQueue = Volley.newRequestQueue(context);
    requestQueue.add(request);

    return serverAnswer;
}

A: У Вас асинхронный запрос, поэтому везде по коду, до момента выполнения запроса, serverAnswer будет пустой. Метод addUser(...) возвращает значение до того, как с сервера пришел ответ.
Предложу пару вариантов:

*

*В метод addUser(...) можете передавать коллбэк:
public interface OnRequestFinishedListener {
    void onResponse(String serverAnswer);
}

public void addUser(..., OnRequestFinishedListener onRequestFinishedListener) {
    ...
}

и после ответа сервера вызывать соответствующий метод:
onRequestFinishedListener.onResponse(serverAnswer);

*Можно выполнить запрос синхронно, но тогда придется самому возиться с созданием фонового потока, в котором будет выполняться метод.


text:
Q: Connecting to TCP and consuming JMS topic
*

*I have a JMS topic. Data is constantly being written to this topic.

*I want to expose a tcp listening port that, when connected, displays streams of data.

*The data is what ever is the latest content of the topic

basically, i want to do a "tail -f" on a jms topic using tcp port. so instead of "tail -f ", it is more like "telnet server1 40000" to view the contents of the topic.
currently I am thinking about using netty.io, but not sure if spring-integration can handle it.
has anybody even done something like this?
using a message listener would be great, except, i only want to consume the topic when a tcp connection is established.

*

*server starts.

*no thing is being read from the topic

*client #1 connects to tcp port 40000, topic string content is being written to the socket

*client #2 connects to tcp port 40000, topic string content is being written to the socket

*both client #1 and client #2 get the same data

*currently there are 2 consumers for the topic

*client #2 disconnects

*number of consumer for the topic is back to being 1

*client #1 still gets data streamed

Thanks.

A: It's pretty easy to set up a service that responds to a TcpConnectionOpenEvent by opening a consumer to the JMS topic and streaming the messages to the connection.
You need inbound and outbound TCP adapters.
When the inbound adapter detects a new connection it emits the event. Use an ApplicationListener (or even inbound adapter) to catch the event, capture the connection ID, open a consumer on the topic and start sending messages to the outbound adapter (set the ip_connectionId so the adapter knows where to route the message).
When the client closes the connection, you'll get a connection closed event; stop the topic consumer and unregister it.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to run multiple scripts of Jmeter in a batch I am using the Jmeter tool for the performance testing.
We have recorded the scripts for each scenario and now we would like to run them in a group in order to simulate the real time scenario.
Could any one please let me know how can we run all the scenarios in one go? Is there any procedure to group all the scenarios that I have recorded and give load on the sever at same time?
Please let me know the steps if any.

A: You can create a single file with one thread group for each scenario, and set the testplan to run concurrently.

A: If your test plans are all separate currently and you want to keep them that way, there's always the option of a second device (or a third, or a fourth...). You won't have a single consolidated report of performance -- but you will get the performance for each plan you run separately.
This can also be a good option if,
a) One load client can't produce enough of the desired load for all your test plans running at once, and
b) you don't want to use the Remote Testing features of JMeter to run the test plan from multiple load clients at once.

A: Let me share my solution for the same problem.
For running multiple .jmx files I have:

*

*folder with all the jmx filed grouped as needed

*runner - batch file with the following:
dir ..\Jmx\*.jmx /s /b /A:-D > ..\runner\data.txt
for /F "tokens=*" %%A in (data.txt) do %JMETER_HOME%\jmeter -n -t %%A -Jusers=10         -Jrampup=5 -Jloop=10 -Jport=[port] -Jserver=[server] -l [folder]\Results.csv
exit
see general structure


text:
Q: How to disable caching in Swagger UI I am using swagger UI for documenting the APIs. I have deployed the Ui and node server( that has JSON) using docker. After deployment, when I make changes in JSON file, the same is not getting reflected in swagger-UI unless i refresh the whole page.
I tried to add <html manifest="example.appcache">in swagger-ui's index.html and the manifest file has the following config
CACHE MANIFEST
NETWORK:
*

Even after setting the manifest the JSON still gets loaded from cache. Can someone help please.

A: There was discussions and some solutions on Swagger repository issues like creating a request interceptor and set the headers before the request is sent:
var interceptor = {
    requestInterceptor: {
        apply: function (requestObj) {

           var headers = request.Obj.headers || {};

           headers['If-Modified-Since'] = 'Mon, 26 Jul 1997 05:00:00 GMT';
           headers['Cache-Control'] = 'no-cache';
           headers['Pragma'] = 'no-cache';
           return requestObj;
       }
    }
};

// assign the request interceptor in the UI
new SwaggerClient({
  url: 'http://localhost:8000/v2/petstore.json',
  requestInterceptor: interceptor.requestInterceptor,

A: If you are using version 3 (Springdoc), you can simply add the following to your application.yaml file.
springdoc:
  cache:
    disabled: true

or related property to application.properties file.

A: You can simply disable caching in your browser dev tools (network tab).


text:
Q: Snort Installation Error I am a newbie to Snort and doesnt have proper knowledge on installation and configuration of the same. I am following snort official document to install snort on an Ubuntu instance in AWS EC2. I have installed pre-requisites (DAQ) and flex and bison (because that installing pre-requisite failed because of flex and bison). Now I installed Snort and trying to run configure --enable-sourcefire, it fails with error
./configure: line 15558: daq-modules-config: command not found
checking for daq_load_modules in -ldaq_static... no
ERROR!  daq_static library not found, go get it from
http://www.snort.org/.

Googled and got some results to execute which daq-modules-config and set the path with the above result. But which daq-modules-config returns nothing. Can anyone help me to resolve this?


text:
Q: AWS Java SDK - Elastic Transcoder set Start time and Duration on InputJob I'm using the Java SDK to create a Elastic Transcoding Job.
In the documentation, I can set Job settings https://docs.aws.amazon.com/elastictranscoder/latest/developerguide/job-settings.html#job-settings-input-details which includes start time and duration.
I'm using com.amazonaws.services.elastictranscoder.model.JobInput
to create the input, there are no options for Start or Duration.
Is it possible to add these somewhere?

A: SDK out of date and there is a new TimeSpan attribute in the latest version.


text:
Q: NoSuchMethodError under test run with gradle I'm trying to experimentally port a MAVEN java project to gradle. One of the problems I came across is failure to execute unit tests because of NoSuchMethodError happening at runtime (during execution). I'm calling FileUtils.write() method.
I modified my code to trace the class path available in the ClassLoader that loaded FileUtils class and I've got following:
C:/Sdk/gradle-2-7/lib/commons-io-1.4.jar
C:/Users/<me>/.gradle/caches/modules-2/files-2.1/commons-io/commons-io/2.4/b1b6ea3b7e4aa4f492509a4952029cd8e48019ad/commons-io-2.4.jar

Out of that I see that there are 2 versions of commons-io in class path during test run and the one coming with gradle is the first and therefore has higher priority.
What is the root cause? How this can be fixed?
Actually, I expect no JARs to be available in classpath other than explicitly declared in dependencies of my gradle project.

Update: it seems that I've got an idea about the root cause - the project being tested is 'gradle plugin' and to compile it in gradle i have to specify following in build.gradle:
dependencies {
    compile gradleApi()
}

And this seeps to capture all gradle dependencies into my project. Though i still do not see the way to fix it:

*

*I can't remove it because the project wont compile

*I can't exclude something because gradle does not support this for gradleApi() (see http://gradle.1045684.n5.nabble.com/exclude-some-dependencies-from-gradleApi-dependency-td5712103.html).

*I can't add only those gradle jar's I really need as dependencies - i do not see any way to reference them explicitly in compile dependencies, i do not see any public repository containing these artifacts. Note: for MAVEN build I've manually uploaded them into local MAVEN repo.

A: TL;DR
Don't use commons-io:2.1, either use Java8, Groovy, or make a helper to use instead of commons-io.
Explination
The root cause is that gradleApi() includes commons-io:1.4 and when the test is executing you end up having two commons-io jars on the classpath and the 1.4 version happens to be earlier so that's why your getting a NoSuchMethodError.
This happens because Gradle doesn't isolate each plugin in a separate classloader like Maven does. Given how Gradle works you can't. This is because in Gradle a good design strategy is to have multiple plugins that chain together to do one thing. You have one plugin that configures things to be generic and without opinions on how you will use it. Then you have a very opinionated plugin that configures a project with a lot of assumptions. This is helpful when a user doesn't share the same opinions as you do, they can just apply the base plugin and apply their own opinions.
With a more concrete example is you have a jar that contains an extension that other plugins use. This could be something like "failBuildOnQualityError". Then each of the separate plugins (using different coordinates) would try to use that extension to see if they should fail the build when checkstyle, findbugs, jacoco, etc find issues.

A: Ok, my initial diagnose about "Gradle doesn't isolate plugin's classpath from own classpath" is wrong. The root cause is actually ...
dependencies {
    compile gradleApi()
}

... ingesting to many dependencies (including commons-io:1.4). And the right solution (at least workable for me) is include only required jars explicitly:
versions = [
    gradle: "2.8",
    groovy: "2.4.4",
]

dependencies {
    compile "org.codehaus.groovy:groovy-all:${versions.groovy}"
    compile "org.gradle:gradle-base-services:${versions.gradle}"
    compile "org.gradle:gradle-base-services-groovy:${versions.gradle}"
    compile "org.gradle:gradle-core:${versions.gradle}"
    compile files("lib/gradle-platform-jvm-${versions.gradle}.jar")
}

Notes:

*

*gradle's core dependencies should be referenced via public artifact IDs (not via direct JAR file references). This way gradle at run-time uses associated POMs to build transitive run-time dependencies. Otherwise you'll get NoClassDefFoundError during execution of unit tests because other gradle's internals are not in execution classpath.

*it looks like not all gradle's artifacts are available in public repositories (jcenter). If in your plugin you are going to build dependencies on other 'native' tasks (like 'jar') - their implementation has to be referenced directly via JAR file.


text:
Q: Exercise:Bounded linear operator Assume $\alpha(.)$ is a function defined on the bounded measurable set $E$.Let $$(Tx)(t)=\alpha(t)x(t)\ \ \ \ \ \ \ \ \ \ \ \ x\in L^2(E)$$.Then $T$ is a bounded linear operator from $L^2(E)$ to itself iff $\alpha(.)$ is measurable on $E$ and essential bounded.
How to prove this,thank you in advance.

A: That $T$ is linear is obvious: $T(cx + y) = \alpha(t)\bigl(cx(t) + y(t)\bigr) = c\alpha(t)x(t) + \alpha(t)y(t) = cTx + Ty$. Now, if $\alpha$ is essentially bounded, then there exists $M > 0$ such that the measure of the set of all $t$ where $|\alpha(t)|> M$ is zero. Therefore, outside a set of zero measure, $|Tx| = |\alpha(t)x(t)| = |\alpha(t)||x(t)|\leq M|x(t)|$. Therefore $Tx\in L^2(E)$. Finally, to prove that $T$ is bounded, by the above inequality, we have
$$\int_E|Tx|^2d\mu \leq M^2\int_E|x|^2 d\mu $$
In other words, $\|Tx\|_{L^2}\leq M\|x\|_{L^2}$. Hence, by definition, the operator $T$ is bounded, and $\|T\|\leq M$.
EDIT: The other direction.
Assume now that $T$, as defined, is a bounded linear operator on $L^2(E)$. Assuming that $\alpha$ is not essentially bounded on $E$, we get that for $\epsilon > 0$ there exists a positive measure set $\widetilde{E}\subset E$ such that $|\alpha(t)| > (\|T\| + \epsilon)^{1/2}$ for all $t\in \widetilde{E}$. Moreover, since $E$ is bounded, so is $\widetilde{E}$, so $0 < \mu(\widetilde{E}) < \infty$. Now take $x(t) = \mu(\widetilde{E})^{-1/2}\chi_{\widetilde{E}}\in L^2(E)$. We get:
$$\int_E |Tx|^2d\mu = \int_E|\alpha|^2|x|^2d\mu = \frac{1}{\mu(\widetilde{E})}\int_{\widetilde{E}}|\alpha|^2d\mu > \|T\| = \|T\|\|x\|_{L^2}.$$
This contradicts the fact that $\|T\|$ is the norm of $T$.


text:
Q: Extract date and numbers in google sheet from steam price history I have this link with a lot of info: https://steamcommunity.com/market/pricehistory/?currency=1&appid=570&market_hash_name=Exalted%20Fractal%20Horns%20of%20Inner%20Abysm
I want to extract all the data of each date and put in a list divided in date, median price and quantity
I am using IMPORTDATA Function but doesn't support all the lenght of the data.
So I take it manually in a sheet:
https://docs.google.com/spreadsheets/d/1MR6jouxvYfbgEJYgMG6UFf0R7uhZascmFtViNEYPrPQ/edit#gid=836818346
Then I want to divide this in a list as:

Date
Median Price
Quantity

Nov 05 2022 23
193.82
4

I think it can be done with REGEXEXTRACT but I don't know what regular_expression to use.
Already figure out the date median price formula:
=ARRAYFORMULA(REGEXEXTRACT(FLATTEN(SPLIT(A2,"[")),"(.{3} \d+ \d{4}.{3}).+,(.+),"""))

Need and adjustment for show the quantity.

A: try:
=INDEX(QUERY(QUERY(REGEXEXTRACT(FLATTEN(SPLIT(A2,
 "[")), "(.{3} \d+ \d{4}).+,(.+),""")*1,
 "select Col1,avg(Col2),count(Col1) group by Col1"), "offset 1", ))

UPDATE:
=INDEX(REGEXEXTRACT(FLATTEN(SPLIT(A2,
 "[")), "(.{3} \d+ \d{4}).+,(.+),""(\d+)"))


text:
Q: How do I set permissions on files in an unpacked Eclipse Plugin (not a jar) I have created an Eclipse feature set, composed of various plugins. One of these plugins contains an executable file that gets called from the plugin. The feature.xml file sets unpack="true" for this plugin, so it is installed as a directory rather than a jar.
But when Eclipse tries to launch the executable, it throws a "permission denied" error. Running chmod on the exectuable fixes this ... but I need this to happen automatically when people install the Eclipse plugin.
I've ensured that the executable file has the correct permissions before I build the plugin.
I'm thinking maybe there's a way to add installation tasks to a feature.xml, perhaps?

A: Figured it out, p2 TouchPoint instructions enable the execution of commands during the installation of a plugin.
http://wiki.eclipse.org/Equinox/p2/Engine/Touchpoint_Instructions_35


text:
Q: UITextField isn't working am new to objective-c programming, so sorry if it's a silly question but i looked thoroughly and couldn't find the error,
p.s: english isn't my first language so programming keywords might be unintentionally used
I've set up a txtfield and defined some of it's properties, such as the keyboard-number pad and stuff, the problem is, when i run it on the simulator, nothing happens, the defult keyboard is called.
i'm just trying to do simple stuff to get it in my head,
in my .h, i have
@interface practiceViewController : UIViewController <UITextFieldDelegate>
{
    UITextField *userInput;
}
@property (nonatomic, retain, readwrite) UITextField *userInput;
@end

and in my .m
-(UITextField *)userInput{
if (userInput == nil) {

userInput=[[UITextField alloc]init];
userInput.keyboardType= UIKeyboardTypeNumberPad;
userInput.returnKeyType= UIReturnKeyDone;
userInput.textColor=[ UIColor redColor];
userInput.clearButtonMode= UITextFieldViewModeWhileEditing;
userInput.delegate = self;
}

return userInput;

}
i also tried to make it as an input, but for some reson it's not working
int nInput=[[userInput text] intValue];

whats pissing me off about this is that i did the same in a previous project and the "input worked" only,  but now everything isn't.
and my property as i haven't defined anything.
i appreciate your help

A: I Think you have to set the frame for UITextField like this ...
userInput.frame=CGRectMake(100,100,60,31);

in your -(UITextField *)userInput method, that's y it didn't show ..

A: Well few things are hazy but ...
You are getting the value of the text field using,
int nInput = [[userInput text] intValue];

If you are not getting the correct value then nInput will be zero. That is because userInput must be nil. You can verify this by logging it by adding NSLog(@"%@", userInput); before the line above.
Whatever value is printed, it looks like your on screen text field is not referenced to by userInput.
Since you're doing the entire thing programmatically, you will have to add your userInput to the view hierarchy by doing this,
[self.view addSubview:self.userInput];

Using the property accessor is important here is important as otherwise userInput would be nil unless you've accessed it using self.userInput earlier.

A: Although this is tagged iPhone, do you happen to be simulating an iPad?  If so, I have run into this.  The iPad will not show a number pad keyboard.

A: userInput= [[UITextField alloc] initWithFrame:CGRectMake(10, 50, 200, 30)]
userInput.keyboardType= UIKeyboardTypeNumberPad;
userInput.returnKeyType= UIReturnKeyDone;
userInput.textColor=[ UIColor redColor];
userInput.clearButtonMode= UITextFieldViewModeWhileEditing;
userInput.delegate = self;

You can just set the frame and add below property(to visible the textfield frame in View otherwise it is not visible in View).
  userInput.borderStyle = UITextBorderStyleRoundedRect;
 [self.view addSubview:userInput];

I hope it will be helpful to you.


text:
Q: Cant install Ruby on Ubuntu 16.04 LTS Can't install Ruby via
sudo apt-get install ruby-full

The following packages have unmet dependencies :
Ruby, ruby-dev, libtcltk-ruby,  ri
E: Unable to correct problems, you have held broken packages.
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb http://am.archive.ubuntu.com/ubuntu/ xenial universe
# deb-src http://am.archive.ubuntu.com/ubuntu/ xenial universe
deb http://am.archive.ubuntu.com/ubuntu/ xenial-updates universe
# deb-src http://am.archive.ubuntu.com/ubuntu/ xenial-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://am.archive.ubuntu.com/ubuntu/ xenial multiverse
# deb-src http://am.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://am.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
# deb-src http://am.archive.ubuntu.com/ubuntu/ xenial-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://am.archive.ubuntu.com/ubuntu/ xenial-backports restricted universe multiverse
# deb-src http://am.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu xenial partner
# deb-src http://archive.canonical.com/ubuntu xenial partner

deb http://security.ubuntu.com/ubuntu xenial-security restricted
# deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://security.ubuntu.com/ubuntu xenial-security universe
# deb-src http://security.ubuntu.com/ubuntu xenial-security universe
deb http://security.ubuntu.com/ubuntu xenial-security multiverse
# deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse
~

A: It looks like you're missing the first lines from your /etc/apt/sources.list file.  Put them in manually at the start of your file:
# deb cdrom:[Ubuntu 12.04 LTS _Precise Pangolin_ - Release amd64 (20120425)]/ dists/precise/main/binary-i386/

# deb cdrom:[Ubuntu 12.04 LTS _Precise Pangolin_ - Release amd64 (20120425)]/ dists/precise/restricted/binary-i386/
# deb cdrom:[Ubuntu 12.04 LTS _Precise Pangolin_ - Release amd64 (20120425)]/ precise main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://am.archive.ubuntu.com/ubuntu/ xenial main restricted
deb-src http://am.archive.ubuntu.com/ubuntu/ xenial main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://am.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
deb-src http://am.archive.ubuntu.com/ubuntu/ xenial-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://am.archive.ubuntu.com/ubuntu/ xenial universe
deb-src http://am.archive.ubuntu.com/ubuntu/ xenial universe
deb http://am.archive.ubuntu.com/ubuntu/ xenial-updates universe
deb-src http://am.archive.ubuntu.com/ubuntu/ xenial-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to

I know this looks a little funny, but I'd say that's what's lacking in your file.  Copy and paste these to the top of /etc/apt/sources.list and run sudo apt-get update and then try your install.

A: Using rbenv with ruby-build plugin typing:
$ rbenv install 2.x.x

For installing rbenv, see instructions at GitHub Project's page.
See also the ruby-build project page.


text:
Q: MS SQL SERVER connection timout on different schema on same server '''
    Try
        Dim connectionString As String = "Server=" & SERVER_NAME & ";Database=" & DB_NAME & ";User Id=" & USER_ID & ";Password=" & PASSWORD_STRING
        Using conn As New SqlConnection(connectionString)
            conn.Open()
            Using adapter As New SqlDataAdapter("SELECT * FROM CUSTOM_VIEW", conn)

                adapter.Fill(dtCustom_view)

            End Using
        End Using
    Catch ex As Exception
        Console.WriteLine(ex)
        Console.WriteLine("Press any key...")
        Console.ReadKey()
        Environment.Exit(0)

    End Try

'''
Problem is when connection is made to DB_NAME="One" works fine, when DB_NAME="Two" exeption is rised
Both schemas are on the same server. I can connect to both schemas using ODBC with same username and password. Problem rised after user have upgraded SQL server to compatibility level 2019. Prior it was 2008 and there were no problem to connect to both schemas.
System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired.  The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
at iSAF.Module1.Main(String[] args)
ClientConnectionId:ba3bf0f6-683d-4394-9d4d-43948269e5da
Error Number:-2,State:0,Class:11

A:
Problem rised after user have upgraded SQL server to compatibility level 2019. Prior it was 2008 and there were no problem to connect to both schemas.

You should turn on Query Store to gather query performance baselines before increasing the compatibility level.


text:
Q: writing hessian service I am new to Spring and Hessian and never used them before.
I want to write a small Hello World Program which clearly shows how this service works.
I am using Maven for list project details and dependencies.
The resources for hessian available online are not complete step-by-step guide.
would appreciate if I get help form someone who has worked writing hessian services

A: The steps for implementing a Hessian-callable service are:

*

*Create a Java interface defining methods to be called by clients.

*Write a Java class implementing this interface.

*Configure a servlet to handle HTTP Hessian service requests.

*Configure a HessianServiceExporter to handle Hessian service requests from the servlet by delegating service calls to the Java class implementing this interface.

Let's go through an example.  Create a Java interface:
public interface EchoService {
    String echoString(String value);
}

Write a Java class implementing this interface:
public class EchoServiceImpl implements EchoService {
    public String echoString(String value) {
        return value;
    }
}

In the web.xml file, configure a servlet:
<servlet>
  <servlet-name>/EchoService</servlet-name>
  <servlet-class>org.springframework.web.context.support.HttpRequestHandlerServlet</servlet-class>
</servlet>

<servlet-mapping>
  <servlet-name>/EchoService</servlet-name>
  <url-pattern>/remoting/EchoService</url-pattern>
</servlet-mapping>

Configure an instance of the service class in the Spring application context:
<bean id="echoService" class="com.example.echo.EchoServiceImpl"/>

Configure the exporter in the Spring application context.  The bean name must match the servlet name.
<bean
    name="/EchoService"
    class="org.springframework.remoting.caucho.HessianServiceExporter">
  <property name="service" ref="echoService"/>
  <property name="serviceInterface" value="com.example.echo.EchoService"/>
</bean>

A: The client has to create a proxy of the remote interface. You could simply write a JUnit-Test:
HessianProxyFactory proxyFactory = new HessianProxyFactory();
        proxyFactory.setHessian2Reply(false);
        proxyFactory.setHessian2Request(false);
        com.example.echo.EchoService service = proxyFactory.create(
                com.example.echo.EchoService, "http://localhost:8080/<optional-context/>remoting/EchoService");

Assert.equals(service.echoString("test"), "test");


text:
Q: How would I find these grades and these class names using mechanize and BeautifulSoup? So, I've figured out how to login in to the website that allows me to check my grades, progress book, with python, mechanize, and BeautifulSoup. But I've run into a problem with getting the name of classes and the grades from the html page. Here is one of the classes and Grades:
< a class="expandable-row" href="/student/assignments/class/16152?

< span class="expandable-row">85.42 B< /span>

So, I need to python to search through the html to find all the classnames and all the grades.
Here is the full html code: http://pastebin.com/ikaw0FmN
Thanks for your help.

A: assuming you know how to grab the page with requests you would do the following:

...
from bs4 import BeautifulSoup
...

gradetd = BeautifulSoup(html).find_all('td',{'class':'fixed-column important'})

for row in gradetd:
    grades = row.find('span',{'class':'expandable-row'}).text.strip()
    if grades:
        avg, grade = grades.split(' ')
        print("{}/{}".format(avg,grade))

89.83/A-
99.14/A+
98.20/A+
91.14/A-
94.32/A
95.76/A
91.28/A-
85.42/B
97.86/A+
95.63/A
90.16/A-
94.09/A
97.02/A+
92.64/A-
100.00/A+
100.00/A+
100.00/A+
98.18/A+
100.00/A+


text:
Q: Configure Xubuntu session (not vanilla xfce) with XRDP sesman.ini
[SessionVariables]
PULSE_SCRIPT=/etc/xrdp/pulse/default.pa
GDMSESSION=xubuntu
DESKTOP_SESSION=xubuntu
XDG_SESSION_DESKTOP=xubuntu

startwm.ini
#!/bin/bash
# xrdp X session start script (c) 2015, 2017 mirabilos
# published under The MirOS Licence

# export GNOME_SHELL_SESSION_MODE=ubuntu
export XDG_CURRENT_DESKTOP=XFCE
export DESKTOP_SESSION=xubuntu
export XDG_SESSION_DESKTOP=xubuntu

if test -r /etc/profile; then
    . /etc/profile
fi

if test -r /etc/default/locale; then
    . /etc/default/locale
    test -z "${LANG+x}" || export LANG
    test -z "${LANGUAGE+x}" || export LANGUAGE
    test -z "${LC_ADDRESS+x}" || export LC_ADDRESS
    test -z "${LC_ALL+x}" || export LC_ALL
    test -z "${LC_COLLATE+x}" || export LC_COLLATE
    test -z "${LC_CTYPE+x}" || export LC_CTYPE
    test -z "${LC_IDENTIFICATION+x}" || export LC_IDENTIFICATION
    test -z "${LC_MEASUREMENT+x}" || export LC_MEASUREMENT
    test -z "${LC_MESSAGES+x}" || export LC_MESSAGES
    test -z "${LC_MONETARY+x}" || export LC_MONETARY
    test -z "${LC_NAME+x}" || export LC_NAME
    test -z "${LC_NUMERIC+x}" || export LC_NUMERIC
    test -z "${LC_PAPER+x}" || export LC_PAPER
    test -z "${LC_TELEPHONE+x}" || export LC_TELEPHONE
    test -z "${LC_TIME+x}" || export LC_TIME
    test -z "${LOCPATH+x}" || export LOCPATH
fi

if test -r /etc/profile; then
    . /etc/profile
fi

dbus-update-activation-environment --verbose XDG_DATA_DIRS XDG_CONFIG_DIRS DESKTOP_SESSION GDMSESSION XDG_SESSION_DESKTOP

test -x /etc/X11/Xsession && exec /etc/X11/Xsession
exec /bin/sh /etc/X11/Xsession

The XRDP session does appear to start with an xubuntu session, however, the desktop backgrounds between a normal xubuntu session and the xrdp one are both different.
Could this be a difference in session settings altogether rather than XRDP starting as vanilla xfce?
edit:
I was not able to find in .config or in .local any config settings that pointed to a particular desktop background for xfce.
SHELL=/bin/bash
SESSION_MANAGER=local/noorez-HPE-421f:@/tmp/.ICE-unix/31644,unix/noorez-HPE-421f:/tmp/.ICE-unix/31644
WINDOWID=60817411
QT_ACCESSIBILITY=1
COLORTERM=truecolor
XDG_CONFIG_DIRS=/etc/xdg/xdg-xubuntu:/etc/xdg:/etc/xdg
XDG_MENU_PREFIX=xfce-
CLUTTER_BACKEND=x11
LANGUAGE=en_CA:en
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
DESKTOP_SESSION=xubuntu
SSH_AGENT_PID=31752
GTK_MODULES=gail:atk-bridge
PWD=/home/noorez
LOGNAME=noorez
XDG_SESSION_DESKTOP=xubuntu
QT_QPA_PLATFORMTHEME=gtk2
XDG_SESSION_TYPE=x11
GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1
PULSE_SCRIPT=/etc/xrdp/pulse/default.pa
HOME=/home/noorez
LANG=en_CA.UTF-8
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
XDG_CURRENT_DESKTOP=XFCE
VTE_VERSION=6003
XRDP_SOCKET_PATH=/run/xrdp/sockdir
XRDP_PULSE_SOURCE_SOCKET=xrdp_chansrv_audio_in_socket_11
LESSCLOSE=/usr/bin/lesspipe %s %s
XDG_SESSION_CLASS=user
TERM=xterm-256color
GTK_OVERLAY_SCROLLING=0
LESSOPEN=| /usr/bin/lesspipe %s
USER=noorez
XRDP_SESSION=1
DISPLAY=:11.0
XRDP_PULSE_SINK_SOCKET=xrdp_chansrv_audio_out_socket_11
SHLVL=1
XDG_SESSION_ID=c54
XDG_RUNTIME_DIR=/run/user/1000
XDG_DATA_DIRS=/usr/share/xfce4:/usr/share/xubuntu:/usr/local/share:/usr/share:/var/lib/snapd/desktop:/usr/share
PATH=/sbin:/bin:/usr/bin:/usr/local/bin:/snap/bin
GDMSESSION=xubuntu
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
UID=1000
_=/usr/bin/env
OLDPWD=/home/noorez/.config/dconf


text:
Q: How to manipulate guided decision table from Java API in Drools? I have requirement in my project where I need to manipulate Drools guided decision table content (just data not structure) from a custom web based UI.
I have searched a lot but I'm not able to find any Java or REST API in Drools which gives access to guided decision table.
Any help would be appreciated.

A: I'm assuming you are talking about guided decision tables in the kie-workbench.
As far as I know, there is no public API to manipulate a guided decision table, but there is another thing you can do. Each project in the kie-workbench is in reality a maven project persisted in a local git repository. The good news is that you can actually make a clone of that repository.
Once you have a local clone of your project, you can locate the guided decision table you want to modify as a file with .gdst extension.
For example, this is the directory structure of the uf-playground sample project coming with the kie-workbench:

In the screenshot above you can see a Pricing loans.gdst file. The content of this file is an xml containing both, the structure and the data of the "Pricing loans" guided decision table.
And here is where things get interesting. If you dig deep down into the kie-workbench code, I'm sure you will find some kind of undocumented and very volatile API to handle these .gdst files. After all, the kie-workbench is actually creating and modifying these files. The challenge here are:

*

*Find this API

*Understand this API

Another solution that, from the technical point of view may not be the best, - but that is easier to implement for simple things such as data manipulation - is to parse and modify those .gdst files using an XML library.
Once you are done with the changes you can push them back to the kie-workbench and they will be available for the GUI users.
Of course none of these 2 proposed solutions are ideal. Using an undocumented API that was not meant to be used by third parties and that will certainly change in the future may not sound like a good idea. But manually parsing an XML file whose semantic may probably change on different versions of the kie-workbench also presents some challenges.
Hope it helps,


text:
Q: What does "pretty" mean in this context? Does the sentence mean that Mr. Trump's comments sound hollow? I don't think it means simply "looking bad."

Far from taking Washington by storm, America's CEO is out of his depth. The art of political compromise is new to him. He blurs his own interests and the interests of the nation. The scrutiny of office grates. He chafes under the limitations of being the most powerful man in the world. You have only to follow his incontinent stream of tweets to grasp Mr Trump's paranoia and vanity: the press lies about him; the election result fraudulently omitted millions of votes for him; the intelligence services are disloyal; his predecessor tapped his phones. It's neither pretty nor presidential.

The Trump presidency is in a hole, The Economist (1 April 2017) http://www.economist.com/news/leaders/21719794-and-bad-americaand-world-trump-presidency-hole

A: The usage here is derived from the phrase not a pretty sight. The writers saying that Trump's behavior since becoming President has been disorderly, undignified, immoral and unworthy of the office.  An antonym of pretty is ugly. The use of the words not pretty here thus adds the idea of "ugliness," in a moral sense, to the idea that Trump is not behaving in a presidential manner.
The entry for the Longman Dictionary of conventional English defines the phrase in this way, with a number of corpus examples.

not a pretty sight
very unpleasant to look at – sometimes used humorously
After a night's drinking, Al was not a pretty sight.

Examples from the Longman Corpus:
not a pretty sight
• Are you sure you want to come in? It's not a pretty sight.
• Afterwards I visited the boys and they were not a pretty sight.
• All directors, including Spielberg, grow up, and in this film the result is not a pretty sight.
• He is not a pretty sight.
• What these portraits give you is a glimpse of Lowry's psychic state, and it's not a pretty sight.
• It's not a pretty sight to finish in a classic fire and fall position.
• It is not a pretty sight to see people so hurt.
The  Oxford Online dictionary gives the moral sense of ugly in this way:

2.2 Morally repugnant.
  'racism and its most ugly manifestations, racial attacks and harassment'

A: No, By,

It's neither pretty nor presidential.

it doesn't necessarily mean hollow. The primary meaning of the word Pretty is at work here.

Pretty defined by Merriam Webster:

*

*artful, pleasing by delicacy or grace.

*having conventionally accepted elements of beauty.

Hollow means - "lacking in substance or value." (I think you meant this.)
While that's (being hollow) true of Donald Trump, the author doesn't mean that here. Rather he points out what a mess Donald Trump is creating and then goes on to say It's not pretty (the mess) and nor is it presidential.


text:
Q: Thread safety of actors running future callbacks The akka documentation states:

(...) you can just write your actor code without worrying about concurrency at all.
Behind the scenes Akka will run sets of actors on sets of real threads, where typically many actors share one thread, and subsequent invocations of one actor may end up being processed on different threads. Akka ensures that this implementation detail does not affect the single-threadedness of handling the actor's state.

But let's say i'm building a Future, and pipe it to a callback, in the event-handling thread. For example, using the ask pattern:
ask(someActor, new SomeRequest(), timeout)
            .onSuccess(new OnSuccess<Object>() {
                @Override
                public void onSuccess(Object answer) throws Throwable {

                  // Modify actor state

                }
            }, getContext().system().dispatcher());

Does this means the callback will never be executed concurrently with the event-handling thread ? And thus, can safely modify the actor state without worrying about synchronization?

A:
Does this means the callback will never be executed concurrently with
  the event-handling thread

In your case No. The callback can be executed concurrently.
To explain: Thread safety of actors comes from confinement. i.e. Akka guarantees that your actor body will only be executed by a single thread at once when actor receives a message.
Now in the mean time, if you spawn a thread and that tries mutating some internal state (like a variable or something), then akka has no control over it. The message consumption and future body execution by a thread can both happen in parallel.

And thus, can safely modify the actor state without worrying about
  synchronization?

If your future blocks deals with variables that are never used by body, then you probably dont need synchronization. In case it does, then you need it.

A: When you mean by "// Modify actor state" is doing a bang (!) to self then it should be okey, but if it's really modify the Actor state then it's a NOK.
The threadsafe property of Actor is due to it's mailbox and actor properties that it only process one message at a time. If you don't use the mailbox of an Actor to modify it's state then you need to do your own locking/synchronizing of those mutable state. (for better explanation please refer to this link: http://doc.akka.io/docs/akka/snapshot/general/jmm.html#Actors_and_the_Java_Memory_Model)


text:
Q: ifelse strange behaviour in grouped data I have come upon an issue with the ifelse function not properly working in my data frame. I want to add a new column based on a conditional in the grouped data, but it seems that only the first element is being passed into the new column.
df <- data.frame(ID = c(1, 1, 1 ,2, 2, 5), A = c("foo", "bar", "bar", "foo", "foo", "bar"), B = c(seq(1:6)))

ID   A B
1  1 foo 1
2  1 bar 2
3  1 bar 3
4  2 foo 4
5  2 foo 5
6  5 bar 6

df%>%
  group_by(ID) %>%
  mutate(C = ifelse(length(which(A == 'bar')) >= 2, B, NA))

# A tibble: 6 x 4
# Groups:   ID [3]
     ID      A     B     C
  <dbl> <fctr> <int> <int>
1     1    foo     1     1
2     1    bar     2     1
3     1    bar     3     1
4     2    foo     4    NA
5     2    foo     5    NA
6     5    bar     6    NA

I also tried do like in tidyverse/dplyr/issues/489
but it produces the same result.
What is the MATRIX;)
expected output
# A tibble: 6 x 4
# Groups:   ID [3]
     ID      A     B     C
  <dbl> <fctr> <int> <int>
1     1    foo     1     1
2     1    bar     2     2
3     1    bar     3     3
4     2    foo     4    NA
5     2    foo     5    NA
6     5    bar     6    NA

A: Here the condition returns a logical vector of length 1 for each 'ID',
df %>%
     group_by(ID) %>%
     summarise(ind = length(which(A=='bar'))>=2)
# A tibble: 3 x 2
#     ID   ind
#  <dbl> <lgl>
#1     1  TRUE
#2     2 FALSE
#3     5 FALSE

so it is better to use if/else.  When we use ifelse, the test, yes and no should be of the the same length.  As the test is returning a single element, the first element of 'B' i.e. we get the first element of 'B' populating for the entire 'ID'
df %>%
  group_by(ID) %>%
  mutate(C = if(length(which(A=='bar'))>=2) B else NA)
# A tibble: 6 x 4
# Groups:   ID [3]
#     ID      A     B    C
#  <dbl> <fctr> <int> <int>
#1     1    foo     1     1
#2     1    bar     2     2
#3     1    bar     3     3
#4     2    foo     4    NA
#5     2    foo     5    NA
#6     5    bar     6    NA

However, if we still needs to use ifelse, then replicate
df %>%
  group_by(ID) %>%
  mutate(C=ifelse(rep(length(which(A=='bar'))>=2, n()),B,NA))
# A tibble: 6 x 4
# Groups:   ID [3]
#     ID      A     B     C
#  <dbl> <fctr> <int> <int>
#1     1    foo     1     1
#2     1    bar     2     2
#3     1    bar     3     3
#4     2    foo     4    NA
#5     2    foo     5    NA
#6     5    bar     6    NA


text:
Q: Crystal Report 2008 swap data table for identical differently-named table I have a Crystal Report that gets its data from a SQL Server view.  The users want the view to be able to get data from a particular start/end date range which means the view needs parameters passed to it.
I have put the view's query into a SQL Server stored procedure with parameters.
I was able to get the Crystal Report in question to use that SP as part of its data and it prompts for the start/end dates just fine.
I have gone through the formula fields and was able to modify the formulas to point to the corresponding fields in the SP's data in stead of the view.
I need to somehow get the fields that are displaying in the details section of the report and other areas to utilize data from the new SP and not from the view.
I'd like to modify each control and field on the Crystal Report layout to somehow change the tablename of those fields from (CurrentTableName).(FieldName) to (NEWTableName).(FieldName).  I think this would be the least intrusive because I think some of the fields being used have formatting and other attributes added to them and I don't want to do a whole bunch of detective work.
I know in other development products there is usually a properties window where you can find the TableName.FieldName for an object in the report and you can just edit it to be NEWTableName.FieldName.


text:
Q: CSS: media query CSS not working 50% of the time (Chrome) I have a site where I am using a media query link element to apply some overriding CSS when the width of the browser goes below a certain pixel width.
<link rel="stylesheet" href="css/main.css" />
<link rel="stylesheet" media='screen and (max-width: 960px)' href='css/mainNarrow.css' />

The issue is, 50% of the time, the second stylesheet does not seem to kick in when the width of the browser is changed. I am using Chrome 58.0.3029.96 (64-bit). Inspecting the elements, the second stylesheet does not seem to even be present, so I do not believe it is a precedence issue.
Here is the site, so that you can refresh and resize to experiment yourself. Half the time I refresh, the resize behavior is different. You can tell when the second stylesheet kicks in, by the top menu being replaced by a hamburger menu button:
http://www.multipleorganics.com
Any ideas why this is happening?

A: You should probably just add that css as a secondary style sheet and remove that media attribute. Within your style you wrap your code in the media query such as:
@media screen and (max-width: 960px) { /*960*/
  // Put your CSS code here...
}


text:
Q: How to use index variable generated from v-for from prent tag in child-tag's v-for value

              <router-link to='' tag='button' class='btn-round'> {{dialog}} d</router-link>

I want take variable dialogIdx that is generated from parent tag's v-for and use the dialogIdx in child tag's v-for value.
I've tried
<tr v-for=`(content, ContentIdx) in this.$store.state.dialogSearch.contents[${dialogIdx}]`

<tr v-for="(content, ContentIdx) in this.$store.state.dialogSearch.contents[{{dialogIdx}}]"

A: It's only because you used this keyword for the nested v-for directive. this refers to the function context that invoked the code execution, which in your case will be the parent v-for directive. Try removing the this keyword from the second v-for loop. You can map the this.$store.state["dialogSearch/contents"] to a computed property and then use it within the nested v-for loop without the this keyword.
Sample implementation

Vue.config.productionTip = false
Vue.config.devtools = false

new Vue({
  el: "#app",
  data: function() {
    return {
      content_keys: {
        0: 'Label 1',
        1: 'Label 2',
        2: 'Label 3',
        3: 'Label 4',
      },
      child_keys: {
        0: {
          0: 'Label 1 Child 1',
          1: 'Label 1 Child 2',
          2: 'Label 1 Child 3',
          3: 'Label 1 Child 4'
        },
        1: {
          0: 'Label 2 Child 1',
          1: 'Label 2 Child 2',
          2: 'Label 2 Child 3',
          3: 'Label 2 Child 4'
        },
        2: {
          0: 'Label 3 Child 1',
          1: 'Label 3 Child 2',
          2: 'Label 3 Child 3',
          3: 'Label 3 Child 4'
        },
        3: {
          0: 'Label 4 Child 1',
          1: 'Label 4 Child 2',
          2: 'Label 4 Child 3',
          3: 'Label 4 Child 4'
        },
      },
    };
  }
})

      {{ dialog }}

        {{ dialogIdx }} : {{ content }}

A: Check an optimized unique approach using reusable computed property
computed: {
   getContent() {
       return contextObj => {
        if(contextObj.label ==='content_keys') return this.$store.state.dialogSearch.content_keys;
        else return this.$store.state.dialogSearch.contents[contextObj.key];
      }
    }
}

and the changes in your template should be

              <router-link to='' tag='button' class='btn-round'> {{dialog}} d</router-link>


text:
Q: Obtain objects of list separated by comma Imagine I have this List of Dictionaries:
my_list = [{"a": 1, "b": 2}, {"a": 2, "b": 3}]

And I need to obtain only:
{"a": 1, "b": 2}, {"a": 2, "b": 3}

It will be passed into another function and that function does not accept Tuples nor Lists, only Dicts separated by comma.
_ = my_super_function_that_only_accepts_dicts_separated_by_comma(
  {"a": 1, "b": 2},
  {"a": 2, "b": 3},
)

A: Sounds like this would be met by a straight unpack action - put a star in front, *my_list. See for example how print works.


text:
Q: Deadlock in dining philosophers with channels from Ben Ari? In Ben Ari's Principles of Concurrent and Distributed Programming (2nd ed.), chapter 8.4, The dining philosophers with channels, they propose a solution which I think might lead to deadlock.
Suppose a philosopher 3 takes fork 3. The philosopher must then take the 4th fork to eat. But the 4th fork might be taken by the 4th philosopher.
As a generalization, each philosopher might take first the fork 'on his left', resulting in each of them waiting for the other fork to be released, which will never be able to occur.
Am I missing something, or is this solution incomplete?
In the chapter about semaphores, something similar happens, but the authors propose an alternative solution which mitigates the deadlock scenario. For example, one could add a restriction so one philosopher first takes the fork on the opposite side of which the others do, thus avoiding deadlock. I think this might be a possible solution, but I'd like to confirm with someone else here.
Thanks in advance!

A:
Am I missing something, or is this solution incomplete?

I was definitely not missing anything: I confirmed with the professor teaching this book at my university that this solution does indeed lead to deadlock.


text:
Q: Java Spring : how can I encapsulate annotations within an other annotation? Is it possible to encapsulate an annotation within an other annotation with values?
I have a lot of end points on my API and would like to automate the required roles / permissions for the end point access.
Here is the current code :
@RestController
@RequestMapping("/health")
public class HealthController {
    @GetMapping("/isAlive")
    @PreAuthorize("hasAnyAuthority('ISALIVE', 'HEALTH_ENDPOINT')")
    public String isAlive() {
        return "Server is up and running";
    }

    @GetMapping("/hello")
    @PreAuthorize("hasAnyAuthority('HELLO', 'HEALTH_ENDPOINT')")
    public String hello() {
        return "Hello";
    }
}

I have 2 authorities per end point, the first is the name of the mapping and method and the second is the name of the class.
In this example there is only 2 different end points with makes it easy but the finished product will have in the hundreds and doing all of the authorities by hand is going to be error-prone and not very efficient.
This is the desired result :
@RestController
@RequestMapping("/health")
public class HealthController {
    @GetMapping("/isAlive")
    @MyAuthorisationAnnotation
    public String isAlive() {
        return "Server is up and running";
    }

    @GetMapping("/hello")
    @MyAuthorisationAnnotation
    public String hello() {
        return "Hello";
    }
}

Where @MyAuthorisationAnnotation would give the right parameters to the @PreAuthorize annotation.
Is it possible?

A:
Is it possible to encapsulate an annotation within an other annotation
with values?

An annotation can have another annotation as a member.
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

@Retention(RetentionPolicy.RUNTIME)
public @interface MyAuthorizationAnnotation {
   PreAuthorize value() default @PreAuthorize("hasAnyAuthority('HELLO', 'HEALTH_ENDPOINT')");
}

However I don't think this helps. I am not familiar with Spring, but I think this post solves your problem, because it seems that @PreAuthorize can be applied to annotations so you can leverage transitivity if you use the checked annotation in a method.
Solution's Post


text:
Q: Oracle: one or more scripts to provoke a failure on instance For educational purposes, i need one or more scripts to provoke a failure on the current instance of Oracle (orcl for example). This way i can be sure that my backups are working accordingly. And yes, I NEED SCRIPTS.. so... no manual shutdown of my computer during a query or weird stuff like that.
To give some more context, am using the 19.x.x version of oracle, and using mostly SQLPLUS and RMAN for everything.
Thank you for your time. And,if i can get more than only one type of script, the better.
EDIT 1:
Since am being told of being "off-topic", i clarify. Am trying to save me up a fortune by skipping up a whole semester if i take a "convalidation exam". And what am asking is a point (or goal if you want) of the "summary" of the class. And it literally says: "The student should make one or more scripts so the instance fails and do a proper backup".
And right now am not recieving an answer from the teacher.

A: Just raise the appropriate exceptions:
DECLARE
  tns_listener_not_found EXCEPTION;
  PRAGMA EXCEPTION_INIT( tns_listener_not_found, -12154 );
BEGIN
  RAISE tns_listener_not_found;
END;
/

or
BEGIN
  RAISE_APPLICATION_ERROR( -20000, 'User specified error.' );
END;
/

A: Just write an SQL*Plus script that deletes the system datafile. The database will fail and the instance very likely, too.
SELECT file_name FROM dba_data_files WHERE file_name LIKE '%system%';

You store the filename in a variable and delete the file on the operating system, for instance on Unix:
rm /opt/oracle/oradata/.../system01.dbf

The HOST command is described here, how to store the file name here, I am confident that you can do the rest yourself!


text:
Q: Mercado Pago Connect "The redirect_uri does not match the original" Saludos,
Estoy intentando de utilizar el api de mercado pago connect, pero tengo problemas para obtener las credenciales de mi usuario. Ya configure el url de mi aplicación en mercado pago, al redirigir al usuario a la pagina de mercado pago para que este ingrese sus credenciales, mercadopago envía correctamente el token de autorización a mi servidor node.js, pero ya en el con dicho token intento de solicitar las credenciales y siempre me muestra el mismo error:
{"name":"MercadoPagoError","message":"{\"message\":\"The redirect_uri does not match the original\",\"error\":\"invalid_grant\",\"status\":400,\"cause\":[]}","stack":"Error\n    at new MercadoPagoError (/user_code/node_modules/mercadopago/lib/mercadopago.js:16:16)\n    at Request._callback (/user_code/node_modules/mercadopago/lib/mercadopago.js:527:22)\n    at Request.self.callback (/user_code/node_modules/mercadopago/node_modules/request/request.js:188:22)\n    at emitTwo (events.js:106:13)\n    at Request.emit (events.js:191:7)\n    at Request.<anonymous> (/user_code/node_modules/mercadopago/node_modules/request/request.js:1171:10)\n    at emitOne (events.js:96:13)\n    at Request.emit (events.js:188:7)\n    at IncomingMessage.<anonymous> (/user_code/node_modules/mercadopago/node_modules/request/request.js:1091:12)\n    at IncomingMessage.g (events.js:291:16)","statu

El código que utilizo del lado del servidor es el siguiente:
// Create the request
const mpCredentialsRequest = {
    "uri": "/oauth/token",
    "params": {
        "client_secret": ACCESS_TOKEN,
        "grant_type": "authorization_code",
        "code": authorizationCode,
        "redirect_uri": url
    },
    "authenticate": false
};

//Requesting the client credentials
mercadopago.post(mpCredentialsRequest).then(function(result) {

    console.log(`result.status = ${result.status}`);
    if(result.status == 200){
      const credentials = result.response;
      processCredentials(userId, credentials, req, res);
    }

}).catch((error) => {
    console.log(error);
    res.send(500, error);
});

En el url pongo el mismo que tengo configurado en mercado pago.
Gracias por la ayuda.

A: En mi caso el problema era el URL que tenia configurado, el cual en la configuración de mercadopago lo tenia con https y en mi código cliente utilizaba http, solo hice el cambio y funciono correctamente.


text:
Q: Checking if all elements in a list are unique What is the best way (best as in the conventional way) of checking whether all elements in a list are unique?
My current approach using a Counter is:
>>> x = [1, 1, 1, 2, 3, 4, 5, 6, 2]
>>> counter = Counter(x)
>>> for values in counter.itervalues():
        if values > 1:
            # do something

Can I do better?

A: Alternative to a set, you can use a dict.
len({}.fromkeys(x)) == len(x)

A: Another approach entirely, using sorted and groupby:
from itertools import groupby
is_unique = lambda seq: all(sum(1 for _ in x[1])==1 for x in groupby(sorted(seq)))

It requires a sort, but exits on the first repeated value.

A: Here is a recursive O(N2) version for fun:
def is_unique(lst):
    if len(lst) > 1:
        return is_unique(s[1:]) and (s[0] not in s[1:])
    return True

A: Not the most efficient, but straight forward and concise:
if len(x) > len(set(x)):
   pass # do something

Probably won't make much of a difference for short lists.

A: An early-exit solution could be
def unique_values(g):
    s = set()
    for x in g:
        if x in s: return False
        s.add(x)
    return True

however for small cases or if early-exiting is not the common case then I would expect len(x) != len(set(x)) being the fastest method.

A: Here is a recursive early-exit function:
def distinct(L):
    if len(L) == 2:
        return L[0] != L[1]
    H = L[0]
    T = L[1:]
    if (H in T):
            return False
    else:
            return distinct(T)

It's fast enough for me without using weird(slow) conversions while
having a functional-style approach.

A: All answer above are good but I prefer to use all_unique example from 30 seconds of python
You need to use set() on the given list to remove duplicates, compare its length with the length of the list.
def all_unique(lst):
  return len(lst) == len(set(lst))

It returns True if all the values in a flat list are unique, False otherwise.
x = [1, 2, 3, 4, 5, 6]
y = [1, 2, 2, 3, 4, 5]
all_unique(x)  # True
all_unique(y)  # False

A: I've compared the suggested solutions with perfplot and found that
len(lst) == len(set(lst))

is indeed the fastest solution. If there are early duplicates in the list, there are some constant-time solutions which are to be preferred.

Code to reproduce the plot:
import perfplot
import numpy as np
import pandas as pd

def len_set(lst):
    return len(lst) == len(set(lst))

def set_add(lst):
    seen = set()
    return not any(i in seen or seen.add(i) for i in lst)

def list_append(lst):
    seen = list()
    return not any(i in seen or seen.append(i) for i in lst)

def numpy_unique(lst):
    return np.unique(lst).size == len(lst)

def set_add_early_exit(lst):
    s = set()
    for item in lst:
        if item in s:
            return False
        s.add(item)
    return True

def pandas_is_unique(lst):
    return pd.Series(lst).is_unique

def sort_diff(lst):
    return not np.any(np.diff(np.sort(lst)) == 0)

b = perfplot.bench(
    setup=lambda n: list(np.arange(n)),
    title="All items unique",
    # setup=lambda n: [0] * n,
    # title="All items equal",
    kernels=[
        len_set,
        set_add,
        list_append,
        numpy_unique,
        set_add_early_exit,
        pandas_is_unique,
        sort_diff,
    ],
    n_range=[2**k for k in range(18)],
    xlabel="len(lst)",
)

b.save("out.png")
b.show()

A: for speed:
import numpy as np
x = [1, 1, 1, 2, 3, 4, 5, 6, 2]
np.unique(x).size == len(x)

A: How about adding all the entries to a set and checking its length?
len(set(x)) == len(x)

A: Here is a two-liner that will also do early exit:
>>> def allUnique(x):
...     seen = set()
...     return not any(i in seen or seen.add(i) for i in x)
...
>>> allUnique("ABCDEF")
True
>>> allUnique("ABACDEF")
False

If the elements of x aren't hashable, then you'll have to resort to using a list for seen:
>>> def allUnique(x):
...     seen = list()
...     return not any(i in seen or seen.append(i) for i in x)
...
>>> allUnique([list("ABC"), list("DEF")])
True
>>> allUnique([list("ABC"), list("DEF"), list("ABC")])
False

A: How about this
def is_unique(lst):
    if not lst:
        return True
    else:
        return Counter(lst).most_common(1)[0][1]==1

A: If and only if you have the data processing library pandas in your dependencies, there's an already implemented solution which gives the boolean you want :
import pandas as pd
pd.Series(lst).is_unique

A: You can use Yan's syntax (len(x) > len(set(x))), but instead of set(x), define a function:
 def f5(seq, idfun=None):
    # order preserving
    if idfun is None:
        def idfun(x): return x
    seen = {}
    result = []
    for item in seq:
        marker = idfun(item)
        # in old Python versions:
        # if seen.has_key(marker)
        # but in new ones:
        if marker in seen: continue
        seen[marker] = 1
        result.append(item)
    return result

and do len(x) > len(f5(x)).  This will be fast and is also order preserving.
Code there is taken from: http://www.peterbe.com/plog/uniqifiers-benchmark

A: Using a similar approach in a Pandas dataframe to test if the contents of a column contains unique values:
if tempDF['var1'].size == tempDF['var1'].unique().size:
    print("Unique")
else:
    print("Not unique")

For me, this is instantaneous on an int variable in a dateframe containing over a million rows.

A: It does not fully fit the question but if you google the task I had you get this question ranked first and it might be of interest to the users as it is an extension of the quesiton. If you want to investigate for each list element if it is unique or not you can do the following:
import timeit
import numpy as np

def get_unique(mylist):
    # sort the list and keep the index
    sort = sorted((e,i) for i,e in enumerate(mylist))
    # check for each element if it is similar to the previous or next one
    isunique = [[sort[0][1],sort[0][0]!=sort[1][0]]] + \
               [[s[1], (s[0]!=sort[i-1][0])and(s[0]!=sort[i+1][0])]
                for [i,s] in enumerate (sort) if (i>0) and (i<len(sort)-1) ] +\
               [[sort[-1][1],sort[-1][0]!=sort[-2][0]]]
    # sort indices and booleans and return only the boolean
    return [a[1] for a in sorted(isunique)]

def get_unique_using_count(mylist):
     return [mylist.count(item)==1 for item in mylist]

mylist = list(np.random.randint(0,10,10))
%timeit for x in range(10): get_unique(mylist)
%timeit for x in range(10): get_unique_using_count(mylist)

mylist = list(np.random.randint(0,1000,1000))
%timeit for x in range(10): get_unique(mylist)
%timeit for x in range(10): get_unique_using_count(mylist)

for short lists the get_unique_using_count as suggested in some answers is fast. But if your list is already longer than 100 elements the count function takes quite long. Thus the approach shown in the get_unique function is much faster although it looks more complicated.

A: If the list is sorted anyway, you can use:
not any(sorted_list[i] == sorted_list[i + 1] for i in range(len(sorted_list) - 1))

Pretty efficient, but not worth sorting for this purpose though.

A: For begginers:
def AllDifferent(s):
    for i in range(len(s)):
        for i2 in range(len(s)):
            if i != i2:
                if s[i] == s[i2]:
                    return False
    return True


text:
Q: Sorting and Alphabetizing String Inputs for Binary Tree I am having to create a guest list of 6 names based on a binary tree structure.
The list needs to be alphabetized then sorted into 2 lists by names starting with letters A-L and M-Z.
However, when I run this code, it simply prints only 5 elements of my list in the order they were input under each category.
Any help would be greatly appreciated. I am new to programming, Python and stackoverflow, and have been assigned this for a course, and have spent over a week reviewing different materials but I'm just stuck. Thank you.
IDLE Python 3.6, I think I need to use some sort of sorting method or that there may be an error or missing component to my enterguest loops
class Node(object):
    def __ init __(self):
        self.left = None
        self.right = None
        self.data = list()

def enterguest(root, guest):
    if guest < root.data[0]:
        if root.left == None:
            root.left = Node()
            root.left.data.append(guest)
        else:
            enterguest(root.left, guest)
    else:
        if guest > root.data[0]:
            if root.right == None:
                root.right = Node()
                root.right.data.append(guest)
            else:
                enterguest(root.right, guest)
        else:
            root.data.append(guest)

def guestresults(root):
    if root == None:
        return
    print(root.data)
    guestresults(root.left)
    guestresults(root.right)

root = Node()
root.data.append("M")
for i in range (0, 6):
    enterguest(root, input("Enter guest name:"))
print("Guests A-L")
guestresults(root.left)
print("Guests M-Z")
guestresults(root.right)

I expect the output to be the 6 names alphabetized and separated into two lists based on the first letter of each name, one list being names A-L and the second list being names M-Z. The actual output is displaying the same 5 names in the order they were input under each category I have created.

A: Actually your code prints the subtree in pre-order (i.e. parent before children), while you should print in in-order (left child first, then parent, then right child).
So change:
print(root.data)
guestresults(root.left)
guestresults(root.right)

to:
guestresults(root.left)
print(root.data)
guestresults(root.right)

The other issue occurs when you enter "M" as a name: in that case it is appended to the root data, which you never output.
I would avoid this kind of problems by not storing equal strings in the same node. When you have an equality, just go to the right child also. So change:
else:
    if guest > root.data[0]:
        if root.right == None:
            root.right = Node()
            root.right.data.append(guest)
        else:
            enterguest(root.right, guest)
    else:
        root.data.append(guest)

to:
else:
    if root.right == None:
        root.right = Node()
        root.right.data.append(guest)
    else:
        enterguest(root.right, guest)

With this change it will work. But please consider also the following points which would improve your solution:

*

*Now that you don't store multiple strings in one node any more, do not create the data property as a list.

*Let the Node constructor take an argument so that you can immediately set the data property upon construction.

*Instead of creating functions enterguest and guestresults, try to create those as methods of your class. This is more in line with an object-oriented approach.

*Instead of using print in those functions, consider returning the result as a list (or yield the results one by one). Leave the actual printing for the main program only. It is always good to separate (business) logic from the actual outputting code.


text:
Q: How to install NDK with Android SDK Manager It is said, that it is possible to install NDK with Android SDK manager with the following picture:

Unfortunately, I don't have SDK Plantforms, SDK Tools and SDK Update Sites tabs in my SDK Manager. My picture is following:

So how to install NDK in my situation?

A: The android's standalone sdk manager [second picture] differs from the one integrated in Android Studio[first picture]. The standalone has the basics for android developing whereas the Android Studio's integrated sdk manager, located in Tools > Android > SDK Manager, adds more useful tools, such as the ndk, Cmake* and LLDB* [* in android studio 222 version] (the ones highlighted).
So you have two options, if you are using Android Studio, using the integrated sdk manager to directly install the ndk or you could manually download the ndk and add the path to your system variables so your build environment is aware of it.

A: If your internet connection is using a proxy, which is most often the case for office networks, the https connection to the Android repo does not work sometimes. As a result you will not see the NDK in the list. If that is the case, copy the https repo link and add the same repo with http, as shown on the picture.

The "Custom Update Site" is the link that manually added repo link. Notice the change from https to http.

A: Since you are using the standalone Android SDK Manager, you'll need to use the sdkmanager command line tool.

*

*Close Android SDK Manager

*Start a Command Prompt as Administrator

*cd"path to your installation of Android SDK Manager"\tools\bin

*sdkmanager ndk-bundle

*Accept the License Agreement

*Wait a long time. The installation is done without any progress indicator.

*When it finally reports done, start Android SDK Manager

*Look under Extras and there you'll find Ndk Bundle

A: @ortisenderos has the right options available to you.
If you're not going to utilize the common setups in android studio and/or eclipse you can expect to place the paths to all your tools into your PATH environment variable, (be it Linux, macOS or Windows).
[Path to CMake]/bin
[Path to Git]/bin
[Path to SDK]/tools
[Path to SDK]/platform-tools
[Path to NDK]
[Path to ANT]/bin

etc...


text:
Q: Modern way to markup 100% height layout in HTML5 and CSS3 I've been away from marking up sites for some time. So, now we have HTML5 and a lot of new features in CSS. I have a common site layout with fixed size header and footer. And of course main content area in between. By default page should take 100% of window height (i.e. content area expands). And if content is long page vertical scrollbar appears and all like usual.
Usually I used to do it by something like this:

contains logo, nav and has fixed height

actual content

           fixed size footer

And accompanying css:
html, body { height:100% }
table#main { height:100% }
td#footer { height:123px }

So, it's obsolete. You, who keeps abreast of new markup techniques, how it is done by now in 2011?
UPD People, issue not about semantic markup or using divs. I know what it does mean. Issue now in - how do I tell footer to stay at bottom even while content is empty or short. When content is long enough footer just go down as it would do in other case. Absolute and fixed is not the solution (at least at its basic form)
SOME SUMMARY UPDATE

*

*I've tried method with usage of display:table and display:table-row and it works: little content, more content

*Method Make the Footer Stick to the Bottom of a Page was adviced by Andrej. It works also: little content, more content
Some disappointment though I feel: first method is just those tables but without table tag. The second is really old, I've avoided to use it because it resembles hack. My god, nothing new :)

A: In 2013 there is still nothing that beats a decent table that has respectively thead/tfoot/tbody.
The below (valid HTML5 page) is a fixed header and footer, 100% height and NOT ANY resize trouble.
<!DOCTYPE html>
<meta charset="utf-8" />
<title>valid HTML5 / fixed header and footer / nada CSS sizing trouble</title>

       head

foot

main

A: As you asked for "modern"... anno 2016 I have maybe a better answer than in 2013:
use the 100vh solution in CSS3. vh is a new unit and stands for ViewPort height.

html, body {            height:                 100% }
header {                height:                 100px }
footer {                height:                 50px }
main {                  height:                 calc(100vh - 150px); }

html, body {            width:                  100% }
header, main, footer {  width:                  1000px }

html, body {            margin:                 0 }
header, main, footer {  margin:                 0 auto }

html, body {            padding:                0 }

html, body {            text-align:             center }

body {                  background-color:       white }
header {                background-color:       yellow }
main {                  background-color:       orange }
footer {                background-color:       red }
<!DOCTYPE html>
<meta charset="utf-8" />
<title>test</title>
bla
bla
bla

But if you wish to be compatible with old browsers, use the code in my 2013 answer.

A: Well, first of all in 2011 we dont use tables for layout anymore!
If I were you, I would write the markup like so:

            contains logo, nav and has fixed height

 /*use
 or
 if it is appropriate - if not sure what to use, use a div*/
            actual content

            fixed size footer

And the CSS would be the same except the changed selectors
html, body { height:100% }
#main { height:100% }
footer { height:123px }

For a fixed footer, I would suggest to use position:absolute or maybe position:fixed - it depends how you want it to behave (scroll with page or always stay at bottom).
To make a "sticky" footer, that will be at the bottom of the page but move with the content, this method will do the trick.

A: Today, you would do like this (not much different really)
http://jsfiddle.net/5YHX7/3/
html, body { height: 100%; width: 100%; margin: 0; }
div { height: 100%; width: 100%; background: #F52887; }

and

A: Technically you could probably still get away with laying out your page with table tags but it is now considered bad practice.  It is considered good practice to use "semantic" web markup which means using tags for their intended purposes so a table tag should be used to represent table data and not invisible design.  DIVs are intended for use designing your invisible page layout.  A list apart is a great website resource for understanding these concepts.
This article is good for understanding semantic markup: http://www.alistapart.com/articles/12lessonsCSSandstandards
So all that said, here is a sample page that does what you want:
http://peterned.home.xs4all.nl/examples/csslayout1.html

A: As asking for "modern" AND "compatible" is a contraction anyway, the grid method wasn't mentioned so far, and maybe is too modern right now, but with some adaptions might be a solution.
This article (and pointers) -with more complex use- is great to read:
https://developers.google.com/web/updates/2017/01/css-grid
Now the code looks nice, however browsers don't... - so I added some forcing.
https://jsfiddle.net/qLcjg6L6/1/
<!DOCTYPE html>

hdr
main
foot

A: Let me add my contribution by adding 3 columns to your header / main / footer layout:
http://jsfiddle.net/ESrG9/
<!DOCTYPE html>

            head

            main
            main
            main

            foot

A: So far nobody mentioned the flex-box method
https://jsfiddle.net/55r7n9or/
<!DOCTYPE html>

  hdr
  main
  foot


text:
Q: How to find if a list is a subset of another list? struct Node {
    int value;
    Node* next;
};

bool propSubset(Node* p, Node* q) {
    if(q == nullptr) return false;
    if(p == nullptr && q != nullptr) return true;
    if(p->value < q->value) return false;
    if(p->value > q->value) return propSubset(p, q->next);
    return propSubset(p->next, q->next);
}

p is a subset of q if

*

*all elements of p are elements of q

*q has at least one element that is not in p.

p and q are both sorted in ascending order.
This is all I got but it doesn't work for case like p = {2, 4}, q = {1, 2, 3, 4}
How can I improve this? Thanks

A: Iterative solution may be better. Given lists of arbitrary length you don't want to run the risk of running out of stack space.
Also the size factor comes into play since the non-intersecting elements in q can be randomly distributed.
You may want to restructure your code something like:
bool propSubset(Node* p, Node* q) {
  int len_q = length(q); // assuming you have length function.
  if (length(p) >= len_q) return false;

  for(int i=0; i < len_q && p != nullptr; ++i) {
    if (p->value == q->value) p = p->next;
    if (p->value < q->value) return false; // That particular value in p is not in q.
    q = q->next;
  }
  if (p == nullptr) return true;
  return false;
}

A: You're assuming that q's element that is not in p is always at the very end of the list. You need to take into account that the extra element can be anywhere in the list and not just the end of the list and you'll be on the right path.


text:
Q: Checkin changes to UTF8 BOM using git I accidentally checked in a utf8 encoded text file from Windows without removing the BOM before. Now I tried to remove it in a later version and check-in this change again. It seems as git ignores the change to the BOM bytes. Is there a setting to make git let me check-in the file like it is? (I know there is a similar issue when it comes to line endings - and there is a setting for this one...)

A: If you can make this reproducible, by all means report a bug
Here's my two cents:
xxd -r > raw <<< "0000000: 4865 c582 c397 c3b8 0a                   He......."
cat raw # shows "Heł×ø" in UTF8 terminals

git init .
iconv -t UTF32BE raw  > test
git commit -am nobom test
iconv -t UTF32 raw  > test
git diff # reports: "Binary files a/test and b/test differ"
git commit -am bom test

Verify different objects present:
git rev-list --objects --all
1d0cf0c1871a8743f947bd4582198db4fc1e72b1
c52c2a8c211a0031e01eef5d5121d5d0b4aabc40
4740254f8f52094afc131040afc80bb68265e78c
fd3c513224525b3ab94a2512cbbfa918793640eb test
2d9da153c5febf0425437395227381d3a4784154
2e54d36463fee81e89423d7d80ccc5d7003aba21 test

or, slightly more direct
for h in $(git rev-list --all -- test); do git ls-tree $a; done
100644 blob 2e54d36463fee81e89423d7d80ccc5d7003aba21    test
100644 blob 2e54d36463fee81e89423d7d80ccc5d7003aba21    test

This is with git 1.7.4.1 on ubuntu 64 bit

xxd test # no bom:
0000000: 0000 0048 0000 0065 0000 0142 0000 00d7  ...H...e...B....
0000010: 0000 00f8 0000 000a                      ........

xxd test # with bom
0000000: fffe 0000 4800 0000 6500 0000 4201 0000  ....H...e...B...
0000010: d700 0000 f800 0000 0a00 0000            ............

A: git does not ignore Byte Order Mark (BOM) sequence and it is possible to git commit a BOM removal only. Tested with xml UTF-8

Removing BOM on Windows in Visual Studio 2017 through File->Save As->Save with Encoding->Unicode (UTF-8 without signature). git sees a change and it can be committed

A: If you can't find a proper solution, you can always add a character to file, commit, remove the BOM and the letter, and amend the commit.


text:
Q: iOS: UITableView Table Data Not Showing Up In to Sub Categories:iPhone I want To Show Data On The Table And that Perticuler Data Have Sub Data
For Ex.

*

*Group A
1.1 List of Names

*Group B
2.1 List of Names
2.2 List of Sports
Thx In Advance (^_^)

A: You need to implement MultiLevel UITableView very good tutorial, thanks to Sagar
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }
    cell.textLabel.text=[[self.arForTable objectAtIndex:indexPath.row] valueForKey:@"name"];
    [cell setIndentationLevel:[[[self.arForTable objectAtIndex:indexPath.row] valueForKey:@"level"] intValue]];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    NSDictionary *d=[self.arForTable objectAtIndex:indexPath.row];
    if([d valueForKey:@"Objects"]) {
        NSArray *ar=[d valueForKey:@"Objects"];
        BOOL isAlreadyInserted=NO;
        for(NSDictionary *dInner in ar ){
            NSInteger index=[self.arForTable indexOfObjectIdenticalTo:dInner];
            isAlreadyInserted=(index>0 && index!=NSIntegerMax);
            if(isAlreadyInserted) break;
        }
        if(isAlreadyInserted) {
            [self miniMizeThisRows:ar];
        } else {
            NSUInteger count=indexPath.row+1;
            NSMutableArray *arCells=[NSMutableArray array];
            for(NSDictionary *dInner in ar ) {
                [arCells addObject:[NSIndexPath indexPathForRow:count inSection:0]];
                [self.arForTable insertObject:dInner atIndex:count++];
            }
            [tableView insertRowsAtIndexPaths:arCells withRowAnimation:UITableViewRowAnimationLeft];
        }
    }
}

-(void)miniMizeThisRows:(NSArray*)ar{
    for(NSDictionary *dInner in ar ) {
        NSUInteger indexToRemove=[self.arForTable indexOfObjectIdenticalTo:dInner];
        NSArray *arInner=[dInner valueForKey:@"Objects"];
        if(arInner && [arInner count]>0){
            [self miniMizeThisRows:arInner];
        }
        if([self.arForTable indexOfObjectIdenticalTo:dInner]!=NSNotFound) {
            [self.arForTable removeObjectIdenticalTo:dInner];
            [self.tableView deleteRowsAtIndexPaths:
              [NSArray arrayWithObject:[NSIndexPath indexPathForRow:indexToRemove inSection:0]]
                      withRowAnimation:UITableViewRowAnimationRight];
        }
    }
}


text:
Q: Access/SQL Query Performance - Creating a unique list based on multiple data sources The objective of this post is to improve the performance of the following query.
The query essentially compiles a list of all unique [Asset] that appear throughout multiple data sources and appends it to another table.
See Sample Tables Below
[Import - Assets]       Asset   Description   Type      Unit
                         P1        Water      Pump       U1
                         P2         Oil       Mix        U2

[Import - BOM]          Asset      Comp    Description   Qty
                         P1         10          X         1
                         P1         11          Y         1
                         M1         20          Z         1

[Import - WO]            WO        Asset   Description   Cost
                         1          P2          x         10
                         2          P2          y         20
                         3          M2          z         22

[Desired Output]        Asset   Description   Type       Unit
                         P1        Water      Pump        U1
                         P2         Oil        Mix        U2
                         M1
                         M2

This query and others with similar functions run extremely slow. I believe the performance issues are a result of the large checks in the WHERE portions (each table can have upwards of 10k records).
It may be the case that the "Import" tables have duplicate [Asset] records that are not removed through the UNION function because they are not identical throughout the other fields. Due to my suspicions, I would like to first remove duplicate [Asset] in each table before checking it against the other tables. For example, only check record 1 & 3 of BOM against records 1 & 3 of WO, rather than all to all.
INSERT INTO [Data - Assets]
SELECT *
FROM (

SELECT "Assets" AS [Source], *
FROM [Import - Assets]

UNION

SELECT "BOM", [Asset], NULL, NULL, NULL, NULL, NULL, NULL
FROM [Import - BOM]
WHERE [Asset] NOT IN (SELECT DISTINCT [Asset] FROM [Import - Assets])

UNION SELECT "WO", [Asset], NULL, NULL, NULL, NULL, NULL, NULL
FROM [Import - WO]
WHERE [Asset] NOT IN (SELECT DISTINCT [Asset] FROM [Import - Assets])
AND [Asset] NOT IN (SELECT DISTINCT [Asset] FROM [Import - BOM])

ORDER BY [Source], [Asset]
) ;

It should be noted that aside from the initial [Import - Assets] table, the source of the additional records does not particularly matter.
I am very new to SQL. Any help in improving performance and instilling good habits is greatly appreciated. Regards.

A: You are correct, the "NOT IN"'s are killing your query.
Just do a full union and then make it a subquery to only include the extra values from the Asset table.
SELECT x.Asset, MAX(x.Description) Description, MAX(x.Type) Type, MAX(x.Unit) Unit
FROM
(SELECT Asset, Description, Type, Unit FROM [Import - Assets]
UNION SELECT Asset, NULL Description, NULL Type, NULL Unit FROM [Import - BOM]
UNION SELECT Asset, NULL Description, NULL Type, NULL Unit FROM [Import - WO]) x
GROUP BY x.Asset


text: Q: Can videojs support adaptive switching without flash player Can anybody tell me that videojs support dynamic/adaptive switching without flash player.I just want pure html player which can play on mobile device with adaptive switching.


text:
Q: Keeping a lower value in some cases and a higher value in some other Geography student here. We recently started to use Raster Calculator and I have a problem in this one case.
So we have three types of roads with a buffer zone. The road itself has value 0, a 1000-2000 unit buffer around it has value of 10 and the rest has value of 5. How can I add these 3 maps by keeping the lowest value except of the cases where value of 5 meets 10?


text:
Q: makefile minify files The code below does not work but meant to illustrate what I want to achieve.  How can I make this code work or is there a better way.  I want to combine all my CSS files into one file, but want to make sure all files under BASE_CSS is at the top of that file.
BASE_CSS = %reset.css %reset2.css %reset3.css
IGNORE_CSS = %main.min.css $(BASE_CSS)

CSS_FILES = $(filter-out $(IGNORE_CSS),$(wildcard \
  public/css/*.css \
  public/css/*/*.css \
  public/css/*/*/*.css \
))

minify:
  cat $(BASE_CSS) $(CSS_FILES) > public/css/main.min.css

A: This will do what I think you want:
# Note the ":=".
# If we use "=", it will run "find" every time ALL_CSS_FILES is mentioned.
ALL_CSS_FILES := $(shell find public/css -name *.css)

BASE_PATTERN = %reset.css %reset2.css %reset3.css

BASE_CSS = $(filter $(BASE_PATTERN), $(ALL_CSS_FILES))

CSS_FILES = $(filter-out $(BASE_PATTERN) %main.min.css, $(ALL_CSS_FILES))

minify:
        cat $(BASE_CSS) $(CSS_FILES) > public/css/main.min.css

EDIT:
To specify the order, just do this:
BASE_CSS = $(filter %reset.css, $(ALL_CSS_FILES))
BASE_CSS += $(filter %reset2.css, $(ALL_CSS_FILES))
BASE_CSS += $(filter %reset3.css, $(ALL_CSS_FILES))


text:
Q: Why is Sublime Text 3 adding a comma to the end of this line in React? I'm really confused by this. I write this code:
const goalButtons = Object.keys(this.state.goalsAndPoints).map(
    i => <button key={i}>{i} – {this.state.goalsAndPoints[i]}</button>
);

And every time I save or navigate away, Sublime adds a comma to the end of the map argument like this:
const goalButtons = Object.keys(this.state.goalsAndPoints).map(
    i => <button key={i}>{i} – {this.state.goalsAndPoints[i]}</button>,
);

What is going on? I can't find anything about it in my settings and I don't think this is required or even good practice for this JS?


text:
Q: How to simplify my imports In my project each class is a file and my directory structure like this:
main.py
myGui/
    __init__.py (empty)
    ClassA.py
    ClassB.py

To use my classes In main.py I need import with:
from myGui.ClassA import ClassA
from myGui.ClassB import ClassB

How to import with:
from myGui import ClassA, ClassB

A: You can add this into your __init__.py
from .ClassA import ClassA
from .ClassB import ClassB

And then import them like you mentioned

A: Assuming you added them to your __ init__.py,
from . import ClassA, ClassB

Should work.


text:
Q: SCSS Loader failure when using express and dev middlewares with webpack 4 I have a project on React built with webpack 4. For server side rendering I constructed express backend and use webpack-dev-middleware, webpack-hot-middleware and webpack-hot-server-middleware.
Also, there are webpack configs for client and node builds versions.
However, if started separately just with webpack command everything works OK, but if I want to start server it throws the following result:
<MY_SYSTEM_PATH>\node_modules\bootstrap\scss\bootstrap.scss:8
@import "functions";
^
SyntaxError: Invalid or unexpected token
    at new Script (vm.js:51:7)
    at createScript (vm.js:136:10)
    at Object.runInThisContext (vm.js:197:10)
    at Module._compile (module.js:613:28)
    at Module._extensions..js (module.js:660:10)
    at Object.require.extensions.(anonymous function) [as .js] (<MY_SYSTEM_PATH>\node_modules\babel-register\lib\node.js:152:7)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:501:12)
    at Function.Module._load (module.js:493:3)
    at Module.require (module.js:593:17)

bootstrap.scss is imported in app folder in index.js, that has the following code:
import React from 'react';
import 'bootstrap/scss/bootstrap.scss';

const App = () => {
    return(

React App!

Just start!

    );
};

export default App;

The following code is got from webpack config for server:
module.exports = merge({
    name: 'server',
    target: "node",
    mode: 'development',
    entry: [
        'babel-regenerator-runtime',
        path.resolve(__dirname, '../src/server')
    ],
    output:{
        path: path.resolve(__dirname, '../public'),
        filename: "bundle.server.js",
        publicPath: "/",
        libraryTarget: "commonjs2"
    },
    module: {
        rules: [
            {
                test: /\.jsx?/,
                use: {
                    loader: 'babel-loader'
                },
                exclude:/node_modules/
            },
            {
                test:/\.scss/,
                use: [
                  {
                      loader: 'css-loader',
                      options: {
                          modules: true
                      }
                  },
                  {
                      loader: 'sass-loader'
                  }
                ]
            }
        ]
    }
}, commonConfig);

This is server development configuration:
const configs = [require('../../webpack/webpack.config.client.dev'), require('../../webpack/webpack.config.node.dev')];
const compilers = webpack(configs);

const publicPath = configs[0].output.publicPath;

// webpack-dev-middleware
app.use(require('webpack-dev-middleware')(compilers, { publicPath }))
// webpack-hot-middleware
app.use(require('webpack-hot-middleware')(compilers.compilers.find(c => c.name === 'client')));

// webpack-hot-server-middleware
const outputPath = configs[0].output.path;

app.use(publicPath, express.static(outputPath));

app.use(require('webpack-hot-server-middleware')(compilers, {
    serverRendererOptions: { outputPath },
}));

The question is: what is the reason for the error presented in first code block and how to go through with it?


text:
Q: Repeated incrementation of a floating point number I'm looking at some legacy code that defines some grid points along the axis f.
int main(){
    double f[9];
    int i = 0;
    for (double a = 0; a <= 1; a += 0.125){
        f[i++] = a;
    }
}

I'm worried about the repeated addition of 1 / 8 to a, and the loop not running correctly. This is because I don't think you can add floating point values like this and rely on it being exactly 1 when i is 8.
Or is this code OK and I should stop worrying? (The code is at least 20 years old apparently and has never caused trouble - although in the original version, double a was declared outside the loop, I'm reading up on why that is.).

A: The code is fine when compiled with a C compiler that provides either exactly IEEE 754 semantics or a close approximation of them (say, FLT_EVAL_METHOD>0, or even arbitrary excess precision for sub-expressions and arbitrary roundings to the nominal precision).
The problems you fear are:

*

*representation error, where 0.125 is not exactly 1/8, and

*operation error, where + is not exactly mathematical addition. None of these happen for this particular program.

0.125 requires 1 bit of precision to be represented exactly in base 2. This means that the floating-point number used by the program in these conditions is exactly the intended 1/8. Furthermore, it can be added to itself 253 times before there is any approximation in the addition.

This reasoning is not correct for other increment steps. For instance, the variation of your program below leaves one index of the array, f[100], uninitialized with at least my compiler (which implements strict IEEE 754 semantics):
int main(){
    double f[101];
    int i = 0;
    for (double a = 0; a <= 1; a += 0.01){
        printf("%.16e %d\n", a, i);
        f[i++] = a;
    }
}

When I run it I get at the last lines:

...
9.8000000000000065e-01 98
9.9000000000000066e-01 99

f[100] is never written to because of both representation error and operation error that occur when trying to add 0.01 repeatedly to itself in binary floating-point.

A: C standard leaves floating number implemented behavior, a lot of compiler use IEEE 754 standard. Your code is not Ok because:

*

*Your code must be compile with IEEE 754 standard or similar standard with the same behavior.

*It's hard to read. When you read the code the exact behavior is not obvious.

*This is not the right way to iterate over array in C.

Imagine, someone doesn't know that requirement, and don't compile with IEEE 754 standard. The behavior could be something completely different. For example, your code could produce a out of bounds, and this is undefined behavior, your program could crash.

That said, an example of code that have the same behavior of your code when compiled with IEEE 754 standard:
#include <stddef.h>

int main(void) {
  double f[9];
  size_t const size_f = sizeof f / sizeof *f;

  double a = 0;
  for (size_t i = 0; i < size_f; i++) {
    f[i] = a;
    a += 0.125;
  }
}