text:
Q: What does a quoted string in the import syntax `import "cryptonite" Crypto.Hash` mean? As stated in the title. There is a codebase, where I have seen the following syntax
import       "cryptonite" Crypto.Hash
             (Context, Digest, SHA256, hash, hashFinalize, hashInit,
             hashUpdate)

This syntax doesn't seem to be mentioned on haskell wiki on imports.
What does the "cryptonite" string do here?
Where does this syntax come from?
Is is part of Haskell2010 and if it is so where in the language report is it mentioned?

A: This is extra syntax that is supported when using the PackageImports extension:

With the PackageImports extension, GHC allows import declarations to
  be qualified by the package name that the module is intended to be
  imported from. For example:
import "network" Network.Socket

would import the module Network.Socket
  from the package network (any version). This may be used to
  disambiguate an import when the same module is available from multiple
  packages, or is present in both the current package being built and an
  external package.
The special package name this can be used to refer to the current
  package being built.

It occasionally happens that two packages export a module with the same name. For example both hashmap and unordered-containers export Data.HashSet. If both packages are installed, we want to disambiguate between the different packages. With this type of import, the author thus specifies that the Crypto.Hash module of the cryptonite needs to be used.
This is to to the best of my knowledge not standard Haskell (in the sense that other Haskell compilers do not have to support this, it seems not specified in the import statement section of the Haskell 2010 report), but a Glasgow Haskell compiler extension. Of course other compilers can support this as well, but a compiler without this extension, can still rightfully call itself a "Haskell compiler". In order to activate this extension, you need to compile with the -XPackageImports extension:
ghc -XPackageImports main.hs
This is a dynamic flag, and thus can be specified in the "pragma" of a Haskell source file as well.


text:
Q: Do odd-weight cusp forms have analytic rank 0? Let $f(z)=\sum_{n\ge 1}a_nq^n$ be a cusp form, where $q=e^{2\pi i z}$. Let $
L(s) = \sum_{n\ge 1} a_nn^{-s}
$ be its corresponding L-function. The completed L-function of $L(s)$, $\Lambda(s)$, should satisfy a functional equation $\Lambda(s)=\bar \Lambda(a-s)$ for some integer $a$.
The analytic rank of $f(s)$ is defined as the order of vanishing of $L$ at $a/2$.
Question: If $f$ is of odd weight, is its analytic rank $0$ (or equivalently, $L(a/2)\neq0$)?

A: It is conjectured that $L$-functions of motives do not have zeros or poles on the real line, except possibly at integers. In particular, if $f$ is a newform of odd weight $k$, then $L(f,s)$ should not vanish at $s=k/2$.
This conjecture appears in Fontaine, Perrin-Riou, Autour des conjectures de Bloch et Kato: cohomologie galoisienne et valeurs de fonctions L. Motives (Seattle, WA, 1991), 599–706, Proc. Sympos. Pure Math., 55, Part 1, Amer. Math. Soc., Providence, RI, 1994. See Remark 4.5.3.i).
I don't know if this is proven for $L$-functions of modular forms.

A: The statement needs some fixing. You must mean newform, rather than cusp form, as otherwise it could be interpreted that linear combinations can be taken (although they must possess identical sign of the functional equation to be allowed).
This said, I think the answer is expected to be no as discussed by François Brunault, BUT the related question allowing (nonholomorphic) Maass forms of eigenvalue 1/4 has a different answer, as noted by Armitage. That is, contrary to the $L$-function expectations otherwise, there are $L$-functions of motivic weight 1 with $\Lambda(s)=-\Lambda(1-s)$, which vanish at $s=1/2$ due to this symplectic root number.
https://doi.org/10.1007/BF01404125

redpajama_set_name: RedPajamaStackExchange


text:
Q: Hash overriding a hash I got some yml config files with a deep, different structures and I want to extract passwords(that are located on different levels) and store them in a yml file outside a git repo. Let me show an example
config1.yml

a:
  b:
    c: 1
    password: secret
    ...
  d: 2
  ...

I wish to replace secret with '' and extract a pass to a different yml file that will look like:
config1_passwords.yml

a:
  b:
    password: secret

Is there any way to merge config1.yml without passwords with config1_passwords.yml to get a correct config structure?
So basically in terms of hashes(parsed ymls) I want to do following:

{ :a => { :b => { :c => 1, :password => '' }, :d => 2 } }
{ :a => { :b => { :password => 'secret' } } }
# =>
{ :a => { :b => { :c => 1, :password => 'secret' }, :d => 2 } }

Thanks for suggestions
EDITED
another example

{ :a => { :b => { :c => 1, :d => { :password1 => '' }, :password2 => '' } } }
{ :a => { :b => { :d => { :password => 'secret' }, :password2 => 'secret2' } } }
# =>
{ :a => { :b => { :c => 1, :d => { :password => 'secret' }, :password2 => 'secret2' } } }

A: Rails 3 has a deep_merge, which does exactly what you want.
a = { :a => { :b => { :c => 1, :d => { :password1 => '' }, :password2 => '' } } }
b = { :a => { :b => { :d => { :password1 => 'secret' }, :password2 => 'secret2' } } }
a.deep_merge(b)
# -> {:a=> {:b=> {:c=>1, :d=>{:password1=>"secret"}, :password2=>"secret2"}}}

Note: I changed a[:a][:b][:d] to contain :password1 instead of :password.

A: Don't think this can be done using Ruby one-liners. But a simple recursive function might do
def recurse_merge_password! conf_hash, pw_hash
  pw_hash.keys.each do |k|
    next unless conf_hash.has_key?(k)
    case
      when k == :password
        conf_hash[:password] = pw_hash[:password]
      when conf_hash[k].is_a?(Hash) && pw_hash[k].is_a?(Hash)
        recurse_merge_password! conf_hash[k], pw_hash[k]
    end
  end
end

h1 = { :a => { :b => { :c => 1, :password => '' }, :d => 2 } }

h2 = { :a => { :b => { :password => "secret" } } }

recurse_merge_password! h1, h2

puts h1.inspect

=> {:a=>{:b=>{:c=>1, :password=>"secret"}, :d=>2}}

If you have arrays and other structures that you may need to traverse, it is up to you to improve on this. Note I made it modify the config in place.

A: It appears you want some sort of Hash deep merge. It's available in ActiveSupport (part of Rails):
# You can omit this require statement if you're running Rails.
require "active_support/core_ext/hash/deep_merge"

a = { a: { b: { c: 1, d: { password1: "" }, password2: "" } } }
b = { a: { b: { d: { password1: "secret" }, password2: "secret2" } } }

a.deep_merge(b)
#=> { a: { b: { c: 1, d: { password1: "secret"}, password2: "secret2" } } }

If you don't want to depend on ActiveSupport, take a look at the implementation.


text:
Q: Categorical attribute splitting for Classification and Regression Tree (CART) I know we can split numerical attributes multiple times in different levels for Classification and Regression Tree (CART) which is a binary tree. How about categorical attributes? Can we split multiple times or only one time? if not, what is the reason?

A: If the categorical predictors have more than 2 categories; you can split it again as you do in case of a numerical variable.
For Example;
If one of the predictors is 'Marital Status' with 3 categories: 'Married', 'Unmarried' and 'Divorced'.
You can have one binary split like 'Unmarried' Vs 'Others' where the latter group consists of the observations of both the groups 'Married' and 'Divorced'.
Further, if required at some stage, you can split 'Other' group into two categories 'Married' and 'Divorced'.
Based on some splitting rule, you can extend this idea for more than 3 categories too.

A: Binary trees are binary.
If you do a multi-way split, it no longer is binary, and finding the optimum split becomes more expensive than you would like, while the overall capabilities don't change compared to using multiple levels.


text:
Q: Thread or Asynctask for Bluetooth? I am writing a program that uses Bluetooth to connect between 2 or more devices.  I used the BluetoothChat as an example.
Problem is that when it reaches the "read" command in the "connected" thread it seems to freeze the whole program.
I think that that is what is happening because the command after the myThread.run() is not reached but the command inside the thread is.
Am I doing something wrong?
Should I be switching to AsyncTask in place of Thread?
I tried reading some of the other posts about the subject but found them hard to follow.
Specifically, if I should be using the AsyncTask then why does the example program use Threads?
This is the code in the connected thread:
    public void run() {
        byte[] buffer = new byte[1024];
        int bytes;

        // Keep listening to the InputStream while connected
        while (true) {
            try {
                // Read from the InputStream
                Log.d(TAG,"Server - BTConnectedThreadServer - run() - before read");
                bytes = mmInStream.read(buffer);
                Log.d(TAG,"Server - BTConnectedThreadServer - run() - after read");

                // Send the obtained bytes to the UI Activity
                mHandler.obtainMessage(BluetoothConstants.MESSAGE_READ, bytes, -1, buffer)
                        .sendToTarget();
                Log.d(TAG,"Server - BTConnectedThreadServer - run() - after send");
            } catch (IOException e) {
                Log.d(TAG,"Server - BTConnectedThreadServer - run() - disconnected", e);
                e.printStackTrace();
                BluetoothConstants.connectionLost(mHandler);

                break;
            }
        }
        Log.d(TAG,"Server - BTConnectedThreadServer - run() - Exited Loop");
    }

The "before read" Log note comes up but nothing else does.
It never returns to the main thread.

A: myThread.run() will still run on the same thread, you want myThread.start() and if that doesnt fix it, show some code

A: You should use myThread.start() not myThread.run() to start the thread.


text:
Q: Perl - Subroutine redefined I have asked this question before or searched and seen others ask - why am I getting the warning "Subroutine mySub redefined at ../lib/Common.pm line x"? and you always get the answer you declared the sub twice in the same code.  I created this test package:
ENTIRE FILE ---------------
package MyCommonPkg;

use strict;

sub thisSubroutineIsNotDefinedAnywhereElse{
}

