text:
Q: change.js not changing the price on cart page shopify I am trying to change the total price of product by ajax but its not changing here is my code.
$.ajax({
    type: 'POST',
    url: '/cart/change.js',
      data: {

        id:28641310441556,
        total_price:900,

      },
    dataType: 'json',
    success: function() {
      //do anything
    }
  });

A: Shopify Docs does not mention any price change option via AJAX API. According to Shopify Docs

The /cart/update.js controller allows updates to several items at
  once, including items that might not yet be in the cart (it will add
  them), and it also allows updates to cart attributes and the cart
  note.

If you want to change price via API, use Shopify REST API.
If you want to offer discounts to customer, use Discount Codes.
Cart prices can be manipulated using Shopify Scripts that are offered as a part of Shopify Plus Plan.


text:
Q: How to ensure secure randomization for python password generator Is there a way to have more secure randomization that is very hard to reproduce?
I have tried letting the user enter a seed to create more secure passwords so its harder to repeat the same seed, but i was wondering if there was a better/automatic way to do this?
import random
import string

LENGTH = input("How long do you want your password?: ")
SEED = input("Seed? (The more random the better)")
GENLIST = list(string.ascii_letters + string.digits)
if SEED != "":
    random.seed(SEED)

try:
    PASSWORD = ""
    for i in range(int(LENGTH)):
        PASSWORD += GENLIST[(random.randint(0, 61))]
    print()
    print(PASSWORD)
except TypeError:
    print("Integer not entered")
input()

A: Use os.urandom(), which reads from the corresponding device.

A: The documentation for random has has a section on this.

Warning

  The pseudo-random generators of this module should not be used for security purposes. Use os.urandom() or SystemRandom if you require a cryptographically secure pseudo-random number generator.

I found this in a similar question with some more discussion on the topic.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Apache - handling TCP connections, but not HTTP requests I have a GPS unit that can send data over a TCP connection, but I don't have the ability to modify the message that it sends so it would come to my server in the form of an HTTP request - it can only send a message in a predefined format.
So, I have the following questions:
1) Is it possible to have Apache handle a TCP connection that doesn't come in the form of an HTTP request, and have the message that is sent be processed by a PHP script?
2) If #1 isn't possible, how would you recommend I handle the data being sent to my server?
I will potentially have hundreds, if not thousands, of these GPS units sending data to my server so I need an efficient way to handle all of the connections coming in (which is why I wanted Apache or some other production worthy server to handle the TCP connections). I would like to be able to deal with the message sent over the connection with PHP since that is what the rest of my application runs on, and I will need to insert the data sent into a database (and PHP is really good at doing that kind of thing).
In case it matters, the GPS unit can send data over a UDP connection, but from what I have read Apache doesn't work with UDP connections.
Any suggestions would be welcome.

A: To answer your questions:
1) Not without major modification
2) Build your own server.  This is easily done with several platforms and in several languages.  I personally like to use the Twisted Framework because Python is relatively simple to use and the framework is very flexible.

A: Using Apache wouldn't be practical as it's using a nuclear bomb when a firecracker will suffice. Creating a PHP server is quite simple on Linux with the help of xinetd.
Modify /etc/services. Say you want your service to run on port 56789. In /etc/services, add the line:
gpsservice   56789/tcp

In /etc/xinet.d/, create a file named gpsservice:
service gpsservice
{
    socket_type             = stream
    protocol                = tcp
    wait                    = no
    user                    = yourusername
    server                  = /path/to/your/script
    log_on_success          = HOST PID
    disable                 = no
}

Create your PHP script (chmod it to be executable):
#!/usr/bin/php
<?php
// do stuff
?>

Restart xinetd service xinetd restart
You now have a quick TCP server written in PHP.


text:
Q: Visio Shape Text positioning below the shape using Text Transform I have a building a set of stencil shapes and I need the text to display below the shape. I am using custom formulas to generate the text, and as such the volume of text changes from use case to use case.
What I have come across is using the Text Transform set of properties, and I have tried the following with success for a single line of text:
TxtWidth = TEXTWIDTH(TheText)
TxtPinX = Width * 0.5
TxtLocPinX = TxtWidth * 0.5
TxtHeight = Height * 0
TxtPinY = Height * -0.2
TxtLocPinY = TxtHieght * 0.5
TxtAngle = 0 deg

The problem arises when there is more than a single line of text to display -> the text appears 'half above (inside) and half below' the bottom the shape.
I would like to place all the text, regardless of how many lines there are, underneath the shape.
What I have tried is to set the TxtPinY = some formula different from above eg/ Height * -(TxtHeight). This seems to always result in an 'error in formula'.
I am sure that this is something simple that I am missing, but I cannot figure it out.
Can anybody point me in the right direction?
Cheers and thanks for taking a look at this,
The Frog

A: You could try the TEXTHEIGHT function to get around this. Specify a reasonable maximum text widht as a second parameter for it:
TxtHeight = TEXTHEIGHT(TheText,100)
TxtPinY = 0
TxtLocPinY = TxtHeight

A: You can use the code provided with the stencil available in this post:
http://visguy.com/vgforum/index.php?topic=7461.msg31490#msg31490


text:
Q: How to reflect dropped tables from models in the database using Sequelize commands? I currently call a custom function dbinit() in terminal whenever I have updated my models and want my database to reflect those changes. This function includes the Sequelize method db.sequelize.sync(), which adds some changes to my database including new tables and columns.
Unfortunately, sync() doesn't remove tables from the database to reflect changes in my model. Is there some code I can add to my custom function that will make the database reflect tables that have been deleted?
(using PostgreSQL 9.4.4 and Node.js 5.1.0)


text:
Q: SDL 2.0 won't initialize. Error: "Failed to connect to the Mir Server" I am running Ubuntu 14.04, and using Eclipse CDT.
In my program, I am trying to initialize SDL and if it doesn't initialize then output the error, but SDL_GetError() returns "Failed to connect to the Mir Server". I am sure SDL is installed correctly since I can successfully initialize SDL on another project.
These are the libraries I am using: http://i.imgur.com/SS1mjzQ.png
#include <SDL2/SDL.h>
#include <iostream>

int main(int argc, char* args[]) {
  if(SDL_Init(SDL_INIT_EVERYTHING) < 0) {
    std::cout << SDL_GetError() << std::endl;
  }

  return 0;
}

A: bash$ export DISPLAY=:0
Setting the DISPLAY run time environment variable fixes it for me — typical X Windows lossage, fails to default to your local display (designed for remote displays) which you'd only know if you'd gone to X11 summer camp.
A complete working example in bash:
(cd /tmp && g++ -xc++ - -lSDL2 && (DISPLAY=:0 ./a.out; echo \$? = $?)) <<.
#include <SDL2/SDL.h>
#include <iostream>

int main() {
  if(SDL_Init(SDL_INIT_EVERYTHING) < 0) {
    std::cout << SDL_GetError() << std::endl;
    return 1;
  }
  return 0;
}
.

$? = 0

A: Does the environment you are running on have a windowing system?
This error has come up for me when I'm running tests initializing SDL2 on Travis CI using Ubuntu 14.04. Based on what I've been able to gather from further testing and hints I've gotten from google searches SDL_Init when initializing SDL if it is passed SDL_INIT_VIDEO (which you are doing implicitly with SDL_INIT_EVERYTHING), it will try and connect with the windowing system of your machine.
So perhaps try:
SDL_Init(0)

and then initialize the other subsystems later with:
SDL_InitSubSystem(SDL_INIT_EVERYTHING)

If you do keep in mind that you must quit every subsystem you initialize in this case it's just technically. You would do that like this:
SDL_QuitSubSystem(SDL_INIT_EVERYTHING)

A: I had this error when I was using gcc to compile.
When I used g++ to compile it fixes the issue. The Lazy Foo tutorial also recommends you to use g++ to compile.
If you are having this problem you can try using g++ to compile and see if this resolves the issue.


text:
Q: Calculate the the properties of Region Of Interest of an Image applying Ostu threshold and Skimage I am using the following image

I would like to calculate the properties for example area,mean_intensity', 'solidity of the maroon color. I have used some code in python to read the image and convert it in grayscale then Ostu threshold to convert it binary image
image = img_as_ubyte(rgb2gray(io.imread("1.jpg")))
plt.imshow(image, cmap='gray')

from skimage.filters import threshold_otsu
threshold = threshold_otsu(image)

#Generate thresholded image
thresholded_img = image < threshold
plt.imshow(thresholded_img,cmap='gray')

After applying the little code I got the following binary image

I can see few scattered black pixels around the solid area. First of all, I want to clear those and then Calculate the properties of my Region of Interest which is black.
What could be the next way it can be done. I have seen measure.regionprops() in from skimage. Not sure can I use it here.


text:
Q: Is the Field Norm Distributive over Multiplication? Let the field norm $N_{L/K}$ for a field extension $L/K$ be given by (for $\alpha\in L$)
$N_{L/K}(\alpha)=(\prod_{j=1}^n \sigma_j(\alpha))^{[L:K(\alpha)]}$,
where $\sigma_j(\alpha)$ are the roots of the minimal polynomial of $\alpha$ in $K$. If $L/K$ is a Galois extension, then
$N_{L/K}(\alpha)=\prod_{\sigma\in Gal(L/K)} \sigma(\alpha)$,
which is distributive over multiplication in $L$ because the automorphisms $\sigma$ are. In particular:
$N_{L/K}(\alpha\beta)=\prod_{\sigma\in Gal(L/K)} \sigma(\alpha\beta)=\prod_{\sigma\in Gal(L/K)} \sigma(\alpha)\prod_{\sigma\in Gal(L/K)}\sigma(\beta)=N_{L/K}(\alpha)N_{L/K}(\beta)$.
Question: For an arbitrary field extension $L/K$, is the norm $N_{L/k}$ distributive over multiplication?


