text:
Q: Why is it that I cannot imagine a tesseract? I try hard to "visualise" (say "imagine") a tesseract but I can't.
Why is it that I can't?

This may be a question for a scholar of some other discipline and not for a mathematician, e.g. psychology (topic: cognition?), anthropology, etc., but I am sure it is well defined and answerable as a question.
It could be answered with a definition of what I can imagine or the definition of what I can't imagine and why, for example.
There may be some fundamental property of our geometry that limits what we can represent so the question may be interpreted mathematically... anyway I think it is not a question to bounce without any thought.
Specifically: what is missing for me to be able to imagine a tesseract? Understanding? A different kind of brain, that processes information in a different way?
Can a top mathematician visualise a tesseract? I am not inviting a discussion, which would be off-topic. I am soliciting a thoughtful and articulate answer, if possible.
Note:
I already saw this question:
In what sense is a tesseract (shown) 4-dimensional?
and this video:
http://www.youtube.com/watch?NR=1&feature=endscreen&v=uP_d14zi8jk
already read this link:
http://en.wikipedia.org/wiki/Tesseract
and I have studied calculus-level maths, etc. and I found no difficulty in reasoning about imaginary numbers, infinite quantities and/or series, demonstrations ad absurdum, etc.

I would be really disappointed if this question were marked as "not constructive", or anything to that effect. I can accept it may be "off topic" because it may relate to how our brain visualises and not some mathematical property that prevents visualisation, but it really should not be considered as "not-constructive". It would actually help me so much to understand this conundrum...

A: The vertices of a tesseract may be thought of as consisting of the $16$ points of $\{0,1\}^4=\{(a,b,c,d) : a,b,c,d\in \{0,1\}\}$.  Two vertices are adjacent (connected by an edge) if and only if their coordinates disagree in exactly one place.  For instance, $(0,1,1,0)$ is adjacent to each of the four vertices $(1,1,1,0), (0,0,1,0), (0,1,0,0), (0,1,1,1)$.
Thus each vertex has degree $4$ pointing in mutually orthogonal directions.  The direction of an edge is determined by which coordinate its vertices disagree in.  This allows us to say which edges are parallel.   For instance, the edge joining $(0,1,0,0)$ to $(0,1,1,0)$ is parallel to the edge joining $(1,0,0,0)$ to $(1,0,1,0)$ since in both edges, the vertices disagree in the third coordinate.

A: The key to the answer to this question is already in the word "visualize": It contains "visual", which refers to seeing. Indeed, when you visualize something, you quite literally activate the same structures in your brain that you would also activate when seeing it. You are actually, in a quite direct sense, putting it in front of your "inner eye". Note that also in "imagine" there's the word "image", which also refers to seeing.
This can be seen(!) in a few self-experiments. First, visualize a common item. Let's say a teapot. When you put this teapot in front of your inner eye, you see it the same way you would if you were looking at it. In particular, you'll see the outside, but not the inside (unless you mentally go inside the imagined teapot, in which case you see the inside, but not the outside). Also, you see the side facing you, but not the opposite side.
Now imagine the teapot getting smaller and smaller. For a real shrinking teapot, as it reaches the boundary of your vision, it will lose structure until it ends up as a little point. And you'll notice that the same will happen with your imagined teapot. Note that I'm assuming that you really imagine it shrinking; you can of course instead keep its size in your imagination and put a "mental label" on it "like this, but much smaller". But you cannot imagine, in the literal sense, a microscopically small teapot with all its structure.
Or in other words, strictly speaking you cannot even visualize Euclidean space.
Now the answer to your question is obvious: You cannot visualize the tesseract because you cannot see it. Our eyes do projections of the three-dimensional space into the two-dimensional spaces of our retinas, and our brain then interprets those two images. The tesseract doesn't live in that three-dimensional space projected onto our retinas.
So does this mean we're out of luck? Well, not completely. While in nature there are no tesseracts to see, and no extended four-dimensional space to see in which they could be put, we can do a mathematical projection of the tesseract into three-dimensional space, and then use computers and our visual apparatus (and, after some experience, also our imagination) to make mental images of those projections, while using our abstract understanding together with our three-dimensional intuition/experience on how projections from 3D to 2D behave, to interpret those projections.
Using this method, it is indeed possible to develop a certain feeling for some aspects of four-dimensional objects, like the tesseract. However note that it will never be as natural as the three-dimensional experience which our brain explicitly evolved for (because our ancestors would not have survived without a sufficient understanding of three-dimensional space).

A: Big surprise: our brains evolved in a three-dimensional environment, and so that is what they are best suited for thinking about. It's easy to visualize because we literally see it all the time.
Thinking in higher dimensions is harder because we have no (little?) direct experience with them, so there is not a clear prototype for most people to use as a springboard for visualizing it.

A: From 2D to 3D
To get an idea of what a 4-cube could look like I started imagining being a 2 dimensional entity on a page containing the projection of a 3-D cube :
$\qquad\qquad\qquad\qquad\qquad$
When my 2D entity progresses in the (new) 'perpendicular' direction to the 'back' of this strange 3-square the square at the middle will appear larger and larger until replacing the external square (a new square will 'materialize' at the middle, seem to grow, and so on...).
Notice that the entity is not moving in its support square and that this square will simply advance in the perpendicular direction without changing size : the growing part is only an effect of perspective!
An actual 3D-entity would cover a continuum of contiguous parallel squares.
Crossing the whole 3D space :

From 3D to 4D
Let's try this in 4D : we consider a 3D cube like the previous one and represent a smaller cube inside the first one. Again we imagine that, as we progress in the new perpendicular direction, the smaller cube will grow until taking the place of the larger one ; a new one will appear at the center, grow and so on... Here too we remain at a fixed position of our support cube which will cross other identical cubes while moving in the perpendicular direction.
An actual 4D-entity should occupy a continuum of contiguous cubes.

To move in 'full-4D' you may imagine that cubes are filling the whole 3D space (generating a 3D grid).
Superpose to this 3D grid a smaller and parallel one (or an infinity of smaller and larger ones if you want...) that has a junction at every vertex with the corresponding vertex of the larger one. This will give you a 4D grid and as you move in 4D the smaller grid will take the place of the larger one, a new small grid will get out of the 'mist', grow and so on...

(4D grid variant)
At this point you may imagine moving in your 3D cube or turning around it (changing only the perspective effect) and even the more confusing 4D rotations.
Excellent visualizations !


text:
Q: What does "grab nails" mean at this comic page? At the end of this comic page one character says: "Grab your nails". At the next pages the second character found a chest with a gun and bullets inside. Could "nails" refer to bullets in this context?

A: It isn't an expression as far as I know. The idiom "fight tooth and nail" refers to animals that fight with their teeth and claws (in fact, "tooth and claw" is also said) so it seems unlikely it is a derivation of this - one does not need to collect their fingernails.

At the next pages the second character found a chest with a gun and bullets inside. Could "nails" refer to bullets in this context?

It could, as 'nail guns' do exist, although they are a tool, not a weapon. Still, this is a comic, so anything is possible. However, as the house explodes in the very next panel after the character says "get in the house and grab your nails before...", this character never manages to retrieve any 'nails' so they are unlikely to be his.
I would expect that earlier panels are more likely to give you a clue as to what these 'nails' are.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Subclassing Flask application doesn't run Trying to run this simple Flask app, not creating a Flask app directly, but subclassing it instead:
#!/usr/bin/env python
# -*- coding: UTF-8 -*-

import logging

from flask import Flask

class TestFlaskApp(Flask):

    def __init__(self):

        super(Flask, self).__init__("TestApp")

        self._logger = logging.getLogger(self.__class__.__name__)

        self.debug = True

        self.route('/', defaults={'path': '.'})
        self.route('/<path:path>')
        def catch_all(path):
            return path

app = TestFlaskApp()
app.run()

Throws this error:
Traceback (most recent call last):
  File "/tmp/myproject/test.py", line 24, in <module>
    app = TestFlaskApp()
  File "/tmp/myproject/test.py", line 17, in __init__
    self.debug = True
  File "/usr/lib/python2.7/dist-packages/flask/config.py", line 36, in __set__
    obj.config[self.__name__] = value
AttributeError: 'TestFlaskApp' object has no attribute 'config'

Using:

*

*Ubuntu 16.04 LTS Xenial

*Python 2.7.11+

*Flask (0.10.1)

A: You've called the super method wrong. It must always be called with the current class, not the superclass.
    super(TestFlaskApp, self).__init__("TestApp")


text:
Q: Are Unix reads and writes to a single file atomically serialized? I'd like to know if the writes upon a single file get done atomically such that write("bla bla") and a subsequent write("herp derp") to the same file never results in interleaving, e.g. "bla herp bla derp". Assuming these writes happen in different processes or threads, what governs which gets done first?
Also, does a read() always return data reflecting the file in a state of all previous writes fully completed (whether the data has been actually written to disk or not)? For example, after write("herp derp"), will all subsequent reads always reflect the full data written to the file, or will a subsequent read sometimes reflect only "herp" but not "derp" (or sometimes reflect none of the data at all)? What if the reads and writes occur in different processes/threads?
I'm not interested in concurrent file access strategies. I just want to know what read and write do exactly.