1;

ENTIRE FILE ---------------
and I USE this package from a perl script, which uses other packages, that use this package also, and I get the warning:
Subroutine ThisSubroutineIsNotDefinedAnywhereElse redefined at ../lib/MyCommonPkg.pm line 19.
I promise I did not declare this sub anywhere else.  So is this caused by a circular reference? How can I go about tracking the cause of this warning down and fixing?

A: If you're on a system with a case-insensitive filesystem (Windows, and quite often OSX), and you do use Common in one file and use common in another, you can cause problems like this.

A: This sounds like a problem caused by circular dependencies.  Here is how to track it down. If your problem class looks like this:
package AlientPlanet;
use Dinosaurs;
sub has_dinosaurs {...}
1;

Then change your example to look like this:
package AlienPlanet;
sub has_dinosaurs {...}     # <-- swap
use Dinosaurs;              # <-- swap
1;

Now compile your code with Carp::Always like this:
⚡ perl -MCarp::Always -c lib/AlienPlanet.pm
Subroutine has_dinosaurs redefined at lib/AlienPlanet.pm line 4.
    require AlienPlanet.pm called at lib/Dinosaurs.pm line 4
    Dinosaurs::BEGIN() called at lib/AlienPlanet.pm line 4
    eval {...} called at lib/AlienPlanet.pm line 4
    require Dinosaurs.pm called at lib/AlienPlanet.pm line 5
    AlienPlanet::BEGIN() called at lib/AlienPlanet.pm line 4
    eval {...} called at lib/AlienPlanet.pm line 4
lib/AlienPlanet.pm syntax OK

Now that you have a stacktrace you can see where the loop is.  The quick and dirty solution is to use Class::Load in Dinosaurs.pm.
For a more detailed explanation try my blog post.

A: Do you have a dependency loop?  If Perl starts compiling your script and encounters a line like this:
use PackageA;

Perl pauses the compilation of your script; locates PackageA.pm and starts compiling it.  If it encounters a line like this:
use PackageB;

Perl pauses the compilation of PackageA; locates PackageB.pm and starts compiling it. Normally, that would complete successfully, and Perl would go back to complete compiling PackageA and when that completes successfully it would go back to compiling your script and when that completes successfully it would start to execute the compiled opcodes.
However, if PackageB.pm contains this line:
use PackageA;

You might expect it would do nothing since Perl has already processed PackageA.pm but the problem is that it hasn't finished yet. So Perl will pause the compilation of PackageB and start compiling PackageA.pm again from the beginning. That could trigger the message you're seeing about subroutines in PackageA being redefined.
As a general rule, two packages should not both depend on each other. Sometimes however the loop is harder to locate because it is caused by a third package.

A: When you have two subroutines with the same name in different packages, you ought to see this warning (when warnings are enabled) as "Subroutine new redefined....".
The simple reason (which is very close to what Grant McLean said, but still not exactly) is you must get your packages skip the compiling phase and make then require. This way, the Perl namespace manager will not find any such conflicting symbols with same name at compile time, and if you modules do not have any errors, they will work just fine afterwards also.
Just make sure you implement
require Module;
statement rather than
use Module;
You should not see this warning again.

A: Are you by any chance running this as a cgi-script on a web-server?
I find I need to restart the webserver to get around this warning.

A: Take a look at the program package MyCommonPkg.pm and see what it says. Does it have something like this?
package MyCommonPkg;

use Exporter qw(import);   #  Might be "require" and not "use"
our @EXPORT = qw(thisSubroutineIsNotDefinedAnywhereElse);

The syntax may be a bit different. The main things you should see are the package statement, that it's using Exporter and that the @EXPORT array has your subroutine's name in it.
What is going on is a namespace clash. Your package is defining the same subroutine you're defining.
In order to prevent this from happening, Perl uses namespaces. By default, your namespace is main. However, packages are suppose to define their own separate namesakes using the package command.
The full namespace of a subroutine or variable is the namespace followed by a double colon, followed by the subroutine or variable name. For example, of you look at File::Find, you will see references to the variables $File::Find::name and $File::Find::dir. These are the variables $name and $dir inside the File/Find.pm package under the File::Find namespace.
In order to make things easier for you, packages can export their variables and subroutines into your main namespace. For example, if I use File::Copy, O can do this:
...
use File::Copy
...
copy ($file, $to_dir);

Instead of:
...
use File::Copy
...
File::Copy::copy ($file, $to_dir);

If you look at File/Copy.pm, you will see the following:
package File::Copy;
...
our(@ISA, @EXPORT, @EXPORT_OK, $VERSION, $Too_Big, $Syscopy_is_copy);
...
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(copy move);

The package File::Copy; defines a namespace. The require Exporter; and the @ISA = qw(Exporter) allows the package to export subroutines and variables into the main namespace. The @EXPORT automatically, without it telling you anything, imports the copy and move subroutines into the main  namespace whether you want them or not!
That last bit is very important. It is now considered bad manners to use @EXPORT. Instead, you should use @EXPORT_OK which requires you to list the subroutines you want to use. More modern packages like Scalar::Util do this.
So several things. First, does your MyCommonPkg have a package MyCommonPkg; statement. If not, it should. This keeps the packages subroutines and variables from affecting your program in nasty ways. Then, you can use @EXPORT or @EXPORT_OK.
If MyCommonPkg does have a package statement, does it use @EXPORT? If so, you have several ways you can avoid this issue:

*

*Ignore the warning. It's just a warning. Since you know you're redefining the subroutine, and you want to use your definition of the subroutine, ignore it.

You can do this to turn off the warning as you redefine the subroutine:
use MyCommonPkg;

no warnings qw(redefine);
sub thisSubroutineIsNotDefinedAnywhereElse {
   ...
}
use warnings qw(redefine);

*

*Use require MyCommonPkg; instead of use MyCommonPkg;. This will prevent the importing of any subroutines or variables into your namespace including ones you wanted to use. Let's say MyCommonPkg defines four subroutines: thisSubroutineIsNotDefinedAnywhereElse, foo, bar, and barfoo. To use any of these subroutines.

You need to do this:
my $answer = MyCommonPkg::foo( $input );

Not fun.

*

*Use another name for your subroutine. It should have been documented that this subroutine is defined in MyCommonPkg, and if you want to use MyCommonPkg, you shouldn't use subroutine names that are exported.

*Finally, if MyCommonPkg is fairly new, and isn't used in dozens of programs, use @EXPORT_OK instead of @EXPORT, and make sure all the programs that use MyCommonPkg are modified to export the subroutines they want:
Like this:
use MyCommonPkg qw(foo bar);

In this case, only subroutines foo and bar are exported. The subroutines thisSubroutineIsNotDefinedAnywhereElse and barfoo are not exported into your environment.

A: I tried to use "package Common.pm" as a package name. The compiler gave me errors. Very kind of it eh? What version of Perl are you using? I tried it on 5.10.0 and 5.12.1.
Even if you can compile it is good practice to remove the .pm file. For Example;
File: some_package.pm;
package some_package;
use strict;

sub yadayadayada { ... }

1;

A: Make sure you didn't forget this line at the end of your module:
1;
I know it's been included in a few of the examples here, but I mention it because it is easy to overlook, and in my case it turned out to be the sole cause of the errors!

A: I had the same problem; It was because the program used a module and the subroutine was present both in the program and in the perl module;


text:
Q: How to write the excel file by Perl with VBA macro inside My Perl scripts will write the excel file as the output to the user, and I also need this excel file includes the VBA codes.
That means after the use open the excel file, they can run the VBA macro by click the button.
Can I use Perl to write the excel file with macro inside?
If it is unable to do so, the workaround may be :
   1. the Perl only write the excel file without macro.
   2. attach the macro to that excel file before send to user


text:
Q: Nil and nil - difference What is difference between nil and Nil?  nil is an uninitialised object, what is about Nil? Thanks!

A: It's the zero value for the Class type.
All of NULL, nil, Nil, NUL, '\0', 0, 0L, 0U, 0.0, 0.0f, ... have the same value (at least on sane systems). They just correspond to different types.
And to make this clear: nil is not an "uninitialized object" but the value of an (initialized) variable of object pointer type.

A:
nil is an uninitialised object

No, it isn't. It's a pointer-to-object that points nowhere. Uninitialized objects need not be nil.

what is about Nil

It's similar, but instead of objects, it is for classes only. (Since classes are objects in Objective-C, you could use nil for a pointer of type Class as well, but that is discouraged for code readability reasons.)

A: Adding a bit of pedantry....
nil is a value that represents a pointer to a valid non-object.  From a C perspective, it is a pointer to nowhere.  However, it has special meanings in the context of Objective-C.  Because Objective-C is a nil eats messages language, assigning nil to an object pointer will make that object pointer effectively a no-op in all subsequent messaging operations.
nil's value is defined as 0, but -- technically -- it doesn't have to be represented by zero bits (though it actually has to compare as equal to zero).  Because standards.
In practice, nil will be 0 exactly as Nikolai indicates.
Nil is the same as nil, but for Class object references as H2C03 mentions.


text:
Q: Como mudar o stdout de volta para o default? No caso eu altero o stdin e stdout para alguns .txt especificos, porem depois de alterar nao sei como fazer ele retornar para o stdout normal(no caso o prompt), eu altero por meio do freopen como no exemplo:
freopen (fileOutName, "w", stdout);

Alguem pode me dizer como fazer o stdout voltar para o prompt?


text:
Q: Automating virtualenv and Django development server startup with fabric?
Possible Duplicate:
Activate a virtualenv via fabric as deploy user

I've been advised to try and use fabric for deploying Django to a production server, and automating tasks by using python instead of bash.
I wanted to start easily and just automate the activation of my virtualenv, and start the Django development server in it.
I've created a file named fabfile.py:
from fabric.api import local

def activate_env():
    local("source /.../expofit_env/bin/activate")