text:
Q: Redirect Traffic to Different pages bases on the address used I Have a webserver running on my raspberry pi and I am using it for multiple projects.  I can easily enough access the different pages with something of the from ip-addrss\project-name.php.  I was looking to eliminate the ip address and found I could set up the domain names on my router. so http:/projector or projector.local redirects to the raspberry pi.  The problem is it always goes to the default page. I can setup http:/ProjectA and http:/ProjectB but they both go to index.php. is there a way in php to redirect based on the url used to get there. so index.php would redirect to projectA.php or projectB.php depending on which url was used?  I looked through $_SERVER and $_POST but they didn't seem to have the right information. Some research lead me to believe apache could do this but I have experience configuring apache.

A: You COULD do it in PHP, by checking $_SERVER['HTTP_HOST'], but that value can be manipulated by who is making the request. So I can access http://ProjectA while specifying the headers host: ProjectB or similar, and you will think that it's ProjectB.
In fact, if you look at the HTTP request, HTTP_HOST is the only way one would determine the domain name. So it doesn't matter if you do it in PHP or Apache.
In Apache, you could do it by enabling vhosts mod for apache. If you're running linux, the command line might be something like this a2enmod vhosts_alias. This will allow you to configure different hosts, determined by the host HTTP header, and IP. Each virtual host points to an individual directory. You can have 2 hosts pointing at the same directory, but you'd have to modify the directory properties, something like this:
<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName ProjectA
    ServerAlias www.ProjectA #you can skip this line if it doesn't apply
    DocumentRoot /var/www/foo
    <Directory "/var/www/foo">
        DirectoryIndex ProjectA.php
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

I didn't try to configure the same directory differently for 2 different hosts. My instincts say that it should work, but it may not.
Here's a guide on how to configure virtual hosts on Ubuntu. https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts
I have no idea how different it is on Raspberry Pi. But the apache config files should have exactly the same syntax and rules. Only paths and commands might differ.


text:
Q: Как в строке подсчитать сумму не целых чисел Javascript
 var stroka = "48,500 52 68,320";

В результате получить 168,820

A: var stroka = "48,500 52 68,320";
var summ = 0.0;
stroka.split(' ').map(item => {
   summ += parseFloat(item.replace(',', '.'));
   return item;
})
// устанавливаем float с 3мя знаками после запятой
result = summ.toFixed(3) + "";
result = result.replace('.', ',')

Использован новый стандарт функций называемый "arrow functions" из ES6, введен уже в Chrome, Firefox. Не поддерживается пока Opera и Safari
Пример через стандартную функцию:
var stroka = "48,500 52 68,320";
var summ = 0.0;
stroka.split(' ').map(function(item) {
   summ += parseFloat(item.replace(',', '.'));
   return item;
})
// устанавливаем float с 3мя знаками после запятой
result = summ.toFixed(3) + "";
result = result.replace('.', ',')


text:
Q: feature selection using PCA is there any way to use PCA for feature selection?! I know what is pca and it is used for dimension reduction.
if you can say no or give me some sources if answer is yes, I would be greatly appreciate it


text:
Q: Is Python's sort function the same as Linux's sort with LC_ALL=C I'm porting a Bash script to Python. The script sets LC_ALL=C and uses the Linux sort command to ensure the native byte order instead of locale-specific sort orders (http://stackoverflow.com/questions/28881/why-doesnt-sort-sort-the-same-on-every-machine).
In Python, I want to use Python's list sort() or sorted() functions (without the key= option). Will I always get the same results as Linux sort with LC_ALL=C?

A: Sorting should behave as you expect if you pass locale.strcoll as the cmp argument to
list.sort() and sorted():
import locale
locale.setlocale(locale.LC_ALL, "C")
yourList.sort(cmp=locale.strcoll)

But in Python 3 (from this answer):
import locale
from functools import cmp_to_key
locale.setlocale(locale.LC_ALL, "C")
yourList.sort(key=cmp_to_key(locale.strcoll))

A: Considering you can add a comparison function, you can make sure that the sort is going to be the equivalent of LC_ALL=C. From the docs, though, it looks like if all the characters are 7bit, then it sorts in this manner by default, otherwise is uses locale specific sorting.
In the case that you have 8bit or Unicode characters, then locale specific sorting makes a lot of sense.

A: Non-unicode strings in Python version less than 3 are actually bytes. sort function and methods do not do anything to enforce locale (locale module function is needed to facilitate locale-aware sorting explicitly).
unicode strings and all strings of Python 3.x are no more bytes. There is a "bytes" type in Python 3.

A: I have been using International Components for Unicode, along with the PyICU bindings, to sort things with sorted() and using my own locale (Catalan on my case). For example, ordering a list of user profiles by name property:
collator = PyICU.Collator.createInstance(PyICU.Locale('ca_ES.UTF-8'))
sorted(user_profiles, key=lambda x: x.name, cmp=collator.compare)

A: Yes! to your specific question

Will I always get the same results as Linux sort with LC_ALL=C?

Yes! Python defaults to the C locale, so you can expect the same behavior as linux LC_ALL=C sort.
You can be more explicit about this behavior by setting it yourself and sorting with strxfrm:
locale.setlocale(locale.LC_ALL, 'C')  # same as you do in linux
locale.setlocale(locale.LC_COLLATE, 'C')  # specific to sorting

mylist.sort(key=locale.strxfrm)
# To incorporate locale sorting with other uses of key=,
# wrap locale.strxfrm() around whatever else you're doing:
mylist.sort(key=lambda i: locale.strxfrm( mysortfunc(i) ))

Documentation
From https://docs.python.org/3/library/locale.html :

Initially, when a program is started, the locale is the C locale, no matter what the user's preferred locale is. ... The program must explicitly say that it wants the user's preferred locale settings for other categories by calling setlocale(LC_ALL, '').

According to POSIX, a program which has not called setlocale(LC_ALL, '') runs using the portable 'C' locale. Calling setlocale(LC_ALL, '') lets it use the default locale as defined by the LANG variable. Since we do not want to interfere with the current locale setting we thus emulate the behavior in the way described above.

Example
# What are the settings when Python first starts?
>>> import locale
>>> locale.setlocale(locale.LC_ALL, None)  # If locale is omitted or None, the current setting for category is returned.
'LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C'
                                           # ^^^^^^^^^^^^
>>> locale.getlocale(locale.LC_COLLATE)  # The 'C' setting is equivalent to:
(None, None)

# Set LC_COLLATE & use strcoll/strxfrm to sort according to user's locale
# (like linux sort(1) does by default):
>>> locale.setlocale(locale.LC_COLLATE, '')  # An empty string specifies the user's default settings.
'en_US.UTF-8'
>>> locale.setlocale(locale.LC_ALL, None)
'LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C'
                                           # ^^^^^^^^^^^^^^^^^^^^^^
>>> mylist.sort(key=locale.strxfrm)
>>> mylist.sort(key=lambda i: locale.strxfrm( mysortfunc(i) ))

# Set LC_ALL (everything) to user's locale (common practice):
>>> locale.setlocale(locale.LC_ALL, '')
'en_US.UTF-8'
>>> locale.setlocale(locale.LC_ALL, None)
'en_US.UTF-8'
>>> locale.getlocale(locale.LC_COLLATE)
('en_US', 'UTF-8')

# Use portable/C locale, including byte-order sorting:
>>> locale.setlocale(locale.LC_ALL, 'C')
'C'
>>> locale.setlocale(locale.LC_ALL, None)
'C'
# The LC_ALL setting overrode our previous LC_COLLATE setting:
>>> locale.setlocale(locale.LC_COLLATE, None)
'C'
>>> locale.getlocale(locale.LC_COLLATE)
(None, None)

Many thanks to Frédéric Hamidi's answer, which sent me in the right direction to understand this.


text:
Q: Tensorflow: Aborted configuration when building from source I am trying to build Tensorflow from source on a Centos6 machine (with GPU support - Titanx). I first built bazel from source. The Tensorflow configuration halted with the following message:
WARNING: Output base '/uufs/chpc.utah.edu/common/home/hpcapps/.cache/bazel/_bazel_hpcapps/9e108560974a04e4bdc017d0599ed450' is on NFS. This may lead to surprising failures and undetermined behavior.
Extracting Bazel installation...
..............
INFO: Starting clean (this may take a while). Consider using --expunge_async if the clean takes more than several minutes.
ERROR: /uufs/chpc.utah.edu/common/home/hpcapps/.cache/bazel/_bazel_hpcapps/9e108560974a04e4bdc017d0599ed450/server (Directory not empty).
Notice that the I emptied the .cache/bazel directory before starting the ./configure.
Any idea what may have gone wrong?
Thanks,
Wim


text:
Q: Click and Get ArrayValue I want display the First value in Array when I click, click again, show the 2nd Value in Array (increase by one...)

 const btn = document.querySelector('.btn');
    const content = document.querySelector('.content');

    btn.addEventListener('click',getArray);

    function getArray(event){
       const items = [10,20,30,40,50];

    }
<button class="btn">Array Index</button>

A: var items = [10,20,30,40,50];
var x = "";
var i = 0;

document.getElementById("btn").onclick = function() {
if( i < items .length) {
x += items [i++] + "
";
}
 document.getElementById("text").innerHTML = x;
}

<button id="btn">Result</button>

A: Here is one possible approach, using a generator function.

const btn = document.querySelector('.btn');
const content = document.querySelector('.content');
const gen = getNextNumber();

btn.addEventListener('click',getArray);

function getArray(event){
   content.innerText = gen.next().value;
}

function *getNextNumber() {
    const items = [10,20,30,40,50];
    for(let i = 0; i < items.length; ++i) {
        yield items[i];
    }
}
<button class="btn">Array Index</button>

A: I think this fits your needs:

const btn = document.querySelector('.btn');
const content = document.querySelector('.content');
let counter = 0; // Counter to access the index

btn.addEventListener('click', getArray);

function getArray() { // Removed 'event' here -> not necessary
  const items = [10, 20, 30, 40, 50];

  if (counter < items.length) { // Prevent getting "undefined"
    content.innerText = items[counter]; // Change the content of your div
    counter++; // Increase counter to get the next index
  }
}
<button class="btn">Array Index</button>