A: Separate write() calls are processed separately, not as a single atomic write transaction, and interleaving is entirely possible when multiple processes/threads are writing to the same file.  The order of the actual writes is determined by the schedulers (both kernel process scheduler, and for "green" threads the thread library's scheduler).
Unless you specify otherwise (O_DIRECT open flag or similar, if supported), read() and write() operate on kernel buffers and read() will use a loaded buffer in preference to reading the disk again.
Note that this may be complicated by local file buffering; for example, stdio and iostreams will read file data by blocks into a buffer in the process which is independent of kernel buffers,  so a write() from elsewhere to data that are already buffered in stdio won't be seen.  Likewise, with output buffering there won't be any actual kernel-level output until the output buffer is flushed, either automatically because it has filled up or manually due to fflush() or C++'s endl (which implicitly flushes the output buffer).


text:
Q: Where does the "git" user come from in gitlab.com? When I create a new blank project in gitlab.com, I see git remote add origin git@gitlab.com:my-group1069/test-project.git in the command line instructions page.
I'm curious about why is it not git remote add origin mygitlabaccount@gitlab.com:my-group1069/test-project.git.

cd existing_folder
git init --initial-branch=main
git remote add origin git@gitlab.com:my-group1069/test-project.git
git add .
git commit -m "Initial commit"
git push -u origin main

I think I should interact with gitlab with my gitlab account, not the git user.
Where does the git user come from?
Is it a built-in gitlab user?

A: SSH is there to authenticate you through your registered SSH public key you registered to your GitLab account.
It is not there to open a remote shell with your "account": said account does not exist as a system user on the remote system. It (mygitlabaccount) only exists as an application account, an entry in the GitLab application.
Only the service (technical) account git does exist on the remote server.
And that one service account will refuse to open an interactive session. It will only allow to execute vetted commands (git clone/push/pull/ls-remote/...).


text:
Q: Excel VBA selecting data from a sorted Table I am running into a problem in VBA in excel.
I am trying to create a participant registration program in excel for a sports tournament. One can add data like the weight, age and name of a participant. And then based on that, The participants are divided into poules named with letters A, B... until Z. I have a table which can sort these poules by letters and then for example only display the participants which are in poule A such as below
Example
Now i want to count the numbers with VBA macros of participants in the poule which is displayed by the sorted table. For example when i sort on poule A it has to return 3 and when i sort on B, it has to return 2.
Determined by the number of participants in a poule the program will print a different poule scheme, depending on the number of participants. (i have this part in VBA)
The problem is when i have a sorted table like below
Example 2
It counts all the participants, and not just the ones in B or any other sorted letter.
I have this:
    Sub Count()
Dim nRows As Integer

nRows = Range(Range("A18"), Range("A18").End(xlDown)).Rows.Count
MsgBox (nRows)

End Sub

This works well if you sort A, but when you sort any other letter, it counts All the table until that letter. Eg. when you sort B, it displays 5 (Number of A + B).
I have looked on the internet for a really long time to find a solution but without succes.
I hope my question is clear and that somebody can help me.

A: I am assuming that you are using worksheet functions.  Use Subtotal when working with filtered data.
These parameters evaluate all cells visible or hidden

*

*1    AVERAGE

*2    COUNT

*3    COUNTA

*4    MAX

*5    MIN

*6    PRODUCT

*7    STDEV

*8    STDEVP

*9    SUM

*10   VAR

*11   VARP

These parameters evaluate only visible cells

*

*101   AVERAGE

*102   COUNT

*103   COUNTA

*104   MAX

*105   MIN

*106   PRODUCT

*107   STDEV

*108   STDEVP

*109   SUM

*110   VAR

*111   VARP

A: Range.SpecialCells will return a range of only visible cells.
Dim rSource As Range
Dim rVisibleCells

Set rSource = Range(Range("A2"), Range("A2").End(xlDown))
Set rVisibleCells = rSource.SpecialCells(xlCellTypeVisible)

MsgBox rVisibleCells.Rows.Count

A: The code does work now, except that it only counts the first letters it encounters.
So when the first column for the poules is for example A A A E A A B B E.
And i sort to A and use the count function, it only returns a value of 3 and not of 5 (because there are 5 A's)
When I sort the table to A, it looks like this (column number, poule value):
14 A
15 A
16 A
18 A
19 A
And it returns just a count of 3, have you maybe got any fixes for that problem as well?
Pictures:
sorted tabel to E
Table


text:
Q: Rails 4.2 / Bootstrap 3 : trying to use font-awesome ... wo success I am trying to use font-awesome, but upon running , I get the following error(s)
ActionController::RoutingError (No route matches [GET] "/assets/fonts/font-awesome/fontawesome-webfont.woff"):
....
ActionController::RoutingError (No route matches [GET] "/assets/fonts/font-awesome/fontawesome-webfont.ttf"):
....
ActionController::RoutingError (No route matches [GET] "/assets/fonts/font-awesome/fontawesome-webfont.svg"):

In my Gemfile  I have:
 gem "font-awesome-rails"  # https://github.com/bokmann/font-awesome-rails

in my framework_and_overrides.css.scss I have:
// import the CSS framework
@import "bootstrap-sprockets";
@import "bootstrap";
@import "font-awesome";

In my application.css  I have:
/*
...
*= require font-awesome
*= require dashboard/framework_and_overrides
....
*/

I added in my application.rb:
config.assets.paths << Rails.root.join("app", "assets", "fonts")

And I run rake assets:clobber , to start on a clean basis .. now way , same errors
Thanks for your enlightenments ...

A: Remove from application.css:
*= require font-awesome

In your framework_and_overrides.css.scss add the following lines at the bottom:
@import "font-awesome-sprockets";
@import "font-awesome";

UPDATE
It turns out you have an issue with the routing of the asset. Rails creates paths to assets depending if they are pre-compiled or not. The safest way to make things work in all cases (both production and development) is to put the routes in font_url ,like this:
@font-face {
  font-family: "FontAwesome";
  src: font_url('fontawesome-webfont.eot');
  src: font_url('fontawesome-webfont.eot?#iefix') format('eot'), font_url('fontawesome-webfont.woff') format('woff'), font_url('fontawesome-webfont.ttf') format('truetype'), font_url('fontawesome-webfont.svg') format('svg');
  font-weight: normal;
  font-style: normal;
}

Alternatively, you can link an external stylesheet (performance might get worse):
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">


text:
Q: Does pthread_exit kill a thread.. I mean free the stack allocated to it? I want to create a lot of threads for a writing into a thread, and after writing I call exit... But, when I call exit do I free up the stack or do I still consume it??

A: In order to avoid resource leaks, you have to do one of these 2:

*

*Make sure some other thread call pthread_join() on the thread

*Create the thread as 'detached', which can either be done by setting the proper pthread attribute to pthread_create, or by calling the pthread_detach() function.

Failure to do so will often result in the entire stack "leaking" in many implementations.

A: The system allocates underlying storage for each thread, (thread ID, thread retval, stack), and this will remain in the process space (and not be recycled) until the thread has terminated and has been joined by other threads.
If you have a thread which you don't care how the thread terminates, and a detached thread is a good choice.
For detached threads, the system recycles its underlying resources automatically after the thread terminates.
source article: http://www.ibm.com/developerworks/library/l-memory-leaks/


text:
Q: ember.js unit testing and integration testing I am exploring ember.js application testing. I came across following blog by Toran Billups
Integration testing your ember.js app with QUnit and Karma
When we do karma start it runs all the test found in test directory.
How can I run say tests in only one .js file?
thanks

A: To run the test from just one JS file, specify the file name in the "files" array of your karma config file.
Here's a sample config file I used recently. My example runs 2 js files for the test portion (the last 2 in the list), but you could easily just do one.
Bryan

A: As @bk11425 suggested, simply modify the 'files' section in your karma.conf.js file from this
module.exports = function(karma) {
    karma.set({
        basePath: 'js',

        files: [
          "vendor/jquery/jquery.min.js",
          "vendor/handlebars/handlebars.js",
          "vendor/ember/ember.js",
          "vendor/jquery-mockjax/jquery.mockjax.js",
          "app.js",
          "tests/*.js",
          "templates/*.handlebars"
        ]

To something like this instead
module.exports = function(karma) {
    karma.set({
        basePath: 'js',

        files: [
          "vendor/jquery/jquery.min.js",
          "vendor/handlebars/handlebars.js",
          "vendor/ember/ember.js",
          "vendor/jquery-mockjax/jquery.mockjax.js",
          "app.js",
          "tests/mytestfile.js",
          "templates/*.handlebars"
        ]

Note- if you are doing integration testing please include the integration helper just above this single test file I showed above


text:
Q: How can I determine which font is broken? There's a bug in the way Ubuntu displays Japanese fonts that I need fixed rather urgently.
The bug is that Ubuntu displays the wrong Japanese characters sometimes.
I'm studying Japanese, and having the wrong characters display is obviously problematic.
However, as you can see if you look at the most recent comments on the bug report, fixing the bug seems stalled on the fact that some specific fonts are probably broken, but I don't know which ones.
Here's what I think is happening. If Japanese text is used in a context where the specified font does not contain Japanese characters, then Ubuntu defaults to some other font for the words that are written in Japanese.
However, it is unclear to me what that default Japanese font would be, and how I can determine it.
Is there a way I can determine the default font being used when I see text on my screen that is showing the faulty characters?

A: Source: bug 616169 comment made by martin-autotelic
Quote:

I've solved this problem for me.  Following information here: http://ubuntuforums.org/showthread.php?t=1487447 Basically I removed all Japanese fonts listed as installed in Synaptic, and then installed only these:

ttf-kochi-mincho-naga10
ttf-kochi-gothic-naga10
ttf-sazanami-gothic
ttf-sazanami-mincho

Now I am getting the correct kanji consistently. Unfortunately, I do not know which of the fonts I uninstalled was corrupted, as I do not have the time to test and experiment. I will report if I work it out, though.

If you want to exactly know what font is messing up you will have remove all of them and have to start adding fonts one at a time and check if the problems starts to show up (lot of work but if you do please update the bug ;) ) To give you a headstart these fonts in the ubuntuforums link mentioned in the quote have been called not to be the culprits by user Frantic_Earthling:
ttf-umeplus
ttf-kochi-mincho-naga10
ttf-kochi-gothic-naga10
ttf-sazanami-gothic
ttf-sazanami-mincho
otf-ipafont-mincho
otf-ipafont-gothic
otf-ipaexfont-gothic
otf-ipaexfont-mincho
anthy
libanthy0
ttf-takao-pgothic
ibus-anthy
libtext-wrapi18n-perl
acroread-fonts
python-chardet
im-switch


text:
Q: Remove current event handler in JQuery? I want to remove an event handler when an event is triggered. I can't use one() because there are cases when I don't want to remove the event handler. Here's what I mean:
$('#a').on('click',function(){
  if(...)
    // remove current event handler
});

Edit: I forgot to mention that there are other event handlers attached to $('#a'). I only want to remove the current one.

A: Use .off(), with name spaced event names
$('#a').on('click.myevent', function () {
    if (...)
    // remove current event handler
    $(this).off('click.myevent')
});

A: To unbind an event handler within itself:
$("#a").on("click", function(evt){
    if (...)
    {
        $(this).off(evt);
    }
});

It isn't very well documented in .off(), but you can read a better explanation of this "third form" from section "Using the Event Object" in  .unbind().

A: Can you please try this:
$('#a').on('click',function(){
  if(...)
   {

   $(this).unbind('click');  or $(this).off('click')
}

});

Bind and unbind are for backward compatibility. You should on/off to detach or attach event handlers
hope this helps..


text:
Q: Ball not jumping I'm creating a simple program that just makes a ball sink all the way to the bottom unless you press the space bar in which case it'll jump but it isn't repainting the screen when it's in the process of jumping. So when the ball is supposed to be going up (which I can confirm that it actually does), it just freezes. Here is the code:
NOTE - The canBePressed boolean variable isn't in is use yet so you can just ignore it.
Main
import javax.swing.JFrame;

public class Main {
    public static void main(String[] args) {
        JFrame frame = new JFrame();
        View view = new View();
        Jumper jumper = new Jumper();
        Model model = new Model(view, jumper);
        view.setJumper(jumper);

        frame.setSize(500, 460);
        frame.getContentPane().add(view);
        frame.setVisible(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
}

View
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.KeyEvent;

import javax.swing.AbstractAction;
import javax.swing.ActionMap;
import javax.swing.InputMap;
import javax.swing.JPanel;
import javax.swing.KeyStroke;

public class View extends JPanel {
    private Jumper jumper;
    private Rectangle bounds;
    private Model model;

    public View() {
        setBackground(Color.BLACK);
        bounds = new Rectangle(0, 0, 400, 400);

        addKeyBinding("space.pressed", KeyEvent.VK_SPACE, new MoveAction(true, Key.SPACE), false);
        addKeyBinding("space.released", KeyEvent.VK_SPACE, new MoveAction(false, Key.SPACE), true);
    }

    public void addKeyBinding(String name, int keyEvent, AbstractAction action, boolean pressed) {
        InputMap inputMap = getInputMap(WHEN_IN_FOCUSED_WINDOW);
        ActionMap actionMap = getActionMap();

        inputMap.put(KeyStroke.getKeyStroke(keyEvent, 0, pressed), name);
        actionMap.put(name, action);
    }

    public void setJumper(Jumper jumper) {
        this.jumper = jumper;
    }

    @Override
    public Rectangle getBounds() {
        return bounds;
    }

    @Override
    public void paintComponent(Graphics g) {
        super.paintComponent(g);
        jumper.paint(g);
    }

    public void setModel(Model model) {
        this.model = model;
    }
}

Jumper
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Point;

public class Jumper {
    private Point location;
    private Dimension dimension;
    private Graphics graphics;

    public Jumper() {
        location = new Point(250, 250);
        dimension = new Dimension(20, 20);
    }

    public Dimension getSize() {
        return dimension;
    }

    public void setLocation(Point location) {
        this.location = location;
    }

    public void callPaint() {
        paint(graphics);
    }

    public void paint(Graphics g) {
        graphics = g;
        System.out.println("PAINT");
        g.setColor(Color.GREEN);
        g.fillOval(location.x, location.y, dimension.width, dimension.height);
    }

    public Point getLocation() {
        return location;
    }
}

Key (ENUM)
public enum Key {
    SPACE
}

Model (Where the problem is probably occurring)
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;

import javax.swing.Timer;

public class Model {

    private boolean canBePressed;
    private int ballX, ballY;
    private int timeCount;
    private Thread thread;
    private Jumper jumper;
    private View view;
    private Timer timer1;
    private Point point;
    static List<Key> key;

    public Model(View view, Jumper jumper) {
        this.view = view;
        view.setModel(this);
        canBePressed = true;
        key = new ArrayList<Key>(3);
        this.jumper = jumper;
        ballX = 250;
        ballY = 0;
        thread = new Thread();

        timer1 = new Timer(5, new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent arg0) {
                try {
                    update();
                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                view.repaint();
            }

        });
        timer1.start();
    }

    public void update() throws InterruptedException {

        if (!key.isEmpty()) {
            if (canBePressed) {
                timer1.stop();
                jump();
            }
        }

        if (ballY + jumper.getSize().height > view.getBounds().height) {
            canBePressed = true;
        } else {
            ballY++;
        }

        point = new Point(ballX, ballY);
        jumper.setLocation(point);
        point = null;
    }

    public void jump() throws InterruptedException {
        for (timeCount = 0; timeCount < 100; timeCount++) {
            ballY--;
            System.out.println(ballY);
            Thread.sleep(5);
            jumper.setLocation(new Point(ballX, ballY));
            view.repaint();
        }

        timer1.start();
    }

}

MoveAction
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;

public class MoveAction extends AbstractAction {

    private boolean pressed;
    private Key direction;

    public MoveAction(boolean pressed, Key direction) {
        this.pressed = pressed;
        this.direction = direction;
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if (pressed) {
            if (Model.key.size() < 1)
                Model.key.add(direction);
        } else {
            Model.key.remove(direction);
        }

    }

}

Anyone got any ideas?


text:
Q: Laravel blade template showing html even when the condition is false I have setup if conditions in my blade template with an if condition that consists of an or operator, but it is showing html even when the condition is false. Not sure how to fix that?
@if(count($images) || count($videos) > 1)

                    <button class="orbit-previous">Previous Slide◀</button>
                    <button class="orbit-next">Next Slide▶</button>
            @if(count($images) > 1)
                    @foreach($images as $image)

                    @endforeach
            @endif
            @if(count($videos) > 1)
                    @foreach($videos as $video)

                    @endforeach
            @endif

        @endif

A: You write or (||) condition in if statement that means if one condition (count($images)) or count($videos)  is true then if statement will work.
If two condition is false then your if statement will not work

A: I think your first condition is not correct : @if(count($images) || count($videos) > 1). The > 1 is not applied on both elements, you should try @if(count($images) > 1 || count($videos) > 1).


text:
Q: Change row with each use So I have this chunk of code, that when run will ask for a set of data, which will then be added to a table, and trigger some other actions. What I desperately need however, is for this macro to run a new row each time it is used, rather than overwrite the same row.
Anyway, would really appreciate some assistance
Sub TestMacro()

    Range("B" & "12").Select
    ActiveCell.FormulaR1C1 = InputBox("Name")
    Range("c" & "12").Select
    ActiveCell.FormulaR1C1 = InputBox("Northing")
    Range("d" & "12").Select
    ActiveCell.FormulaR1C1 = InputBox("Easting")
    Range("e" & "12").Select
    ActiveCell.FormulaR1C1 = InputBox("Transition Length (Ls)")
    Range("f" & "12").Select
    ActiveCell.FormulaR1C1 = InputBox("Minimum Radius (Rc)")
    Range("g" & "12").Select
    ActiveCell.FormulaR1C1 = InputBox("Central Angle (DELTA)")
    Range("u" & "13").Select
    ActiveCell.FormulaR1C1 = Range("B160")
    Range("v" & "13").Select
    ActiveCell.FormulaR1C1 = Range("C160")
    Range("w" & "13").Select
    ActiveCell.FormulaR1C1 = Range("D160")
    Range("x" & "13").Select
    ActiveCell.FormulaR1C1 = Range("E160")

End Sub

A: What may work for you is to use an event on a worksheet and a UserForm:
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
        UserForm1.Show
        MsgBox UserForm1.TextBox1 ' do stuff with form objects
        Set UserForm1 = Nothing ' skip this step to retain form values between calls
    End Sub

Create a UserForm to capture the data then process the data on return from the form.
In this case the form pops up every time you change cells in the sheet so that may not be the best solution. You can put the same code in a SUB() and add a shortcut key:
    Sub GetData()
        UserForm1.Show
        MsgBox UserForm1.TextBox1 ' do stuff with form objects
        Set UserForm1 = Nothing ' skip this step to retain form values between calls
    End Sub

Open the Macros dialog on the Developer tab (you may need to turn on the tab in Options) then set the SHortCut key via the Options... for the GetData macro.
You can preload some of the objects on the UserForm:
    Sub GetData()
        UserForm1.TextBox1 = "Hello"
        UserForm1.Show
        MsgBox UserForm1.TextBox1 ' do stuff with form objects
        Set UserForm1 = Nothing ' skip this step to retain form values between calls
    End Sub


text:
Q: MVC 5 Razor System.Security.SecurityException Just created a new application and put the trust level Medium in web.config
<trust level="Medium" />

I need to test the application in Medium trust level because I have to host on shared server.
Now run the application and get error on this line
@Html.ActionLink("XYZ", "Index", "Home", new {area=""}, new {@class="link" })

Here is the complete error:
Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Source Error:

            </button>
             @Html.ActionLink("xyz", "Index", "Home",
             new { area = "" }, new { @class = "navbar-brand" })

Stack Trace:
[SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
   System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
   System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap, StackCrawlMark& stackMark) +34
   System.Security.CodeAccessPermission.Demand() +46
   System.Web.HttpContext.System.IServiceProvider.GetService(Type service) +54
   System.Web.HttpContextWrapper.GetService(Type serviceType) +13
   System.Web.WebPages.UrlRewriterHelper.IsUrlRewriterTurnedOn(HttpContextBase httpContext) +157
   System.Web.WebPages.UrlRewriterHelper.WasRequestRewritten(HttpContextBase httpContext) +37
   System.Web.WebPages.UrlUtil.GenerateClientUrlInternal(HttpContextBase httpContext, String contentPath) +229
   System.Web.WebPages.UrlUtil.GenerateClientUrl(HttpContextBase httpContext, String contentPath) +120
   System.Web.Mvc.UrlHelper.GenerateUrl(String routeName, String actionName, String controllerName, RouteValueDictionary routeValues, RouteCollection routeCollection, RequestContext requestContext, Boolean includeImplicitMvcValues) +324
   System.Web.Mvc.UrlHelper.GenerateUrl(String routeName, String actionName, String controllerName, String protocol, String hostName, String fragment, RouteValueDictionary routeValues, RouteCollection routeCollection, RequestContext requestContext, Boolean includeImplicitMvcValues) +100
   System.Web.Mvc.HtmlHelper.GenerateLinkInternal(RequestContext requestContext, RouteCollection routeCollection, String linkText, String routeName, String actionName, String controllerName, String protocol, String hostName, String fragment, RouteValueDictionary routeValues, IDictionary`2 htmlAttributes, Boolean includeImplicitMvcValues) +96
   System.Web.Mvc.HtmlHelper.GenerateLink(RequestContext requestContext, RouteCollection routeCollection, String linkText, String routeName, String actionName, String controllerName, String protocol, String hostName, String fragment, RouteValueDictionary routeValues, IDictionary`2 htmlAttributes) +71
   System.Web.Mvc.HtmlHelper.GenerateLink(RequestContext requestContext, RouteCollection routeCollection, String linkText, String routeName, String actionName, String controllerName, RouteValueDictionary routeValues, IDictionary`2 htmlAttributes) +66
   System.Web.Mvc.Html.LinkExtensions.ActionLink(HtmlHelper htmlHelper, String linkText, String actionName, String controllerName, RouteValueDictionary routeValues, IDictionary`2 htmlAttributes) +187
   System.Web.Mvc.Html.LinkExtensions.ActionLink(HtmlHelper htmlHelper, String linkText, String actionName, String controllerName, Object routeValues, Object htmlAttributes) +115
   ASP._Page_Views_Shared__Layout_cshtml.Execute() in d:\TestProjects\Medium\Medium\Views\Shared\_Layout.cshtml:19
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +270
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +121
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +145
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer) +41
   System.Web.WebPages.<>c__DisplayClass3.<RenderPageCore>b__2(TextWriter writer) +335
   System.Web.WebPages.HelperResult.WriteTo(TextWriter writer) +42
   System.Web.WebPages.WebPageExecutingBase.WriteTo(TextWriter writer, HelperResult content) +45
   System.Web.WebPages.WebPageBase.Write(HelperResult result) +53
   System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body) +178
   System.Web.WebPages.WebPageBase.PopContext() +229
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +154
   System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +695
   System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +382
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +431
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +39
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +116
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +529
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +106
   System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +321
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +185
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +42
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +133
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +40
   System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +34
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +70
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +133
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +37
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +44
   System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +39
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +62
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +133
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +37
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +39
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +39
   System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +39
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +70
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +133
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56
   System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +37
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +40
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9742689
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

A: I had the same problem a few weeks ago. My problem with the trust medium level was that my cshtml had a "~" at the javascript tag, like:

Removing the "~" simply resolved my problem.
It's a weird error because it points to a Razor declaration instead of the "~" line. Although the "~" is a special Razor symbol in this case.
Hope this might help.


text:
Q: Relationships between classes that implement same interface I'm pretty much java beginner, and i've come to ask stackoverflow forum for one simple question. I already checked similar question here on SO, but i didn't found the desired answer, LINK: Is there any relation between the class that implements interface and that interface?
We know if Cat extends Animal, there is a relationship here. So Cat is-a Animal ( but not necessarily otherwise. Animal is also a Dog..). We know this relationship as "is-a" - inheritance.
If we have another two classes: Girl and Candy and if class Girl holds instance of Candy, then we name this relationship "has-a"-composition, because we can say that Girls has-a Candy.
Correct me if i made something wrong with above examples.
Anyway my question is if its there some relationship between objects of classes that implement the same interface? Let's say:
public class A implements InterfaceA {}

public class B implements InterfaceA {}

If there is some relationship, how we can make use of that relationship? Thanks for your answers in advance..
EDIT: For those who think that there isn't a relationship, i have a book "java how to program ninth edition" and there is a UML diagram which shows classes that implements same interface in "relationship" ?
Image:

A: There is no relationship between the objects which implement same interface. Both are independent implementations of their own. They just follow the protocol defined by interface.
If you try to cast from one object type to another object type, you will end-up getting ClassCastException.
EDIT:
Your UML diagram suggest that there is relationship between interface and class (IS-A), but not between the two classes which implement same interface. There is no line with relationship symbol between the classes (like you see between class and interface)

A: This means that your classes have similar behaviour described by the interface methods.
For example, consider two classes: Fish and Bird. They both can implement interface Moveable like:
inteface Moveable{
    void move(int x, int y, int z);
}

class Fish implements Moveable{
    public void move(int x, int y, int z){
       swim(x, y, z);
   }
    private void swim(int x, int y, int z){
      //a method describing how the fish swims
    }
}

class Bird implements Moveable{
    public void move(int x, int y, int z){
       fly(x, y, z);
   }

    private void fly(int x, int y, int z){
      //a method describing how the bird flies
    }
}

You can call the behaviour specified by interface methods like:
Moveable bird = new Bird();
Moveable fish = new Fish();

bird.move(10,10,10);
fish.move(10,10,-10);

So either of them can move, though the way they move differs greatly. This way both classes share common behaviour though its implementation may be unknown to you.

A: The relationship between a class implementing and interface, and the interface is also an "is-a" relationship, the same as extending from a class.
It's useful (or at least one reason it's useful) because by providing an interface, you can code to an interface rather than code to an implementation of that interface, making it easy (if you ever need to) to swap your implementations over with the minimum of fuss.
Note that if you're going "across" the inheritance hierarchy, so looking at the relationship between two classes which inherit the same interface, there is no implicit relationship here at all.

A: There is no formal name for the relationship between two classes which implement the same interface.
Or, for that matter, which extend the same base class. If a child which extends another is its child, then two children of the same class are siblings, but this is not a term which is generally used.
If you wanted to extend this anthropomorphic metaphor to interfaces, you could call two implementations of an interface look-alikes, perhaps.


text:
Q: Calculating Distance iOS MapKit Using CLLocation I am trying to find the distance in miles using the latitude and longitude. I have the following method:
- (void)locationManager:(CLLocationManager *)manager
    didUpdateToLocation:(CLLocation *)newLocation
           fromLocation:(CLLocation *)oldLocation
{
    if(!newLocation) return;

    if ((oldLocation.coordinate.latitude != newLocation.coordinate.latitude) &&
        (oldLocation.coordinate.longitude != newLocation.coordinate.longitude))
    {

        CLLocation *loc1 = [[CLLocation alloc] initWithLatitude:oldLocation.coordinate.latitude longitude:oldLocation.coordinate.longitude];
        CLLocation *loc2 = [[CLLocation alloc] initWithLatitude:newLocation.coordinate.latitude longitude:newLocation.coordinate.latitude];

        CLLocationDistance distance = ([loc2 distanceFromLocation:loc1]) * 0.000621371192;

        //distance = distance;

        NSLog(@"Total Distance %f in miles",distance);
    }

}

For some reason it prints out something like 5678.32 miles. The location is pretty much stationary and not moving at all.

A: CLLocation *loc2 = [[CLLocation alloc] initWithLatitude:newLocation.coordinate.(!!!!!)latitude longitude:newLocation.coordinate.(!!!!!)latitude];

A: You are initializing loc2 with the latitude of the new location for both the longitude and the latitude:
This line:
CLLocation *loc2 = [[CLLocation alloc] initWithLatitude:newLocation.coordinate.latitude longitude:newLocation.coordinate.latitude];

Should say:
CLLocation *loc2 = [[CLLocation alloc] initWithLatitude:newLocation.coordinate.latitude longitude:newLocation.coordinate.longitude];

Hope it helps!


text:
Q: Water discrimination by Remote sensing I have NIR, green, red edge, red, IR bands at disposal of a an area with a river, I want to discriminate water surfaces, do you have any good ideas on how to do that ? I did a NDWI which is not very convincing. NDVI neither.
Multispectral sensor is Multispec4 from Airinov.

thermal:7.5-13.5 micrometer, sensor is a thermoMAP camera of Sensefly, produced by airinov I think
The NIR/(red+green+NIR) ratio is visible below, river streams are kind of visible but there is lot of noise:

A: NDWI should be okay for it, but you can also look at NIR-ratio, which is the fraction of the total reflectance that is contributed by the NIR-band. In a case where you have the Red Edge band, I'd not count that and simply do:
NIR_ratio = NIR / ( Green + Red + NIR )

This approach gives a decent singleband ratio to look at. Shadows will consistently give you issues, regardless of which pixel-based method you use, so you could take it a few steps further and apply a object-oriented classification with a reasonable minimum object size, to remove isolated shadows.


text:
Q: Publish a Universal Binary iOS Framework in Swift using CocoaPods Created a framework in xcode, now want to install using POD. I created a binary zip of my framework. And uploaded it one of my repository. Now got stuck how to proceed. Any help will be appreciated.

A: You can see a sample podspec which downloads framework binary from a http url.
Pod::Spec.new do |s|
      s.name             = "FRAMEWORK_NAME"
      s.version          = "VERSION"
      s.summary          = "SUMMARY"

      s.description      = "DESC"

      s.homepage         = "HOMEPAGE"
      s.license          = { :type => 'LICENSE_TYPE', :text => "COPYRIGHT" }
      s.author           = { "AUTHOR" }
      s.source           = { :http => "HTTP_FILE_PATH.zip"}

      s.platform         = :ios, 'DEPLOYMENT_TARGET'
      s.requires_arc     = true

      s.vendored_frameworks = 'SDK_NAME.framework'
      s.public_header_files = ["SDK_NAME.framework/Headers/*.h"
      s.frameworks = 'SDK_NAME'
      s.xcconfig = { "FRAMEWORK_SEARCH_PATHS"=> "\"$(PODS_ROOT)/SDK_NAME\"" }

end


text:
Q: Jenkins SYSTEM user removes custom workspace configuration I have a job NightlyTest-Winx64 configured to use the customWorkspace D:\builds\build-dir\Quick-Winx64-Trunk.
Quick-Winx64-Trunk is a job in Jenkins that will checkout the source repository, compile, archive some artifacts and then trigger the NightlyTest-Winx64 job. It triggers NightlyTest-Winx64 to run on the same node using the same workspace so that we're not checking out and compiling twice and only need to run test.
On the first run of the NightlyTest-Winx64 the customWorkspace exist and is used as expected. However during this first run the SYSTEM user removes the customWorkspace configuration from the job. As a result all subsequent builds of NightlyTest-Winx64 will run in the default workspace which is incorrect.
Has anyone encountered this behavior before and why is the SYSTEM user changing my job configuration?

A: It was a conflict between two of the plugins I was using to trigger the Nightly using the workspace of the Quick.
Previous Configuration:

*

*Trigger parameterized build from Quick with Node name as parameter (Parameterized Trigger Plugin)
https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin

*On Nightly expect one parameter node and set customWorkspace to that of the quick

*Under Build Environment select Run on same node as.. and share same workspace (Node Stalker Plugin)
https://wiki.jenkins-ci.org/display/JENKINS/Node+Stalker+Plugin
Node stalker was acting as the SYSTEM user and making the configuration changes. Using both of the above plugins was redundant and as a result caused the conflict.
New Configuation:

*

*Trigger build from quick with no parameters (built into Jenkins)

*Use the Node stalker plugin to grab the correct node and workspace for the Nightly


text:
Q: Converting local degree of freedom to global degree of freedom (Manipulating a list) I want to convert the local connectivity matrix to the global one as follows.
Consider two quad elements with connectivity
{{1,2,3,4},{2,5,6,3}}

Now let's say each node has 5 degrees of freedom. Then I want to write my connectivity including 5 degrees of freedom at each node as follows:
For Element 2
{2,5,6,3} -> {6,7,8,9,10,21,22,23,24,25,26,27,28,29,30,11,12,13,14,15}

Is there a simple way to convert into this form?

A: The question is not very clear. If all you want is to map the elements to the corresponding list then here is one way to do it.
map = Table[5 i + j, {i, 0, 5}, {j, 1, 5}] // AssociationThread[Range[6], #] &;
map[#] & /@ {2, 5, 6, 3} // Flatten
(* {6, 7, 8, 9, 10, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 11, 12, 13, 14, 15} *)

or using replacement rules
rules = Table[5 i + j, {i, 0, 5}, {j, 1, 5}] // Thread[Range[6] -> #] &;
{2, 5, 6, 3} /. rules // Flatten

A: f = {a, m} \[Function] Module[{n, k},
    {n, k} = Dimensions[a];
    ArrayReshape[
     Outer[Plus, Flatten[(a - 1) m], Range[1, m]],
     {n, m k}
     ]
    ];

Test:
f[{{1,2,3,4},{2,5,6,3}} , 5]

{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
    20}, {6, 7, 8, 9, 10, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 11,
    12, 13, 14, 15}}

This is fairly efficient:
a = Partition[RandomChoice[1 ;; 1000000, 1000000], 4];
f[a, 5]; // RepeatedTiming // First

0.03

A: This may work:
   list1 = {{1, 2, 3, 4}, {2, 5, 6, 3}}
   Flatten[{5*# - 4, 5*# - 3, 5*# - 2, 5*# - 1, 5*#}\[Transpose]] & /@ list1

{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
  20}, {6, 7, 8, 9, 10, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 11,
  12, 13, 14, 15}}


text:
Q: Passing ID as correct variable type in GraphQL Mutate function I'm trying to edit an item using GraphQL by passing in arguments using this.props.mutate. I'm getting following error... Error: GraphQL error: Variable $id of required type ID! was not provided. Hence, the problem lies in me passing the wrong ID type to the mutate function. Anyone know how to pass the ID type as the correct type to the mutate function? or can I cast the ID type from string to the correct type to pass as variable to the mutate function? Thank you
i'm using local component state to hold the values to prefill a form in case you are wondering why I am using local state
import UPDATE_CHAT_MUTATIONS from '../graphql/mutations/updateChat';

class EditChat extends React.Component {
  state = {
    text: '',
    id: ''
  }

  componentWillMount() {
    this._onEditLoad()
  }

  _onEditLoad = () => {
    const chat = this.props.navigation.state.params;
    this.setState({ text: chat.text, id: chat._id })
  }

  _onChangeText = text => this.setState({ text });

  _onEditPress = async () => {
    const { id, text } = this.state;
    await this.props.mutate({
      variables: {
        _id: id,
        text
      }
    });

    Keyboard.dismiss();
    this.props.navigation.goBack(null);
  }

A: i managed to get it to work! I made an error on the graphql mutations on the client side. Below is the code that works!! Hope this will help those who face the same issue. Cheers
import { gql } from 'react-apollo';

export default gql`
  mutation updateChat($_id: ID!, $text: String!) {
    updateChat(_id: $_id, text: $text) {
      text
      _id
      updatedAt
    }
  }
`;


text:
Q: WpAlchemy - _global_head is being output 3 times Today while attempting to make use of the repeating fields function (have_fields_and_multi) I've discovered that with the latest WpAlchemy (1.6.1) and the latest Wordpress (4.6.1), the inline JavaScript blocks from MetaBox.php are output 3 times on the admin page.  This breaks functionality because 3 sets of onclick events are included.
I tried this on two local sites with the same result.
I'm attempting to work around it via event.stopImmediatePropogation as a temporary fix but would love to have something more solid.
(I have added this as an issue at https://github.com/farinspace/wpalchemy/issues/111 as well)
Am I'm alone in experiencing this problem, and does anyone have any idea how to fix it?

A: The clue was in the original script here - line 460 of MetaBox.php has the comment "// todo: when first run define a constant to prevent other instances from running again ...". The code below fixed this issue.
if(!defined('HEAD_CALLED')):
  add_action( 'admin_head', array( $this, '_global_head' ) );
  define('HEAD_CALLED', true);
endif;


text:
Q: Angular UI-router parent state not active Hi i got a problem with parent state not active when child is call.
I'm using ui-router with ui-sref-active function.
Here is my router code:
.state('customers', {
    abstract: true,
    parent: 'app',
    url: '/customers',
    templateUrl: 'app/customer/parent.html',
})
.state('customers.list', {
    parent: 'customers',
    url: '',
    controller: 'customerCtrl as customer',
    templateUrl: 'app/customer/index.html'
})

.state('customers.birthday', {
    parent: 'customers',
    url: '/birthday',
    templateUrl: 'app/customer/birthday.html',
})

Here is my html:

              Customers

I'm using ng-repeat because there are plenty of menu.
The problem is when I call /customers the ui-sref-active is working properly. But when /customers/birthday call, ui-sref-active is gone.
Here below screenshot:

Any advice how to make it working?
Thanks in advance!

A: Might be because of how your nesting routes. Try something like this:
.config(function($stateProvider, $urlRouterProvider, $ionicConfigProvider) {
$stateProvider
.state('exampleState', {
    url: '/example',
    abstract: true,
    templateUrl: 'templates/example/root-view.html',
    controller: 'ParentCtrl'
  })

  .state('exampleState.games', {
    url: '/games',
    views: {
      'stats-games':{
        templateUrl: 'templates/example/firstpage.html',
        controller: 'PageOneCtrl'
      }
    }
  })
  .state('exampleState.sesaons', {
    url: '/seasons',
    views: {
      'stats-games':{
      templateUrl: 'templates/example/secondpage.html',
      controller: 'PageTwoCtrl'
    }
  })
});

A:     .state('home', {
        url: '/home',
        abstract: true,
        templateUrl: 'templates/home.html'

    })
    .state('home.main', {
        url: '',
        templateUrl: 'templates/main.html'

    })
    .state('home.owner', {
        url: '/owner',
        templateUrl: 'templates/owner.html'

    })

A: I finally solve it.
At my
    app.run(['$rootScope', '$state', function($rootScope, $state) {
    $rootScope.$on('$stateChangeStart', function(evt, to, params) {
      if (to.redirectToChild) {
        evt.preventDefault();
        $state.go(to.redirectToChild.state, params)
      }
    });
}]);

 app.config([ '$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) {
    $urlRouterProvider.otherwise("/404");
    .state('customers', {
        url: '/customers',
        templateUrl: 'app/customer/parent.html',
        redirectToChild: {
                state: 'customers.list'
            },
    })
    .state('customers.list', {
        parent: 'customers',
        url: '',
        controller: 'customerCtrl as customer',
        templateUrl: 'app/customer/index.html'
    })

    .state('customers.birthday', {
        parent: 'customers',
        url: '/birthday',
        templateUrl: 'app/customer/birthday.html',
    })
}]);


text:
Q: Issues with System.Net.Http.dll I'm having issues referring to System.Net.Http.dll version 4.2.0.0
Here is my setup -

Visual Studio 2017, 15.8.7
A simple console application targeting .net 4.7.2

When I create a new project, by default it has a reference to System.Net.Http.dll and the location is C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Net.Http.dll.
But when I execute my code,
class Program
{
    static void Main(string[] args)
    {
        var assembly = GetAssemblyNameContainingType(typeof(HttpClient).FullName);
        Console.WriteLine("Path: " + assembly.Location);
        Console.WriteLine("Version: " + assembly.GetName().Version);

        Console.ReadKey();
    }

    public static Assembly GetAssemblyNameContainingType(String typeName)
    {
        foreach (Assembly currentassembly in AppDomain.CurrentDomain.GetAssemblies())
        {
            Type t = currentassembly.GetType(typeName, false, true);
            if (t != null)
            { return currentassembly; }
        }

        return null;
    }
}

I get the below output
  Path: C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Net.Http\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Net.Http.dll
  Version: 4.0.0.0

It seems to pick up reference to System.Net.Http.dll from GAC instead of the Programs Files (x86) folder.
I specifically need reference to 4.2.0.0 - since it addresses serialization of HttpRequestException in a way Newtonsoft json can serialize and deserialize it without erroring out.
I read quite a few posts about others facing an issue with System.Net.Http.dll, many of those said that this was addressed in Visual Studio 2017, 15.8 and that one won't have to add reference to the System.Net.Http nugets and should let visual studio to refer it appropriately from framework.
Am i missing something?
I have tried numerous things -
Adding reference path (C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.7.2) in project properties - did not help
Adding reference using path to C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.7.2\System.Net.Http.dll - did not help
Copy local - True - did not help
Specific version - True - did not help
Added binding redirect - did not help. Gave below exception
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

System.BadImageFormatException: 'Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Reference assemblies should not be loaded for execution.  They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)'
Unchecked Auto-generate binding redirects in project properties - did not help
Unchecked Auto-generate binding redirects with manual binding redirect - did not help
Unchecked Auto-generate binding redirects with manual binding redirect + copy local - did not help
Adding a hint path - did not help

        C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.7.2\System.Net.Http.dll

Here is my .csproj (original, reverted after doing all above changes)
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{EEE1B52B-0316-4EB5-9F3B-383E377964BE}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <RootNamespace>SysNetHttpTests</RootNamespace>
    <AssemblyName>SysNetHttpTests</AssemblyName>
    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <Deterministic>true</Deterministic>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
      <HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Net.Http" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config" />
    <None Include="packages.config" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

A: Official MS answer (by Jose Perez Rodriguez):

This is by design. Due to a Windows requirement, all of the framework
  assemblies installed in the GAC need to be versioned 4.0.0.0. The
  actual implementation contained in that assembly is not the 4.0.0.0
  implementation but the 4.2.0.0 instead. There are a bunch of
  complicated reasons of why Windows has this requirement on our
  assemblies installed on the GAC, like servicing, bugfixing, and just
  having one GAC for all .NET 4+ frameworks, but essentially this is
  expected.

While you think it is 4.0 it's in fact 4.2. Dll hell, welcome back!


text:
Q: How can i bring a before pseudo element in front of a Background but behind of an other background? I use mutiple Background. I use a before Element in the back of an multibackground with Css3 code and a background-image.
and i have also an other Background called (apc-container)behind this Background.
My problem is that the before Element  is also behind the #acp-container.
in the pseudo element before i use the z-index.
i try to use this also in the #acp-container but it does not work.
So how i bring the before pseudo Element in front of the #apc-container and in the back of the #subfilter a BG?
you can check it out with this code and you see the problem easy.

#streams-container,
#acp-container {
  border-radius: 10px;
  background-color: #f8f8f8;
  min-height: 500px;
}
.subfilter {
  margin-top: 160px;
}
.subfilter a {
  margin-right: 130px;
  margin-left: 130px;
  width: 145px;
  height: 145px;
  display: inline-block;
  position: relative;
  line-height: 145px;
  background-size: auto auto, auto auto;
  background-color: #eaeaea;
  background-image: url(images/Eye.png), -webkit-gradient(linear, left top, left bottom, from(#f6f6f6), to(#eaeaea));
  background-image: url(images/Eye.png), -webkit-linear-gradient(top, #f6f6f6, #eaeaea);
  background-image: url(images/Eye.png), -moz-linear-gradient(top, #f6f6f6, #eaeaea);
  background-image: url(images/Eye.png), -ms-linear-gradient(top, #f6f6f6, #eaeaea);
  background-image: url(images/Eye.png), -o-linear-gradient(top, #f6f6f6, #eaeaea);
  background-image: url(images/Eye.png), linear-gradient(top, #f6f6f6, #eaeaea);
  -moz-border-radius: 5px;
  -webkit-border-radius: 5px;
  border-radius: 5px;
  -moz-box-shadow: 0 1px 1px rgba(0, 0, 0, .25), 0 2px 3px rgba(0, 0, 0, .1);
  -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .25), 0 2px 3px rgba(0, 0, 0, .1);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .25), 0 2px 3px rgba(0, 0, 0, .1);
}
.subfilter a.finiwatch {
  background-position: 0px -172px, 0 0;
}
.subfilter a:active {
  top: 1px;
}
.subfilter a::before {
  content: '';
  position: absolute;
  z-index: -1;
  top: -8px;
  right: -8px;
  bottom: -8px;
  left: -8px;
  background-color: #eaeaea;
  -moz-border-radius: 5px;
  -webkit-border-radius: 5px;
  border-radius: 5px;
  opacity: 0.5;
}
.subfilter a:active::before {
  top: -9px;
}
.subfilter a:hover::before {
  opacity: 1;
}
.subfilter a.finiwatch:hover::before {
  background-color: #B3F390;
}
.subfilter a:hover {
  top: 0px, 1px;
}
.subfilter a.finiwatch:hover {
  background-position: -160px -158px, 0 0;
}
.subfilter a:active {
  background: url(images/Eye.png), -moz-linear-gradient(top, #eaeaea, #f6f6f6);
  background-image: url(images/Eye.png), -webkit-gradient(linear, left top, left bottom, from(#eaeaea), to(#f6f6f6));
  background-image: url(images/Eye.png), -webkit-linear-gradient(top, #eaeaea, #f6f6f6);
  background-image: url(images/Eye.png), -moz-linear-gradient(top, #eaeaea, #f6f6f6);
  background-image: url(images/Eye.png), -ms-linear-gradient(top, #eaeaea, #f6f6f6);
  background-image: url(images/Eye.png), -o-linear-gradient(top, #eaeaea, #f6f6f6);
  background-image: url(images/Eye.png), linear-gradient(top, #eaeaea, #f6f6f6);
}
.subfilter a.finiwatch:active {
  background-position: -318px -158px, 0 0;
}
.subfilter a.finiwatch:selected {
  background-position: -318px -158px, 0 0;
}

A: For everyone stumbling accross this...

#streams-container {
  border-radius: 10px;
  background-color: #f8f8f8;
  min-height: 500px;
  position: relative;
  z-index: 1;
}

.subfilter {
  margin-top: 160px;
}
.subfilter a {
  margin-right: 130px;
  margin-left: 130px;
  width: 145px;
  height: 145px;
  display: inline-block;
  position: relative;
  line-height: 145px;
  background-size: auto auto, auto auto;
  background-color: blue;
}
.subfilter a.finiwatch {
  background-position: 0px -172px, 0 0;
}

.subfilter a::before {
  content: '';
  position: absolute;
  z-index: 10;
  top: -8px;
  right: -8px;
  bottom: -8px;
  left: -8px;
  background-color: pink;
  -moz-border-radius: 5px;
  -webkit-border-radius: 5px;
  border-radius: 5px;
  opacity: 0.5;
}

.subfilter a:active::before {
  top: -9px;
}
.subfilter a:hover::before {
  opacity: 1;
}
.subfilter a.finiwatch:hover::before {
  background-color: #B3F390;
}
.subfilter a:hover {
  top: 0px, 1px;
}
.subfilter a.finiwatch:hover {
  background-position: -160px -158px, 0 0;
}

A: Found a way
give apc-container a relative position and a z-index of 1 and teh before element a z-index of -10.
#streams-container,
#acp-container {
  border-radius: 10px;
  background-color: #f8f8f8;
  min-height: 500px;
  position: relative;
  z-index: 1;
}

.subfilter a::before {
  content: '';
  position: absolute;
  z-index: -10;
  top: -8px;
  right: -8px;
  bottom: -8px;
  left: -8px;
  background-color: #eaeaea;
  -moz-border-radius: 5px;
  -webkit-border-radius: 5px;
  border-radius: 5px;
  opacity: 0.5;
}


text:
Q: Assembly print to file from array I need this program to write out a file with the first 47 values of the Fibonacci series calculated. My procedure correctly displays the 47 entries using procedures included from a provided library however it does not print them out to the file.
Im fairly sure that its storing the array in the esi, but my fib.bin file only has one entry and its not the beginning of the array. I'm fairly certain all I need to do is use the esi, but I cant figure it out, Thanks in advance.
TITLE Fibonacci Numbers                     (FibNums.asm)

INCLUDE Irvine32.inc

.data
fileHandle DWORD ?
filename BYTE "fib.bin",0

FIB_COUNT = 47
array DWORD FIB_COUNT DUP(?)

.code
main PROC

    ;Creates the file
    mov  edx,OFFSET filename
    call CreateOutputFile
    mov  fileHandle,eax

    ;Generates the array of values
    mov esi,OFFSET array
    mov ecx,FIB_COUNT
    call generate_fibonacci

    ;Write out to file
    mov eax,fileHandle
    mov edx,OFFSET array
    mov ecx,SIZEOF array
    call WriteToFile

    ;Close the file
    mov eax,fileHandle
    call CloseFile

    exit
main ENDP

;--------------------------------------------------
generate_fibonacci PROC USES eax ebx ecx
;
;Generates fibonacci values and stores in an array
;Receives: ESI points to the array, ECX = count
;Returns: Nothing
;---------------------------------------------------

    mov eax,1
    mov ebx,0

L1: add eax,ebx
    call    WriteDec
    call Crlf

    mov [esi],eax
    xchg    eax,ebx
    loop L1
    ret
generate_fibonacci ENDP

END main

A: You have to increment esi:
...
L1: add eax,ebx
    call WriteDec
    call Crlf

    mov [esi], eax
    xchg eax, ebx
    add esi, 4          ; move forward 4 Bytes (4*8 bits) = 1 dword (1*32 bits)
    loop L1
...

A: L1: add eax,ebx
    call    WriteDec
    call Crlf

    mov [esi],eax
    xchg    eax,ebx
    ***add  esi,TYPE array***
    loop L1

Funny solution, just need to add TYPE array to the esi, to move the spot where it was outputting the answer in the register. Working 100% now.


text:
Q: Is there a way to get a Silverlight app and a Flash app to communicate? I'm looking for any way to get a flash app to communicate with a silverlight app, and vice versa.
Are there any drawbacks to communication between the two apps?  What are (or not) you able to communicate?

A: I imagine you could try communicating via the DOM on the page in which the controls are hosted. I believe both have hooks into it from inside their programming environments.

A: Of course, right after I asked this question, I find this article about a project called Microbe that passes a ball between Java and Silverlight, althought I can't find the actual site that hosts this idea.
Anyway, here's the article.  If I can find the actually site I'll link it in this answer.

A: Haha, nice, I was going to suggest using Javascript to do that, post more when you actually do it!


text:
Q: Php - Is it possible to block access to a webpage depending on the address used? Consider the following scenario.
There is a site on a local network which can be accessed one of 2 ways:

*

*11.11.11.111/testsite (ip)

*test.site.com (vhost)

Is it possible with php to only allow access using test.site.com?
EDIT:
While there were many good suggestions as to how to solve this problem, I went with Publi Design & John V.'s mod_rewrite suggestion, but I implemented it in the httpd.conf file and redirected to a forbidden page.
What worked for me was:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^test.site.com$ [NC]
RewriteRule .? - [F]

A: As Michael P suggested in his comment, it's best to do this using a server configuration file, rather than with PHP. But it is possible with PHP, and rather easy. All you need is a simple if/else statement using PHP's global variable $_SERVER. Something like this should do.
<?php
// put this at the top of every page that will be accessed
if ($_SERVER['HTTP_HOST'] != 'test.test.com') { 'Please visit this site using the correct link: http://test.test.com'; exit; }
?>

A: I would avoid the PHP request and go up one level. I haven't tried this, but maybe the .htaccess file could help you, using something similar to this:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^11.11.11.111/testsite$ [NC]
RewriteRule ^(.*)$ test.site.com/$1 [L,R=301]

You might have to play around with it, but I would imagine something along those lines should get you to where you want to be.


text:
Q: Prestashop custom field in groups in admin I have edit AdminGroupsController.php and add one field to renderForm function, like :
array(
      'type' => 'text',
       'label' => $this->l('Myfield'),
       'name' => 'my_field',

and name is same as database column. But I don't get how or where it does the edit and/or add action so I can add the field to be saved to the database. It will post the field now but it does not save it.
Another issue is, I have in override/controllers/admin/AdminGroupsController.php :
class AdminGroupsController extends AdminGroupsControllerCore
{
  public function renderForm()
  {

but it does not work, even I delete cache_index file from cache.
I had to do the edits to the controllers/admin/AdminGroupsController.php ...

A: I found out that I had to copy classes/Group.php to override/classes/Group.php and modify it:
class Group extends GroupCore
{

Seems to be the model for this.
and to add fiel(d) to the model I wanted to update, and it seems it will fetch that also when I try to edit the group.
Also, I still don't know why overriding AdminGroupController DOES NOT work, but overriding this class (model) works...


text:
Q: sigma.js: can't display graph with json I have difficulty display graph with json file. I have try to run the example(load-external-json.html) provide by the application but it can't display graph.
I look through the web for solution but haven't find one solution that solve my problem.
the plug-in use: plugins/sigma.parsers.json/sigma.parsers.json.js
sigma.parsers.json("data/arctic.json", // Here I need to put the filepath instead of "data.json"
{
container: document.getElementById('container'),
settings: {
  defaultNodeColor: '#00a',
  edgeColor: 'default',
  defaultEdgeColor: '#a00'
} });

Best Regards,
luis

A: I believe this plugin makes an XHR request to get the specified file (in this case data/arctic.json). That means you may need a run a server locally in order to see this work properly.
If you have Python installed, an easy way to do this is to run python -m SimpleHTTPServer from the directory where load-external-json.html is located. Then you should be able to see it live at http://localhost:8000/load-external-json.html.

A: From sigma.js wiki on github:

Sigma provides many code examples to show you what it can do and how to use it. Some of these examples load external data files, and you need to access them through a local server to see the examples working.

you need to run a simple Node based http server. Just follow the instructions on the wiki:
https://github.com/jacomyal/sigma.js/wiki


text:
Q: How to add a strike through for each character deleted pressing backspace or del button I got this weird requirement and Im not sure how to achieve it.
When we press the backspace button we shouldnt delete the content but instead add a strike through over the previous text.
What i tried is this
ed.on('keydown', function( args,e ) {
                        if(evt.keyCode == 8){
                            $('#p').wrap('<strike>')
                        }
                    });

But the problem i face is that the whole <p> tag get a strike. Is there a way to add the <strike> to each character deleted on clicking the backspace button using jquery/javascript ?
Note: Im using a TincyMCE plugin for the text editor


text:
Q: Any relation between the singular values of ${\bf A}$ and ${\bf I} - {\bf A}$ Is there any relation between the singular values of ${\bf A}$ and ${\bf I} - {\bf A}$? When $\bf A$ is Hermitian, then the singular values of $\bf A$ is just it eigenvalues, and ${\bf I} - {\bf A}$ has its singular values being $1$ minus those eigenvalues. Is there any relation when $\bf A$ is not Hermitian? Thanks!

For readers of this post, see also If the absolute value of every eigenvalue of a matrix is smaller than 1, is the maximum singular value smaller than 1?.

A: The singular values of $I-A$ are not determined by those of $A$. To illustrate, consider
$$
A_1=\pmatrix{1&-1\\ 1&1},\quad A_2=\pmatrix{-1&1\\ -1&-1},\quad A_3=\pmatrix{1&1\\ 1&-1}.
$$
The singular values of these three matrices are all equal to $\sqrt{2}$, but the singular values of $I-A_1$ are $1,1$, the singular values of $I-A_2$ are $\sqrt{5},\sqrt{5}$ and the singular values of $I-A_3$ are $\sqrt{2}+1,\ \sqrt{2}-1$.
One can, however, relate the singular values of $A$ and $I-A$ by inequalities. See the other answer here by Qiaochu Yuan, for instance.

A: In general, the singular values of two matrices $M, N$ of the same dimension are related to the singular values of $M + N$ by various inequalities, for example the Weyl inequalities
$$\sigma_{k+\ell+1}(M + N) \le \sigma_{k+1}(M) + \sigma_{\ell+1}(N).$$
See this blog post for a proof. We can get various constraints relating the singular values of $A$ and $I - A$ by careful plugging in. For example, with $M = A, N = I - A$, we get
$$\sigma_{k+\ell+1}(I) \le \sigma_{k+1}(A) + \sigma_{\ell+1}(I - A)$$
where $\sigma_{k+\ell+1}(I) = 1$ if $k+\ell+1 \le n$ and $0$ otherwise. This tells us that for $k+\ell+1 \le n$ the singular values $\sigma_{k+1}(A)$ and $\sigma_{\ell+1}(I - A)$ can't both be too small; for example, one of them must be at least $\frac{1}{2}$. (You can think of this as a quantitative version of the observation that the ranks of $A$ and $I - A$ must add up to at least $n$, where all of the matrices here are $n \times n$.)
With $M = I, N = -A$, we get
$$\sigma_{k+\ell+1}(I - A) \le \sigma_{k+1}(I) + \sigma_{\ell+1}(A).$$
Since the singular values are in decreasing order we get the strongest version of this claim by setting $k = 0$, which gives
$$\sigma_{\ell+1}(I - A) \le 1 + \sigma_{\ell+1}(A).$$
This tells us that the singular values of $I - A$ can't be too much larger than the singular values of $A$.
Finally, with $M = I, N = A - I$, we get
$$\sigma_{k+\ell+1}(A) \le \sigma_{k+1}(I) + \sigma_{\ell+1}(I - A).$$
As before the strongest version of this claim comes from setting $k = 0$ and gives
$$\sigma_{\ell+1}(A) \le 1 + \sigma_{\ell+1}(I - A)$$
which says that the singular values of $A$ can't be too much larger than the singular values of $I - A$. This is the same as the previous claim but with the roles of $A$ and $I - A$ switched.


text:
Q: Is Dynamic Method Dispatch only meant to reduce compiling time I am new to JAVA and while studying I came across Dynamic Method Dispatch and this example confused me
class A {
   void callme() {
     System.out.println("Inside A's callme method");
  }
}

class B extends A {
  // override callme()
  void callme() {
    System.out.println("Inside B's callme method");
  }
}

class C extends A {
  // override callme()
  void callme() {
    System.out.println("Inside C's callme method");
  }
}

class Dispatch {
  public static void main(String args[]) {
    A a = new A(); // object of type A
    B b = new B(); // object of type B
    C c = new C(); // object of type C
    A r; // obtain a reference of type A

    r = a; // r refers to an A object
    r.callme(); // calls A's version of callme

    r = b; // r refers to a B object
    r.callme(); // calls B's version of callme

    r = c; // r refers to a C object
    r.callme(); // calls C's version of callme
  }
}

if I just do this
a.callme();
b.callme();
c.callme();

I get the same result.
When i read about DMD by googling I didnt get satisfactory explanations. I just understood that it is late binding but not early binding and thats it. So it is just used to escape during compiling or is there something else. Is there any easy example to understand the benefit.

A: This is more commonly referred to as dynamic binding. It provides polymorphic behavior (Polymorphism is an OOP concept).
In Java, dynamic binding is done based on the actual type of the object. This means that regardless of the declared type of the object, the invoked method body will be the one declared in the class that was used to construct it (the runtime class). This is the class with which new was used.
When you assign r = a, and call r.callme(), Java (at runtime) will see that the class of the object that the variable r points to is A, and will therefore run the implementation of callme() provided by the class A.
Likewise, when you reassign r = b and call r.callme(), Java will see that the class of the object is B and will run B.callme.
Regarding the "why" part, the Java tutorial has states:

The dictionary definition of polymorphism refers to a principle in biology in which an organism or species can have many different forms or stages. This principle can also be applied to object-oriented programming and languages like the Java language. Subclasses of a class can define their own unique behaviors and yet share some of the same functionality of the parent class.


text:
Q: Which install docs to use for two node WSO2 IS installation? I am performing the initial setup of WSO2 Identity Server for a small organization.  We will not have a large number of transactions but we want high availability and reliability.  We have decided on a two node "cluster" or "active/active" configuration.  We have been testing with WSO2 IS v 5.3.0.  I am having a problem sorting through all the documentation and determining which install documents to use.
I found this document for WSO2 IS v 5.2.0 that specifically covers "Clustering Identity Server."  This document references a detailed database setup procedure that appears to be out of date.  It also covers the configuration of Hazelcast along with editing other XML files.  The clustering install guide is located here: https://docs.wso2.com/display/CLUSTER44x/Clustering+Identity+Server+5.1.0+and+5.2.0
Then I found this newer install guide that covers the "active/active" configuration.  This document is titled "Deployment for Small and Medium-sized Enterprises" and is located here https://docs.wso2.com/display/IS5xx/Deployment+for+Small+and+Medium-sized+Enterprises#DeploymentforSmallandMedium-sizedEnterprises-Active/Active
This new document contains a very simple procedure for setting up an active/active configuration that looks like it will meet our needs.  My concern is that this second document does not cover any of the specific database setup that is covered in the clustering document.  This second document does not cover the hazelcast setup or other clustering configurations.  My guess is the "active/active" setup is not the same as the "clustered" architecture.
Can someone clarify the difference between the "clustered" and "active/active" architecture?

A: Deployment pattern 1 in this document is your requirement as I understood. It explains how to configure a High available clustered deployment. There is no difference in the two terms.
I think this is the documentation you are looking for.


text:
Q: need help fixing a java program /*
  * program can convert decimal to binary and report if an illegal char is
  * used
  *program cant convert binary to decimal
  */
  import java.util.Scanner;
/**
   * This class contains a complete program, with just a main() method, for
   * converting non-negative decimal integers (ie, base 10 integers) to
   * positive binary integers (ie, base 2 integers). The values to be
   * converted are read in from the command line.
   */
    public class BaseConversions2
    {
    public static void main(String[] args)
    {
    //prints the intro to the program if the user does not give any
    //numbers
    if (args.length == 0)
    {
        printOpening();
        printIntro();

        return;
    }

    //method to check and convert numbers given by the user
    runCovert(args);
}

private static void runCovert(String[] args)
{
    for (int i = 0; i < args.length; ++i)
    {
        if (args[i].startsWith("d"))
        {

            decimalToBinary(args);
            ++i;

        }

        else
        {

            binaryToDecimal(args);
            ++i;
        }

    }
}

//method to check if the decimal number the user gave is valid
//if it is convert it
//if not print an error
//method to check if the binary number the user gave is valid
//if it is convert it
//if not print an error
public static void binaryToDecimal(String[] args)
{

    for (int i = 0; i < args.length; ++i)
    {

        String value = args[i].replaceAll("b", "");
//                String test = value.replaceAll("\\s+", "");

        if (value.matches("[0-1]+"))
        {
            int test2 = Integer.parseInt(value, 2);
            if (test2 >= 0 && test2 <= 11111111111111l)
            {
                System.out.println("The binary value " + args[i]
                    + " is equivalent to the decimal value "
                    + test2);
                pause();
                System.out.println("");
                ++i;
            }
            else
            {
                System.out.println("Error: "
                    + "The decimal value " + args[i]
                    + " is out of range");

                pause();

            }

        }
        else
        {
            System.out.println("Error: The decimal value "
                + args[i]
                + " has an illegal character in it, ex -+/");

            pause();

        }

    }
}

//method that runs the two conversion methods above
private static void decimalToBinary(String[] args)
{

    for (int i = 0; i < args.length; ++i)
    {

        String value = args[i].replaceAll("d", "");
//                String test = value.replaceAll("\\s+", "");

        if (value.matches("[0-9]+"))
        {
            int test2 = Integer.valueOf(value);
            if (test2 >= 0 && test2 <= 65535)
            {
                System.out.println("The decimal value " + args[i]
                    + " is equivalent to the binary value "
                    + Integer.toBinaryString(test2));
                pause();
                System.out.println("");

            }
            else
            {
                System.out.println("Error: "
                    + "The decimal value " + args[i]
                    + " is out of range, "
                    + "or does not start with the "
                    + "letter \"d");

                pause();

            }

        }
        else
        {
            System.out.println("Error: The decimal value "
                + args[i]
                + " has an illegal character in it, ex -+/");

            pause();

        }

    }
}

private static void printIntro()
{

    System.out.print("This program allows the user to convert "
        + "either decimal integer values to their\n"
        + "equivalent binary values, or vice versa. "
        + "In either case, it then displays, on\n"
        + "the standard output, a sentence containing "
        + "both the original and the converted\n"
        + "values. Values to be converted are entered on "
        + "the command line, separated by a\n"
        + "blank space. Decimal values must have a d "
        + "as their first character and binary\n"
        + "values must have a b as their first character.");
    System.out.println("");
    System.out.println("");
    System.out.print("The program may convert any number "
        + "of values of either type on any given run.\n"
        + "A value is valid only if it contains just "
        + "those digits allowed by its base,\n"
        + "and lies within the permitted range. "
        + "Our maximum values are: 1111111111111111\n"
        + "for binary, and 65535 for decimal. As numbers, "
        + "these maximum values are equal.\n"
        + "The minimum value in both cases is 0.");
    System.out.println("");
    System.out.println("");
    System.out.println("If any given value does not satisfy the "
        + "necessary criteria, an error must be\n"
        + "reported and the value must be ignored by "
        + "the program, which simply carries\n"
        + "on after reporting the error. In addition, "
        + "if the initial character of a value\n"
        + "is neither b nor d, the program also reports "
        + "the error and carries on.");
    System.out.println("");
    System.out.println("");
    System.out.println("\t\t\t\t\t\t\t\tScreen 1 of 1");

    pause();
}

//method to print the opening screen
private static void printOpening()
{

    pause();
    System.out.println("");
    System.out.println("");
}

//method to pause the program
private static void pause()
{
    Scanner kbd = new Scanner(System.in);

    System.out.print("\n\n\n\nPress Enter to continue ...");
    kbd.nextLine();

}

}

i need help working out why my code is not working, basically my code take a binary number and converts it to a decimal and vise versa, however when i put a binary and a decimal numbers in at the same time it say one of them has an illegal character in it and i need to work out why is do this.
i know this is a lot of code but help would really be appreciated as im really stuck right now

A: If it is not necessary, just remove .contact, or add a class to the
. Your code says that change all instance of
 that is a child of the .contact, but I can't see any element with a class of .contact, that's why it does not affect the

EDIT
Added new css thanks to domdom, and removed !important

img {
  margin-right: 5px;
}

  The Soyuz TMA-M is the latest version in the series of Russian Soyuz Spacecraft that are currently used to Transport Crew to and from the International Space Station.

A: assign display:inline css property for both  and  tag.Then reduce the image size.You will get what you need.That is beacuse image size is bigger thet ehat line hight.

A: Add a div outside the p and img elements. Or, just add class contact to your p element.

.contact {
     display: inline !important;
     margin-left: 5px !important;
 }

The Soyuz TMA-M is the latest version in the series of Russian Soyuz Spacecraft that are currently used to Transport Crew to and from the International Space Station.

A: You to use this code

The Soyuz TMA-M is the latest version in the series of Russian Soyuz Spacecraft that are currently used to Transport Crew to and from the International Space Station.


text:
Q: Convert json to pre-defined dynamic models I am working on a project where I am using Refit library for making Http calls and parsing the data to specific models. This works well for most of it, however, I have an issue where I have parse the Json to pre-defined models at run time. As an example the response below from the API can vary based on what actions the user of the app has to take. My question is how to parse the "actions" field from the Json to a specific model. I have pre-defined all the models for which the values can be mapped. Like I have a "ResetPassword", "TwoFactorAuthnentication" etc etc. I would like to use a TypeAdapter or something equivalent to be able to parse the value to specific model.
Any help will be greatly appreciated.
   "authorizeActions": [
        {
            "action": "",
            "required": true,
            "webFallback": true
         }
    ]

   "authorizeActions": [
        {
             "action": "resetPassword",
             "required": true,
             "webFallback": true
         }
     ]

Below is the model which I am using currently
public class AuthorizeActions
{

    [JsonProperty(PropertyName = "required")]
    public bool Required { get; set; }

    [JsonProperty(PropertyName = "webFallback")]
    public bool WebFallback { get; set; }

    //Here i need to define the action , what I want is to be parsed to a
    concrete class like, however the value can change, one time it can
    be "ResetPassword" but it can also be "TwoFactorAuthentication" etc etc.

}


text:
Q: Convex cone and compact subset I need a little help in the following question.

Let $V$ be a real normed vector space and let $K\subset V$ be a compact and convex subset. Let $C\subset V^\prime$ be a convex cone. Assume that, for each $f\in C$, there exists $v_f\in K$ such that $f(v_f)\geqslant0$. Show that, there exists $v\in K$ such that $f(v)\geqslant0$, for all $f\in C$.

Hint: For $f\in C$, show that the collection of sets $K_f=\{v\in K;\ f(v)\geqslant0\}$ (which are closed and non-empty) has the finite intersection property.
Remark. We say that $C$ is a cone in a vector space if for all $v\in C$ and all $\lambda\geqslant0$, we have that $\lambda v\in C$.
My idea: Since $K$ is compact, if we show that the above collection has the finite intersection property, we get that the arbitrary intersection $$\bigcap_{f\in C}K_f$$ is non-empty, by using Theorem 1 of this page. Then it follows the result.
So, how we prove that $\{K_f\}_{f\in C}$ has the F.I.P.?

A: Since you only need a little help, I will write a partial answer and let you figure out the rest:
Suppose that $K$ is a compact in $V={\mathbb R}^n$, $C$ is a closed convex cone in $V^*$. I will be using the standard identification of $V^{**}$ with $V$.
Let $\hat{K}$ denote the cone over $K$, this is again a closed convex cone. If there is no $v\in K$ such that $f(v)\ge 0$ for all $f\in C$, then $\hat{K}\cap C^*=\{0\}$, where $C^*\subset V^{**}=V$ is the dual cone  of $C$. Thus (by a theorem which you should know from your class or the textbook you are reading), there exists a closed half-space $H\subset V$ containing $C^*$ and intersecting $\hat{K}$ only at the origin.  Thus, since $C^{**}=C$, there exists $f\in C$ such that
$$
H= \{x: f(x)\ge 0\}.
$$
Therefore, $f|_{K -\{0\}}$ is strictly positive, implying that $0\in K$. A contradiction, since $c(0)=0\ge 0$ for all $c\in C$.


text:
Q: How to prove this Proposition about determinant functions and linear composition? Let $\Delta$be a determinant function of $N$ dim vector space $V$.
Let $|v\rangle$and $\{|v_k \rangle \}^N_{k = 1} $ in vector space $V$.
Proof the following eqatuion:
$$\sum_{j=1}^N(-1)^{j-1}\Delta(|v\rangle,|v_1\rangle,\cdots,\widehat{|v_j\rangle},\cdots,|v_N\rangle)|v_j\rangle=\Delta(|v_1\rangle,\cdots,|v_N\rangle)|v\rangle$$
$\widehat{|v_j\rangle}$ means that this vector does not exist here.
$\Delta\equiv\sum_\pi\epsilon_\pi\cdot\pi\mathbf{m}$
where $\mathbf{m}$ is a multilinear map
from Hassani, Sadri - Mathematical Physics A Modern Introduction to Its Foundations page 55 Proposition 2.6.9
my proof:
If $\{|v_k \rangle \} ^ N_{k = 1} $is linear dependent, on both sides of the equation of determinant function vectors are linearly dependent, leads to both side of eqatuion equal to $0$.
If  $\{|v_k \rangle \} ^ N_{k = 1} $ is linearly independent, because the dimensions of it is equal to $V$, so that they can span $V $ and be seen as a set of base of $V$, making $|v \rangle $ be linear combination of $\{|v_k \rangle \} ^ N_{k = 1} $ so that $|v\rangle=\sum_{i=1}^N\alpha_i|v_i\rangle$. because determinant function's linearity:
$$\Delta(\sum_{i=1}^N\alpha_i|v_i\rangle,|v_1\rangle,\cdots,\widehat{|v_j\rangle},\cdots,|v_N\rangle)=\sum_{i=1}^N\alpha_i\Delta(|v_i\rangle,|v_1\rangle,\cdots,\widehat{|v_j\rangle},\cdots,|v_N\rangle)\notag$$
$$=\sum_{i=1}^N\sum_{j=1}^N(-1)^{j-1}\alpha_i\Delta(|v_i\rangle,|v_1\rangle,\cdots,\widehat{|v_j\rangle},\cdots,|v_N\rangle)|v_j\rangle$$
$$\Delta(|v\rangle,|v_1\rangle,\cdots,\widehat{|v_j\rangle},\cdots,|v_N\rangle)=0$$unless $i=j$ so
$$\sum_{j=1}^N(-1)^{j-1}\alpha_j\Delta(|v_j\rangle,|v_1\rangle,\cdots,\widehat{|v_j\rangle},\cdots,|v_N\rangle)|v_j\rangle$$
$$=\sum_{j=1}^N\alpha_j|v_j\rangle (-1)^{j-1}\Delta(|v_j\rangle,|v_1\rangle,\cdots,\widehat{|v_j\rangle},\cdots,|v_N\rangle)=\Delta(|v_1\rangle,\cdots,|v_N\rangle)|v\rangle$$
$(-1)^{j-1}$is due to the complete antisymmetry of the Levi-Chivita symbol in the definition of the determinant function, such that every time the sequential order of any position is swapped in a permutation, there's a minus sign as result.
in other words, $j=1$ no transposition,$(-1)^{0}=1$,when $j=2$transposition$|v_j\rangle$and$|v_{j-1}\rangle$ to get $-\Delta(|v_1\rangle,|v_j\rangle,\cdots,|v_N\rangle)$,when $j=3$transposition $|v_j\rangle$and$|v_{j-1}\rangle$to get$\Delta(|v_1\rangle,|v_2\rangle,|v_j\rangle,\cdots,|v_N\rangle)$...
I am a junior undergraduate physics student, and have not been exposed to rigorous mathematical training. I don't know how to write a good formal proof, and I'm not sure if my proof is reasonable, correct, or readable, so I would like to hear some suggestions, thanks.