def run_local_server():
    local("/.../server/manage.py runserver")

def start():
    activate_env()
    run_local_server()

However, when I run
fab start

i get the following message:
[localhost] local: source /.../expofit_env/bin/activate
/bin/sh: 1: source: not found

Fatal error: local() encountered an error (return code 127) while executin
'source /.../expofit_env/bin/activate'

What am I doing wrong?

Update
Based on Burhan Khalid's proposal, i tried the following:
....
def activate_env():
    local("/bin/bash /.../expofit_env/bin/activate")
....

Running just
fab activate_env

results:
[localhost] local: /bin/bash /.../expofit_env/bin/activate

Done.

However after execution, virtualenv isn't activated.
For the following code:
def start_env():
    with prefix('/bin/bash /.../expofit_env/bin/activate'):
        local("yolk -l")

I still get an error, as if virtualenv wasn't activated.
alan@linux ~/Desktop/expofit $ fab start_env
[localhost] local: yolk -l
/bin/sh: 1: yolk: not found

When i manually activate virtualenv, yolk workd fine:
alan@linux ~/.../expofit_env $ source bin/activate
(expofit_env)alan@linux ~/.../expofit_env $ yolk -l

DateUtils       - 0.5.2        - active
Django          - 1.4.1        - active
Python          - 2.7.3rc2     - active development (/usr/lib/python2.7/lib-dynload)
....

Update
Tried a new approach from this question.
from __future__ import with_statement
from fabric.api import *
from contextlib import contextmanager as _contextmanager

env.activate = 'source /.../expofit_env/bin/activate'

@_contextmanager
def virtualenv():
    with prefix(env.activate):
        yield

def deploy():
    with virtualenv():
        local('yolk -l')

Gives the same error:
[localhost] local: yolk -l
/bin/sh: 1: source: not found

Fatal error: local() encountered an error (return code 127) while executing 'yolk -l'

Aborting.

Even dough the first command passes without errors:
alan@linux ~/.../expofit_env/bin $ fab virtualenv

[servername] Executing task 'virtualenv'

Done.

Update
It is possible to run the local with a custom shell.
from fabric.api import local

def start_env():
        local('source env/bin/activate',shell='/bin/bash')

However, that didn't activate the virtualenv as if it was done manually.

A: To use enable a virtualenv from the fab file you need to run your commands as follow:
def task():

    # do some things outside the env if needed

    with prefix('source bin/activate'):
        # do some stuff inside the env
        pip install django-audiofield

All the commands within the with bloc will be executed inside the virtualenv

A: By default you are using the sh shell, and the source command is a bashism (that is, something that only works in bash).
To activate your environment, you need to execute it with bash directly. /bin/bash /path/to/bin/activate.


text:
Q: How to Download an html page in a pdf file I have already written some java script code in order to download the html page as to excel which works fine, however i do not know on how to approach the javascript code for the pdf file download.
would appreciate a bit of help thanks in advance
  function fnExcelReport() {
    // formatting for the headers
    var tab_text = "

";
    var textRange;
    var j = 0;
    // grab the table data
    tab = document.getElementById('PrintSummaryTable'); // id of table
    //for each row in the table
    for (j = 0 ; j < tab.rows.length ; j++) {

        tab_text = tab_text + tab.rows[j].innerHTML + "
";
    }

    tab_text = tab_text + "
";

    var ua = window.navigator.userAgent;
    var msie = ua.indexOf("MSIE ");

    if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./))      // If Internet Explorer
    {
        txtArea1.document.open("txt/html", "replace");
        txtArea1.document.write(tab_text);
        txtArea1.document.close();
        txtArea1.focus();
        sa = txtArea1.document.execCommand("SaveAs", true, "Say Thanks to Sumit.xls");
    }
    else                 //other browser not tested on IE 11
        sa = window.open('data:application/vnd.ms-excel,' + encodeURIComponent(tab_text));

    return (sa);
}

<button id="btnExport" onclick="fnExcelReport();"> EXPORT TO EXCEL </button>


text:
Q: QGraphicsPixmapItem: No such file or directory ^ I have a problem with Qt. I made some code yesterday and yesterday
everything worked fine, but today i got this message. I reinstalled Qt two times and still got same message on different projects. Someone know how to deal with this?
Here is error that i got from compile output

C:/Qt/Tools/mingw492_32/bin/mingw32-make -f Makefile.Debug
  mingw32-make[1]: Entering directory 'C:/Users/michal/Documents/build-Game_2-Desktop_Qt_5_6_3_MinGW_32bit-Debug'
  g++ -pipe -fno-keep-inline-dllexport -g -std=gnu++0x -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN    ../Game_2/tower.cpp   -o ../Game_2/Tower
  In file included from ../Game_2/tower.cpp:1:0:
  ../Game_2/tower.h:3:31: fatal error: QGraphicsPixmapItem: No such file or directory
   #include
                                 ^
  compilation terminated.
  : recipe for target '../Game_2/Tower' failed
  mingw32-make[1]: Leaving directory 'C:/Users/michal/Documents/build-Game_2-Desktop_Qt_5_6_3_MinGW_32bit-Debug'
  makefile:34: recipe for target 'debug' failed
  mingw32-make[1]: * [../Game_2/Tower] Error 1
  mingw32-make: * [debug] Error 2
  18:46:16: The process "C:\Qt\Tools\mingw492_32\bin\mingw32-make.exe" exited with code 2.
  Error while building/deploying project Game_2 (kit: Desktop Qt 5.6.3 MinGW 32bit)
  When executing step "Make"
  18:46:16: Elapsed time: 00:01.

and code:
#ifndef TOWER_H
#define TOWER_H
#include <QGraphicsPixmapItem>
#include <QGraphicsPolygonItem>
#include <QGraphicsItem>
class Tower: public QGraphicsPathItem
{
public:
    Tower(QGraphicsItem * parent = 0);
private:
    QGraphicsPolygonItem * attack_area;

};

#endif // TOWER_H

https://pastebin.com/u/NoName977


text:
Q: Align on the left i have this website http://steam-to-rent.ch/ and what i need is to align the entire content on the left (same line as the Logo). I'm using bootstrap grid but in the homepage and here http://steam-to-rent.ch/uber.html i can't align on the left. This is the HTML code:

Dampf wird überall gebraucht!

Damit es wieder mit Volldampf voraus gehen kann

Die Einsatzgebiete für Dampf sind vielfältig. Sei es im Spital, der Universitätskantine, der Molkerei, der Wäscherei, der Lederverarbeitung, der Gummiherstellung, in der gesamten Lebensmittelindustrie, beim Gemüsebauer um Randen und Mais zu kochen, in der Futtermühle, der Getreidemühle oder in der Käserei. Mit unserer Dampfkessel - Vermietung helfen wir Ihnen schnell und kompetent bei Ausfällen, damit Sie Ihre Prozesse zügig wieder aufnehmen können.

A: Just remove the margin you have given in your css
.single-service {
  margin:30px 25px;
}

.service-content {
  margin:65px;
}

A: Remove div's holding col-sm-12 and service-content classes from your HTML page
col-sm-12 is having 15px padding
and
.service-content {
    margin-left: 65px; /* because of this 65px your content is shifted to left, so remove this value or avoid using this class in HTML */
    bottom: 0;
}


text:
Q: Subtract an amount from a cell until it reaches 0, then move and subtract from the next amount Can you please assist me with the below?  The objective of my excel project is that each   time each time B is found in column A is minus the quantities of A till the quantity is reached.
Only values with A is where the quantities will be subtracted from.
The next time it finds the next B , it will check any above A's with remaining quantity and so.

I attempted the below aswell but was not successful .
=IF(A2="B",MAX(SUM($B$2:B2)-OFFSET(A2,0,1),0),"")

i was thinking of opting into a vba code.
For Example:
With the first "B" is the sequence above, the remaining balance is zero (0) because 300 -100 leaving zero of the quantity left.  The remaining 200 will be taken off 250 leaving a balance of 50.
The Remaining balance on B will always be zero

A: Based on the above comments it seems that the answer is to put the following formula into cell C2 and then copy it down to the rest of the C column:
=MAX(SUMIF($A$2:A2,"A",$B$2:B2)-SUMIF($A$2:$A$8,"B",$B$2:$B$8),0)

In order to calculate the "current" balance of "A" the following formula can be used in a separate column. For example in cell D2:
=SUMIF($A$2:A2,"A",$B$2:B2)-SUMIF($A$2:A2,"B",$B$2:B2)

(and then copied down again for column D)


text:
Q: Razor DropDownFor default text and value I have created a dropdown list in razor as,
@Html.DropDownListFor(model => model.ItemID, new SelectList(Model.ItemList, "Id", "ItemCodes", String.Empty), "ALL", new { @id = "ItemDetails"})

Here I wanted a default value which I added as 'All'. The text 'All' will be the first element, which is fine. However how can I make sure that the All has the value as '0'.
That is current Html markup is <option value="">ALL</option>.
I needed that as <option value="0">ALL</option>.
How can I add that as part of above Razor declaration.

A: You can not do this by helper syntax instead of this You canto insert an item at 0 index like this.
Model.ItemList.Insert(0,new SelectListItem{Value="0",Text="ALL"});

A: Use Jquery to do this:
 $("#ItemDetails").prepend("<option selected=selected value='0'>All</option>");

and ur htmlhelper will be as:
@Html.DropDownListFor(model => model.ItemID, new SelectList(Model.ItemList, "Id", "ItemCodes", String.Empty), new { @id = "ItemDetails"})


text:
Q: How do I see the contents of process.env using bash? Using the integrated Bash terminal in VS Code on Windows 10, I can access individual properties of the Node process.env object using echo $PROPERTYNAME, but I can't figure out how to list all of them.
$ process.env
bash: process.env: command not found