I added my changes and additions to your code as comments


text:
Q: Adding an animation to a random walk plot [Python] I have written a code that plots random walks. There are traj different random walks generated and each consists of n steps. I would like to animate their moves. How can I do that?
My code below:
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

def random_walk_2D(n, traj = 1):

    for i in range(traj):

        skoki = np.array([[0, 1], [1, 0], [-1, 0], [0, -1]])
        losy = np.random.randint(4, size = n)

        temp = skoki[losy, :]

        x = np.array([[0, 0]])

        temp1 = np.concatenate((x, temp), axis = 0)

        traj = np.cumsum(temp1, axis = 0)

        plt.plot(traj[:, 0], traj[:, 1])
        plt.plot(traj[-1][0], traj[-1][1], 'ro') #the last point

    plt.show()

A: As it stands now, you generate traj in one shot. I mean that traj in traj = np.cumsum(temp1, axis = 0) already contains all the "story" from the beginning to the end. If you want to create an animation that is in "real time", you should not generate traj in one shot, but iteratively, plotting new steps as they come. What about doing:
import numpy as np
import matplotlib.pyplot as plt

def real_time_random_walk_2D_NT(
    nb_steps, nb_trajs, with_dots=False, save_trajs=False, tpause=.01
    ):
    """
    Parameters
    ----------
    nb_steps     : integer
                   number of steps
    nb_trajs     : integer
                   number of trajectories
    save_trajs   : boolean (optional)
                   If True, entire trajectories are saved rather than
                   saving only the last steps needed for plotting.
                   False by default.
    with_dots    : boolean (optional)
                   If True, dots representative of random-walking entities
                   are displayed. Has precedence over `save_trajs`.
                   False by default.
    tpause       : float (optional)
                   Pausing time between 2 steps. .01 secondes by default.
    """
    skoki = np.array([[0, 1], [1, 0], [-1, 0], [0, -1]])
    trajs = np.zeros((nb_trajs, 1, 2))
    for i in range(nb_steps):
        _steps = []
        for j in range(nb_trajs):
            traj = trajs[j,:,:]
            losy = np.random.randint(4, size = 1)
            temp = skoki[losy, :]
            traj = np.concatenate((traj, temp), axis = 0)
            traj[-1,:]   += traj[-2,:]
            _steps.append(traj)
        if save_trajs or with_dots:
            trajs = np.array(_steps)
            if with_dots:
                plt.cla()
                plt.plot(trajs[:,i, 0].T, trajs[:,i, 1].T, 'ro') ## There are leeway in avoiding these costly transpositions
                plt.plot(trajs[:,:i+1, 0].T, trajs[:,:i+1, 1].T)
            else:
                plt.plot(trajs[:,-1+i:i+1, 0].T, trajs[:,-1+i:i+1, 1].T)
        else:
            trajs = np.array(_steps)[:,-2:,:]
            plt.plot(trajs[:,:, 0].T, trajs[:,:, 1].T)

        plt.pause(tpause)

real_time_random_walk_2D_NT(50, 6, with_dots=True)

real_time_random_walk_2D_NT(50, 6)


text:
Q: svg fill grouped polylines to make a filled shape I working on create an svg floorplan at the momoment, a consists of multiple paths that are grouped together, where there is a break in a path that represents a doorway.
However I try and fill my group I don't get a complete fill, I get fill that is partial and consists of isometric shapes, is there a way to fill a group completely even when I have non joined paths?
My code,
<g id="Group" stroke="none" stroke-width="1" fill="blue" fill-rule="evenodd" transform="translate(66.000000, 103.000000)">
    <path d="M184.068359,305.802734 L143.80664,305.802734" id="Path-17" stroke="#979797"></path>
    <polyline id="Path-18" stroke="#979797" points="93.7480469 305.845703 0.466745757 305.845703 0.466745757 92.1182094 141.39461 92.1182094 195.207031 65.8398438 195.207031 54.2361072 188.045332 54.2361072"></polyline>
    <polyline id="Path-19" stroke="#979797" points="188.199219 6.6484375 207.78952 6.6484375 208.511719 0.703125 284.00589 0.703125 284.00589 5.9776195"></polyline>
    <polyline id="Path-20" stroke="#979797" points="284.890625 55.1621094 283.505859 134.390625 183.903627 134.390625 183.903627 306.27391"></polyline>
</g>

What I am trying to do is fill everything inside the red strokes as blue, but make it a complete fill?
https://jsbin.com/reyunufeno/edit?html,output

A: In the code below I have merged all of your shape elements into one path, beginning each with a new "M" which causes the "pen" to "jump" over the doorways. For the original I coloured the stroke red and made the fill "none". I then just copied that original path and deleted the internal "M"s to "connect" the floor outline across the doorways, eliminated the stroke of the copy and filled the copy with blue.

<svg width="300" height="320">
  <g transform="translate(5,5)">
    <path stroke="red" stroke-width="10" fill="none" d="M184.068359,305.802734 L143.80664,305.802734 M93.7480469 305.845703 0.466745757 305.845703 0.466745757 92.1182094 141.39461 92.1182094 195.207031 65.8398438 195.207031 54.2361072 188.045332 54.2361072 M188.199219 6.6484375 207.78952 6.6484375 208.511719 0.703125 284.00589 0.703125 284.00589 5.9776195 M284.890625 55.1621094 283.505859 134.390625 183.903627 134.390625 183.903627 306.27391"/>
    <path fill="blue"                                d="M184.068359,305.802734 L143.80664,305.802734  93.7480469 305.845703 0.466745757 305.845703 0.466745757 92.1182094 141.39461 92.1182094 195.207031 65.8398438 195.207031 54.2361072 188.045332 54.2361072  188.199219 6.6484375 207.78952 6.6484375 208.511719 0.703125 284.00589 0.703125 284.00589 5.9776195  284.890625 55.1621094 283.505859 134.390625 183.903627 134.390625 183.903627 306.27391"/>
  </g>
</svg>


text:
Q: How to architect Service Broker with three or more systems? I'm trying to implement a Service Broker architecture for a business process involving three systems and I want to do it in the spirit of using SB as designed.

*

*System 'A' is an accounting system. Whenever an invoice is 'released' in
that system, a SB conversation starts.

*System 'O' is a internally-developed orchestration system. Think of
it as morally equivalent to BizTalk.

*System 'C' is a database that has information that needs to be
included on the final invoice to be sent to the customer.
How do I structure a conversation or series of conversations to touch all three systems?
Can I have 'A' submit to 'O', which does a lookup into 'C' - all in the context of a single conversation?


text:
Q: Spinner not displaying entries I have two spinners, one where the user selects the food type and a second that is meant to display the food (e.g. Breakfast and Porridge). However my second spinner isn't displaying my foods. Why would this appear? Below is my MainActivity class and my Food class code.
private void chooseBreakfast() {
    planspinner1 = (Spinner) findViewById(R.id.planspinner);
    List<Food> planlist = new ArrayList<Food>();
    planlist.add(new Food("Porridge-35g/140cal",4));
    planlist.add(new Food("Coffee-10g/10cal",1));
    planlist.add(new Food("Toast-30g/90cal",3));

    for(int i =0;i<planlist.size();i++){
        System.out.println(planlist.get(i).getName()+ "has" + planlist.get(i).getCalories()+ "calories.");
    }

    ArrayAdapter<Food> planAdapter1 = new ArrayAdapter<Food>(this,android.R.layout.simple_spinner_item, planlist);
    planAdapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    planspinner1.setAdapter(planAdapter1);
}

public class Food {
    private String mstrName;
    private int mintCalories;

    public Food(String pstrName, int pintCalories) {
        mstrName = pstrName;
        mintCalories = pintCalories;
    }

    public String getName() {
        return mstrName;
    }

    public int getCalories() {
        return mintCalories;
    }
}

Why would my second spinner appear like this?

A: Override toString() method of your Food class and it might work.
  public class Food {
    private String mstrName;
    private int mintCalories;

    public Food(String pstrName, int pintCalories) {
        mstrName = pstrName;
        mintCalories = pintCalories;
    }

    public String getName() {
        return mstrName;
    }

    public int getCalories() {
        return mintCalories;
    }

    public String toString() {
        return getName();
    }

}


text:
Q: MYSQL эфиктивный запрос для выборки последних значений с разным типом Помогите написать запрос оптимальный по скорости для поиска в бд MYSQL.
Примерная структура таблицы:
id, type, value, time

Значения столбца type (1-10)
Мне нужно сделать выборку из таблицы самых последних значений по полю time где type = 1 и type = 2 и type = 3. При этом я должен получить только самые последнии строки из БД где type будет 1, 2 и 3. В результате выполнения запросса должен получить 3 строки, в случае если записей с type = 2 к примеру нет, то получить только 2 строки где type = 1 и 2.
Запрос SELECT * FROM table WHERE type = 1 ORDER BY time DESC LIMIT 1 мне полностью подходит, но я не хочу отправлять 3 таких запросса для каждого значения Type.
Подскажите с запроссом для решения моей задачи.

A: (SELECT * FROM table WHERE type = 1 ORDER BY time DESC LIMIT 1)
UNION ALL
(SELECT * FROM table WHERE type = 2 ORDER BY time DESC LIMIT 1)
UNION ALL
(SELECT * FROM table WHERE type = 3 ORDER BY time DESC LIMIT 1)


text:
Q: Navigation Drawer stays open I'm working on a c# WPF program and i've a Navigation Drawer that should be closed when a checkBox is checked and opened when the checkbox is not checked
Here is a Screenshot from the Navigation Drawer

I'm trying to do that with a DataTrigger.
Here is the XAML Code:
My Storyboards:
<Window.Resources>
        <Storyboard x:Key="OpenMenu">
            <DoubleAnimation
                Storyboard.TargetProperty="(Width)"
                From="70"
                To="350"
                Duration="0:0:0.5" />
        </Storyboard>
        <Storyboard x:Key="CloseMenu">
            <DoubleAnimation
                Storyboard.TargetProperty="(Width)"
                From="350"
                To="70"
                Duration="0:0:0.5" />
        </Storyboard>
    </Window.Resources>

