text:
Q: Is it ok to set all cassandra nodes as seeds? I'm interested in speeding up the process of bootstrapping a cluster and adding/removing nodes (Granted, in the case of node removal, most time will be spend draining the node). I saw in the source code that nodes that are seeds are not bootstrapped, and hence do not sleep for 30 seconds while waiting for gossip to stabilize. Thus, if all nodes are declared to be seeds, the process of creating a cluster will run 30 seconds faster. My question is is this ok? and what are the downsides of this? Is there a hidden requirement in cassandra that we have at least one non-seed node to perform a bootstrap (as suggested in the answer to the following question)? I know I can shorten RING_DELAY by modifying /etc/cassandra/cassandra-env.sh, but if simply setting all nodes to be seeds would be better or faster in some way, that might be better. (Intuitively, there must be a downside to setting all nodes to be seeds since it appears to strictly improve startup time.)

A: Good question. Making all nodes seeds is not recommended. You want new nodes and nodes that come up after going down to automatically migrate the right data. Bootstrapping does that. When initializing a fresh cluster without data, turn off bootstrapping. For data consistency, bootstrapping needs to be on at other times. A new start-up option -Dcassandra.auto_bootstrap=false was added to Cassandra 2.1: You start Cassandra with the option to put auto_bootstrap=false into effect temporarily until the node goes down. When the node comes back up the default auto_bootstrap=true is back in effect. Folks are less likely to go on indefinitely without bootstrapping after creating a cluster--no need to go back and forth configuring the yaml on each node.
In multiple data-center clusters, the seed list should include at least one node from each data center. To prevent partitions in gossip communications, use the same list of seed nodes in all nodes in a cluster. This is critical the first time a node starts up.
These recommendations are mentioned on several different pages of 2.1 Cassandra docs: http://www.datastax.com/documentation/cassandra/2.1/cassandra/gettingStartedCassandraIntro.html.


text:
Q: What does int[*] mean in C# under Visual studio 2017 We make use of a third party dll that exposes a method taking an out NetworkStream.Data[] parameter:
public void Read(int elementsCount, int timeOutInMs, out Data[] array, out bool timedOut)

We use it in our code by passing in a NetworkStream.Data (a datatype defined in said library) array, and it compiles fine under Visual Studio 2012.
However, when compiled under Visual Studio 2017, this generates a cast error:

Error CS1503 Argument 4: unable to cast 'out NetworkStream.Data[]' to 'out NetworkStream.Data[*]'

Decompilers such as DnSpy do indicate the same thing in the tooltip for the method, and in IL it shows the argumnt to be
[out] valuetype NetworkStream.Data[0...]& data

What does this NetworkStream.Data[*] or NetworkStream.Data[0...] mean and why does the cast fail  in VS 2017?

A: It means that the array has one or more lower bounds that are not zero.
For example, this code:
Array test = Array.CreateInstance(typeof(int), new[] { 2 }, new[] { 2 });
Console.WriteLine(test.GetType().FullName);

Prints System.Int32[*].

A: It's an array with a non default lower bound, see documentation on how to deal with this.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Encabezados laterales en tablas ¿Cómo puedo crear encabezados laterales izquierdo en tablas? Por ejemplo, tengo la siguiente tabla:

            Titulo 1
            Titulo 2
            Titulo 3
            Titulo 4

            Ejemplo 1
            Ejemplo 2
            Ejemplo 3
            Ejemplo 4

            Ejemplo 1
            Ejemplo 2
            Ejemplo 3
            Ejemplo 4

            Ejemplo 1
            Ejemplo 2
            Ejemplo 3
            Ejemplo 4

            Ejemplo 1
            Ejemplo 2
            Ejemplo 3
            Ejemplo 4

            Ejemplo 1
            Ejemplo 2
            Ejemplo 3
            Ejemplo 4

            Ejemplo 1
            Ejemplo 2
            Ejemplo 3
            Ejemplo 4

            Ejemplo 1
            Ejemplo 2
            Ejemplo 3
            Ejemplo 4

            Ejemplo 1
            Ejemplo 2
            Ejemplo 3
            Ejemplo 4

            Ejemplo 1
            Ejemplo 2
            Ejemplo 3
            Ejemplo 4

            Ejemplo 1
            Ejemplo 2
            Ejemplo 3
            Ejemplo 4

            Ejemplo 1
            Ejemplo 2
            Ejemplo 3
            Ejemplo 4

            Ejemplo 1
            Ejemplo 2
            Ejemplo 3
            Ejemplo 4

y asi se veria en el navegador:

Como pueden ver tengo seccionados los tbody por color ya que debe ser así, yo quiero agregarle una cabecera extra de lado izquierdo a cada uno de esos tbody para indicar la separación, algo así como unas pestañas
Nota: He probado con rowspan y la idea es que no estén dentro de la tabla, si no a un lado, como pestañas.
¿como hago eso? ¡¡Gracias!!

A: Tomando en cuenta la primer recomendación que hice (solo deberías tener un tbody), podrias solo estilizar la primer celda para dar forma de pestañas:

td, th{
  border: 1px solid black;
}
.pestana{
  background-color: #DFD;
  color: black;
  writing-mode: tb-rl;
  min-width:20px;
  border-left: 0px;
}

thead .pestana{
  border: 0px;
  background-color: #FFF;
}

      Titulo 1
      Titulo 2
      Titulo 3
      Titulo 4

      Head 1
      Ejemplo 1
      Ejemplo 2
      Ejemplo 3
      Ejemplo 4

      Ejemplo 1
      Ejemplo 2
      Ejemplo 3
      Ejemplo 4

      Ejemplo 1
      Ejemplo 2
      Ejemplo 3
      Ejemplo 4

      Head 2
      Ejemplo 1
      Ejemplo 2
      Ejemplo 3
      Ejemplo 4

      Ejemplo 1
      Ejemplo 2
      Ejemplo 3
      Ejemplo 4

      Ejemplo 1
      Ejemplo 2
      Ejemplo 3
      Ejemplo 4

donde rowspan="3" es un numero variable dependiendo el numero por el cual se desea agrupar.


text:
Q: Ubuntu app stores and 32 and 64 bits apps Is there any tutorial to submit applications in multiple architectures ?

*

*if only one architecture is submitted, I guess 64 bits is recommended today ? (do we have stats on how many users use 32 vs 64 bits ?)

*do we need to create 2 apps with 2 different package and version names ?

*do we have to take into consideration multiarch ?

Other tips appreciated :)

A: If you are submitting free open source applications to the Application Review Board they require a Launchpad PPA, if you are submitting to the commercial MyApps developer program a tar/zip file with both 32 and 64-bit versions is best.


text:
Q: How to create in angular simple independent grid directive fully configured in controller? I need to create independent grid directive in angular. Data and actions will be set in controller. Action can refer to other controllers or other action in parent controller. Both are possible.

Here is live example: http://plnkr.co/edit/efe4notoE1TyONH3W347?p=preview
in index.html

controller
app.controller('MainCtrl', function($scope) {
    $scope.data = [
        {id: 1, name: 'aaa'},
        {id: 2, name: 'bbb'},
        {id: 3, name: 'ccc'}
    ];

    // actions (show, delete) have to be defined before $scope.actionList
    $scope.show = function (row) {
        alert('show: ' + row.id + ':' + row.name);
    }
    $scope.delete = function (row) {
        alert('delete: ' + row.id);
    }

    $scope.actionList = [
        { label: 'edit', href: '#/edit/{{row.id}}', title: 'to other CTRL' },
        { label: 'show', click: $scope.show, title: 'use ngClick' },
        { label: 'delete', click: $scope.delete, title: 'use ngClick' }
    ];

    // call any action in this CTRL
    $scope.call = function (fun, row) {
        fun(row);
    }

});