A: The bash way of listing environment variables is env:
$ env
LANG=en_US.UTF-8
TZ=US/Pacific
EDITOR=vim
PAGER=less
[...]

A: Pure node answer (on Linux at least)
node --print 'process.env'
{ LC_PAPER: 'es_AR.UTF-8',
  LESSKEY: '/etc/lesskey.bin',
  MANPATH: '/usr/local/man:/usr/share/man',
  NNTPSERVER: 'news',
...
}

A: Solved: start by typing node and pressing enter, then type process.env and press enter.
$ node
> process.env
{ ALLUSERSPROFILE: 'C:\\ProgramData',
  APPDATA: 'C:\\Users...,
  ...
}


text:
Q: How to sort a string of email addresses to a list I want to sort a string that contains email addresses to a list of email addresses.
The code gets stuck and nothing happens.
unsorted = "sge@grg.lt ggrge@yahoo.com"
def sort_thatstring():
    s = ""
    out = []
    for x in unsorted:
        s = ""
        while x != " ":
            s+=str(x)
        else:
            out.append(s)
sort_thatstring()
print out

I would like to get:
out = ["sge@grg.lt", "ggrge@yahoo.com"]

A: You can do:
sorted_list = sorted(unsorted.split(), key=lambda x: x.split('@')[1])

print(sorted_list)
#['sge@grg.lt', 'ggrge@yahoo.com']

A: Your code has two issues:
You reset s every time you loop in the for loop causing you to loose the data you have read.
The while statement also constructs a loop, but you are using it like an if. Try replacing while with if and read up on the difference between conditionals and loop constructors.
Your function also needs to return the out array otherwise it will be destroyed as soon as your function reaches the end.


text:
Q: Compiling classes with Toolprovider and loading them with ClassLoader I'm trying to load classes that I generate an compile in runtime. I can compile them without no problem with this code:
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null);

List<File> sourceFileList = new ArrayList<File>();
sourceFileList.add(new File(sourceFile));
Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjectsFromFiles(sourceFileList);
CompilationTask task = compiler.getTask(null, fileManager, null, null,null, compilationUnits);

But I don't understand how to load the Class I've compiled (or where it is compiled) for posterior usage. I've tried several things like:
Class type = ClassLoader.getSystemClassLoader().loadClass(className);

or
ClassLoader loader = URLClassLoader.newInstance(new URL[] { myUrl }, getClass().getClassLoader());  //(URL?)