And the DataTrigger:
<Grid.Style>
                <Style TargetType="Grid">
                    <Setter Property="Width" Value="350" />
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding ElementName=CheckBox, Path=IsChecked}" Value="False">
                            <DataTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource CloseMenu}" />
                            </DataTrigger.EnterActions>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding ElementName=CheckBox, Path=IsChecked}" Value="True">
                            <DataTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource OpenMenu}" />
                            </DataTrigger.EnterActions>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Grid.Style>

And the CheckBox
<CheckBox Name="CheckBox" />

The problem is that the Navigation Drawer stays open.
It closes quickly and opens again when I check the CheckBox.
Any ideas?
EDIT:
This is the code after BionicCode's answer:
<Grid.Style>
                <Style TargetType="Grid">
                    <Setter Property="Width" Value="70" />
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding ElementName=CheckBox, Path=IsChecked}" Value="True">
                            <DataTrigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource OpenMenu}" />
                            </DataTrigger.EnterActions>
                            <DataTrigger.ExitActions>
                                <BeginStoryboard Storyboard="{StaticResource CloseMenu}" />
                            </DataTrigger.ExitActions>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Grid.Style>


text:
Q: Cambiar el nombre del archivo pdf ¿Cómo puedo hacer para ponerle un nombre a mi archivo generado en pdf en MVC al momento de presionar descargar?
Es decir, es un poco compleja la pregunta, pero la idea es que al clickear sobre descargar muestre título y cuota.
Dejo captura para que se entienda lo que quiero decir:

Presionamos el botón descargar y luego se nos abre el cuadro:

Quiero saber si al nombre 100878.pdf se le puede agregar algo más de manera programada. Es decir, una vez que presione el botón descargar el nombre sea: 100878-08.pdf.
Dejo algo del código del pdf generado en MVC:
@model IEnumerable<ProviEntity.Models.ProvidusCuotas>

@{
    ViewBag.Title = "DetailCustomer";
}

    <meta name="viewport" content="width=device-width" />
    <title>Inicio</title>

            @foreach (var item in Model)
            {

                    Suscriptor:

                            @Html.DisplayFor(modelItem => item.apellido), @Html.DisplayFor(modelItem => item.nombre)

                    Domicilio:

                        @Html.DisplayFor(modelItem => item.domicilio)

                    Barrio:

                        @Html.DisplayFor(modelItem => item.barrio)

                    Localidad:

                        @Html.DisplayFor(modelItem => item.localidad)

                    Teléfono:

                        @Html.DisplayFor(modelItem => item.telefono)

                    Celular:

                        @Html.DisplayFor(modelItem => item.celular)

            }

    @*-----------------------------------------------DATOS DE DERECHA DE LA CHEQUERA---------------------------------------------------------------**@

        @**Fecha Sorteo*@

            @foreach (var item in Model)
            {

                    @Html.DisplayFor(modelItem => item.fechaSorteo)

            }

        @*Plan Anterior*@

            @foreach (var item in Model)
            {

                        @Html.DisplayFor(modelItem => item.planantes)

            }

        @*Valor Nominal*@

            @foreach (var item in Model)
            {

                        @Html.DisplayFor(modelItem => item.valnom)

            }

        @*Valor en Cero*@

                    $0

        @*Valor Nominal**@

            @foreach (var item in Model)
            {

                        @Html.DisplayFor(modelItem => item.valnom)

            }

        @*Descripción*@

            @foreach (var item in Model)
            {

                        @Html.DisplayFor(modelItem => item.descplanactual)

            }

        @*Monto = Importe*@

            @foreach (var item in Model)
            {

                    @Html.DisplayFor(modelItem => item.monto)

            }

            @foreach (var item in Model)
            {

                    @Html.DisplayFor(modelItem => item.acidzona)
                    @Html.DisplayFor(modelItem => item.cobrador)
                    @Html.DisplayFor(modelItem => item.codigo)
                    @Html.DisplayFor(modelItem => item.titulo)/@Html.DisplayFor(modelItem => item.endoso)
                    @Html.DisplayFor(modelItem => item.sorteo)
                    @Html.DisplayFor(modelItem => item.cuota)
                    @Html.DisplayFor(modelItem => item.vencimiento)	@*vencimiento*@

            }

A: En tu controlador, antes de tu return, debes agregar un encabezado a la respuesta.
public ActionResult GenerarPdf()
{
    ...
    Response.Clear();
    Response.AppendHeader("Content-Disposition", "attachment; filename=\"NOMBRE DEL ARCHIVO.pdf\"");
    // "attachment" es para forzar una descarga, puedes sustituirlo por "inline" para que el
    // navegador lo abra en una nueva pestaña.

    // En caso de que generes un Stream:
    return new FileContentResult(bytesDelArchivo, "application/pdf");
    // En caso de que lo hagas por una ruta de archivo físico:
    return File(rutaDelArchivo, "application/pdf");
}


text:
Q: ImageViews being cut off and resized I have a three section relative layout for a login page.
The first section at the top of the page is 1 Imageview and 2 Textviews.
The second section is 6 RelativeLayouts containing 1 ImageView to the left and 1 TextView to the right.
The third section is a Button

The first four icons are ok on any device. The 5th and 6th are both getting resized or not showing up.
I would like to see all 6 but if 1 can't fit dont add it. How can I do this in a proper way.
Thanks - P.S Code is below
 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/newd_login_overlay"
    android:orientation="vertical" >

<LinearLayout android:id="@+id/linLoginText"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:orientation="vertical" >

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/login_logo_white" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="@string/newd_login_text_one"
        android:textColor="@android:color/white"
        android:textSize="24sp" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="@string/newd_login_text_two"
        android:textColor="@android:color/white"
        android:textSize="18sp" />
</LinearLayout>

<LinearLayout
    android:id="@+id/linLoginFeature"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_above="@+id/btnLoginCreate"
    android:layout_below="@+id/linLoginText"
    android:layout_marginLeft="5dp"
    android:layout_marginStart="5dp"
    android:orientation="vertical" >

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="5dp">

        <ImageView android:id="@+id/imgLoginSecurity"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:src="@drawable/newd_security"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginStart="10dp"
            android:layout_toRightOf="@+id/imgLoginSecurity"
            android:layout_toEndOf="@+id/imgLoginSecurity"
            android:layout_centerVertical="true"
            android:text="@string/newd_login_security"
            android:textColor="@android:color/white"
            android:textSize="18sp" />

    </RelativeLayout>

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="5dp">

        <ImageView android:id="@+id/imgLoginAntivirus"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:src="@drawable/newd_antivirus"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginStart="10dp"
            android:layout_toRightOf="@+id/imgLoginAntivirus"
            android:layout_toEndOf="@+id/imgLoginAntivirus"
            android:layout_centerVertical="true"
            android:text="@string/newd_login_antivirus"
            android:textColor="@android:color/white"
            android:textSize="18sp" />

    </RelativeLayout>

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="5dp">

        <ImageView android:id="@+id/imgLoginTracker"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:src="@drawable/newd_phone_tracker"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginStart="10dp"
            android:layout_toRightOf="@+id/imgLoginTracker"
            android:layout_toEndOf="@+id/imgLoginTracker"
            android:layout_centerVertical="true"
            android:text="@string/newd_login_booster"
            android:textColor="@android:color/white"
            android:textSize="18sp" />

    </RelativeLayout>

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="5dp">

        <ImageView android:id="@+id/imgLoginBackup"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:src="@drawable/newd_backup"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginStart="10dp"
            android:layout_toRightOf="@+id/imgLoginBackup"
            android:layout_toEndOf="@+id/imgLoginBackup"
            android:layout_centerVertical="true"
            android:text="@string/newd_login_backup"
            android:textColor="@android:color/white"
            android:textSize="18sp" />

    </RelativeLayout>

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="5dp">

        <ImageView android:id="@+id/imgLoginPrivacy"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:src="@drawable/newd_privacy"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginStart="10dp"
            android:layout_toRightOf="@+id/imgLoginPrivacy"
            android:layout_toEndOf="@+id/imgLoginPrivacy"
            android:layout_centerVertical="true"
            android:text="@string/newd_login_privacy"
            android:textColor="@android:color/white"
            android:textSize="18sp" />

    </RelativeLayout>

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="5dp">

        <ImageView android:id="@+id/imgLoginBooster"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:src="@drawable/newd_signal_booster"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginStart="10dp"
            android:layout_toRightOf="@+id/imgLoginBooster"
            android:layout_toEndOf="@+id/imgLoginBooster"
            android:layout_centerVertical="true"
            android:text="@string/newd_login_tracker"
            android:textColor="@android:color/white"
            android:textSize="18sp" />

    </RelativeLayout>

</LinearLayout>

<Button
    android:id="@+id/btnLoginCreate"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="10dp"
    android:layout_marginRight="20dp"
    android:layout_marginEnd="20dp"
    android:layout_marginLeft="20dp"
    android:layout_marginStart="20dp"
    android:layout_alignParentBottom="true"
    android:background="@drawable/newd_login_btn"
    android:gravity="center"
    android:text="@string/newd_login_btn_text"
    android:textColor="@android:color/black" />

</RelativeLayout>