grid directive. Parameter call will be used to pass all action functions to controller. hrefCompiled compile href of action (e.g. #/edit/{{row.id}})
app.directive('grid', function () {
    return {
        scope: {
            data: '=',
            actionList: '=',
            call: '&'
        },
        //
        controller: function ($scope, $interpolate) {
            $scope.hrefCompiled = function (action, row) {
                if (action.href) {
                    return $interpolate(action.href)({row: row})
                }
                return '';
            }
        },
        templateUrl: 'grid.html'
    }
});

grid.html

        {{key}}
        actions

        {{row.id}}
        {{row.name}}

                {{action.label}}

Here is live example: http://plnkr.co/edit/efe4notoE1TyONH3W347?p=preview
May be this is not best practice, but it works. Please help me to improve it. Thanks.

A: You may refer or use one of those angular-table plugins: http://angular-ui.github.io/ng-grid/ or http://angulartable.com/

A: You can use ng-table directive allow to liven your tables. It support sorting, filtering and pagination. Header row with titles and filters automatic generated on compilation step.
Examples

Pagination
Sorting
Filtering
Cell template
Row template
Params in url
Ajax
Custom template(pagination)
Custom filters
Table with checkboxes


text:
Q: angular how to use scope from a different controller I have a user.list.ctrl and a user.detail.cntr.  All the controllers are build as a module and are injected in a "user-module" which I inject in the app.js.  (see the complete code in the plunker below)
my controller module
angular.module('user-module', ['user-module.controllers']);

my user-module
angular.module('demo.app', ['user-module']);

In both controllers i inject user-Fctr with data from a REST factory. (works well)
user.list.cntrl has a  $scope.refresh()
user.detail.cntrl has a $scope.update()
user.list.cntrl

*

*
*

*When I enter a new record, i call the $scope.refresh() so I can refresh the list. (this is working fine)

user.detail.cntrl

*

*
*

*When i click a user from the list, the user detail loads in a different view (works ok)

*

*when I update the user.detail, I want to call $scope.refresh() to update the user.list , but it is not working.  I cannot call $scope.refresh()

I thought that since I inject the same factory into both controllers I can use each others $scopes.
Any ideas on how I can use $scope.refresh() (or update the list when I update the user.detail.js)
I make a plunker with all the js files (the plunker is not functional, it is only to show the code that I have)
http://plnkr.co/edit/HtnZiMag0VYCo27F5xqb?p=preview
thanx for taking a look at this

A: This is a very conceptual problem.
You have created a controller for each "piece" of view because they are meant for different activities. This is the purpose of controllers. So that is right.
However, you are trying to access the refresh function, written in one controller, in another one. Taken literally, this is wrong, since then, refresh is out of place either inside the user list controller or the detail controller.
A function that is meant to control (literally) what is happening on a specific piece of view is a controller. - There you are right having a controller for the list and one for the details.
A function that is meant to be shared between controllers must be a service. This is exactly what you want for your refresh function to be.
Whenever you inject the same factory into n controllers, you can't use the scope of every controller. This isn't the purpose of a controller.
However, whenever you inject the same factory into n controllers, you can use its exposed methods.
The problem you have, can be solved as follows:
app.factory( 'sharedFunctions', [ 'factoryId', function sharedFunctions( factoryId ) {
  var refresh = function () {
   factoryId.getAll(/*your params to query*/)
     .success( function ( response ) {
        //This will return the list of all your records
        return response;
     });
  };
  return sharedFunctions;
}]);

With this factory service registered, then you can inject it to your controllers and whenever you need to refresh, just call the exposed method of the service and plot the new information into the view.
Hope it works for you!

A: i ended up doing this:
I added in the list.contrl  this:
 factoryId.listScope = $scope;

since I already have the factoryId (my data service) injected in the detail controller, I can call this:
factoryId.listScope.refresh();

it works but I don't know if this is the best way. any comments?


text:
Q: Adding new entry in the TOC I need some help in two problems that I am facing now in my thesis writing.
I want to add a new page with the title "List of Scientific Contribution" at the end of my thesis and its corresponding entry in the TOC.
I am using Easy Thesis template from sharelatex.
In the Thesis.tex file, I have
\documentclass[a4paper, 12pt, oneside, doublespacing]{Thesis}
\input{Settings/Packages.tex}
\input{Settings/Administrative.tex}
%% ----------------------------------------------------------------
\begin{document}
\frontmatter      % Begin Roman style (i, ii, iii, iv...) page numbering

\widowpenalty=500
\clubpenalty=500

\input{Frontpages/Fixed/Title}
\input{Frontpages/DeclarationPage.tex}
\input{Frontpages/Abstract}
\input{Frontpages/Abstrak}
\input{Frontpages/Acknowledgements.tex}
\input{Frontpages/Fixed/TableOfContents.tex}
\input{Frontpages/Fixed/ListOfFigures.tex}
\input{Frontpages/Fixed/ListOfTables.tex}
\input{Frontpages/Abbrev.tex}
\input{Frontpages/Symbols.tex}
%% The Body -------------------------------------------------------
\setstretch{1.3}  % Return the line spacing back to 1.3 the whole document.
\mainmatter       % Begin normal, numeric (1,2,3...) page numbering
\pagestyle{fancy}  % Return the page headers back to the "fancy" style

\newpage
%\include{Chapters/Chapter1}    % Introduction
%\include{Chapters/Chapter2}    % Literature Review
%\include{Chapters/Chapter3}    % Research Methodology
%\include{Chapters/Chapter4}    % Paper 1
%\include{Chapters/Chapter5}    % Paper 2
%\include{Chapters/Chapter6}    % PAper 3
\include{Chapters/Chapter7}     % Conclusion
%\include{Chapters/testChap}
%\include{Chapters/abbreTest}

%% Bibliography ---------------------------------------------------
\backmatter
\begingroup
\begin{normalsize}
\bibliographystyle{Files/vjHarvard3}
\renewcommand{\bibname}{References}
    \setlength{\bibsep}{10pt}
    \setstretch{1}
\bibliography{Backmatters/References/all_thesis_chapters} \endgroup

\mainmatter

\begin{appendices}
\input{Backmatters/Appendices/Appendix_A} % Appendix Title
\input{Backmatters/Appendices/Appendix_B} % Appendix Title
\end{appendices}

% List of publication
\input{Backmatters/listofpublication}

\end{document}  % The End
%% ----------------------------------------------------------------

I have placed my new file \input{Backmatters/listofpublication} after the appendix section and before the \end{document} line.
The file listofpublication.tex contain lines as below for testing purpose:
\clearpage
\addtotoc{LIST OF SCIENTIFIC CONTRIBUTION}
\pagestyle{fancy}
\setstretch{1.3}
\addtocontents{toc}{\vspace{1em}}
%############################################################################

\chap{List of Scientific Contribution}

\begin{enumerate}
  \item The first item

  \item The second item

  \item The third etc \ldots
\end{enumerate}

When I complie this, I get the output as below:

Question.1) In the output, the last line (2 List of Scientific Contribution) supposed not to appear in the table of contents. But here I can see it present as the last line. How I can delete this ?
and
Question.2) I want the entries Apendix to be in UPPERCASE in TOC.
Appreciate any help with kind.
Thank you.


text:
Q: To maintain data in a form after doing a validation in rails I am validating my form but sending the error message cleans the fields and I want the data to be kept so that I only complete the ones I need
I have this code in the controller:
def create
mensaje=""
@farm = Farm.new(params[:farm])
if @farm.nombre==""  || !valid_prescence?(@farm.nombre)
  mensaje="Favor de capturar los datos que se encuentran como requeridos"
else
  @buscar=Farm.where(nombre: params[:farm][:nombre], tipo: params[:farm][:cliente_id])
  if @buscar.any?
    mensaje="La finca "+params[:farm][:nombre]+" ya se encuentra registrada en el sistema, favor de verificar."
  end
end

respond_to do |format|
  if mensaje !=""
    format.html { redirect_to new_farm_path, notice: mensaje }
    format.json { render json: @farm.errors, status: :unprocessable_entity }
  else
    if@farm.save
    format.html { redirect_to @farm, notice: 'Finca creada correctamente.' }
    format.json { render json: @farm, status: :created, location: @farm }
  else
    format.html { render action: "new" }
    format.json { render json: @farm.errors, status: :unprocessable_entity }
  end
end end end

At the moment of falling in the exception returns me to the form but with empty fields
What I want is to be able to keep the data after sending the message
This is part of the form after the validation

A: As soon as you put something into mensaje the repond will do a redirect to thenew action, which is why the form is empty. You have to clear out the controller, those validations do not belong there, I've only done some of that work for you.
def create
  @farm = Farm.new(params[:farm])
  if @farm.nombre == ""  || !valid_prescence?(@farm.nombre)
    flash[:notice] = "Favor de capturar los datos que se encuentran como requeridos"
  else
    @buscar = Farm.where(nombre: params[:farm][:nombre], tipo: params[:farm][:cliente_id])
    if @buscar.any?
      flash[:notice] = "La finca #{params[:farm][:nombre]} ya se encuentra registrada en el sistema, favor de verificar."
    end
  end

  respond_to do |format|
    if @farm.save
      format.html { redirect_to @farm, notice: 'Finca creada correctamente.' }
      format.json { render json: @farm, status: :created, location: @farm }
    else
      format.html { render action: "new" }
      format.json { render json: @farm.errors, status: :unprocessable_entity }
    end
  end
end

A: to show error on form have a look at How to show error message on rails views? or http://railscasts.com/episodes/211-validations-in-rails-3