without success (I don't understand these...). Could you help me or give a simple example of ho to do this so I can develop form it?
Thanks in advance.

A: Your last attempt should work. myUrl should refer to the directory (or Jar) containing the .class generated.
myUrl = new URL("file:///myGeneratedCode/");

The url must end with a "/" to be considered a directory, otherwise, it will assume a Jar file.

A: I finally found the 'problem'. It was a stupid mistake from my side: I was trying to compile the generated java file before closing it. The annoying thing it's that JavaCompiler was not throwing any Exception.
With this solved and the class generated I have no more issues loading it with ClassLoader
Thanks again.


text:
Q: Make heartbeat check MySQL replication lag before resource takeover I am using heartbeat with MySQL master-master configuration, and using mon to check up on MySQL health. All works well for detecting downed host or broken MySQL. But the problems start after takeover, when replication collisions start piling up.
Is it possible to add a hook to heartbeat, to make it wait before taking over the IP address, by running an external script? I wrote one that checks up on replication, and exits with code 0 or 1 depending if all clear to proceed, and waits for replication to catch up completely to avoid collisions.

A: Maybe you can take a few ideas from how mysql-master-ha do something very similar?


text:
Q: AWS ECS fargate service task is not picking up the updated ECR image via Codepipeline Cloudformation provider Here is how the codepipeline was setup
1.Source -> codecommit
2.Build -> Codebuild will build the docker image from codecommit and push to ECR registry
3.Deploy -> Codedeploy will deploy the new image via cloudformation provider (ActionMode: CREATE_UPDATE)
I am able to successfully push the updated docker images to ECR , however the ECS fargate service is not being updated with the new changes and i am not sure what is wrong with my configuration. I am providing the service definition and pipeline configuration for reference:
Cloudformation Service definition:
  Service:
    Type: AWS::ECS::Service
    Properties:
      Cluster: !Ref Cluster
      TaskDefinition: !Ref TaskDefinition
      LaunchType: FARGATE
      DeploymentConfiguration:
        **MaximumPercent: 200**
        **MinimumHealthyPercent: 0**
      DeploymentController:
        **Type: ECS**
      **DesiredCount: 1**
      HealthCheckGracePeriodSeconds: 120
      NetworkConfiguration:
        AwsvpcConfiguration:
          AssignPublicIp: DISABLED
          Subnets:
            - !Ref PrivateSubnetOne
            - !Ref PrivateSubnetTwo
          SecurityGroups:
            - !Ref ContainerSecurityGroup
      LoadBalancers:
        - ContainerName: !Ref ServiceName
          ContainerPort: 80
          TargetGroupArn: !Ref TargetGroup

CodePipeline stage:
                  Name: Deploywebservice
                  ActionTypeId:
                    Category: Deploy
                    Owner: AWS
                    Version: "1"
                    Provider: CloudFormation
                  InputArtifacts:
                    - Name: Sourcefiles
                  Configuration:
                    **ActionMode: CREATE_UPDATE**
                    StackName: !Sub ${AWS::StackName}-webservice
                    RoleArn: !GetAtt CloudFormationRole.Arn
                    TemplatePath: SourceZip::web-service.yml
                    TemplateConfiguration: SourceZip::web-service-parameters.json
                    Capabilities: CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND
                  RunOrder: 1

I am really running out of ideas and hence posting it here for help.


text:
Q: Logging/Debugging of computer vision apps When I'm writing an computer-vision program (using OpenCV and Python) I need to print/show a lot of intermediate results in form of images (using cv2.imshow(..)) for debugging purposes to find out what is happening. After finishing the program I have no idea what to do with this "debugging code". Because this code is useless in production code, but it might be very useful in case of bug fixing in the future and it will make much easier for someone else to understand the logic of the code.
In case of plain text logging people usually use some logging library (in python it is logging library) that allows to print the redundant information only while debugging.
I did some research and I found nearly no discussion on that topic and in case of python just one unmaintained library that does this kind of logging so I am wondering whether my idea of logging of computer vision programs is wrong and I should rather think about dividing my program into processing part and visualization part?

A: If the debugging aspect of your program is important, include it as part of your program.  Similar to Chrome, have the user press some sort of function key or key sequence to activate. Don't include this in your public documentation.
Another possibility is to add a log level to your program.  Typical log levels are Verbose (Debug), Information, Error.  In production the log level is set to Error, while locally developers can set it to Verbose to see everything (all your debug prints.  Just set the level in your configuration file and it can be altered as needed.

A:
I should rather think about dividing my program into processing part and visualization part?

Yes.
I don't have a good comprehensive answer (i.e. I don't think I have found a solution to the problem), but here is my approach.
I added "debug image listener interface" to the main algorithm classes. The interface contains a method that will "receive" some images which are generated during the normal execution of the main algorithm. The implementer of that listener class will decide what to do with that image, such as saving it.
The separation of "extension points" (the interface, which serves as callbacks or hooks) and the implementations (the debug image listener implementations, which are responsible for saving them to disk or analyzing them on-the-fly) is what allows separation of production code and development code.
This is acceptable in C++ because, in C++, OpenCV matrix handles (cv::Mat) behave similar to references to the underlying matrices. Passing a handle for read-only purpose does not require a copy of the underlying memory. This means handle-passing is memory-efficient.
For more complicated use cases, this is what I have tried:

*

*Pass a descriptive string along with each image. The string may describe the step which generates that intermediate image.

*Pass a string which can be used as a filename (i.e. characters from the descriptive string which are not valid as filename characters had been stripped out)

*Add a second method to the interface, which allows interrogating whether a particular intermediate image should be saved or not.

*Convert between multi-channel and high-bit-depth (integer-valued) images via Morton code, so that matrices that are not PNG-compatible can be encoded in PNG.

As you can see, logging of 2D images requires a lot of small tricks, and appears to be far from being a solved problem.
Finally, image algorithm development sometimes require a lot of R&D, which is typically done as a separate software project (or "software artifact" - tangible by-products from software development process). These artifacts are worth maintenance. Without these artifacts, fixing of algorithm-level defects or algorithm-level improvements, or even parameter tuning (as opposed to implementation or coding defects) can become impossible.


text:
Q: How to check null value or zero Using VB.Net
I want to check whether the table row is null or 0
Code
 sCmd = New SqlCommand("SELECT * from table1)", conObjects.myConnection)
        dReader = sCmd.ExecuteReader
        While dReader.Read()
 If dReader.Item(11) <> "0" And dReader.Item(11) IsNot Nothing Then
msgbox ("Not NUll or 0")
End if
End while

Showing Error as "Operator '<>' is not defined for type 'DBNull' and string "0""
Why i am getting this error, How to solve this problem.
Need VB.Net Code Help

A: You should always use AndAlso and OrElse instead of And and Or.
With AndAlso the latter expression is only evaluted if the former returned true. On this way you can avoid exceptions and make your code more efficient.
But apart from that, you should use reader.IsDBNull(index):
If Not dReader.IsDBNull(11) AndAlso dReader.GetString(11) <> "0" Then

End If

A: Try using AndAlso
If (dReader.Item(11) IsNot Nothing) AndAlso (cint(dReader.Item(11)) <> 0) Then
    msgbox ("Not NUll or 0")
End if

basically what it does is, when the first expression is already true, the second expression is not evaluated.

A: There are two problems here: one is that you use And instead of AndAlso: the former will cause your whole line to be evaluated, where the latter will only evaluate the second argument if its first argument is already True.
Your second problem is that you check for "not zero" before you check for "Nothing", and so your first part can fail before the second part is evaluated.
Try this instead:
If dReader.Item(11) IsNot Nothing AndAlso dReader.Item(11) <> "0" Then

Also, it's been a while since I did ADO, but shouldn't you be checking IsDbNull instead of comparing to Nothing?  Perhaps VB takes care of that for you, I'm not sure.

A: If Convert.ToString(dReader.Item(11)) <> "0" AndAlso dReader.IsDBNull(11)=False


text:
Q: Can't install GeoServer WPS, missing files I'm following the instructions step by step from GeoServer to build a GeoServer with WPS remote plugin but at some point in the instructions in the deploy and configure
https://docs.geoserver.org/latest/en/user/community/remote-wps/install_geoserver.html#deploy-and-configure-geoserver
During this command:
mvn clean install -Pwps,wps-remote,importer,security,rest-ext -DskipTests
It starts complaining about missing files. What am I missing? I'm starting same as the guide on a CentoOS 7 clean minimal installation.
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ gs-gwc ---
[INFO] Compiling 43 source files to /root/geoserver.src/src/gwc/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/GWC.java:[33,25] error: package javax.servlet.http does not exist
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/GWC.java:[34,25] error: package javax.servlet.http does not exist
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/GWC.java:[35,25] error: package javax.servlet.http does not exist
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/GWC.java:[1214,73] error: cannot find symbol
[ERROR]  class GWC
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/layer/GeoServerTileLayer.java:[26,25] error: package javax.servlet.http does not exist
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/layer/GeoServerTileLayer.java:[27,25] error: package javax.servlet.http does not exist
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletRequest.java:[18,20] error: package javax.servlet does not exist
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletRequest.java:[19,20] error: package javax.servlet does not exist
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletRequest.java:[20,25] error: package javax.servlet.http does not exist
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletRequest.java:[22,25] error: package javax.servlet.http does not exist
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletRequest.java:[27,40] error: cannot find symbol
[ERROR]  class HttpServletRequest
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletRequest.java:[47,12] error: cannot find symbol
[ERROR]  class FakeHttpServletRequest
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletRequest.java:[49,68] error: cannot find symbol
[ERROR]  class FakeHttpServletRequest
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletRequest.java:[53,68] error: cannot find symbol
[ERROR]  class FakeHttpServletRequest
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletRequest.java:[71,11] error: cannot find symbol
[ERROR]  class FakeHttpServletRequest
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletRequest.java:[135,11] error: cannot find symbol
[ERROR]  class FakeHttpServletRequest
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletRequest.java:[139,11] error: cannot find symbol
[ERROR]  class FakeHttpServletRequest
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletRequest.java:[187,11] error: cannot find symbol
[ERROR]  class FakeHttpServletRequest
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletRequest.java:[252,11] error: cannot find symbol
[ERROR]  class FakeHttpServletRequest
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[13,20] error: package javax.servlet does not exist
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[16,25] error: package javax.servlet.http does not exist
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[89,38] error: cannot find symbol
[ERROR]  class GwcServiceProxy
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[89,69] error: cannot find symbol
[ERROR]  class GwcServiceProxy
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[114,29] error: cannot find symbol
[ERROR]  class GwcServiceProxy
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[191,48] error: cannot find symbol
[ERROR]  class GwcServiceProxy
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[215,61] error: cannot find symbol
[ERROR]  class GwcServiceProxy
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[196,32] error: cannot find symbol
[ERROR]  class GwcServiceProxy.ResponseWrapper
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[201,15] error: cannot find symbol
[ERROR]  class GwcServiceProxy.ResponseWrapper
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletResponse.java:[17,20] error: package javax.servlet does not exist
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletResponse.java:[18,25] error: package javax.servlet.http does not exist
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletResponse.java:[26,48] error: cannot find symbol
[ERROR]  class HttpServletResponse
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletResponse.java:[30,57] error: cannot find symbol
[ERROR]  class FakeHttpServletResponse
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletResponse.java:[49,17] error: cannot find symbol
[ERROR]  class FakeHttpServletResponse
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletResponse.java:[57,11] error: cannot find symbol
[ERROR]  class FakeHttpServletResponse
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletResponse.java:[73,26] error: cannot find symbol
[ERROR]  class FakeHttpServletResponse
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletResponse.java:[170,11] error: cannot find symbol
[ERROR]  class FakeHttpServletResponse
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/GWC.java:[766,8] error: cannot find symbol
[ERROR]  class GWC
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/GWC.java:[767,8] error: cannot find symbol
[ERROR]  class GWC
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/GWC.java:[1223,36] error: incompatible types: FakeHttpServletRequest cannot be converted to HttpServletRequest
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/GWC.java:[1228,8] error: cannot find symbol
[ERROR]  class GWC
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/GWC.java:[1247,8] error: cannot find symbol
[ERROR]  class GWC
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/layer/GeoServerTileLayer.java:[428,61] error: cannot find symbol
[ERROR]  class GeoServerTileLayer
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/layer/GeoServerTileLayer.java:[622,12] error: cannot find symbol
[ERROR]  class GeoServerTileLayer
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/layer/GeoServerTileLayer.java:[623,12] error: cannot find symbol
[ERROR]  class GeoServerTileLayer
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/wms/CachingWebMapService.java:[119,45] error: cannot find symbol
[ERROR]  class CachingWebMapService
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/wms/CachingWebMapService.java:[166,53] error: cannot find symbol
[ERROR]  class CachingWebMapService
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/layer/GWCGeoServerRESTConfigurationProvider.java:[94,49] error: cannot find symbol
[ERROR]  class GWCGeoServerRESTConfigurationProvider.RESTConverterHelper
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/layer/GWCGeoServerRESTConfigurationProvider.java:[104,57] error: cannot find symbol
[ERROR]  class GWCGeoServerRESTConfigurationProvider.RESTConverterHelper
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/layer/GWCGeoServerRESTConfigurationProvider.java:[113,57] error: cannot find symbol
[ERROR]  class GWCGeoServerRESTConfigurationProvider.RESTConverterHelper
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/layer/GWCGeoServerRESTConfigurationProvider.java:[124,49] error: cannot find symbol
[ERROR]  class GWCGeoServerRESTConfigurationProvider.RESTConverterHelper
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[100,50] error: cannot find symbol
[ERROR]  variable responseWrapper of type GwcServiceProxy.ResponseWrapper
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[200,8] error: method does not override or implement a method from a supertype
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[205,8] error: method does not override or implement a method from a supertype
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[219,8] error: method does not override or implement a method from a supertype
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[224,8] error: method does not override or implement a method from a supertype
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletResponse.java:[28,50] error: cannot find symbol
[ERROR]  class FakeHttpServletResponse
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletResponse.java:[58,37] error: cannot find symbol
[ERROR]  class FakeHttpServletResponse
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletResponse.java:[58,69] error: cannot find symbol
[ERROR]  class FakeHttpServletResponse
/root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletResponse.java:[75,36] error: cannot find symbol
[INFO] 59 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] GeoServer ......................................... SUCCESS [1.148s]
[INFO] Core Platform Module .............................. SUCCESS [4.443s]
[INFO] Open Web Service Module ........................... SUCCESS [5.183s]
[INFO] Main Module ....................................... SUCCESS [17.972s]
[INFO] GeoServer Security Modules ........................ SUCCESS [0.138s]
[INFO] GeoServer JDBC Security Module .................... SUCCESS [4.204s]
[INFO] GeoServer LDAP Security Module .................... SUCCESS [3.779s]
[INFO] Web Coverage Service Module ....................... SUCCESS [2.257s]
[INFO] Web Coverage Service 1.0 Module ................... SUCCESS [5.308s]
[INFO] Web Coverage Service 1.1 Module ................... SUCCESS [5.340s]
[INFO] Web Coverage Service 2.0 Module ................... SUCCESS [7.309s]
[INFO] Web Feature Service Module ........................ SUCCESS [9.957s]
[INFO] Web Map Service Module ............................ SUCCESS [11.875s]
[INFO] KML support for GeoServer ......................... SUCCESS [6.140s]
[INFO] GeoWebCache (GWC) Module .......................... FAILURE [3.186s]
[INFO] REST Support Module ............................... SKIPPED
[INFO] REST Configuration Service Module ................. SKIPPED
[INFO] GeoServer Web Modules ............................. SKIPPED
[INFO] Core UI Module .................................... SKIPPED
[INFO] WMS UI Module ..................................... SKIPPED
[INFO] GWC UI Module ..................................... SKIPPED
[INFO] WFS UI Module ..................................... SKIPPED
[INFO] Demos Module ...................................... SKIPPED
[INFO] WCS UI Module ..................................... SKIPPED
[INFO] Security UI Modules ............................... SKIPPED
[INFO] Security UI Core Module ........................... SKIPPED
[INFO] Security UI JDBC Module ........................... SKIPPED
[INFO] Security UI LDAP Module ........................... SKIPPED
[INFO] REST UI Module .................................... SKIPPED
[INFO] GeoServer Extensions .............................. SKIPPED
[INFO] Web Processing Service parent ..................... SKIPPED
[INFO] Web Processing Service Module ..................... SKIPPED
[INFO] Web Processing Service GUI ........................ SKIPPED
[INFO] GeoServer Data Importer ........................... SKIPPED
[INFO] Importer Core Module .............................. SKIPPED
[INFO] Importer Web UI Module ............................ SKIPPED
[INFO] Importer REST Api Module .......................... SKIPPED
[INFO] Community Space ................................... SKIPPED
[INFO] REST plugin community module ...................... SKIPPED
[INFO] Web Processing Service - Remote processes invocation  SKIPPED
[INFO] GeoServer Web Application ......................... SKIPPED
[INFO] Web process status sharing with Hazelcast ......... SKIPPED
[INFO] GeoServer Security Extension Modules .............. SKIPPED
[INFO] GeoServer Security Extension Web Modules .......... SKIPPED
[INFO] Importer Berkley DB Persistence Module ............ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:29.120s
[INFO] Finished at: Fri Nov 01 09:24:30 GMT 2019
[INFO] Final Memory: 380M/741M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project gs-gwc: Compilation failure: Compilation failure:
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/GWC.java:[33,25] error: package javax.servlet.http does not exist
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/GWC.java:[34,25] error: package javax.servlet.http does not exist
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/GWC.java:[35,25] error: package javax.servlet.http does not exist
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/GWC.java:[1214,73] error: cannot find symbol
[ERROR] class GWC
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/layer/GeoServerTileLayer.java:[26,25] error: package javax.servlet.http does not exist
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/layer/GeoServerTileLayer.java:[27,25] error: package javax.servlet.http does not exist
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletRequest.java:[18,20] error: package javax.servlet does not exist
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletRequest.java:[19,20] error: package javax.servlet does not exist
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletRequest.java:[20,25] error: package javax.servlet.http does not exist
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletRequest.java:[22,25] error: package javax.servlet.http does not exist
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletRequest.java:[27,40] error: cannot find symbol
[ERROR] class HttpServletRequest
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletRequest.java:[47,12] error: cannot find symbol
[ERROR] class FakeHttpServletRequest
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletRequest.java:[49,68] error: cannot find symbol
[ERROR] class FakeHttpServletRequest
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletRequest.java:[53,68] error: cannot find symbol
[ERROR] class FakeHttpServletRequest
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletRequest.java:[71,11] error: cannot find symbol
[ERROR] class FakeHttpServletRequest
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletRequest.java:[135,11] error: cannot find symbol
[ERROR] class FakeHttpServletRequest
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletRequest.java:[139,11] error: cannot find symbol
[ERROR] class FakeHttpServletRequest
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletRequest.java:[187,11] error: cannot find symbol
[ERROR] class FakeHttpServletRequest
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletRequest.java:[252,11] error: cannot find symbol
[ERROR] class FakeHttpServletRequest
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[13,20] error: package javax.servlet does not exist
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[16,25] error: package javax.servlet.http does not exist
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[89,38] error: cannot find symbol
[ERROR] class GwcServiceProxy
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[89,69] error: cannot find symbol
[ERROR] class GwcServiceProxy
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[114,29] error: cannot find symbol
[ERROR] class GwcServiceProxy
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[191,48] error: cannot find symbol
[ERROR] class GwcServiceProxy
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[215,61] error: cannot find symbol
[ERROR] class GwcServiceProxy
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[196,32] error: cannot find symbol
[ERROR] class GwcServiceProxy.ResponseWrapper
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[201,15] error: cannot find symbol
[ERROR] class GwcServiceProxy.ResponseWrapper
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletResponse.java:[17,20] error: package javax.servlet does not exist
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletResponse.java:[18,25] error: package javax.servlet.http does not exist
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletResponse.java:[26,48] error: cannot find symbol
[ERROR] class HttpServletResponse
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletResponse.java:[30,57] error: cannot find symbol
[ERROR] class FakeHttpServletResponse
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletResponse.java:[49,17] error: cannot find symbol
[ERROR] class FakeHttpServletResponse
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletResponse.java:[57,11] error: cannot find symbol
[ERROR] class FakeHttpServletResponse
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletResponse.java:[73,26] error: cannot find symbol
[ERROR] class FakeHttpServletResponse
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletResponse.java:[170,11] error: cannot find symbol
[ERROR] class FakeHttpServletResponse
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/GWC.java:[766,8] error: cannot find symbol
[ERROR] class GWC
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/GWC.java:[767,8] error: cannot find symbol
[ERROR] class GWC
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/GWC.java:[1223,36] error: incompatible types: FakeHttpServletRequest cannot be converted to HttpServletRequest
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/GWC.java:[1228,8] error: cannot find symbol
[ERROR] class GWC
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/GWC.java:[1247,8] error: cannot find symbol
[ERROR] class GWC
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/layer/GeoServerTileLayer.java:[428,61] error: cannot find symbol
[ERROR] class GeoServerTileLayer
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/layer/GeoServerTileLayer.java:[622,12] error: cannot find symbol
[ERROR] class GeoServerTileLayer
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/layer/GeoServerTileLayer.java:[623,12] error: cannot find symbol
[ERROR] class GeoServerTileLayer
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/wms/CachingWebMapService.java:[119,45] error: cannot find symbol
[ERROR] class CachingWebMapService
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/wms/CachingWebMapService.java:[166,53] error: cannot find symbol
[ERROR] class CachingWebMapService
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/layer/GWCGeoServerRESTConfigurationProvider.java:[94,49] error: cannot find symbol
[ERROR] class GWCGeoServerRESTConfigurationProvider.RESTConverterHelper
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/layer/GWCGeoServerRESTConfigurationProvider.java:[104,57] error: cannot find symbol
[ERROR] class GWCGeoServerRESTConfigurationProvider.RESTConverterHelper
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/layer/GWCGeoServerRESTConfigurationProvider.java:[113,57] error: cannot find symbol
[ERROR] class GWCGeoServerRESTConfigurationProvider.RESTConverterHelper
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/layer/GWCGeoServerRESTConfigurationProvider.java:[124,49] error: cannot find symbol
[ERROR] class GWCGeoServerRESTConfigurationProvider.RESTConverterHelper
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[100,50] error: cannot find symbol
[ERROR] variable responseWrapper of type GwcServiceProxy.ResponseWrapper
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[200,8] error: method does not override or implement a method from a supertype
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[205,8] error: method does not override or implement a method from a supertype
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[219,8] error: method does not override or implement a method from a supertype
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/dispatch/GwcServiceProxy.java:[224,8] error: method does not override or implement a method from a supertype
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletResponse.java:[28,50] error: cannot find symbol
[ERROR] class FakeHttpServletResponse
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletResponse.java:[58,37] error: cannot find symbol
[ERROR] class FakeHttpServletResponse
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletResponse.java:[58,69] error: cannot find symbol
[ERROR] class FakeHttpServletResponse
[ERROR] /root/geoserver.src/src/gwc/src/main/java/org/geoserver/gwc/FakeHttpServletResponse.java:[75,36] error: cannot find symbol
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :gs-gwc