A: Use  android:layout_weight
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/newd_login_overlay"
    android:orientation="vertical" >

    <LinearLayout android:id="@+id/linLoginText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:orientation="vertical" >

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:src="@drawable/login_logo_white" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="@string/newd_login_text_one"
            android:textColor="@android:color/white"
            android:textSize="24sp" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="@string/newd_login_text_two"
            android:textColor="@android:color/white"
            android:textSize="18sp" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/linLoginFeature"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:weightSum="6"
        android:layout_above="@+id/btnLoginCreate"
        android:layout_below="@+id/linLoginText"
        android:layout_marginLeft="5dp"
        android:layout_marginStart="5dp"
        android:orientation="vertical" >

        <RelativeLayout
            android:layout_weight="1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="5dp">

            <ImageView android:id="@+id/imgLoginSecurity"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:src="@drawable/newd_security"/>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:layout_marginStart="10dp"
                android:layout_toRightOf="@+id/imgLoginSecurity"
                android:layout_toEndOf="@+id/imgLoginSecurity"
                android:layout_centerVertical="true"
                android:text="@string/newd_login_security"
                android:textColor="@android:color/white"
                android:textSize="18sp" />

        </RelativeLayout>

        <RelativeLayout
            android:layout_weight="1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="5dp">

            <ImageView android:id="@+id/imgLoginAntivirus"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:src="@drawable/newd_antivirus"/>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:layout_marginStart="10dp"
                android:layout_toRightOf="@+id/imgLoginAntivirus"
                android:layout_toEndOf="@+id/imgLoginAntivirus"
                android:layout_centerVertical="true"
                android:text="@string/newd_login_antivirus"
                android:textColor="@android:color/white"
                android:textSize="18sp" />

        </RelativeLayout>

        <RelativeLayout
            android:layout_weight="1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="5dp">

            <ImageView android:id="@+id/imgLoginTracker"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:src="@drawable/newd_phone_tracker"/>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:layout_marginStart="10dp"
                android:layout_toRightOf="@+id/imgLoginTracker"
                android:layout_toEndOf="@+id/imgLoginTracker"
                android:layout_centerVertical="true"
                android:text="@string/newd_login_booster"
                android:textColor="@android:color/white"
                android:textSize="18sp" />

        </RelativeLayout>

        <RelativeLayout
            android:layout_weight="1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="5dp">

            <ImageView android:id="@+id/imgLoginBackup"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:src="@drawable/newd_backup"/>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:layout_marginStart="10dp"
                android:layout_toRightOf="@+id/imgLoginBackup"
                android:layout_toEndOf="@+id/imgLoginBackup"
                android:layout_centerVertical="true"
                android:text="@string/newd_login_backup"
                android:textColor="@android:color/white"
                android:textSize="18sp" />

        </RelativeLayout>

        <RelativeLayout
            android:layout_weight="1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="5dp">

            <ImageView android:id="@+id/imgLoginPrivacy"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:src="@drawable/newd_privacy"/>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:layout_marginStart="10dp"
                android:layout_toRightOf="@+id/imgLoginPrivacy"
                android:layout_toEndOf="@+id/imgLoginPrivacy"
                android:layout_centerVertical="true"
                android:text="@string/newd_login_privacy"
                android:textColor="@android:color/white"
                android:textSize="18sp" />

        </RelativeLayout>

        <RelativeLayout
            android:layout_weight="1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="5dp">

            <ImageView android:id="@+id/imgLoginBooster"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:src="@drawable/newd_signal_booster"/>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:layout_marginStart="10dp"
                android:layout_toRightOf="@+id/imgLoginBooster"
                android:layout_toEndOf="@+id/imgLoginBooster"
                android:layout_centerVertical="true"
                android:text="@string/newd_login_tracker"
                android:textColor="@android:color/white"
                android:textSize="18sp" />

        </RelativeLayout>

    </LinearLayout>

    <Button
        android:id="@+id/btnLoginCreate"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dp"
        android:layout_marginRight="20dp"
        android:layout_marginEnd="20dp"
        android:layout_marginLeft="20dp"
        android:layout_marginStart="20dp"
        android:layout_alignParentBottom="true"
        android:background="@drawable/newd_login_btn"
        android:gravity="center"
        android:text="@string/newd_login_btn_text"
        android:textColor="@android:color/black" />

</RelativeLayout>


text:
Q: How do I construct an Html object from a String variable in Java controller code within the play (2.3) framework I am just getting started working with the play framework, and I'm trying to understand the interaction between java application code, and the scala-based template framework (Note: I know absolutely nothing about Scala so far, beyond the fact that it's another language that compiles to bytecode on the JVM, and that your Scala and Java classes can interact).
I have a test1.scala.html template that looks like this:
@(title: String)(content: Html)

<!DOCTYPE html>

        <title>@title</title>

        @content

As you can see from the top line, the template expects a String and an Html argument, but I can't figure out how to construct the Html argument from Java caller code!
I have tried a few variations in my controller class:
return ok(test1.render("My Title","It finally works!"));