A: Validations don't belong in the controller. Put your validations in the model (business logic). Here is an excellent guide on validations: http://guides.rubyonrails.org/active_record_validations.html.
After that, your controller will reduce and only decide on if @farm.save (as https://stackoverflow.com/users/336392/thomas-r-koll already showed).
def create
  @farm = Farm.new(params[:farm])

  respond_to do |format|
    if @farm.save
      format.html { redirect_to @farm, notice: 'Finca creada correctamente.' }
      format.json { render json: @farm, status: :created, location: @farm }
    else
      format.html { render action: "new" }
      format.json { render json: @farm.errors, status: :unprocessable_entity }
    end
  end
end

It would also be interesting to see your form code in the view. You should be aware that all values as well as the error messages from the validations are inside your @farm instance variable. If you write the form correctly (i.e. following standard Rails conventions), it will automatically display errors and old values.


text:
Q: Rowwise summing factor columns in dataframe I have a tibble called ehp30 with 13 columns which correspond to the answers of a questionnaire (11 columns) by patients at a certain followup timepoint. First row is (with fake data):
   Pat_TNO AssNo    eSocialEvents eJobsAtHome eStandingUp eSittingDown eWalking  eExercise eAppetite eSleep    eHadToLieDown eUnableToDo eUnableToCope
     <dbl> <fct>    <fct>         <fct>       <fct>       <fct>        <fct>     <fct>     <fct>     <fct>     <fct>         <fct>       <fct>
 1    1234 baseline Often         Often       Sometimes   Sometimes    Sometimes Often     Sometimes Often     Often         Often       Sometimes

I want to mutate a new column on the end called 'pain' which is the sum of the values from the 11 columns between eSocialEvents and eUnableToCope. The levels are:
 "Never"     "Rarely"    "Sometimes" "Often"     "Always"

which are effectively numbered 1-5, so the sum of the first row should be 39.

A: You can convert to numeric, and then use rowSums:
library(dplyr)
dat %>%
  mutate(across(starts_with("e"), as.numeric),
         rowS = rowSums(select(., starts_with("e")))

A: With some sample data in a reproducible format
dd <- read.table(text="Pat_TNO AssNo    eSocialEvents eJobsAtHome eStandingUp eSittingDown eWalking  eExercise eAppetite eSleep    eHadToLieDown eUnableToDo eUnableToCope
  1    1234 baseline Often         Often       Sometimes   Sometimes    Sometimes Often     Sometimes Often     Often         Often       Sometimes
  2    4567 baseline Always        Often       Sometimes   Sometimes    Sometimes Often     Sometimes Often     Often         Often       Sometimes", header=TRUE)

You can use dplyr to sum the rows with the given level order
levels <- c("Never", "Rarely", "Sometimes", "Often", "Always")

dd %>%
  rowwise() %>%
  mutate(score=sum(match(c_across(starts_with("e")), levels))) %>%
  select(AssNo, score)

Here we use match() to look up the index of the value in the levels vector. If all the columns are already factors with all the levels set in the correct order, you could just use as.numeric on the factor values to convert them to integers


text:
Q: FindFirstFile and FindNextFile question Output:
The first file found is LOG_09.TXT
Next file name is LOG_10.TXT
Next file name is LOG_11.TXT
Next fi                         (cut off word "file"?)

Function:
//Find last modified log file
    hFind = FindFirstFile("..\\..\\LOGS\\LOG*.TXT", &FindFileData);
    if (hFind == INVALID_HANDLE_VALUE)
    {
      printf ("FindFirstFile failed (%d)\n", GetLastError());
      return;
    }
    else
    {
      printf("The first file found is %s
",FindFileData.cFileName);

      //List all the other files in the directory.
      while (FindNextFile(hFind, &FindFileData) != 0)
      {
         printf ("Next file name is %s
", FindFileData.cFileName); //NOT DISPLAYING ALL NAMES CONSISTENTLY??

      }

      dwError = GetLastError();
      FindClose(hFind);

      if (dwError != ERROR_NO_MORE_FILES)
      {
         printf ("FindNextFile error. Error is %u.\n", dwError);
         return (-1);
      }

    }

The word "file" is actually cut short in my printf. Sometimes it displays all the file names sometimes it displays a few, sometimes it doesn't even finish the printf quoted line, like shown above. What is causing this and am I being mislead by the printf functionality? In the debugger it looks like everything is OK, but I want to be certain and understand this. For example, I don't have a null char after i in file right? Why is it being cut off here? Thanks.
EDIT: Incorrect - Single threaded application library. (Was multithreaded before, sorry)
printing to a file gives the complete list of files while printf concurrently is "unstable". Not sure I understand why....

A: Since you say your program is multi-threaded, I would guess that the thread this function is executing in is being killed early. This wouldn't happen when running under the debugger. You need some thread synchronization to ensure this thread is allowed to complete.

A: Since your app is multithreaded, the printf may get cut short half way through, by another thread which then gets control, try this:

*

*After all printf() calls, use fflush(stdout);, to make sure that the buffer is flushed.

*If that doesn't fix it you can protect the stdout resource with a named mutex, or a critical section. Basically wrap all printf + fflush calls with a Wait, followed by a Signal on the named mutex.

(Not sure if step 2 will be necessary).


text:
Q: Comparing 2 files with second file containing subset of data from file 1 I have 2 files containing test number, test name, seed value, status (passed or failed), and a test type (mcu or bfm). The only 2 columns I'm focused on are the test names and status. I ran some tests which are a subset of my total tests and generated a log file with the above format and wanted to do a diff to see if the status of the tests have changed; a tkdiff won't work since the files aren't the same. How can I do a comparison to see if the diff of my subset of tests against the main test file? I would do it by hand except there's over 400 tests.
Example:
Subset tests
|---------|------------------------------------------------------------------------------|-------|-----------|------------|
|Sr.Num   |test_name                                                                     |seed   |Status     |XDATA MASTER|
|---------|------------------------------------------------------------------------------|-------|-----------|------------|
|        1|                                                     usb3_bootrom_flex_connect|      1|     PASSED|         MCU|
|        2|                                                       usb3_XTAL_25MHZ_bootrom|      1|     PASSED|         MCU|

All tests file
|---------|------------------------------------------------------------------------------|-------|-----------|------------|
|Sr.Num   |test_name                                                                     |seed   |Status     |XDATA MASTER|
|---------|------------------------------------------------------------------------------|-------|-----------|------------|
|       50|                                                     usb3_bootrom_flex_connect|      1|     FAILED|         MCU|
|      200|                                                       usb3_XTAL_25MHZ_bootrom|      1|     FAILED|         MCU|

Output file:
usb3_bootrom_flex_connect  New: PASSED  Old: FAILED
 usb3_XTAL_25MHZ_bootrom   New: PASSED  Old: FAILED
Test subset: https://pastebin.com/9rWAupaJ
All tests: https://pastebin.com/cVpzY8C8
I just want to see if the subset tests have changed in status. It doesn't matter how I do this really. If I could do it with a tkdiff I would.

A: Maybe you could do something with a lot of cutting and grepping and tkdiff, but you can use a single sed script to do the job:
sed -n -e '3{:a' -e 'n;s/.* \([^|]*\)| *[0-9]*| *\([A-Z]*\).*/\1 \2/;H;ta}
  G;s/^|[^|]*| *\([^|]*\)| *[0-9]*| *\([A-Z]*\).*\1 \([A-Z]*\).*/\1  New: \2  Old: \3/p' tests.new tests.old

The first line collects the new test results in the hold space, the second line scans the lines of the old tests, compares the test name with those in the hold space and prints a line for a match.
For a detailed explanation of that principle see this answer.
Please note that for larger files of new tests this script may get slow because of the regular expression with back reference.


text:
Q: HTML Canvas - passing a background image to Canvas while it's also passing base64 data I'm currently trying to do some Javascript work in Laserfiche forms which requires me to save the base64 data for an image in a separate text area, and feed that data back into the image to allow the canvas to be turned into an image in which I can save into the system.
The issue is I'm trying to have a background image in which the user can draw on (in this case, a vehicle that they can draw a circle on to indicate where the damage is). I am using sketch.js to allow the drawing part of the task.
From what I've read is that the background CSS cannot be saved into the canvas. That's fine but how do I pass the background image when I'm already grabbing the base64 data and passing that back into my canvas?
The saveimage class belongs to the text area and the imagefinish belong to the checkbox that they mark when the image is ready
html

      Marker
      Eraser
      Download

  <canvas id="colors_sketch" width="750" height="500" style="border:2px solid #000000 ; background: url(http://localhost/forms/img/vanImage.jpg"></canvas>

<input name="Field11" id="Field11-0" type="checkbox" value="isLocked" vo="e" data-parsley-class-handler="#Field11" data-parsley-errors-container="#Field11" data-parsley-multiple="Field11">
    <textarea id="Field13" name="Field13" aria-labelledby="Field13" class="cf-medium" rows="3" vo="e" data-parsley-id="28"></textarea>

Javascript
//submitted form
  if ($('[name=IsLocked]').val() == 'True') {
    var myCanvas = document.getElementById('colors_sketch');
    var ctx = myCanvas.getContext('2d');
    var img = new Image;
    img.onload = function() {
      ctx.drawImage(this, 0, 0, myCanvas.width, myCanvas.height);
    }
    img.src = $('.saveimage .cf-field').text();
  }
  else {
  //fill form
  //$.getScript('http://localhost/Forms/js/sketch.js', function() {
     $.getScript('https://rawgit.com/intridea/sketch.js/gh-pages/lib/sketch.js', function() {
      //script is loaded and executed put your dependent JS here
      $.each(['#f00', '#ff0', '#0f0', '#0ff', '#00f', '#f0f', '#000', '#fff'], function() {
        $('#colors_demo .tools').append(" ");
      });
      $.each([3, 5, 10, 15], function() {
        $('#colors_demo .tools').append("" + this + " ");
      });
      //$('#colors_sketch').sketch();
      $('#colors_sketch').sketch({defaultColor: "#000"});
    });
    $('.imagefinish input').change(function(){
      if(this.checked) {
        var myCanvas = document.getElementById('colors_sketch');
        $('.saveimage textarea').val(myCanvas.toDataURL());
      }
    });
  }

I was able to add an image by adding a variable for my image path
 var image   = 'http://localhost/forms/img/vanImage.jpg'

and I also added the two lines to my onload for the style of "myCanvas". I have a feeling that this solution will only work because of how Laserfiches forms software works but the marked answer is also correct.
img.onload = function() {
      ctx.drawImage(this, 0, 0, myCanvas.width, myCanvas.height);
      myCanvas.style.backgroundRepeat = "no-repeat";
    myCanvas.style.backgroundImage = 'url('+image+')'
    }
    img.src = $('.saveimage .cf-field').text();
  }

A: Load the background image on page load, or an appropriate time and when the client is ready, draw the background onto the canvas behind the user content using ctx.globalCompositeOperation = "destination-over";
Create an image to hold the background.
const backgroundImage = new Image();
backgroundImage.src = "http://localhost/forms/img/vanImage.jpg";

You need to ensure that the image has loaded when the client clicks ready, incase it has not loaded you can set a callback that will call back the ready function if needed.
var backgroundLoadedCallback = null;
backgroundImage.onload = function(){
     if( typeof backgroundLoadedCallback === "function"){
         backgroundLoadedCallback();
     }
}

Then create the canvas -> textarea function
function canvasToTextarea(){

    const myCanvas = document.getElementById('colors_sketch');
    const ctx = myCanvas.getContext("2d");
    ctx.globalCompositeOperation = "destination-over";  // make sure the background go under the drawn pixels
    // draw and fit background to the canvas
    ctx.drawImage(backgroundImage,0,0,ctx.canvas.width,ctx.canvas.height);
    // then convert to URL for textarea
    $('.saveimage textarea').val(myCanvas.toDataURL());

}

In the checked function
$('.imagefinish input').change(function(){
  if(this.checked) {
     if(backgroundImage.complete) { // image has loaded so all good
         canvasToTextarea(); // put canvas data URL to textarea
     } else { // background has not yet loaded (or could be an error you will have to deal with that as well
          // set the callback to the canvasToTextarea function
          backgroundLoadedCallback = canvasToTextarea;
          // when the background has loaded the canvas and background
          // will be moved to the textarea as a data URL
     }
  }
});

Or modify sketch.js
Below is the draw function from sketch.js (and it`s very old school)
Sketch.prototype.redraw = function() {
  var sketch;
  this.el.width = this.canvas.width();
  this.context = this.el.getContext('2d');
  sketch = this;
  $.each(this.actions, function() {
    if (this.tool) {
      return $.sketch.tools[this.tool].draw.call(sketch, this);
    }
  });
  if (this.painting && this.action) {
    return $.sketch.tools[this.action.tool].draw.call(sketch, this.action);
  }
};

Just replace it with the following. You dont need to modify the sketch.js file justy overwrite the redraw Prototype
In your code load the background and set the new redraw
const backgroundImage = new Image();
backgroundImage.src = "http://localhost/forms/img/vanImage.jpg";

// replace Sketch.js redraw function
Sketch.prototype.redraw = function(){
  var sketch;
  // dont need the next line use clear instead
  // this.el.width = this.canvas.width();

  const ctx = this.context = this.el.getContext('2d');
  // clear canvas
  this.context.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
  // If backgroundimage complete draw it first
  if(backgroundImage && backgroundImage.complete){
      ctx.drawImage(backgroundImage,0,0,ctx.canvas.width,ctx.canvas.height);
  }

  // back to the original code. :P
  sketch = this;
  $.each(this.actions, function() {
    if (this.tool) {
      return $.sketch.tools[this.tool].draw.call(sketch, this);
    }
  });
  if (this.painting && this.action) {
    return $.sketch.tools[this.action.tool].draw.call(sketch, this.action);
  }
}


text:
Q: How to convert a CURL into a Python request? I am trying to make a request following the IBM Tone Analyzer API instructions, and according to the docs this is what it'll look like.
curl -X POST -u "apikey:{apikey}" --header "Content-Type: application/json" --data-binary @tone.json "https://gateway.watsonplatform.net/tone-analyzer/api/v3/tone?version=2017-09-21"
I converted that to a python request() and I have this:
response = requests.post(url=analyzer_url, header=header, data=data)
the problem is that I have no clue what -u "apikey:{apikey}"'s equivalent is on the request() parameters.
Could anyone help me?

A: Well I did look at this question but I don't think they talk about the -u "apikey:{apikey}" which was the main source of my issue. (what I now know is Authentication).
I found my answer thanks to Bakuriu's reply (here) My final post request looked like this:
res = requests.post(
url,
headers=headers,
data=json.dumps(my_json).encode('utf-8'),

auth=("apikey", API_KEY)
)

(I wish the folks in the comment section had taken the time to read the context of my question rather than looking for a duplicate. @ Bakuriu your response helped me the most, but you just didn't submit an actual answer, so I had to answer my own question.)


text:
Q: Sprite Navigation Tools I was wondering if anyone is aware of any alternatives to tools such as SpriteCow?
Sometimes i have issues with SpriteCow - namely when images tend to be very close together, it seems that it has difficulty selecting just the image you want. Those of you that have worked with complex sprite sheets which have images very close or glued together will know what i am talking about.
I was wondering if there are any other alternative or similar services that i am not aware about? Or perhaps i am not using spriteCow as well as i could? Feedback is appreciated.
Cheers,
Antonio

A: http://spritegen.website-performance.org/
http://spriteme.org/
The above are the sprite generators that I frequently use. Hope this
 helps too!
In the above generators on can also set the space between the images.


text:
Q: Calculate distance between the area surrounded by a Path and a specific point in Flutter According to the documentation for Path:
Closed sub-paths enclose a (possibly discontiguous) region of the plane based on the current fillType.

As far as I understand this implies that when a Path object is closed it surrounds a two dimensional area.
When the user clicks on a point of the screen I want to calculate the distance between the point that the user clicks and the area that's surrounded by the path. I get the point that the user clicks via GestureDetector/onPanDown but I have trouble figuring out how to calculate the distance to the path (or the area surrounded by the path). All the functions that Path offers seem to return void or bool but no distances.
Imagine for illustration: (red is the Path object when I draw it to the screen and the X is supposed to be where my user clicks; the distance between the two represented by the green line is what I'm interested in)

How do I calculate the distance?

A: First of all traverse through all points of the path.
and for each point find out the distance to clicked position and hold the shortest one.
So to get the points of the path use PathMetrics.
double getShortestDistance(Path path, Offset clickedPoint) {
    PathMetrics pathMetrics = path.computeMetrics();

    double minDistance;

    pathMetrics.toList().forEach((element) {
      for (var i = 0; i < element.length; i++) {
        Tangent tangent = element.getTangentForOffset(i.toDouble());
        Offset pos = tangent.position;

        double distance = getDistance(pos,clickedPoint);
        if(minDistance==null||distance<minDistance) {
          minDistance = distance;
        }
      }
    });

    return minDistance;
  }

  double getDistance(Offset pos, Offset clickedPoint) {
    double dx = pos.dx-clickedPoint.dx;
    double dy = pos.dy-clickedPoint.dy;
    double distance = sqrt(dx*dx+dy*dy);
    return distance.abs();
  }

got reference from here


text:
Q: Elements stay not in Fieldset I have the following HTML Code

            <form>
            <fieldset class="fldset-class">
                <legend class="legend-class">Vorselektion</legend>

                                186
 Gesamt Bewerber

                                25
 Verknüpft

                                6
 Absage(n)

            </fieldset>
                </form>

This gives me a circles which shloud sty inside the fieldset.
But it doesen't work.
The fieldset stays behind the circles. Here you can see what i mean:

And here is my CSS for each Circle for the first two:
.kreis {

text-align: center;
width: 110px;
height: 110px;
padding: 15px;
border-radius: 50%;
background-color:white;
position:absolute;

border: 5px solid rgb(0, 122, 146);

-webkit-animation: animation 1000ms linear both;
animation: animation 1000ms linear both;
}

.zweiterKreis {

text-align: center;
width: 80px;
height: 80px;
padding: 10px 5px 5px 5px;
border-radius: 50%;
background-color:white;
position: absolute;
margin: 3% 50px 0 30%;
border: 5px solid rgb(106, 199, 44);

-webkit-animation: animation 1000ms linear both;
animation: animation 1000ms linear both;
}

So what must i do, that the circles stay inside the fieldset ?

A: Can you check with Position value to Relative.

.kreis {

text-align: center;
width: 110px;
height: 110px;
padding: 15px;
border-radius: 50%;
background-color:white;
position:absolute;

border: 5px solid rgb(0, 122, 146);

-webkit-animation: animation 1000ms linear both;
animation: animation 1000ms linear both;
}

.zweiterKreis {

text-align: center;
width: 80px;
height: 80px;
padding: 10px 5px 5px 5px;
border-radius: 50%;
background-color:white;
position: relative;
margin: 3% 50px 0 30%;
border: 5px solid rgb(106, 199, 44);

-webkit-animation: animation 1000ms linear both;
animation: animation 1000ms linear both;
}

            <form>
            <fieldset class="fldset-class">
                <legend class="legend-class">Vorselektion</legend>

                                186
 Gesamt Bewerber

                                25
 Verknüpft

                                6
 Absage(n)

            </fieldset>
                </form>


text:
Q: How to track and analysis android app? I want to know what kind of users are using my app.
I think I need the device id, the network type, the network provider name and its ip address. is there any framework to do this thing? And of course I will ask user to enable it before I can do it and leave an option to disable it when user want to toggle it off.

A: You can use a service like Flurry or Google Analytics to gather some of this data (not sure about device ID or IP address), but as others have said, you might want to make this "opt-in" via an application preference due to privacy concerns.

A: You could do this relatively easy by reading this information in your app programatically and then send it to you per sms, email, or just upload it to a server.
However, I don't think that the users will be very lucky that you're doing this. At least you have to inform them about that.
For a ID you could use this:
http://developer.android.com/reference/android/telephony/TelephonyManager.html#getDeviceId%28%29
To get the IP you could use this code:
public String getLocalIpAddress() {
    try {
        for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
            NetworkInterface intf = en.nextElement();
            for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
                InetAddress inetAddress = enumIpAddr.nextElement();
                if (!inetAddress.isLoopbackAddress()) {
                    return inetAddress.getHostAddress().toString();
                }
            }
        }
    } catch (SocketException ex) {
        Log.e(LOG_TAG, ex.toString());
    }
    return null;
}

To get the network type (I think your talking about wifi or mobile) you can use this code snippet:
ConnectivityManager conMan = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);

//mobile
State mobile = conMan.getNetworkInfo(0).getState();

//wifi
State wifi = conMan.getNetworkInfo(1).getState();

and then use it like that:
if (mobile == NetworkInfo.State.CONNECTED || mobile == NetworkInfo.State.CONNECTING) {
    //mobile
} else if (wifi == NetworkInfo.State.CONNECTED || wifi == NetworkInfo.State.CONNECTING) {
    //wifi
}

A: You don't need to roll your own solution, there are plenty of free, off-the-shelf solutions which work and will let you focus on your app.  I also recommend staying away from web analytics solutions because the application model is different so shoe-horning a mobile app into it can be strange.  You don't think of your app as page views and referrals, do you?
Localytics is one solution: the service is free, the SDK is open source, and the turnaround time is instant so integration can be done and verified in 10 minutes.
[Disclaimer: this is my site]

A: Google has a full SDK for this very purpose. Documentation and details are available at:
http://code.google.com/mobile/analytics/docs/android/
From the page:

The Google Analytics for Mobile Apps
  SDKs provide an interface for tracking
  activity within mobile apps and
  reporting that activity via the
  standard Google Analytics dashboard.
Tracking mobile applications has some
  structural variations from tracking
  website pages. For that reason, you
  should be familiar with Analytics
  tracking in order to understand how
  this SDK works.
Use the SDK to track two basic types
  of user interaction:
Pageviews - This is the standard unit of
  measure for a traditional web site,
  and is used to calculate visits,
  session length, and bounce rate. We
  recommend that you trigger at least
  one pageview at application load to
  track unique visitors. Because mobile
  apps don't contain HTML pages, you
  must decide when (and how often) to
  trigger a pageview request, and choose
  descriptive names for reporting
  purposes. The names you choose will be
  populated in your Analytics reports as
  page paths in the Content reports,
  even though they are not actually HTML
  pages.
Events - You can define additional
  events to be reported in the Event
  Tracking section of Google Analytics.
  Events are grouped using categories
  and may also use per-event labels,
  which provides flexibility in
  reporting. For example, a multimedia
  app could could have play/stop/pause
  actions for its video category and
  assign a label for each video name.
  The Google Analytics reports would
  then aggregate events for all events
  tagged with the video category. For
  more information on Event Tracking,
  see the Event Tracking Guide


text:
Q: Python Multi-threading with sockets hangs on first function I am building an application that uses sockets in order for a client to act as a client and a server at the same time. To do so I uses the "threading" python library to "listen" and "speak" simultaneously. The problem is that when the first thread that is targeting the "listening" function starts, the program waits for inbound connection and the second thread targeting the "sending" function never actually launches.
So my question is how can I listen and speak at the same time ?
I have looked up this issue here but could not find a suitable solution so here I am.

    def listen():

        addr = socket.gethostbyname(socket.gethostname())
        port = 30000

        with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
            s.bind((addr, port))
            s.listen()
            conn, address = s.accept()

            with conn:
                addr, port = address

                while True:
                    try:
                        data = conn.recv(4096)

                        print("New message: {}".format(data.decode()))
                    except ConnectionResetError:
                        print("Connection has been interrupted.")
                        break

    def send(addr: str):

        with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
            try:
                s.connect((target, self.port))
            except ConnectionRefusedError:
                print("Cannot reach host {}".format(target))
                exit()

            while True:
                content = str(input("Message: "))

                try:
                    s.sendall(content.encode())
                except ConnectionResetError:
                    print("Connection has been interrupted.")
                    exit()

if __name__ == "__main__":
    x = threading.Thread(target=listen())
    y = threading.Thread(target=send())

    x.start()
    y.start()

A: The problem is that instead of passing a function as the target argument to Thread, you're calling the function (listen(), send()).  The function then never returns.
So replace this:
x = threading.Thread(target=listen())
y = threading.Thread(target=send())

with this (parenthesis omitted):
x = threading.Thread(target=listen)
y = threading.Thread(target=send)


text:
Q: Creating an R function containing dplyr and ggplot I am trying to build an R function that contains dplyr and ggplot but keep getting errors. I've looked at other solutions but cannot seem to make it fit to mine.
I've replicated my problem using the iris dataset.
Without a function and looks like this:
cat_dat <- iris %>%
     group_by(Species) %>%
     summarise(mean=mean(Sepal.Length))

bar_num <- ggplot(cat_dat, aes(x=Species, y=mean)) +
     geom_bar(stat='identity')

bar_num

But when I try to enclose the same code in a function like this, I get different chart:
bar_viz <- function(data, grp_var, var) {

     enq_grp_var <- enquo(grp_var)

     cat_dat <- iris %>%
          group_by(!!rlang::sym(grp_var)) %>%
          summarise(mean=mean(!!rlang::sym(var)))

     bar_num <- ggplot(cat_dat, aes(x=grp_var, y=mean)) +
          geom_bar(stat='identity')

     return(bar_num)

}

# Call function

bar_viz(iris, "Species", "Sepal.Length")

A: We can use .data pronoun  :
library(dplyr)

bar_viz <- function(data, grp_var, var) {

  cat_dat <- iris %>%
    group_by(.data[[grp_var]]) %>%
    summarise(mean=mean(.data[[var]]))

  bar_num <- ggplot(cat_dat, aes(x= .data[[grp_var]], y=mean)) +
    geom_bar(stat='identity')
  return(bar_num)
}

# Call function

bar_viz(iris, "Species", "Sepal.Length")


text:
Q: Remove the selection from a JList in java swing I'm trying to remove the selection at my JList, after an item has been clicked, because it then can not be clicked again without moving the selection.
I'vet tried this, but keep getting an error, and i don't see what is going on.
    ListSelectionModel mode = new DefaultListSelectionModel();
    mode.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    mode.addListSelectionListener(new ListSelectionListener()
    {
        public void valueChanged(ListSelectionEvent evt)
        {

            // Åben url'en i en browser
            if( !evt.getValueIsAdjusting() )
            {

                if(isDownloaded(data_alle.get(list_alle.getSelectedIndex()),data_downloaded))
                {
                    try {
                        Desktop.getDesktop().open(new File(data_downloaded.get(list_alle.getSelectedIndex()).getPath()));
                    } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                }
                else
                {
                    OpenURI.open(data_alle.get(list_alle.getSelectedIndex()).getUrl(), url);
                }
                list_alle.clearSelection();

            }
        }

    });

    list_alle.setSelectionModel(mode);

And the error:
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.get(Unknown Source)
at gui.Kursus$2.valueChanged(Kursus.java:114)
at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source)
at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source)
at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source)
at javax.swing.DefaultListSelectionModel.changeSelection(Unknown Source)
at javax.swing.DefaultListSelectionModel.changeSelection(Unknown Source)
at javax.swing.DefaultListSelectionModel.removeSelectionIntervalImpl(Unknown Source)
at javax.swing.DefaultListSelectionModel.clearSelection(Unknown Source)
at javax.swing.JList.clearSelection(Unknown Source)
at gui.Kursus$2.valueChanged(Kursus.java:127)
at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source)
at javax.swing.DefaultListSelectionModel.fireValueChanged(Unknown Source)
at javax.swing.DefaultListSelectionModel.setValueIsAdjusting(Unknown Source)
at javax.swing.JList.setValueIsAdjusting(Unknown Source)
at javax.swing.plaf.basic.BasicListUI$Handler.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

A: In your selection handler you are not making any out of bounds check for the selected item
if( !evt.getValueIsAdjusting() && list_alle.getSelectedIndex() >= 0) {...}

What's happening is

*

*The selection changes and enters you handlers code, you process the change and clear the selection

*Your handler is notified of the change to the selection (again), you process the change and hit an ArrayOutOfBoundsException because nothing's selected

A: Since relevant code / line #s are missing from your question, my best guess is as follows:
I had a similar problem with selection manipulation for JList. When you are determining the index of what is being selected, the reported index from getMinSelectionIndex() and related calls will sometimes report 0 as negative numbers (may have something to do with deltas, but I am admitted unsure). Place a manual check to ensure that the index you are working with isn't negative:
 89     class SharedListSelectionHandler implements ListSelectionListener {
 90         public void valueChanged(ListSelectionEvent e) {
 91             ListSelectionModel lsm = (ListSelectionModel)e.getSource();
 92
 93             if (!lsm.getValueIsAdjusting()){
 94                 int index = lsm.getMinSelectionIndex();
 95                 if (index < 0) {
 96                     index = 0;
 97                 }
 98                 handleListSelectionEvent(index);
 99             }
100
101         }
102     }


text:
Q: Upload image to different domain on same server Using a standard LAMP server with full control, I need to upload an image from DomianA using a PHP script to a directory on DomainB.  The server has suPHP and mod_security in place.
Currently using an absolute path to DomainB I am getting the error:
Warning: move_uploaded_file() [function.move-uploaded-file]: open_basedir restriction in effect.
I tried to chown the upload directory on DomainB to the user of DomainA (where the script is being run). With no luck.
After researching I have found two potential solutions, and want to see if there are any better methods.  And maybe some code to get me going in the right direction.

*

*Symlink - so basically have a dir (below the domain level I guess?) then have each domain have a symbolic link to that location.

*Modify my httpd.conf - not sure what to do, but I don't want to open any potential security holes by doing this.

A: If domain B only needs to serve up files from that directory and not modify them, then put the directory somewhere in domain A's tree, with proper permissions to allow the uploads.
You can then configure domain B to access that directory via an alias:
Alias /path/to/the/files/in/domain/A  /dom_a_dir

Then you can access the files directly via
http://dom.b.com/dom_a_dir


text:
Q: Tap actions on Android wear watchfaces So, I know this is undocumented and unsupported and not recommended etc.
But, I haven't given up on trying to add a button to an Android watchface. If you are familiar with WatchMaker, you know they support this feature!
My guess is that is has something to do with implementing onCommand on the engine, but I have encountered 2 problems with this method:

*

*For some reason the X and Y are always 0 there

*I don't know how to disable the default tap action that takes you to the menu.

Anyways, if someone can guess or know how WatchMaker are doing this, please suggest a solution!

A: You can find an example here
In fact, these WatchFaces add views in the WindowManager that have an onClickListener when visible.


text:
Q: Graphviz dot - Italic text in HTML table is non-italic I'm using dot version 2.26.3
The following .dot contents:
digraph html {
results [shape=none, margin=0, label=<

    Title

    Description.

>];
}

..should produce a non-italic 'Title' and italic 'Description' when generating an SVG according to the documentation.
dot -Tsvg filename.dot -o output/filename.svg
However, the description is non-italic as you can see:

Any idea why?
UPDATE
I couldn't get the latest version installed for various reasons.
In the end I remedied by using an italicised font.
Equally, you could use a strong font as an equivalent for bold.
Standard.
In italics.
In bold.

A: Here's why - from the link to the documentation you provided:

The font markups for bold, italic, underlining, subscript and
  superscript (, , , ; and ) are only available in
  versions after 14 October 2011, and are currently only available via
  the cairo and svg renderers

Version 2.26.3 however seems to be from January 2010 - at least when checking the dates of the downloads for ubuntu or windows.
I recommend to upgrade.

A: I have version 2.28 installed, and my local documentation (C:\Program Files\Graphviz 2.28\share\graphviz\doc\html\info\shapes.html#html) makes no mention of any  or  tags under the HTML-Like Labels section. It appears that the tags still work when producing png output, but the support was (apparently) either removed from or never added to the svg functionality and is now (apparently) not supported for any output.


text:
Q: How do I play Mountain on linux? I recently bought Mountain and I can't figure out how to run it on Ubuntu 14.04 64bit. I emailed the developer but they haven't responded in over a week. When I downloaded the game, it came with a mountain.x86 file but when I run it I get a missing library error and the missing library is not available in the package manager.

A: You need Mono installed, and if you are running 64-bit (most likely) you may also need to install the 32-bit versions of the graphics libraries that Mountain needs. Ubuntu has most of these libraries installed by default, but only in 64-bit. This is what I did to get going:
sudo apt-get install mono-complete libglu1-mesa:i386 libxcursor1:i386 libxrandr2:i386

You should also make sure that you unpacked the zip with folders intact - there should be a Mountain_Data/Mono folder with Mountain.x86 the only top level file.
Having said all that, I only get as far as drawing the sketches and the "LOADING" screen, then it crashes with a core dump.

A: I am right now playing Mountain on Ubuntu 14.10.
Mountain is now out on Steam, so I installed steam, paid $0.99 (again) and playing through steam is working great. I did install the proprietary nvidia drivers because I was getting some openGL error when I launched steam. Now the error is gone and I am playing Mountain.


text:
Q: Siemens NX 10 installation: Could not determine filesystem containing /usr/ugs100 I debug script to install Siemens NX 10 applications for Debian 8.2, and get the warning:

Could not determine filesystem containing /usr/ugs100
  space calculations may be incorrect.

The source code of the script: ug_install (too large to post here). The code fragment generating this message, together with the two functions that it calls and other relevant functions:
Init_fs_arrays() # Initializes the File System array.
{       # RKB Thu Jan 31 22:39:57 PST 1991
        # RKB Updated: Sep 28 15:26:28 PDT 1992
        # RKB updtd: Jul  6 22:51 93 V10.1.1 make generic.
        # RKB updtd: Mar  7 18:34 94 V103P2E streamline, rm "set --".
        # RKB updtd: Mar  9 22:34 94 V103P2E rm test -s for FS_FILE, just wait f
        # RKB updtd: Wed Apr 20 2005 NX4P11 Added Linux support.
        # This function initializes the FS_NAME & FS_FREE
        # arrays based on the contents of $FS_FILE
        FS_FILE="$UGS_TMP/filesystem_info" # File name to read the results from.
        $VECHO "${MSG}Initializing File System array ..."
        wait $SIZE_FS_PID # in case the file is not ready, wait for the bg job.
        I=0 # Initialize the index
        # Linux
        # cat $FS_FILE | while read NAME SPACE  ; do
        # Linux cant do "cat file | while read" "must use while read done < file
        while read NAME SPACE ; do
                FS_NAME[$I]=$NAME ; FS_FREE[$I]=${SPACE:=0} ; FS_NEEDED[$I]=0
                ((I+=1))  # Increment the index.
        done < $FS_FILE
        return 0
} # End of Init_fs_arrays

Get_fsindex() # Get the index number to supplied file system name.
{       # RKB Mon Jan 21 21:00 91
        # RKB Mar  8 23:59 94 V103P2E chg to use while loop not grep -n. faster.
        : ${FS_NAME[*]:?} # Required variable internal check.
        : ${1:?} # Required arg internal check.
        I=0 # Init the index counter
        # Loop thru the FS_NAME array to get index number for filesystem in arg
        while [ $I -le ${#FS_NAME[*]} ] ; do
                [ $1 = "${FS_NAME[$I]}" ] && { echo $I ; return 0; }
                ((I+=1)) # Increment the index.
        done
        unset FS_INDEX ;
        return 1 # Didn't find the file system.
} # End of Get_fsindex

Get_fs_info() # Returns filesystem info for the directory argument.
{
    # Requires 2 global variables.
    : ${DF_CMD:?cmd var must be set to use this function. }
    : ${AWK_CMD:?cmd var must be set to use this function. }
    # Requires 2 args; a switch and a target directory.
    TARGET=$2 ; : ${TARGET:?} # Internal check
    #
    # If dir doesn't exist, check parent.
    while [ ! -d $TARGET ] ; do
        [ -f $TARGET ] && { # error if a file exists.
            print "${ERR}directory name expected. file exists: $TARGET" >&2
            return 1 ;
        }
        TARGET=`dirname $TARGET`
    done
    #
    # Do appropriate action based on the switch. The options are:
    # use -sp to get free space, -fs for real filesystem name, -mnt returns
    # the mount point and -nfs returns true if the filesystem is NFS mounted,
    # and false if it's not.
    #
    # Set machine specific number for the df field containing filesystem.
    [ $MACHINE = IRIX -o $MACHINE = IRIX64 ] && N=6 || N=5
    case $1 in
        -fs*)  $DF_CMD $TARGET | tr "\012" " " | $AWK_CMD '{print $(NF-$N)}' ;;
        -mnt*) $DF_CMD $TARGET | tr "\012" " " | $AWK_CMD '{print $NF}'      ;;
        -nfs)  $DF_CMD $TARGET | tr "\012" " " | $AWK_CMD '{print $(NF-$N)}' | grep ":/" >$NULL || return 1 ;;
        -sp*)  $DF_CMD $TARGET | tail -1 | $AWK_CMD '{printf("%d",$(NF-2))}' ;;
    esac
    return 0
} # Get_fs_info

…
    SPACE_REQUIRED_KB=0
    # Get the mount point for BASE_DIR.
    BASE_MNT_PT=`Get_fs_info -mnt $BASE_DIR` || {
            print "${WARN}Could not determine mount point for $BASE_DIR
                              \r\tFile System information may be incorrect.
    } # Shouldn't be any problem, but just to be safe.
    FS_INDEX=`Get_fsindex $BASE_MNT_PT` || {
            print "${WARN}Could not determine filesystem containing $BASE_DI
                              \r\tspace calculations may be incorrect. "
    } # Shouldn't be any problem, but just to be safe.
    #

The contents of the temporary file /tmp/filesystem_info:
/dev    10240
/run    1621732
/dev/shm    4031816
/run/lock   5116
/dev/mqueue 0
/dev/hugepages  0
/boot/efi   72815
/run/user/116   815520
/run/user/1000  815484

*

*That the Get_fs_info function returns?

*How to understand the contents of the filesystem_info file?


text:
Q: Python Simple HTTP Server Batch File Error I'm currently playing around with home networking and getting into servers and I found a python command that will make the directories of you python folder avaliable over your LAN. To execute it in windows, I've just been entering the following into Command Prompt:
cd..
cd..
cd Python33
python -m http.server 8000

This creates the server that can be accessed via x.x.x.x:8000. Instead of manually entering these commands every time, however, I tried to make a batch script that would do this automatically. Below is the script for the batch file. The problem I'm having, is When I run the batch file, command prompt is saying 'python' is not recognized as an internal or external command. I was wondering if someone could tell my why this is happening and offer a solution or reason as to why this couldn't work. Thanks.
@ECHO OFF
cd..
cd..
cd Python33
python -m http.server 8000
pause

EDIT:
Below is the code that works, this will also set the directory to the C drive.
@ECHO OFF
cd C:\
C:\Python33\python -m http.server 8000

A: Maybe it's because the batch file is located in a directory that is not 2- level deep (C:\path\to\batch.bat)
Specifying the path of the python executable will solve your problem.
@ECHO OFF
C:\python33\python -m http.server 8000
pause

A: Try this:
@ECHO OFF
cd..
cd..
cd Python33
python -m SimpleHTTPServer 8000
pause


text:
Q: issue with color transition on hover and mouse speed I'm having an issue with a color transition on firefox and chrome, depending on the mouse speed when it passes on each element. I have a logo, I want to change the color of each letter immediately when the mouse cursor passes on them, and then get the original color back with a fading transition. The issue is that when you pass across the logo too quickly, some letters are discarded and the animation isn't trigerred.. I have this issue with FireFox and Chrome but not with Edge.
Here is the HTML :

LOGO

And the CSS :
#logo > .letter{
  font-size: 5em;
  color: red;
  transition: color .5s ease-in .2s;
}

#logo > .letter:hover {
  color: black;
  transition: color 0s ease-in 0s;
}

Here is a codepen : https://codepen.io/anon/pen/gjLrrZ
Just pass your mouse horizontaly on the LOGO quickly and you'll see what I mean.
So the question is, should I do this with JavaScript ? Because CSS should have better performance am I right?

A: You're actually building this correctly I believe.
What you're experiencing is that the mouse is moving too quickly for the mousemove event to register on top of every logo letter.
Edge probably just has better performance with registering the event and triggering the CSS change.
CSS will have the best performance, you're correct there.
You might try adding an additional event listener (hover event on top of .letter through Javascript) and pairing the two together, but otherwise I don't think you'll find an effective solution to speeding up mousemove registrations on specific browsers.
Hope this helps!


text:
Q: Using DataAnnonations constraints on a Data Transfer Object(dto) Model to update a Domain Model i have a question.
i have a form which returns a CustomerDto model when submitted, i want to add some constraints like required, minlength etc to perform validation on the form, but the domain model class(Customer) that the customerDto model would map the form data to when saving does not have these data annotations constraints, is it possible for me to
add these constraints in the CustomerDto model only and perform server side validation with them and then map the CustomerDto model to the Customer model(domain) which do not have these constraints?
I do not want to alter the existing database structure by adding constraints to the Domain model customer class, but i still want to use CustomerDto model class to perform server side validation


text:
Q: two levels spatial regression in r I need help to find the proper approach in R for an analysis of data. I have measures of a variable Y for various individuals, distributed in various geographical zones.
I want to perform a regression were Y is explained by variables that are defined for each zone, and I would like to account for correlation between zones (something like a Simultaneous Autoregressive Model, but with repeated measures inside each zone). I don't really know how to proceed:

*

*summarizing my variable inside each zone, by the mean or median, and use a standard SAM model. But one looses info about variability or amount of measures in each zone, etc. Which seems wrong.

*using the package spdep and perform a standard SAM model with repeated measures inside each zone, but in this case I don't know how to account for the fact that the measures are repeated in each zone.

*Using geeglm from geepack with the zone as cluster and a fixed correlation structure would account for the fact that measures are repeated inside the zone, but I don't know how to include the between zone correlation, needed for spatial analysis

*A mixed effect model, but I do not know how to specify it. Usually, the dependent variable Y vary inside each cluster, and the second level account for variation between cluster. But here I am interested in explanatory variable that are constant inside each cluster and only vary between cluster

Does anyone know what is the proper approach for this situation ?


text:
Q: Auto-Populate A Pop-Up Menu in Numbers 3.5 I'm trying to steer clear of Excel, despite my sister's nagging, and I've done pretty well to create a Quote and Invoice workbook in Numbers. The problem I am having is working out how to automatically populate and update a pop-over menu.
In Excel, I can choose to create a list based on a range of cells, which is pretty much exactly the function I require. However, in Numbers I can only seem to create plain text items in a pop-up menu and not reference any cells.
For a little bit more info, I have a separate sheet in my workbook that contains item codes, descriptions, and prices. I can reference them normally in the other sheets. I want to be able to select a cell in one sheet and have a list / pop-up menu come up with all the item codes from the other sheet, and have it automatically update if I add a new one.
Is this possible or will I have to switch to that horrid beast Excel?

A: I had the same sort of problem and with some help from people within the Apple Support community I came up with this solution. Hopefully it will work for you.
This is my list of players in sheet 1. In your case, the Players name would be the item codes.

Here is sheet where I want to information copied to.

The P# corresponds to the number next to the Players name in Sheet 1. If I enter a 1 and a 2 the names are filled in to the column to the left of the box.

This shows the formula required to transfer the players name from sheet 1 to sheet 2.

To take it a step further, when I fill in the Players winnings in Sheet 1 it also fills it in all the "Earnings" cells for that player in Sheet 2 using the formula shown below.

My list of players goes to 300 but the last 20 or so are empty. That way I can still add more names or in your case, item codes, to it.
This may be more complicated than you require but hopefully it helps you.

A: This is possible -- see https://discussions.apple.com/thread/6894760
You create a source column with each of your options in a cell, select them and format as a pop up.
You can then copy and paste a single cell from this region to get a cell which is a pop up containing these values.
If you edit a value in the source column you need to repeat the copy and paste.

A: Yes you can do it,
Thanks to this post https://discussions.apple.com/thread/6894760 I found SGIII's answer which explains how to solve it:
The first step is to put the "Copy Style" and "Paste Style" buttons in the toolbar (right click over the toolbar and personalize it)

Now you can:

*

*Add the new value(s) to your source column

*Select the values in the column and choose Data Format > Pop-Up Menu

*Select one of the cells in the source column (which now includes the new values in its Pop-up Menu) and click Copy Style

*Select cells in the target column, and click Paste Style.  The target column will then include the (expanded) Pop-up Menu preserving the previous values.

Voila!

A: While not dynamic, MacMost has a helpful workaround:

*

*Select one of the cells using the current pop-up menu, and add a new item in the "Pop-Up Menu" list in the Data Format section, in the Format sidebar, under the Cell tab.

*Select all the cells using the earlier pop-up menu, as well as the cell with the pop-up menu you just edited

*The Data Format section will now have a message warning you that "The selected cells contain different pop-up menu items." and a button below to "Merge Menu Items"; click the button.

Now all of the pop-up menu items have the new menu item added, and retain their earlier values.


text:
Q: How to decorate a specific type in Autofac? I have a command like this:
public class EditComplaintCommandHandler : IHandleCommand<EditComplaintCommand>
{
    private readonly IUnitOfWork _unitOfWork;

    public EditComplaintCommandHandler(
        IUnitOfWork unitOfWork)
    {
        _unitOfWork = unitOfWork;
    }

    public void Handle(EditComplaintCommand command)
    {
        // do stuff
    }
}

Now I only want to decorate this command. Here's my decorator:
public class MySpecificCommandDecorator : IHandleCommand<EditComplaintCommand>
{
    private readonly IUnitOfWork _unitOfWork;

    public MySpecificCommandDecorator(IUnitOfWork unitOfWork)
    {
        _unitOfWork = unitOfWork;
    }

    public void Handle(EditComplaintCommand command)
    {
       // do something
    }
}

So I want that MySpecificCommandDecorator only decorates EditComplaintCommandHandler.
I've tried:
builder.RegisterAssemblyTypes(assemblies)
       .AsClosedTypesOf(typeof(IHandleCommand<>))
       .Named("handler", typeof(IHandleCommand<>));

builder.Register(c => new MySpecificCommandDecorator(c.Resolve<IUnitOfWork>()))
       .As<IHandleCommand<EditComplaintCommand>>();

but this doesn't work off course, since I didn't register it as a decorator.
How can I only decorate EditComplaintCommandHandler with MySpecificCommandDecorator using Autofac?


text:
Q: How to rename files with powershell if there are duplicate files? Get-ChildItem -Filter *_* | Foreach-Object -Process {
     $NewName = [Regex]::Match($_.Name,"^[^ _]*").Value +'.jpg'
     $_ | Rename-Item -NewName $NewName
 }

I have been using this code to rename files
For example, 569_SOM_TEST.jpg to 569
but if there is 569_TOB_TEST.jpg, It gives an error Rename-Item : Cannot create a file when that file already exists.
I want it to make it 569-1.
How can I accomplish this?

A: To prevent renaming clashes, you can put the below helper function at the top of your script:
function Rename-FileUnique {
    # Renames a file. If a file with that name already exists,
    # the function will create a unique filename by appending '(x)' after the
    # name, but before the extension. The 'x' is a numeric value.
    [CmdletBinding()]
    Param(
        [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Position = 0)]
        [string]$Path,

        [Parameter(Mandatory = $true, Position = 1)]
        [string]$NewName,

        [switch]$PassThru
    )
    # Throw a bit nicer error than with [ValidateScript({Test-Path -Path $_ -PathType Leaf})]
    if (!(Test-Path -Path $Path -PathType Leaf)){
       Throw [System.IO.FileNotFoundException] "Rename-FileUnique: The file '$Path' could not be found."
    }

    # split the new filename into a basename and an extension variable
    $baseName  = [System.IO.Path]::GetFileNameWithoutExtension($NewName)
    $extension = [System.IO.Path]::GetExtension($NewName)    # this includes the dot
    $folder    = Split-Path -Path $Path -Parent

    # get an array of all filenames (name only) of the files with a similar name already present in the folder
    $allFiles = @(Get-ChildItem $folder -Filter "$baseName*$extension" -File | Select-Object -ExpandProperty Name)
    # for PowerShell version < 3.0 use this
    # $allFiles = @(Get-ChildItem $folder -Filter "$baseName*$extension" | Where-Object { !($_.PSIsContainer) } | Select-Object -ExpandProperty Name)

    # construct the new filename / strip the path from the file name
    $NewName = $baseName + $extension   # or use $NewName = Split-Path $NewName -Leaf

    if ($allFiles.Count) {
        $count = 1
        while ($allFiles -contains $NewName) {
            $NewName = "{0}-{1}{2}" -f $baseName, $count++, $extension
        }
    }
    Write-Verbose "Renaming '$Path' to '$NewName'"
    Rename-Item -Path $Path -NewName $NewName -Force -PassThru:$PassThru
}

and use it like:
Get-ChildItem -Filter '*_*.jpg' | Foreach-Object {
    # create the proposed new filename
    $newName = '{0}.jpg' -f ($_.Name -split '_')[0]
    $_ | Rename-FileUnique -NewName $newName
 }

This will ensure that any proposed new filename gets a not already used index number attached to its basename.


text:
Q: how to use spring's @IntegrationTest in main method? i have a spring boot application. sometimes i need to launch long running report generation. the easiest way was to create an @IntegrationTest to use spring's @Autowire:
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@SpringApplicationConfiguration(classes=Application.class)
@IntegrationTest
public class ReportGenerationTest {

    @Autowired MyService myService;
    @Value("classpath:/test.txt") Resource testData; //it's in test, not in src

    @Test
    public void generate_report() {

       report(myService, testData);
    }
}

it works perfectly. but i don't want it to be run with every build. i also don't want to add/remove @Ignore as sooner or later someone will accidentally commit it without @Ignore and i don't want to do any code editing just to run reports
ideally i would like it to be a main method run on demand. but how can i manually create a spring context for the src service and test resources?
i need something like:
public class MyReport {

  public static void main(String[] args) {

    ReportGenerationTest reportGenerator = getAutowiredInstanceFromSpring();
    reportGenerator.generate_report();
  }
}


text:
Q: javascript: how to manage a div with no ID my page is full of php-generated content split in div's that have the same class but no id's. I want to show some buttons that allow me to manage, change and delete the div's; the buttons should be able to change the class, delete the div and select the content of the div.
How can I do this? is there a way to set the button's onclick action to something, say ... onclick="changetheclass(this)" that would actually change the class of the div containing this button?
Man I feel I'm not making any sense here :(
Did anyone understand what I'm talking about? If so, is there any possibility to do this?
Thanks in advance!
:)
EDIT: this is one of the divs, so that you could understand what I'm talking about:

    this is the content of the div
    <button onclick="change_the_class(this_div_or_something)">click here to change the class of the div
    <button onclick="select_the_content(this_div_or_something)">click here to change the class of the div
    <button onclick="delete_the_whole_div(this_div_or_something)">click here to change the class of the div

A: Is this what you looking for ??

            Hello
            <button onclick="javascript:changeClass(this);" value="Change CSS">CSS</button>
            <button onclick="javascript:deleteDiv(this);" value="Change CSS">Delete</button>

            Hello
            <button onclick="javascript:changeClass(this);" value="Change CSS">CSS</button>
            <button onclick="javascript:deleteDiv(this);" value="Change CSS">Delete</button>

            Hello
            <button onclick="javascript:changeClass(this);" value="Change CSS">CSS</button>
            <button onclick="javascript:deleteDiv(this);" value="Change CSS">Delete</button>

            Hello
            <button onclick="javascript:changeClass(this);" value="Change CSS">CSS</button>
            <button onclick="javascript:deleteDiv(this);" value="Change CSS">Delete</button>

A: in JS, you can use querySelectorAll:
//get all divs with class "myDiv"
var divs = document.querySelectorAll('div.myDiv');

//for each of the gathered divs, do something with it
for(var i=0; i< divs.length;i++){
    var aDiv = divs[i];

    //"aDiv" is a div in the collection of matched divs
    //you can do anything with it: add buttons etc.

}

A: First stay away from onclick="something" - inline JavaScript. then yes you can still manage to do what you want to do without ids.
var divs = document.getElementsByTagName('div'),
    result = [],
    len = divs.length,
    i = 0,
    aLink;

for(; i < len; i++){
    // update the condition if there can be more than one class name as this assume a single class name
    if (divs[i].className == 'myClassName') result.push(divs[i]);
}

len = result.length;
i = 0;

for (; i < len; i++) {
aLink = document.createElement('a');
aLink.innerHTML = 'Edit';
aLink._parent = result[i]; // store a reference to the parent div
aLink.href = '#';
aLink.onclick = function(ev) {
ev.preventDefault();
// do your edit stuff here, ev.target._parent contain the targetted div
};
result[i].appendChild(aLink);
}

A: $('div.my-class').each( function( index, element ){
   var div = $( element ); // not sure if this is needed

   // add the buttons, e.g. via div.html('');

   // add the buttons' click handlers
});


text:
Q: Wsl2 access denied mkdir docker compose On such DockerFile
FROM node:8

ENV HOST localhost
ENV PORT 3000

# Create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

# Install GYP dependencies globally, will be used to code build other dependencies
RUN npm install -g --production node-gyp && \
    npm cache clean --force

# Install Gekko dependencies
COPY package.json .
RUN npm install --production && \
    npm install --production redis@0.10.0 talib@1.0.2 tulind@0.8.7 pg && \
    npm cache clean --force

# Install Gekko Broker dependencies
WORKDIR exchange
COPY exchange/package.json .
RUN npm install --production && \
    npm cache clean --force
WORKDIR ../

# Bundle app source
COPY . /usr/src/app

EXPOSE 3000
RUN chmod +x /usr/src/app/docker-entrypoint.sh
ENTRYPOINT ["/usr/src/app/docker-entrypoint.sh"]

CMD ["--config", "config.js", "--ui"]

I am running docker-compose up -d
On such docker-compose.yml:
version: '3'
services:
  gekko:
    build: ./
    volumes:
      - ./volumes/gekko/history:/usr/src/app/history
      - ./config.js:/usr/src/app/config.js
    links:
      - redis
#      - postgresql
    environment:
     - HOST
     - PORT
     - USE_SSL
    ports: # you can comment this out when using the nginx frontend
      - "${PORT}:${PORT}"
## optionally set nginx vars if you wish to frontend it with nginx
#    environment:
#     - VIRTUAL_HOST=gekko
#     - PORT=3000
#     - DOMAIN=gekko

  redis:
    image: redis:latest
    volumes:
      - ./volumes/redis:/data
## optionally uncomment if you wish to use nginx as a frontend
#  nginx:
#    restart: always
#    image: jwilder/nginx-proxy
#    ports:
#     - "80:80"
#    volumes:
#     - /var/run/docker.sock:/tmp/docker.sock:ro
## optionally uncomment if you wish to use postgresql as a db
#  postgresql:
#    restart: always
#    image: postgres:9.6-alpine
#    ports:
#      - 5432:5432
#    volumes:
#      - ./_postgresql:/var/lib/postgresql/data:rw
#    environment:
#      POSTGRES_DB: gekko
#      POSTGRES_USER: username
#      POSTGRES_PASSWORD: password

Unfortunately, I got such error:
[+] Running 0/0
 - Container gekko-redis-1  Creating                                                                                0.0s
Error response from daemon: mkdir C:\Users\userName\Desktop\Appsome_Repos\gekko\volumes: Access is denied.

I think it can be caused by some WSL 2 permissions, but I have no idea where to change it.
I am using Windows and Docker:

I stuck with it, any help is really appreciated.


text:
Q: Set full-width on input How do I set full width on input elements inside a radio group?
I'm using the following setup to create two options (user can either upload a file or specify a URL):
<v-radio-group v-model="photo_mode">
    <v-layout row align-baseline>
    <v-radio value="file" />
    <v-file-input v-model="eitem.photo" class="mr-4 mt-0" :disabled="photo_mode=='url'" />
    </v-layout>
    <v-layout row align-baseline>
    <v-radio value="url" />
    <v-text-field v-model="eitem.photo_url" class="mr-4 mt-0" :disabled="photo_mode=='file'" />
    </v-layout>
</v-radio-group>

The looks fine except that both v-file-input and v-text-field are not as wide as the container. Here is a snapshot:

As you see, the v-text-field above the radio group (Details field) is correctly showing full-width, but the two inputs inside the radio group are not.  What can I do to fix this?

A: Found the solution. This is a bug in Vue. Already reported here. The solution is to simply add the following CSS in your App.vue:
<style>
  .v-input--selection-controls .v-input__control{
      width: 100%;
  }
</style>

Make sure the style section is not marked with scoped keyword.

A: I found that I also needed to set the style of v-label too, in order for this workaround to function properly. Also I used scoped css locally in the component:
.radio-group-full-width >>> .v-input__control {
   width: 100%
}

.radio-group-full-width >>> .v-label {
  width: 100%
}

So in the template:
<v-radio-group class="radio-group-full-width">


text:
Q: GRUB: Reboot PC after typing wrong password to decrypt OS partition I have encrypted with LUKS the OS and swap partition on my laptop. When I boot if I type the wrong password it stops at the first attempt. This seems strange, but it's all right for me. The trouble is that it immediately enters in grub rescue mode and most of the grub commands I can see in the manual don't work. I assume that no extra module is loaded while in rescue mode. I just would like to reboot my PC, but halt, normal, or similar commands are not recognised. The only way is to shutdown with the hardware button. Is there a nicer way to reboot?
The OS is OpenSUSE 15.2
GRUB2 2.04

A: That's "normal" (debatable whether it's a GRUB bug or a feature) if GRUB asks for the LUKS password before showing the boot menu.
I just press Ctrl+Alt+Del to reboot in such a case.


text:
Q: How do I add my order by field to this select statement? To avoid "ORDER BY items must appear in the select list if SELECT DISTINCT is specified.", I need to add AssessmentSuperSet.Deadline to my SELECT statement at the top.  Where should I do this?  Any help greatly appreciated.  Thanks.
DECLARE @cols AS NVARCHAR(MAX),
@query  AS NVARCHAR(MAX)

select @cols = STUFF(
    (SELECT distinct ',' + QUOTENAME(AssessmentSuperSet.Title)
            from AssessmentSuperSet inner join AssessmentSet on AssessmentSuperSet.SuperSetID =     AssessmentSet.SuperSetID
            where ClassID = '8KF/En 14/15' order by AssessmentSuperSet.Deadline ASC
    FOR XML PATH(''), TYPE
    ).value('.', 'NVARCHAR(MAX)')
,1,1,'')

set @query = 'SELECT StudentID, FName, SName, ' + @cols + ' from
     (
        select KS3Assessments.StudentID,
          Pupils.FName,
          Pupils.SName,
          KS3Assessments.NCLevel,
          AssessmentSuperSet.Title
        from KS3Assessments inner join Pupils on KS3Assessments.StudentID = Pupils.StudentID
                            inner join AssessmentSuperSet on KS3Assessments.SuperSetID = AssessmentSuperSet.SuperSetID
        where Pupils.GroupDesignation = ''8KF/En 14/15''
    ) x
    pivot (max(NCLevel) for Title in (' + @cols + ') ) p '

execute(@query)

A: Instead of distinct try using a group by clause:
select @cols = STUFF(
    (SELECT ',' + QUOTENAME(AssessmentSuperSet.Title)
            from AssessmentSuperSet inner join AssessmentSet on AssessmentSuperSet.SuperSetID =     AssessmentSet.SuperSetID
            where ClassID = '8KF/En 14/15'
          group by AssessmentSuperSet.title, AssessmentSuperSet.Deadline
          order by AssessmentSuperSet.Deadline ASC
    FOR XML PATH(''), TYPE
    ).value('.', 'NVARCHAR(MAX)')
,1,1,'')

set @query = 'SELECT StudentID, FName, SName, ' + @cols + ' from
     (
        select KS3Assessments.StudentID,
          Pupils.FName,
          Pupils.SName,
          KS3Assessments.NCLevel,
          AssessmentSuperSet.Title
        from KS3Assessments inner join Pupils on KS3Assessments.StudentID = Pupils.StudentID
                            inner join AssessmentSuperSet on KS3Assessments.SuperSetID = AssessmentSuperSet.SuperSetID
        where Pupils.GroupDesignation = ''8KF/En 14/15''
    ) x
    pivot (max(NCLevel) for Title in (' + @cols + ') ) p '

execute(@query)

Since you didn't provide any suitable test data I haven't tried it.


text:
Q: Java run time environment mac I am trying to install an application on a MAC 10.6.4, however i get an installation error that no java runtime environment.
However on the java website, the mac section indicates that MAC provides its own java and should use the software update software to get the latest java application. I have done this and gotten the latest java however I still get the same error no java run time
is there something am missing?

A: One thing that comes to mind is that this might search for an old JRE and doesn't work correctly with the JRE v6 installed on Snow Leopard.
Just to confirm that you have Java installed and working, you could try to start it, i.e. with the command  java -version in Terminal.app.


text:
Q: How to solve no wifi at all on laptop? I am using an HP laptop running on Windows 10 which seems to have no wifi connection at all. In Windows settings, there is no wifi option under Network & Update.
I tried to uninstall the network driver and set it to automatic wlan from Services, but the wifi remains invisible on my pc.
What are some of the things I can do to solve this problem ?

A: Look on the laptop - sides and back for a manual switch that can turn Wi-Fi ON or oFF.  It may have been switched OFF and needs to be turned back on.
Look also on the keyboard as there may be a Wireless ON / OFF on the keyboard. I have laptop with both the above.
Also make sure Airplane Mode is not ON. Airplane mode is in Windows Settings.
Look in Control Panel, Device Manager. Look in the Network Section. There should be a Wireless entry and a LAN entry. Beside the Wireless Entry, is there a Red or Orange icon beside Wireless indicating a hardware error if red or driver error if orange.
Work through the above and then try installing the Wireless driver if (a) the switch is ON and (b) there is no red icon on the wireless entry.
You may wish to look at your HP documentation to see what it says about Wireless on your machine.
If all these steps fail, that means the wireless card apparently has a hardware problem, and so the next step is to try an external USB Wireless adapter.


text:
Q: Applicability of Separation of Variables Is there a comprehensive set of differential equations on which the method of separation of variables works/doesn't work?
If there is, what makes those differential equations fall into that bracket? Can we get an intuition about the applicability of the method by looking at the physical context?


text:
Q: Command option in Visual Studio Properties Window right click menu not working When right clicking on the Properties Window, a menu is shown as in the image.  Turning on or off the 'Description' option will show or hide the bottom part, in this case showing "The cursor that appears...".
However, changing the 'Commands' option has no visible effect.  How does it work?


text:
Q: Error: Bootstrap's JavaScript requires jQuery AngularJS I am trying to add datepicker in my code but its throwing Error: Bootstrap's JavaScript requires jQuery. Please help me to solve this error. Code works perfectly when i create separate controller in separate file. when i am trying to merge code, i am not getting how to call controller.
here is my html page
<!doctype html>

<meta charset="utf-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">

<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootswatch/3.1.1/readable/bootstrap.min.css">

    <base href="http://demos.telerik.com/kendo-ui/datepicker/angular">
    <link rel="stylesheet" href="//kendo.cdn.telerik.com/2016.1.112/styles/kendo.common-material.min.css" />
    <link rel="stylesheet" href="//kendo.cdn.telerik.com/2016.1.112/styles/kendo.material.min.css" />

<form name='myform' ng-init="step = 1">

<button type="submit" class="OptionButton" ng-disabled="!step1form.$valid" ng-click="step = 2">

Purchase ready property
</button>
<button type="submit" class="OptionButton">

Purchase under construction property
</button>
<button type="submit" class="OptionButton">

Transfer my existing home loan
</button>
<button type="submit" class="OptionButton">

Renovate my home
</button>

            <input kendo-date-picker
             ng-model="dateString"
             k-ng-model="dateObject"
             style="width: 100%;" />

</form>

and here is my JS code
var app = angular.module('plunker', []);

app.controller('MainCtrl', function($scope) {
  $scope.name = '';

          $scope.monthSelectorOptions = {
            start: "year",
            depth: "year"
          };
          $scope.getType = function(x) {
            return typeof x;
          };
          $scope.isDate = function(x) {
            return x instanceof Date;
          };

});

 /*var app1 = angular.module("KendoDemos", [ "kendo.directives" ])
      app1.controller("MyCtrl", function($scope){
          $scope.monthSelectorOptions = {
            start: "year",
            depth: "year"
          };
          $scope.getType = function(x) {
            return typeof x;
          };
          $scope.isDate = function(x) {
            return x instanceof Date;
          };
      })*/

   this is the code of datepicker. its works fine but its not working on merging.
<!DOCTYPE html>

    <base href="http://demos.telerik.com/kendo-ui/datepicker/angular">

    <title></title>
    <link rel="stylesheet" href="//kendo.cdn.telerik.com/2016.1.112/styles/kendo.common-material.min.css" />
    <link rel="stylesheet" href="//kendo.cdn.telerik.com/2016.1.112/styles/kendo.material.min.css" />

            <input kendo-date-picker
             ng-model="dateString"
             k-ng-model="dateObject"
             style="width: 100%;" />

A: This line :

should be called just before

This way, JQuery will load before Bootstrap JS and you will have access to Bootstrap in your own JS.

A: Modify your html to receive these imports...
<!doctype html>

<meta charset="utf-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootswatch/3.1.1/readable/bootstrap.min.css">
<link rel="stylesheet" href="http://kendo.cdn.telerik.com/2016.1.112/styles/kendo.common-material.min.css" />
<link rel="stylesheet" href="http://kendo.cdn.telerik.com/2016.1.112/styles/kendo.material.min.css" />

<base href="http://demos.telerik.com/kendo-ui/datepicker/angular">

    <form name='myform' ng-init="step = 1">

                <button type="submit" class="OptionButton"
                    ng-disabled="!step1form.$valid" ng-click="step = 2">

 Purchase ready
                    property
                </button>
                <button type="submit" class="OptionButton">

 Purchase under
                    construction property
                </button>
                <button type="submit" class="OptionButton">

 Transfer my
                    existing home loan
                </button>
                <button type="submit" class="OptionButton">

 Renovate my
                    home
                </button>

                <input kendo-date-picker ng-model="dateString"
                    k-ng-model="dateObject" style="width: 100%;" />

    </form>

A: <!doctype html>

    <base href="http://demos.telerik.com/kendo-ui/datepicker/angular">

    <title></title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css">
    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootswatch/3.1.1/readable/bootstrap.min.css">

    <link rel="stylesheet" href="//kendo.cdn.telerik.com/2016.1.112/styles/kendo.common-material.min.css" />
    <link rel="stylesheet" href="//kendo.cdn.telerik.com/2016.1.112/styles/kendo.material.min.css" />

<form name='myform' ng-init="step = 1">

I want home loan for

<button type="submit" class="OptionButton" ng-disabled="!step1form.$valid" ng-click="step = 23">

Purchase ready property
</button>
<button type="submit" class="OptionButton" ng-disabled="!step1form.$valid" ng-click="step = 23">

Purchase under construction property
</button>
<button type="submit" class="OptionButton" ng-disabled="!step1form.$valid" ng-click="step = 23">

Transfer my existing home loan
</button>
<button type="submit" class="OptionButton" ng-disabled="!step1form.$valid" ng-click="step = 2">

Renovate my home
</button>

My co-applicant's monthly income is

        <input kendo-date-picker
             ng-model="dateString"
             k-ng-model="dateObject"
             style="width: 100%;" />

<button ng-disabled="!step23form.$valid" ng-click="step = 24">Next</button>

</form>