text:
Q: Load CLR assembly (with unmanaged code) as embedded resource in C# exe I would like to have a CLR assembly stored as an embedded resource within my C# application and loaded during runtime.
I included the dll as an embedded resource and attempted to retrieve the data bytes during runtime and load the assembly as follows
        using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("MyNamespace.MyCLRAssembly.dll"))
        {
            byte[] assemblyData = new byte[stream.Length];
            stream.Read(assemblyData, 0, assemblyData.Length);
            return Assembly.Load(assemblyData);
        }

However, this failed, reporting
Attempt to load an unverifiable executable with fixups (IAT with more than 2 sections or a TLS section.) (Exception from HRESULT: 0x80131019)

To prevent this error, the CLR dll needs to be compiled with the /CLR:Pure switch, however this is not possible because the CLR dll contains unmanaged code.
Therefore I tried an alternative solution to extract the assembly and copy to a temp folder in the user AppData path, then setting the PATH variable accordingly. This failed, reporting file not found exception when the application attempted to access the CLR assembly. I can copy to the installation path of the C# application and this runs okay but not in a remote folder.
As a test, I copied the CLR dll to a folder within the PATH variable but this failed. Can someone tell me what I am doing wrong? Does the problem relate to a difference in assembly types  i.e. C# assembly loading an assembly with managed and unmanaged C++.
Thanks.


text:
Q: How to store user profile photo in list using Microsoft Flow? elaboration on solution original question that wont let me comment on or expand on...
How to store user profile photo in list using Microsoft Flow?
How did you get the code  to work?
I am using this to pass the photo info from a SP list into a Ticker with spservices.
"PhotoContentType" gets $content-type passed to it and "Picture" gets the $content passed to it.
$().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "NewUsers",
    webURL: "/sites/CFFIntranet",
    CAMLViewFields: "<ViewFields><FieldRef Name='Title' /><FieldRef Name='Created' /><FieldRef Name='Department' /><FieldRef Name='Location' /><FieldRef Name='Picture' /><FieldRef Name='PhotoContentType' /></ViewFields>",
    completefunc: function (xData, Status) {

    console.log(Status);
    console.log("GetListItems operation: " + xData.responseText);

    $(xData.responseXML).SPFilterNode("z:row").each(function() {

            var PhotoContentType = $(this).attr("ows_PhotoContentType");
            var Picture = $(this).attr("ows_Picture");
            var Name = $(this).attr("ows_Title");
            var Created = $(this).attr("ows_Created");
            var Department = $(this).attr("ows_Department");
            var Location = $(this).attr("ows_Location");
            var fixedDate = convertDateSlashFormat(Created);

            var NewUL = "
   "+Name+" "+Department+"
";
            $("#NewEmpTickerUL").append(NewUL);

            });
        }
        });

A: I found by changing:
var NewUL = "
   "+Name+" "+Department+"
";
$("#NewEmpTickerUL").append(NewUL);
to:
var NewUL = "
   "+Name+" "+Department+"
";
 $("#NewEmpTickerUL").append(NewUL);
The picture will show correctly.


text:
Q: Calling the superclass' constuctor twice in the subclass' constructor I have a user defined class, say A. I have another user defined class B which publicly extends A.
When I define the constructor of B, I have to call the constructor of A in the member initializer list of B's constructor, or else the compiler will call the default constructor.
class A {
    int a;
public:
    A(int x = 0) {
        a = x;
    }
};

class B : public A {
    int b;
public:
    B(int x = 0) : A(2*x) {
        b = x;
    }
};

Now, I understand the logic behind all this. However, what I want to know is what happens when I do this instead:
class A {
    int a;
public:
    A(int x = 0) {
        a = x;
    }
};