This fails, obviously, because the second argument is a String and not Html, so I have an argument mismatch. (There's a runtime error:  actual argument String cannot be converted to Html by method invocation conversion -- which makes sense, but I was hoping for some magic here. :))
So I tried creating some Html from a String, figuring this was a likely helper class somewhere in the package and this might 'just work':
return ok(test1.render("My Title",new Html("It finally works!")));

This won't compile, because javac can't find an Html class. Ok, fair enough. Scanning the play documentation, there appears to be a play.api.templates.Html class (written in Scala) with a constructor that takes a String, so I try the full package-qualified name:
return ok(test1.render("My Title",new play.api.templates.Html("It finally works!")));

And this won't compile either: I get a Symbol not found for 'Html' in package play.api.templates.
So: what's the magic sauce that will let me turn my String (which contains a snippet of HTML) into an HTML object I can pass into the template?

A: Play templates have been factored out into the Twirl module, as stated in the Play 2.3 Migration Guide.
play.api.templates.Html is now play.twirl.api.Html.


text:
Q: Embedding R (kable) results in LaTeX Apology at first if this question has been asked or the sample is not reproducible. I'm totally new to LaTex and happy to take any advice.
I am working on my thesis on a .tex LaTex template given by the university, and I just saved it as a .rnw file since I would like to include some R results. Before I added code, the file can knitr well and generate a pdf.
\documentclass[master,tocprelim]{cornell}
\usepackage{graphicx,pstricks}
\usepackage{graphics}
\usepackage{moreverb}
\usepackage{subfigure}
\usepackage{epsfig}
\usepackage{hangcaption}
\usepackage{txfonts}
\usepackage{palatino}
\graphicspath{ {figures/} }

\begin{document}

He said it is cool\cite{tkh1998}.

<<code, echo=FALSE, message=FALSE, warning=FALSE>>=
library(kableExtra)
library(tidyverse)
library(dplyr)
data = data.frame(matrix(rnorm(20, 10, 2), ncol=4))
kable(data, 'latex', caption = 'Time series Errors',
        longtable = T, booktabs = T) %>%
  kable_styling(latex_options = c("striped", "hold_position", "repeat_header"))
@

\appendix

%\bibliography{LR}

\end{document}

(I don't know how to include reference in the .rnw file, but my .bib file include this citation:
@ARTICLE{tkh1998,
author={ {Tin Kam Ho}},
journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
title={The random subspace method for constructing decision forests},
year={1998},
volume={20},
number={8},
pages={832-844},
keywords={pattern classification;trees (mathematics);decision theory;random processes;learning (artificial intelligence);random subspace method;decision forests;decision trees;overfitting;maximum accuracy;decision tree based classifier;generalization accuracy;feature vector;classification accuracy;Decision trees;Classification tree analysis;Training data;Clustering algorithms;Tin;Stochastic systems;Binary trees;Support vector machines;Support vector machine classification},
doi={10.1109/34.709601},
ISSN={0162-8828},
month={Aug},}

However, after I added:
<<code, echo=FALSE, message=FALSE, warning=FALSE>>=
library(kableExtra)
library(tidyverse)
library(dplyr)
data = data.frame(matrix(rnorm(20, 10, 2), ncol=4))
kable(data, 'latex', caption = 'Time series Errors',
        longtable = T, booktabs = T) %>%
  kable_styling(latex_options = c("striped", "hold_position", "repeat_header"))
@

This file cannot be knitr anymore. It produced errors including "citation tkh1998 undefined on input line 86" (I don't even have line 86!!), "Incompatible color definition on input line 89", "Undefined control sequence".
I appreciate any suggestion about integrating LaTeX output and R results together (especially KableExtra outputs), shall I mainly write in .tex or .rnw, etc.

A: Welcome to TeX.SE. This answer suggests that you use the biblatex package and biber to produce your citations and bibliography. The answer then assumes you are using RStudio as your editor and to compile your .Rnw file.
Executing biber from within RStudio was answered here: How to insert references and bibliography into a .Rnw file produce with RStudio R Sweave and knitr?

You need to add this code chunk:
<<biber, eval= TRUE, include= FALSE, cache= FALSE, echo= FALSE>>=
system (paste ("biber", sub ("\\.Rnw$", "", current_input())))
@

This will call biber to produce the .bbl file required for producing a bibliography. Note that RStudio automatically deletes this file at the end of the compilation so you cannot see it.
Compile the .Rnw file twice to produce the citations and bibliography.
I removed packages not required for this MWE. However, since you have the kable option booktabs = T you will need to load the booktabs package with \usepackage{booktabs}. Another kable option used in the MWE is striped. This uses \rowcolor from the xcolor package, so you also need to load that as well. Finally, the table is not being set using the longtable environment, so write longtable = F. You need longtable = T when the table will span more than one page.
This is output:

This is the MWE;
\begin{filecontents}{\jobname.bib}
@ARTICLE{tkh1998,
author={ {Tin Kam Ho}},
journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
title={The random subspace method for constructing decision forests},
year={1998},
volume={20},
number={8},
pages={832-844},
keywords={pattern classification;trees (mathematics);decision theory;random processes;learning (artificial intelligence);random subspace method;decision forests;decision trees;overfitting;maximum accuracy;decision tree based classifier;generalization accuracy;feature vector;classification accuracy;Decision trees;Classification tree analysis;Training data;Clustering algorithms;Tin;Stochastic systems;Binary trees;Support vector machines;Support vector machine classification},
doi={10.1109/34.709601},
ISSN={0162-8828},
month={Aug},}
}
\end{filecontents}

\documentclass{article}
\usepackage{booktabs}         % reqired for booktabs=T
\usepackage[backend= biber]{biblatex}
\usepackage[table]{xcolor}    % required for "striped"
\addbibresource{\jobname.bib}

\begin{document}

He said it is cool\cite{tkh1998}.

<<code, echo=FALSE, message=FALSE, warning=FALSE>>=
library(kableExtra)
library(tidyverse)
library(dplyr)
data = data.frame(matrix(rnorm(20, 10, 2), ncol=4))
kable(data, 'latex', caption = 'Time series Errors',
        longtable = F, booktabs = T) %>%
  kable_styling(latex_options = c("striped", "hold_position", "repeat_header"))
@

\appendix

<<biber, eval= TRUE, include= FALSE, cache= FALSE, echo= FALSE>>=
system (paste ("biber", sub ("\\.Rnw$", "", current_input())))
@

\printbibliography

\end{document}


text:
Q: Shell script: Insert multiple lines into a file ONLY after a specified pattern appears for the FIRST time. (The pattern appears multiple times) I want to insert multiple lines into a file using shell script. Let us consider my original file: original.txt:
aaa
bbb
ccc
aaa
bbb
ccc
aaa
bbb
ccc
.
.
.

and my insert file: toinsert.txt
111
222
333

Now I have to insert the three lines from the 'toinsert.txt' file ONLY after the line 'ccc' appears for the FIRST time in the 'original.txt' file. Note: the 'ccc' pattern appears more than one time in my 'original.txt' file. After inserting ONLY after the pattern appears for the FIRST time, my file should change like this:
aaa
bbb
ccc
111
222
333
aaa
bbb
ccc
aaa
bbb
ccc
.
.
.

I should do the above insertion using a shell script. Can someone help me?
Note2: I found a similar case, with a partial solution:
sed -i -e '/ccc/r toinsert.txt'  original.txt
which actually does the insertion multiple times (for every time the ccc pattern shows up).

A: Use ed, not sed, to edit files:
printf "%s\n" "/ccc/r toinsert.txt" w | ed -s original.txt

It inserts the contents of the other file after the first line containing ccc, but unlike your sed version, only after the first.

A: This might work for you (GNU sed):
sed '0,/ccc/!b;/ccc/r insertFile' file

Use a range:
If the current line is in the range following the first occurrence of ccc, break from further processing and implicitly print as usual.
Otherwise if the current line does contain ccc,insert lines from insertFile.
N.B. This uses the address 0 which allows the regexp to occur on line 1 and is specific to GNU sed.
or:
sed -e '/ccc/!b;r insertFile' -e ':a;n;ba' file

Use a loop:
If a line does not contain ccc, no further processing and print as usual.
Otherwise, insert lines from insertFile and then using a loop, fetch/print the remaining lines until the end of the file.
N.B. The r command insists on being delimited from other sed commands by a newline. The -e option simulates this effect and thus the sed commands are split across two -e options.
or:
sed 'x;/./{x;b};x;/ccc/!b;h;r insertFile' file

Use a flag:
If the hold space is not empty (the flag has already been set), no further processing and print as usual.
Otherwise, if the line does not contain ccc, no further processing and print as usual.
Otherwise, copy the current line to the hold space (set the flag) and insert lines from insertFile.
N.B. In all cases the r command inserts lines from insertFile after the  current line is printed.


text:
Q: Azure Pipelines, Hosted Ubuntu Agent and Azure CLI Task with PowerShell Core: Use Az module and authenticate properly I have a couple of PowerShell scripts that use the PowerShell Az module (Link). As a result of certain requirements it is now necessary to run these scripts on a hosted Ubuntu agent (18.04).
So I selected the Azure CLI task with PowerShell Core as Script type

The first issue I encounter is that the agent does not  know the Az cmdlets. The second issue is that even when the Az cmdlets are available there is no authenticated context to work with them.
How can I resolve these two issues?

A: First it is necessary to install the Az module on the hosted Ubuntu agent. This can be done with a Azure CLI task with script type PowerShell Core by executing
Install-Module -Name Az -AllowClobber -Force
To then be able to authenticate it is necessary to enable on the task

and then in the PowerShell script to authenticate via
$tenantIdEnv = $env:tenantId
$spnIdEnv = $env:servicePrincipalId
$spnKeyEnvSecureString = ConvertTo-SecureString $env:servicePrincipalKey -AsPlainText -Force
$credentialsServicePrincipal = New-Object System.Management.Automation.PSCredential($spnIdEnv, $spnKeyEnvSecureString)
Connect-AzAccount -ServicePrincipal -TenantId $tenantIdEnv -Credential $credentialsServicePrincipal


text:
Q: Is there a method for zotonic cms to replace some defined text parts to links? Is there a method, yes bla bla, like in Subtext CMS (on asp.net btw) which is called there Terms Expansion or (Keyword Expansion) i don't remember correct.. For Zotonic cms to replace some defined text parts to links? I mean: -- animal -> should be replace to animal
Ah, please well help me.. I will be gratefull.

A: You could use a custom filter to do this. Here's a simple example I use for mailing lists which replaces #NAME with the name of the recipient:
-module(filter_inject_firstname).

-export([inject_firstname/3]).

-include("zotonic.hrl").

inject_firstname(Body, undefined, _Context) ->
    Body;
inject_firstname(Body, Recipient, _Context) ->
    Val = case proplists:get_value(props, Recipient, []) of
              Props when is_list(Props) ->
                  [{email, proplists:get_value(email, Recipient)},
                   {name_first, proplists:get_value(name_first, Props)},
                   {name_surname, proplists:get_value(name_surname, Props)},
                   {name_surname_prefix, proplists:get_value(name_surname_prefix, Props)}];
              _ ->
                  [{email, proplists:get_value(email, Recipient)}]
          end,
    Name = proplists:get_value(name_first, Val),
    iolist_to_binary(re:replace(Body, "#NAME", Name, [global])).


text:
Q: How would i loop this Scanner in java? package javaapplication97;

import java.util.Scanner;

public class JavaApplication97 {

    public static void main(String[] args) {

        System.out.println("Enter a number: ");
        Scanner s1 = new Scanner(System.in);

        if (s1.hasNextInt())
           System.out.println("This is an int");

    }
}

A: i think you mean this
import java.util.*;

public class test{

    public static void main(String[] args) {

        while(true){
            System.out.println("Enter a number: ");
            Scanner s1 = new Scanner(System.in);

            if (s1.hasNextInt()){
                System.out.println("This is an int");
            }
            else if(s1.nextLine().compareTo("stop")==0){
                break;
            }
            else{
                System.err.println("this is not an int");
            }
            System.out.println("---------");
    }
}


text:
Q: What should basically public folder contain in React I was learning React and came across public folder which contains html file, favicon and the others. The question is for what public folder is actually created? and what should it contain?

A: Just static contents that do not need to compile (.html, .svg, .jpg, ...).
Just like www folder for ASP.net Core projects.
But It is your desition to put them there or somewhere else.
Documentation

A: React is a JavaScript library that needs to be "compiled" into code that the browser understands, so the public or build or dist folders are for holding the output of the compilation process or if you'd like, they store your artifact.
Just like target folder for Java projects.


text:
Q: report with subreport ms access 2007 I have three table in my database.
Customers, which contains detaills of each client, such as  name, phone number ...
Products, containing detaills of each product.
each time a client requests a product, a new line is inserted in the third table Orders.
the table Orders contains the customer id (foreign key), the product id (foreign key) and the quantity desired.
what I'm looking to do is to creat a report based on the Orders table, that shows me for each Client all the Orders that he has made.
I'm working on ms access 2007.
please help me !!!

A: Create a query based on the orders table joined to the customer table. Use the query design window to build the query. You can then base your report on the query, using grouping to get the customer details at the top of the group and the prder details as lines within the group. Use the report wizards.

A: Ok I have the solution.
I created a form with this record source:
SELECT
  DISTINCT Costumers.Code, Costumers.Name, Costumers.phone
FROM
  Costumers INNER JOIN Orders
  ON Costumers.ID=Orders.IdCostumer;

then I've created a subreport with this record source:
 SELECT
   [Costumers].[Code],
   [Orders].[Code],
   [Products].[Description],
   [Orders].[Quantity]
 FROM
   Products INNER JOIN
   (Costumers INNER JOIN Orders ON Costumers.ID=Orders.IdCostumer)
   ON Products.ID=Orders.IdOrder;

and that's working the way I want.
thank you for your interest !!!
:-)


text:
Q: How can I make the program stop if the input is invalid? I need to know how can I make my program continue with the login ONLY if the entered username is valid, but if an incorrect username is entered it should stop, but the break function just doesn't work.
I am a beginner, and I am truly sorry about posting about something this simple, but I cant get it to work and I cant find a direct answer elsewhere.
Code:
if a == x:
    print('entered username is valid')
else:
    print('entered username is invalid')
    break

I tried using {}, and it didn't quite work; it said something about just not working properly but the brackets don't work in any scenario.

A: while a!="":
  if a!=x:
    print("username invalid")
    break
  else:
    print("username login valid")
    b=str(input("enter password"))
    if b==y:
      print("logged in successfully")
      break

you can work with something similar, break are only for loops , you should integrate it with while/for loop, for this example we entered in a loop that loos on while your "a" username input is not empty

A: break is for loops. If you want your program to stop, try replacing break by sys.exit().
Of course, you'll need to add at the beginning of your program:
import sys

because sys.exit() is a function of module sys.


text:
Q: present continuous = present perfect in many cases I have read the book Advanced Grammar in Use by Martin Hewings.  One of the uses of the present continuous is:  To talk about particular actions or events that have begun but haven't ended at the time of speaking, we use the present continuous.  For example:

The car isn't starting again.

My question is:  Is this use similar to the use the present perfect, and can we replace this sentence like this:

The car hasn't started again.

The author wrote that one of the uses of the present continuous is when to talk about action has begun and hasn't ended at the time of speaking, this is clearly that is similar to the use of present perfect, isn't right?

A: Both sentences are different. The comparison should be something like

(1) The car isn't starting.
  (2) The car hasn't been starting.

However, these are quite different.
Present continuous is used for action happening right now. (Not in the past.)

The car isn't starting.

Present perfect continuous is used for an event that began in the past and is still in progress in the present.

The car hasn't been starting.

Note that in both tenses, the action is not yet completed, but the main difference here is that the former gives you information about something happening right now (event in the present) and the latter tells you about something that started in the past and is still in progress.
Compare:

I'm learning a new language. (It's happening right now and not in the past.)
I've been learning a new language. (It's still happening in the present but first, the action happened in the past.)