class B : public A {
    int b;
public:
    B(int x = 0) {
        A(2*x);
        b = x;
    }
};

I mean, we all know that the compiler will call the default constructor of A before it enters the body of the B's constructor. Now, the first line of B's constructor body is to call another constructor of A (which takes arguments). So, what does this result in? Two different  constructors of the superclass are getting called here whenever an object of the subclass is being created. Please explain what happens...whether two objects will be created or what.

A: That doesn't call the constructor for the A subobject of the B being initialised. Instead, it creates and destroys a temporary object of type A. The only way to call the constructor of the base subobject is through the initialiser list, as in the first example.

A:
Now, the first line of B's constructor body is to call another constructor of A (which takes arguments). So, what does this result in?

It constructs a temporary A and the temporary object is discarded right away. That call has no relationship to initializing the A part of B.


text:
Q: Git - Fatal: Reference is not a Tree - Local Submodule Directory Deleted I have a GitHub repo that contains two submodules. I made several changes to these submodules and committed them.  However, it seems I have not done this correctly.
I recently lost my local copy of the repository, and am trying to clone the remote.  However, when I run
git clone --recursive myrepo.git

I get the error:
fatal: reference is not a tree: ...
Unable to checkout ... in submodule path....
Unable to checkout ... in submodule path....

When I click the submodule link the GitHub, I get a 404 error.
I have two questions.

*

*It seems it is not possible to restore these submodules with the commits I have made to them.  Is this true?

*If #1 is true.  What is the best way to pull back in the current upstream submodules (considering the error above)?  I can reproduce the commits I made to the submodules manually fairly easily.

A:
It seems it is not possible to restore these submodules with the commits I have made to them. Is this true?

Yes, because you committed the submodule content, but did not push them to their respective remote repos.

If #1 is true. What is the best way to pull back in the current upstream submodules (considering the error above)?

You need to checkout the submodule gitlink, the special entry in the index (meaning their folder name) at at previous state, in order for those gitlinks to reference a SHA1 which is present in their remote repo.
Start by listing their history
git log -- yourSubmodule

Pick a previous commit, and type:
git show <previouscommit> -- yourSubmodule

You will see to which SHA1 that gitlink entry refers to.
Once you checkout that gitlink to a previous commit, a git submodule update --init should restore the content of the older SHA1 from that gitlink, allowing you to cd into that submodule folder and restore the commits you did before.
Don't forget to add, commit and push from within that submodule, before going back into the parent repo, add commit and push there as well.


text:
Q: How does comment sort order work? Hope, the question is clear from the title itself.

*

*How does comment sort order work?

*Is there any difference in comment sort order for question and answer?

A: It's sorted by date, unless you use a greasemonkey script, e.g. for threaded comments. If there are many comments, some (those with the least great-comment votes) may be hidden by default, however.


text:
Q: Preventing the back press action in a fragment while leaving the SingleTop activty alive My app has two activities, ActivityA and ActivityB. ActivityB has two Fragments, Fragment1 and Fragment2.
In the mobile:
ActivityA => ActivityB | Fragment1 => Fragment2
In Tablet:
ActivityA => ActivityB | Fragment1 && Fragment2 (together)
what I want to do is:
I want to ensure that when the back button pressed in mobile while Fragment2 is active, the app goes back to Fragment1 given that the app is singleTop; i.e. I want activity to be alive all the time.
I used the folowing code, The problem is:
when the back button clicked in a mobile device, Fragment1 starts but disappears shortly and ActivityA takes the screen.
How can I correct my code?
@Override
public void onBackPressed() {
    super.onBackPressed();

    if (!DeviceType.isTablet(ActivityB.this) && Fragment2 != null) { // DeviceType.isTablet() returns "true" if the device is Tablet

        Bundle bundle = new Bundle();
        bundle.putInt("clickedFragment1Item", clickedFragment1Item);

        startFragment1(bundle); // A method to start Fragment1

    }
}


text:
Q: Use OpenSSL in C++Builder I'm compiling an app in C++Builder 10 Seattle, and trying to use OpenSSL for RSA work.
I followed this tutorial:
How to Use OpenSSL to Generate RSA Keys in C/C++
Here is the code:
#include <stdio.h>
#include <openssl/rsa.h>
#include <openssl/pem.h>

bool generate_key()
{
    int             ret = 0;
    RSA             *r = NULL;
    BIGNUM          *bne = NULL;
    BIO             *bp_public = NULL, *bp_private = NULL;

    int             bits = 2048;
    unsigned long   e = RSA_F4;

    // 1. generate rsa key
    bne = BN_new();
    ret = BN_set_word(bne,e);
    if(ret != 1){
        goto free_all;
    }

    r = RSA_new();
    ret = RSA_generate_key_ex(r, bits, bne, NULL);
    if(ret != 1){
        goto free_all;
    }

    // 2. save public key
    bp_public = BIO_new_file("public.pem", "w+");
    ret = PEM_write_bio_RSAPublicKey(bp_public, r);
    if(ret != 1){
        goto free_all;
    }

    // 3. save private key
    bp_private = BIO_new_file("private.pem", "w+");
    ret = PEM_write_bio_RSAPrivateKey(bp_private, r, NULL, NULL, 0, NULL, NULL);

    // 4. free
    free_all:

    BIO_free_all(bp_public);
    BIO_free_all(bp_private);
    RSA_free(r);
    BN_free(bne);

    return (ret == 1);
}

int main(int argc, char* argv[])
{
    generate_key();
    return 0;
}

When I added libeay32.lib and ssleay32.lib to my project, I got an error message:

[ilink32 Error] Error: 'C:\USERS\ERICWANG\DESKTOP\TESTOPENSSL2\LIB\LIBEAY32.LIB' contains invalid OMF record, type 0x21 (possibly COFF)

I've seen some tips like using coff2omf and implib tools, but both didn't work.

*

*I used coff2omf.exe to convert libeay32.lib. I put coff2omf.exe and libeay32.lib in the same folder, and entered this command:
coff2omf libeay32.lib Blibeay32.lib

It said:

ERROR: COFF error: libeay32.lib  : invalid machine type detected

*I tried to convert libeay32.lib to a .dll file using implib.exe. I entered this command:
implib libeay32.lib Blibeay32.dll

It said:

Error : unable to open file

And my libeay32.lib change its size to 1KB file. Which means the file was wrong.

A: OpenSSL works just fine in C++Builder.  I use it in my own C++Builder apps.
You cannot use the .lib files that are included with the pre-compiled OpenSSL DLLs.  Those .lib files are meant for Visual Studio.
In C++Builder, you need to use C++Builder's implib or mkexp command-line utility to create C++Builder-compatible import libs from the DLLs.  Use implib for 32bit DLLs and mkexp for 64bit DLLs.
It works fine, I have been using this technique for years when new OpenSSL versions are released.
Your implib command is wrong.  You cannot "convert libeay32.lib to a .dll file". The first parameter is an output parameter, the second parameter is an input parameter.  You need to create a .lib file for an existing DLL.  There is no Blibeay32.dll file, which is why you are getting the "unable to open file" error.  Drop the B and use the correct DLL filenames:
implib libeay32.lib libeay32.dll
implib ssleay32.lib ssleay32.dll

mkexp libeay32.a libeay32.dll
mkexp ssleay32.a ssleay32.dll

This will create .lib or .a files containing references for importing the functions from libeay32.dll and ssleay32.dll, respectively.


text:
Q: Given that for two naturals $p$ and $q$ are coprime, How to show that two naturals $u$ $v$ exist such as $pu-vq =1$ I know by Bézout theorem two integers $u$ and $v$ exist and verify $pu+qv=1$ but to show that $u$ and $v$ are naturals I'm stuck.

A: If $p$ and $q$ are both positive integers and $pu+qv=1$ with integers $u$ and $v$, then one of them is positive and the other is not. If $u$ is the positive one, then you're done (i.e., just change the sign of $v$ and subtract instead of adding). If $u$ is not positive, then let $u'=u+(\text{a gazillion})q$ and  $v'=(\text{a gazillion})p-v$, where "a gazillion" is whatever it takes to make $u'$ positive, and note that
$$pu'-qv'=p(u+(\text{a gazillion})q)-q((\text{a gazillion})p-v)=pu+qv=1$$

A: The usual trick is to look at the set $S=\{up+vq: u, v\in \mathbb{Z}\}.$ First of all, note that $up+vq$ is always non-zero, otherwise $p$ and $q$ will have common factors. It is therefore clear that if the linear combination $up+vq=1$ for some $u, v,$ then $1$ is the smallest natural number in the $S.$ This suggests that one should look at $r=\min\{s\in S: s\ge 0\}.$ The goal is to show that $r=1.$ The idea here is that $r$ is a linear combination of $p$ and $q,$ therefore, $gcd(p, q)$ divides $r.$ Well, this does not seem to help much. So let us look at what happens if we divide $gcd(p, q)$ by $r.$ To do this, we use a trick. We show that $r$ divides both $p$ and $q.$ To see this we write, $$p= mr+ n,$$
for some natural numbers $m, n$ where $0\le n<r.$
Now, look at it carefully. Note that $r=up+vq,$ It is clear that $P-mr$ is a linear combination of $p$ And $q.$ Therefore, $n\in S.$ If $n>0,$ It will contradict the fact that $r=\min(S).$ Therefore, $n=0.$ In other words, $r$ divides $p.$ Replace $p$ By $q$ and the above argument shows that $r$ divides $q.$ Therefore, $r$ divides $gcd(p, q).$
Conclusion: $\textbf{r=gcd(p, q)}=1.$


text:
Q: Get periods without cover by another periods I Have Db Entity which looks like:
TimeEntity {
 public DateFrom {get; set;}
 public DateTo {get; set;}
}

There are activities which are one by one but can be situation when will be breaks.
How to get periods when there is no activity?
How to do it by linq? Do I must get all activities from db and do it myself?
Thank You!

A: This query should return gaps.
var withoutAdjacent =
    from p in ctx.Periods
    where !ctx.Periods.Any(p2 => p2.DateFrom == p.DateTo) && ctx.Periods.Any(p2 => p2.DateFrom > p.DateTo)
    select p;

var gapPeriods =
    from p in withoutAdjacent
    select new TimeEntity
    {
        DateFrom = p.DateTo,
        DateTo = ctx.Periods.Where(p2 => p2.DateFrom > p.DateTo).Min(p2 => DateFrom)
    };


text:
Q: TextView tapping is not working on iOS 14 I have two question about textView tapping detection,
first is, I know it's working well with web site urls, but if the url is the mailto url, it will open the mail app?
the second and my biggest problem is, when I use Xcode 11.7 or 12 GM to run the project on iOS 13.5 device simulators, the tap on url is working well, but not mailto (it's expected), but when I run the app on iOS 14 devices and simulator, the textView detect the links, but tapping is not working at all. Is it the big from iOS 14 or something change on iOS14?

A: If you call gestureRecognizers on UITextField in iOS 14, it'll return you 17 (!) entities, including a few responsible for interaction with detected links:

*

*UITextInteractionNameLinkTap

*UITextInteractionNameSingleTap

*UITextInteractionNameDoubleTap

*UITextInteractionNameTapAndAHalf

They have cross-dependencies, specifically "single tap" ones are expecting the double-tap to fail.
Indeed, taps on links did not work for me, while a double-tap would open it.
So the workaround is to remove that double-tap gesture so it does not block all the rest:
if let doubleTap = textView.gestureRecognizers?
    .first(where: { ($0 as? UITapGestureRecognizer)?.numberOfTapsRequired == 2 }) {
    textView.removeGestureRecognizer(doubleTap)
}


text:
Q: Easiest way to modify a column? If I try to do something like below:
ALTER TABLE myTable MODIFY id int unsigned;

and id is a primary key or a foreign key, it will throw the following error:
ERROR 1025 (HY000): Error on rename of './mydb/#sql-146dd_c' to './mydb/myTable' (errno: 150)

If I drop the key doing something like this:
ALTER TABLE myTable DROP FOREIGN KEY id;

Then I can run my MODIFY fine, but this seems a bit convoluted.
Is there any way that I can just MODIFY my column without dropping and re-adding my primary keys/foreign keys?

A: You can indeed rename primary keys, however, you'll have to temporarily revoke their special status first using the DROP PRIMARY KEY clause to ALTER TABLE:
ALTER TABLE tbl_name DROP PRIMARY KEY my_misnamed_primary_key;
ALTER TABLE tbl_name RENAME COLUMN my_misnamed_primary_key TO primary_key;
ALTER TABLE tbl_name ADD PRIMARY KEY primary_key;

Sorry, but for integrity purposes, this is the only way you should do so.


text:
Q: Split code to separate node js files or modules in Node.js bot framework I am building a chatbot application using the MS bot framework. I have two flows, they are flow1 and flow2. All the code is placed in app.js. I want to split it into different files: app.js, flow1.js & flow2.js and I want to use flow1.js and flow2.js functions in app.js.
Below is the app.js code
bot.dialog('Flow', [
    function(session, results) {
        builder.Prompts.choice(session, 'Please select the flow', 'flow1|flow2', { listStyle: builder.ListStyle.button });
    },function (session, results) {
        if(results.response.entity === 'flow1'){
            session.beginDialog('Flow1')
        }else{
            session.beginDialog('Flow2')
        }
    }
]).endConversationAction("stop",
    "",
    {
        matches: /^cancel$|^goodbye$|^exit|^stop|^close/i
        // confirmPrompt: "This will cancel your order. Are you sure?"
    }
);

bot.dialog('Flow1', [
    function(session, results) {
        builder.Prompts.text(session, "May I know your name?")
    },function (session, results) {
        session.userData.name = results.response
        builder.Prompts.text(session, "Hi! What is your favorite color?")
    },
    function(session, results) {
        session.userData.color = results.response.entity
        builder.Prompts.text(session, "Please enter color code?")
    },
    function(session, results) {
        session.userData.colorcode = results.response
        session.send('Your inputs
name: '+session.userData.name+
                    "
color: "+session.userData.color+
                    "
color code : "+session.userData.colorcode);
        session.endConversation();
    }
]).endConversationAction("stop",
    "",
    {
        matches: /^cancel$|^goodbye$|^exit|^stop|^close/i
        // confirmPrompt: "This will cancel your order. Are you sure?"
    }
);

bot.dialog('Flow2', [
    function(session, results) {
        builder.Prompts.text(session, "Please enter your user name?")
    },function (session, results) {
        session.userData.username = results.response
        builder.Prompts.text(session, "Please enter your password?")
    },
    function(session, results) {
        session.userData.password = results.response
        session.userData.colorcode = results.response
        session.send('Your inputs
username: '+session.userData.username+
                    "
Password: "+session.userData.password);
        session.endConversation();
    }
]).endConversationAction("stop",
    "",
    {
        matches: /^cancel$|^goodbye$|^exit|^stop|^close/i
        // confirmPrompt: "This will cancel your order. Are you sure?"
    }
);


text:
Q: Leading zeros disappear when using bulk insert from file I am using bulk insert to insert data from a csv file to a SQL table. One of the columns in the csv file is an "ID" columns: i.e. each cell in the column is an "ID number" that may have leading zeros. Example: 00117701, 00235499, etc.
The equivalent column in the SQL table is of varchar(255) type.
When I bulk insert the data into the table, the leading zeros in each element of the "ID" column disappear. In other words, 00117701 becomes 117701, etc.
Is this a column type problem? If not, what's the best way to overcome this problem?
Thanks!

A: not sure what is causing it to strip off the leading zeroes, but I had to 'fix' some data in the past and did something like this:
UPDATE <table> SET <field> = RIGHT('00000000'+cast(<field> as varchar(8)),8)

You may need to adjust it a bit for your purposes, but maybe you get the idea from it?


text:
Q: Changing the look of radio buttons I tried googling it but i cant get past the million posts about unselecting radio buttons... Anyways, my problem is my radio buttons (all my buttons actually) look ugly:

Is there any way to replace the background of them with this:

...or  make them transparent? Any help will be greatly appreciated.

A: Take make them transparent, simply use setOpaque(false)
To change the background, you'll need to bet creative.  The basic idea would be to load the background image and apply it to something like a JLabel, setting the labels layout manager and add the button to it.
The more complex solution would be to split the background image into 9 sections (4 borders, top, bottom, left and right edges and centre), draw each to their respective areas and providing some means for supporting child components.
This is going to require some custom painting and creatie layout management.
I'd also recommend taking a look at Swings Look and Feel support


text:
Q: Flutter: iOS doesn't ask for permissions I have this code showing the Retry button:
TextButton(
              onPressed: () async {
                await _checkPermission().then(
                  (hasGranted) {
                    if (hasGranted == PermissionStatus.granted) {
                      refreshContacts();
                    }
                  },
                );
              },

...

Future<PermissionStatus> _checkPermission() async {
    final Permission permission = Permission.contacts;
    final status = await permission.request();
    return status;
  }

This always returns:
PermissionStatus.permanentlyDenied

but it doesn't open the permission question again.
Info.plist:
<key>NSContactsUsageDescription</key>
    <string>This app requires access to display the contacts list. This will be used to import contacts automatically if necessary to the app contacts list.</string>

A: If a permission is permanently denied, it can only be enabled from the application settings (bar reinstalling the app). You can use the openAppSettings function to redirect the user to the settings.

A: Fixed by this issue on its repo: https://github.com/Baseflow/flutter-permission-handler/issues/718#event-5560838657

A: as per the current version of permission handler you need to add contact permission in Podfile and plist both files make sure you have added this.


text:
Q: If condition doesn't trigger Long story short story, I am playing with the tweepy library to make a markov bot on twitter: I am now trying to answer to the right tweet but...
>>> repr(mention.id)
'698147667990441984'
>>> repr(698147667990441984)
'698147667990441984'
>>> mention.id is 698147667990441984
False
>>>

The ID of the targeted tweet (I am currently working with a hardcoded tweet) has this exact ID but for some reason any check leads to a 'False' no matter how I do it (for instance by trying to convert it into strings)
Thanks in advance

A: The tweet ID is most probably a string. So just put it between quotation marks: mention.id is '698147667990441984'


text:
Q: How can I .toggle("flip") only the parent element? I'm a beginner at JavaScript. Below is some code I found on JSFiddle
$(document.body).on('click', '.button', function() {
     console.log("CLICK");
     document.querySelector('.card').classList.toggle("flip");
});

I'm trying to have multiple elements that can flip individually. I want to use a button inside that element to trigger the flip of only that parent element. I don't know where to start so I really hope that you guys can help me.

A: If you are looking for native js solution. This is the way to go:
var button = document.getElementsByClassName("button");
for (var i = 0; i < buttons.length; i++) {
    buttons.item(i).addEventListener("click", function () {
         this.parentNode.parentNode.classList.toggle("flip");
    });
}

A: document.querySelector:

Returns the first element within the document (using depth-first pre-order traversal of the document's nodes) that matches the specified group of selectors.

You current code always toggles the first .card element in the document.
You want each card's button to flip that card. You know that the card is the ancestor of the button that you want triggering its flip, so when a button is clicked, flip that button's ancestor of class card:
$('.button').on('click', function () {
    $(this).closest('.card').toggleClass("flip");
});

Demo
Notes:

*

*I changed your selector from document.body to only .button elements. To select all buttons (allowing you to remove class="button", remove the period (i.e. $('button')

*.closest('selector') returns the nearest ancestor elements in that selector group

*.toggleClass() is cleaner than .classList.toggle()