A: I have a bit different view.

*

*The car isn't starting again.

This sentence doesn't work well without the adverb again as the present continuous expresses that the action of the engine not starting/igniting is being repeated in a certain period of time. Let's say you failed to ignite the engine and you got it fixed yesterday. But, the car didn't start again this morning and that's when you use the above sentence.
Let's take a look at another example:

How long have you been running? (I have been running) For 10 years.

"I have been running for 10 years" doesn't mean a continuous action as in "I have been reading a book for an hour". You can read a book for an hour without taking any rest, but you can't run for 10 years. The above usage expresses a repetition of running on a regular basis, i.e. 10 miles per week, or 20 miles per week or month.
Now, most important thing is if your car doesn't start for the first time since you bought the car, you should not use the present continuous. You should use the present simple:

My car doesn't start. The engine doesn't start. *My car is not
  starting. *The engine is not starting.

The sentence with * is misleading as it might indicate the car/engine didn't start in the past once or several times.

*The car hasn't started again.

Compared with "the car isn't starting again", the sentence contains a different information. No. 1 means you are trying to start a car now, but No. 2 means the car didn't start in the past (you have an experience of it) and the experience was repeated in the past. It could be from a few seconds ago to a few hours ago. Contrast it with:

The car has started again.

This sentence means the engine was ignited at some point in the past, probably not long ago. Again, it doesn't express the present action.
Compare it with:

The car didn't start 10 minutes ago, but it has just started.

There is a difference in using the "present continuous" and "present perfect".

No. 3. *The car hasn't been starting.

The verbs such as start, begin, finish, etc. are an event verb, however, they are different from other verbs in that it doesn't take a long time comparatively to start/begin/finish something. For example:

*I have been starting to have/finishing having lunch.

You could have (eat) lunch for an hour, but you start or finish it in an instance. That's why it is awkward (even nonsensical) to use the present perfect continuous for those verbs. Contrast it with:

I have been preparing for lunch. I have been trying to start the work.

It could take an hour or more to prepare for nice lunch or try to start something. That's why you can use the present perfect continuous for the above examples.
I hope you can see the difference clearly now.


text:
Q: access service broker queues with c# I will do a project using "sql server service broker". I have never used it but tried tutorials from microsoft website and I think I got the idea. Now, I can create all the required elements for service broker in the database. but my question is, how do you use service broker from c#. I want to add messages to queue from c# and read from c#?
I read that I can access the queue table with old style sql like below
select columns from SchemaName.QueueName WITH(NOLOCK);

but I dont think this is the correct way. how can I do it properly in c#? please give me a clue

A: According to BOL, only Service Broker can add to the queue:

Service Broker manages updates to queues. Although the name of a queue
  can be used in place of a table name in a SELECT statement, a queue
  cannot be the target of an INSERT, UPDATE, DELETE, or TRUNCATE
  statement.

You can run normal queries on the queue using ADO .Net
Take a look here: http://msdn.microsoft.com/en-us/library/ms166127%28v=sql.100%29.aspx


text:
Q: Check if email id is windows live id or not I am developing MVC4 application and i want to authenticate my application using windows live id. I have developed page where i can invite users, so i want to check if user's email id is windows live id or not?
I have tried different things, but they are just validating whether email id is gmail id or not.
I have tried below code. but it is working for Gmail, not for windows live id
            TcpClient tClient = new TcpClient("gmail-smtp-in.l.google.com", 25);
            string CRLF = "\r\n";
            byte[] dataBuffer;
            string ResponseString;
            NetworkStream netStream = tClient.GetStream();
            StreamReader reader = new StreamReader(netStream);
            ResponseString = reader.ReadLine();
            /* Perform HELO to SMTP Server and get Response */
            dataBuffer = BytesFromString("HELO KirtanHere" + CRLF);
            netStream.Write(dataBuffer, 0, dataBuffer.Length);
            ResponseString = reader.ReadLine();
            dataBuffer = BytesFromString("MAIL FROM:<YourGmailIDHere@gmail.com>" + CRLF);
            netStream.Write(dataBuffer, 0, dataBuffer.Length);
            ResponseString = reader.ReadLine();
            /* Read Response of the RCPT TO Message to know from google if it exist or not */
            dataBuffer = BytesFromString("RCPT TO:<" + email.Trim() + ">" + CRLF);
            netStream.Write(dataBuffer, 0, dataBuffer.Length);
            ResponseString = reader.ReadLine();
            if (GetResponseCode(ResponseString) == 550)
            {
                IsExist = false;
                //Response.Write("Mai Address Does not Exist !

");
                //Response.Write("Original Error from Smtp Server :" + ResponseString);
            }
            /* QUITE CONNECTION */
            dataBuffer = BytesFromString("QUITE" + CRLF);
            netStream.Write(dataBuffer, 0, dataBuffer.Length);
            tClient.Close();

Is there any other way i can achieve this?

A: It depends on how you choose to authenticate your users.  If you are using Microsoft apps 2.0 for authentication a live account has a 'tid' claim of ""9188040d-6c67-4c5b-b112-36a304b66dad" while work or school accounts have unique 'tid' claims.
You can also view this question for more information: How to determine if an email address is a Microsoft 'Work or School' account or a Microsoft Account


text:
Q: If "in-" forms antonyms, why is "invaluable" not the opposite of "valuable"? I'm not an native speaker. Most of the time when I hear a word that starts with "in-" I think of an opposite, a negation:

visible – invisible
valid – invalid
dependent – independent

But I get puzzled by invaluable. This is actually like superlative, right? You have some skill that is valuable and then you have the top skill, the most precious one – the invaluable one.
And I'm understanding the words valuable and invaluable in the wrong way, or is "in-" in this case something different?

A: Valuable and invaluable are not antonyms, but the prefix in- still means not. M-W explains:

Valuable and invaluable do mean similar things, but the in- in invaluable isn't playing any tricks. It simply means "not." We think of valuable as meaning "having a great deal of value," as in "valuable jewelry" or "learned a valuable lesson."
Invaluable, on the other hand, means "valuable beyond estimation." Much like priceless, it describes something that is of such a great value that it cannot fairly be quantified.

To understand how invaluable was formed, Etymonline comes handy:

1570s, "above value, too valuable for exact estimate," from in- "not" + value (v.) "estimate the worth of" + -able. It also has been used in a sense "without value, worthless" (1630s, from in- + valuable).

Although it has been used as the antonym of valuable in the past, now that meaning has not survived.
M-W says:

While the verb value often means "to prize or esteem" (as in "I value our friendship"), it can also mean "to estimate or assign the monetary worth of" or "appraise." If something is of such a nature that its importance cannot be stated in monetary terms, that obviously makes it unable to be valued, or invaluable.


text:
Q: Program doesn't produce any error or output I have the following Python program:
 import xml.etree.ElementTree as ET
    import sys

    class MyXmlParser(object):

        def __init__(self, users):
            self.doc  = ET.parse("users.xml")
            self.root = self.doc.getroot()

        def do_something(self, output = sys.stdout):
            root_new  = ET.Element("users")
            for child in self.root:
                username             = child.attrib['username']
                password             = child.attrib['password']
                # create "user" here
                user    = ET.SubElement(root_new, "user")
                user.set("username",username)
                user.set("password",password)
                # checking attribute - skip KeyError
                try:
                    remote_access   = child.attrib['remote_access']
                    user.set("remote_access", remote_access)
                except KeyError:
                    pass

                for g in child.findall("group"):
                    # create "group" here
                    group     = ET.SubElement(user,"group")
                    if g.text != "lion":
                        group.text = g.text
            tree = ET.ElementTree(root_new)
            tree.write(output)
if __name__ =='main':
    parser = MyXmlParser()
    parser.do_something()

And this is my xml :
<users>
<user username="admin"  password="admin" remote_access="yes"></user>
<user username="private_user1" password="user1" ><group>group1</group><group>group2</group></user>
<user username="private_user2" fullname="user2" password="user2"><group>group1</group><group>group2</group></user>
</users>

I can't find any mistake in this program. It should output some xml. But presently it's not giving any error or output. I expected some xml as output :( Thanks in advance

A: I changed your MyXmlParser class constructor to:
    def __init__(self, users=None):
        self.doc = ET.parse("users.xml")
        self.root = self.doc.getroot()

and added this after the class definition:
if __name__==" __main_ ":
    parser = MyXmlParser()
    parser.do_something()

and got this one line of output:
<users><user password="admin" remote_access="yes" username="admin" /><user password="user1" username="private_user1"><group>group1</group><group>group2</group></user><user password="user2" username="private_user2"><group>group1</group><group>group2</group></user></users>


text:
Q: Why can't Google Chrome find my app.js file I'm starting to learn Nodejs with a simple app. Google Chrome can't seem to find my app.js file in my /assets/js.app

And then as you can see, I believe I have the paths set ups correctly

Instead of {{ vm.message }} it should say Hello World.
Chrome keeps telling me it can't find the app.js file in the index.ejs template file, which looks like this
    <html ng-app="TestApp">
<title>The MEAN Stack</title>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.js"></script>
</head>
<body ng-controller="MainController as vm">
    {{ vm.message }}
    <script src="/assets/js/app.js"></script>
</body>
</html>

A: When using express.static, the optional route prefix is not actually part of the file path, but rather it is appended to the url. You can use /assets/assets/js/app.js, but it may be better to just remove the prefix: app.use(express.static(__dirname + "/public")).
I would also say that assets should be reserved for things like images and that js and perhaps even css belong in their own higher level directories, but this is debatable.
Serving static content from express is fine for development or toy apps, but in a real production app you should look into a better static file server than node.js.


text:
Q: Is $K(G,1) = BG$? Is an Eilenberg-MacLane space $K(G,1)$ the same as the classifying space $BG$ for a group $G$ ?

A: Let $G$ be a discrete group (i.e. a group equipped with the discrete topology), $BG$ its classifying space, and $EG$ the universal $G$-bundle. Then we have a fibration
$$G \hookrightarrow EG \rightarrow BG,$$
and the long exact sequence of this fibration reads
$$\cdots \to \pi_{n+1}(BG) \to \pi_n(G) \to \pi_n(EG) \to \pi_n(BG) \to \cdots \to \pi_0(G) \to \pi_0(EG) \to 0.$$
The total space of the universal $G$-bundle is contractible and $G$ has the discrete topology, so $\pi_{n}(BG) \cong 0$ for all $n > 1$. Since $EG$ is connected, the tail end of the sequence tells us that
$$\pi_1(BG) \cong \pi_0(G) \cong G,$$
since $G$ has the discrete topology. Therefore we see that $BG$ is a $K(G,1)$ when $G$ is a discrete group.
Note that since $EG$ is contractible, $\pi_{n+1}(BG) \cong \pi_n(G)$ for all $n \geq 1$, so if $G$ is equipped with a topology for which $\pi_n(G) \not\cong 0$ for $n \geq 1$, then $BG$ cannot be a $K(G,1)$.


text:
Q: What does "The invocation of the constructor on type that matches the specified binding constraints threw an exception." mean? What does "The invocation of the constructor on type  that matches the specified binding constraints threw an exception." mean in silverlight?

A: Silverlight called your constructor, and your constructor threw an exception.
You can find the original exception from your constructor in the InnerException.


text:
Q: Metrics on the time it takes to replciate an on-premise server to the site recovery fault I'm trying to get metrics on the time it takes replicate an on premise server to ASR. I realize that this is largely due to bandwidth and size of the on-premise server instance disk etc but it would be nice to be able to get some of that data from azure of start and end time of when replication took to complete.
Is that somewhere available?
Failure I don't think is as a big of an issue it looks like Azure provides detail around that in replication jobs activity and typically doesn't seem to take more than 5 min.


text:
Q: Starting a new activity (android) i'm tring to start a new activity from the main one but i'm getting an error when the application is launched the application ... has stopped unexpectedly. please try again (no error on eclipse ). that's my code:
public class clubber extends Activity {
    protected SearchData sData ;
    protected boolean club;
    protected boolean resto;
    protected boolean bar;
    protected String searchTerms;
    protected String city;
    protected String distance;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

       (...)

        //Search button action
        final Button button = (Button) findViewById(R.id.search);
        button.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                // Perform action on clicks
                Toast.makeText(clubber.this, "Let's find something !", Toast.LENGTH_SHORT).show();
                Intent intent = new Intent();
                intent.setClass(clubber.this, Map.class);
                startActivity(intent);
            }
        });
    }
    (...)
}

the target class:
package com.clubber;

import android.os.Bundle;

import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;

public class Map extends MapActivity {
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.map);
        MapView mapView = (MapView) findViewById(R.id.mapView);
        mapView.setBuiltInZoomControls(true);
    }

    protected boolean isRouteDisplayed() {
        // TODO Auto-generated method stub
        return false;
    }
}

androidmanifest.xml:
    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.club"
      android:versionCode="1"
      android:versionName="1.0">

    <uses-library android:name="com.google.android.maps" />
    <application android:icon="@drawable/icon" android:label="@string/app_name">

    <activity android:name="com.clubber.ClubberActivity" android:label="@string/app_name">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
    </activity>
    <activity android:name=".Map"></activity>

    </application>
    <uses-permission android:name="android.permission.INTERNET" />

</manifest>

map.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <com.google.android.maps.MapView
        android:id="@+id/mapView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:enabled="true"
        android:clickable="true"
        android:apiKey="*******************************"
        />

    <LinearLayout android:id="@+id/zoom"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        />

</RelativeLayout>

logcat :
 D/AndroidRuntime(  512): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime(  512): CheckJNI is ON
D/AndroidRuntime(  512): Calling main entry com.android.commands.am.Am
I/ActivityManager(   60): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.club/com.clubber.ClubberActivity } from pid 512
I/ActivityManager(   60): Start proc com.club for activity com.club/com.clubber.ClubberActivity: pid=520 uid=10036 gids={3003, 1015}
D/AndroidRuntime(  512): Shutting down VM
I/AndroidRuntime(  512): NOTE: attach of thread 'Binder Thread #3' failed
D/dalvikvm(  512): GC_CONCURRENT freed 102K, 69% free 319K/1024K, external 0K/0K, paused 1ms+3ms
D/dalvikvm(  512): Debugger has detached; object registry had 1 entries
W/dalvikvm(  520): Unable to resolve superclass of Lcom/clubber/Map; (36)
W/dalvikvm(  520): Link of class 'Lcom/clubber/Map;' failed
E/dalvikvm(  520): Could not find class 'com.clubber.Map', referenced from method com.clubber.ClubberActivity$5.onClick
W/dalvikvm(  520): VFY: unable to resolve const-class 35 (Lcom/clubber/Map;) in Lcom/clubber/ClubberActivity$5;
D/dalvikvm(  520): VFY: replacing opcode 0x1c at 0x0013
D/dalvikvm(  520): VFY: dead code 0x0015-0022 in Lcom/clubber/ClubberActivity$5;.onClick (Landroid/view/View;)V
I/ActivityManager(   60): Displayed com.club/com.clubber.ClubberActivity: +2s131ms
D/dalvikvm(  129): GC_EXPLICIT freed 70K, 50% free 2952K/5831K, external 2638K/3237K, paused 103ms
D/AndroidRuntime(  520): Shutting down VM
W/dalvikvm(  520): threadid=1: thread exiting with uncaught exception (group=0x40015560)
E/AndroidRuntime(  520): FATAL EXCEPTION: main
E/AndroidRuntime(  520): java.lang.NoClassDefFoundError: com.clubber.Map
E/AndroidRuntime(  520):    at com.clubber.ClubberActivity$5.onClick(ClubberActivity.java:121)
E/AndroidRuntime(  520):    at android.view.View.performClick(View.java:2485)
E/AndroidRuntime(  520):    at android.view.View$PerformClick.run(View.java:9080)
E/AndroidRuntime(  520):    at android.os.Handler.handleCallback(Handler.java:587)
E/AndroidRuntime(  520):    at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime(  520):    at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(  520):    at android.app.ActivityThread.main(ActivityThread.java:3647)
E/AndroidRuntime(  520):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(  520):    at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime(  520):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime(  520):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime(  520):    at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager(   60):   Force finishing activity com.club/com.clubber.ClubberActivity
W/ActivityManager(   60): Activity pause timeout for HistoryRecord{406b0d20 com.club/com.clubber.ClubberActivity}
D/dalvikvm(   60): GC_CONCURRENT freed 1010K, 47% free 4446K/8263K, external 2046K/2554K, paused 11ms+10ms

A: There are two things wrong with the manifest:
<activity android:name=".Map"></activity>

should be outside the other activity and in application.
<uses-library android:name="com.google.android.maps" />

should be inside application
Use this xml:
  <?xml version="1.0" encoding="utf-8"?>
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.clubber"
  android:versionCode="1"
  android:versionName="1.0">

<application android:icon="@drawable/icon" android:label="@string/app_name">

    <uses-library android:name="com.google.android.maps" />
    <activity android:name=".clubbera" android:label="@string/app_name">

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".Map"> </activity>

</application>
<uses-permission android:name="android.permission.INTERNET" />

A: You are missing the Map activity in your manifest.  The stacktrace in logcat is probably telling you that is the error...

A: pls ensure your Logcat, that you had yield, Activity Not Found Exception, this is because you had forgot to register your map activity in Android manifest file.
you have to add the Activity as shown below

    <activity android:name=".clubber" android:label="@string/app_name">

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".Map"></activity>

</application>

A: In order to have this running you need to put in the manifest file the following line:
<uses-library android:name="com.google.android.maps" />

but please pay attention and add the line inside the <application> tag like bellow:
<application>
    ...
    <uses-library android:name="com.google.android.maps" />
</application>


text:
Q: Unix Shell File Descriptors I need to run a program called pg.sh.  It report stdout to output log. How do I save stdout and both stderr and stdout into 2 separate log files?
I searched and got the below code
(pg.sh 2>&1 1>&3 ) 3>&1 1>&2 | tee output.log) > final.log 2>&1

I understand 1 and 2 are File Descriptors pointing to stdout and stderr. 3 is another File Descriptor pointing to stdout.
The above code works fine, But I do not understand how this is being achieved. Could some one help me with the code written?

A: starting from the outer redirection: ( .. ) 3>&1 1>&2 , the order is important:

*

*fd 3 is open for write as duplicate of 1 (stdout: here it's the pipe input)

*then fd 1 is crushed as duplicate of 2 (stderr) (or redirected to stderr)

the | input is then the fd 3, whereas the stderr is not captured by tee,
The nested redirection:

*

*fd 2 is redirected to stdout (which was redirected to outer stderr)

*fd 1 is redirected to fd 3 (which was redirected to outer stdout)
as tee duplicates output logged, (the final redirection >final.log 2>&1, as the fd 2 is open after fd 1 they are both redirected to final.log)
the file final.log will contain program stdout and stderr, but output.log only stdout.
Maybe it could be written easier, using 3>&1 1>&2 2>&3 which reverses stdout and stderr.
The following should do the same:
( pg.sh | tee output.log ) >final.log 2>&1

The following writes program stdout to output.log stderr to error.log and both to final.log.
( ( pg.sh | tee output.log ) 3>&1 1>&2 2>&3 | tee error.log ) >final.log 2>&1