text:
Q: Checkout another branch when there are uncommitted changes on the current branch Most of the time when I try to checkout another existing branch, Git doesn't allow me if I have some uncommitted changes on the current branch. So I'll have to commit or stash those changes first.
However, occasionally Git does allow me to checkout another branch without committing or stashing those changes, and it will carry those changes to the branch I checkout.
What is the rule here? Does it matter whether the changes are staged or unstaged? Carrying the changes to another branch doesn't make any sense to me, why does git allow it sometimes? That is, is it helpful in some situations?

A: You have two choices: stash your changes:
git stash

then later to get them back:
git stash apply

or put your changes on a branch so you can get the remote branch and then merge your changes onto it. That's one of the greatest things about git: you can make a branch, commit to it, then fetch other changes on to the branch you were on.
You say it doesn't make any sense, but you are only doing it so you can merge them at will after doing the pull. Obviously your other choice is to commit on your copy of the branch and then do the pull. The presumption is you either don't want to do that (in which case I am puzzled that you don't want a branch) or you are afraid of conflicts.

A: The correct answer is
git checkout -m origin/master
It merges changes from the origin master branch with your local even uncommitted changes.

A: Preliminary notes
This answer is an attempt to explain why Git behaves the way it does.  It is not a recommendation to engage in any particular workflows.  (My own preference is to just commit anyway, avoiding git stash and not trying to be too tricky, but others like other methods.)
The observation here is that, after you start working in branch1 (forgetting or not realizing that it would be good to switch to a different branch branch2 first), you run:
git checkout branch2

Sometimes Git says "OK, you're on branch2 now!"  Sometimes, Git says "I can't do that, I'd lose some of your changes."
If Git won't let you do it, you have to commit your changes, to save them somewhere permanent.  You may want to use git stash to save them; this is one of the things it's designed for.  Note that git stash save or git stash push actually means "Commit all the changes, but on no branch at all, then remove them from where I am now."  That makes it possible to switch: you now have no in-progress changes.  You can then git stash apply them after switching.

Sidebar: git stash save is the old syntax; git stash push was introduced in Git version 2.13, to fix up some problems with the arguments to git stash and allow for new options.  Both do the same thing, when used in the basic ways.

You can stop reading here, if you like!
If Git won't let you switch, you already have a remedy: use git stash or git commit; or, if your changes are trivial to re-create, use git checkout -f to force it.  This answer is all about when Git will let you git checkout branch2 even though you started making some changes.  Why does it work sometimes, and not other times?
The rule here is simple in one way, and complicated/hard-to-explain in another:
You may switch branches with uncommitted changes in the work-tree if and only if said switching does not require clobbering those changes.
That is—and please note that this is still simplified; there are some extra-difficult corner cases with staged git adds, git rms and such—suppose you are on branch1.  A git checkout branch2 would have to do this:

*

*For every file that is in branch1 and not in branch2,1 remove that file.

*For every file that is in branch2 and not in branch1, create that file (with appropriate contents).

*For every file that is in both branches, if the version in branch2 is different, update the working tree version.

Each of these steps could clobber something in your work-tree:

*

*Removing a file is "safe" if the version in the work-tree is the same as the committed version in branch1; it's "unsafe" if you've made changes.

*Creating a file the way it appears in branch2 is "safe" if it does not exist now.2  It's "unsafe" if it does exist now but has the "wrong" contents.

*And of course, replacing the work-tree version of a file with a different version is "safe" if the work-tree version is already committed to branch1.

Creating a new branch (git checkout -b newbranch) is always considered "safe": no files will be added, removed, or altered in the work-tree as part of this process, and the index/staging-area is also untouched.  (Caveat: it's safe when creating a new branch without changing the new branch's starting-point; but if you add another argument, e.g., git checkout -b newbranch different-start-point, this might have to change things, to move to different-start-point.  Git will then apply the checkout safety rules as usual.)

1This requires that we define what it means for a file to be in a branch, which in turn requires defining the word branch properly.  (See also What exactly do we mean by "branch"?)  Here, what I really mean is the commit to which the branch-name resolves: a file whose path is P is in branch1 if git rev-parse branch1:P produces a hash.  That file is not in branch1 if you get an error message instead.  The existence of path P in your index or work-tree is not relevant when answering this particular question.  Thus, the secret here is to examine the result of git rev-parse on each branch-name:path.  This either fails because the file is "in" at most one branch, or gives us two hash IDs.  If the two hash IDs are the same, the file is the same in both branches.  No changing is required.  If the hash IDs differ, the file is different in the two branches, and must be changed to switch branches.
The key notion here is that files in commits are frozen forever.  Files you will edit are obviously not frozen.  We are, at least initially, looking only at the mismatches between two frozen commits.  Unfortunately, we—or Git—also have to deal with files that aren't in the commit you're going to switch away from and are in the commit you're going to switch to.  This leads to the remaining complications, since files can also exist in the index and/or in the work-tree, without having to exist these two particular frozen commits we're working with.
2It might be considered "sort-of-safe" if it already exists with the "right contents", so that Git does not have to create it after all.  I recall at least some versions of Git allowing this, but testing just now shows it to be considered "unsafe" in Git 1.8.5.4.  The same argument would apply to a modified file that happens to be modified to match the to-be-switch-to branch.  Again, 1.8.5.4 just says "would be overwritten", though.  See the end of the technical notes as well: my memory may be faulty as I don't think the read-tree rules have changed since I first started using Git at version 1.5.something.

Does it matter whether the changes are staged or unstaged?
Yes, in some ways.  In particular, you can stage a change, then "de-modify" the work tree file.  Here's a file in two branches, that's different in branch1 and branch2:
$ git show branch1:inboth
this file is in both branches
$ git show branch2:inboth
this file is in both branches
but it has more stuff in branch2 now
$ git checkout branch1
Switched to branch 'branch1'
$ echo 'but it has more stuff in branch2 now' >> inboth

At this point, the working tree file inboth matches the one in branch2, even though we're on branch1.  This change is not staged for commit, which is what git status --short shows here:
$ git status --short
 M inboth

The space-then-M means "modified but not staged" (or more precisely, working-tree copy differs from staged/index copy).
$ git checkout branch2
error: Your local changes ...

OK, now let's stage the working-tree copy, which we already know also matches the copy in branch2.
$ git add inboth
$ git status --short
M  inboth
$ git checkout branch2
Switched to branch 'branch2'

Here the staged-and-working copies both matched what was in branch2, so the checkout was allowed.
Let's try another step:
$ git checkout branch1
Switched to branch 'branch1'
$ cat inboth
this file is in both branches

The change I made is lost from the staging area now (because checkout writes through the staging area).  This is a bit of a corner case.  The change is not gone, but the fact that I had staged it, is gone.
Let's stage a third variant of the file, different from either branch-copy, then set the working copy to match the current branch version:
$ echo 'staged version different from all' > inboth
$ git add inboth
$ git show branch1:inboth > inboth
$ git status --short
MM inboth

The two Ms here mean: staged file differs from HEAD file, and, working-tree file differs from staged file.  The working-tree version does match the branch1 (aka HEAD) version:
$ git diff HEAD
$

But git checkout won't allow the checkout:
$ git checkout branch2
error: Your local changes ...

Let's set the branch2 version as the working version:
$ git show branch2:inboth > inboth
$ git status --short
MM inboth
$ git diff HEAD
diff --git a/inboth b/inboth
index ecb07f7..aee20fb 100644
--- a/inboth
+++ b/inboth
@@ -1 +1,2 @@
 this file is in both branches
+but it has more stuff in branch2 now
$ git diff branch2 -- inboth
$ git checkout branch2
error: Your local changes ...

Even though the current working copy matches the one in branch2, the staged file does not, so a git checkout would lose that copy, and the git checkout is rejected.
Technical notes—only for the insanely curious :-)
The underlying implementation mechanism for all of this is Git's index.  The index, also called the "staging area", is where you build the next commit: it starts out matching the current commit, i.e., whatever you have checked-out now, and then each time you git add a file, you replace the index version with whatever you have in your work-tree.
Remember, the work-tree is where you work on your files.  Here, they have their normal form, rather than some special only-useful-to-Git form like they do in commits and in the index.  So you extract a file from a commit, through the index, and then on into the work-tree.  After changing it, you git add it to the index.  So there are in fact three places for each file: the current commit, the index, and the work-tree.
When you run git checkout branch2, what Git does underneath the covers is to compare the tip commit of branch2 to whatever is in both the current commit and the index now.  Any file that matches what's there now, Git can leave alone.  It's all untouched.  Any file that's the same in both commits, Git can also leave alone—and these are the ones that let you switch branches.
Much of Git, including commit-switching, is relatively fast because of this index.  What's actually in the index is not each file itself, but rather each file's hash.  The copy of the file itself is stored as what Git calls a blob object, in the repository.  This is similar to how the files are stored in commits as well: commits don't actually contain the files, they just lead Git to the hash ID of each file.  So Git can compare hash IDs—currently 160-bit-long strings—to decide if commits X and Y have the same file or not.  It can then compare those hash IDs to the hash ID in the index, too.
This is what leads to all the oddball corner cases above.  We have commits X and Y that both have file path/to/name.txt, and we have an index entry for path/to/name.txt.  Maybe all three hashes match.  Maybe two of them match and one doesn't.  Maybe all three are different.  And, we might also have another/file.txt that's only in X or only in Y and is or is not in the index now.  Each of these various cases requires its own separate consideration: does Git need to copy the file out from commit to index, or remove it from index, to switch from X to Y?  If so, it also has to copy the file to the work-tree, or remove it from the work-tree.  And if that's the case, the index and work-tree versions had better match at least one of the committed versions; otherwise Git will be clobbering some data.
(The complete rules for all of this are described in, not the git checkout documentation as you might expect, but rather the git read-tree documentation, under the section titled "Two Tree Merge".)

A: *

*The branch switch only happens when you change a file that has no diff between the two branches. In that case git treats that change common for both the files.

*This gets prevented when you change a file whose diff exists between the two branches. In that case you get ABORT signal.

Came to this conclusion after and hour of investigation with local testing.

A: If the new branch contains edits that are different from the current branch for that particular changed file, then it will not allow you to switch branches until the change is committed or stashed. If the changed file is the same on both branches (that is, the committed version of that file), then you can switch freely.
Example:
$ echo 'hello world' > file.txt
$ git add file.txt
$ git commit -m "adding file.txt"

$ git checkout -b experiment
$ echo 'goodbye world' >> file.txt
$ git add file.txt
$ git commit -m "added text"
     # experiment now contains changes that master doesn't have
     # any future changes to this file will keep you from changing branches
     # until the changes are stashed or committed

$ echo "and we're back" >> file.txt  # making additional changes
$ git checkout master
error: Your local changes to the following files would be overwritten by checkout:
    file.txt
Please, commit your changes or stash them before you can switch branches.
Aborting

This goes for untracked files as well as tracked files. Here's an example for an untracked file.
Example:
$ git checkout -b experimental  # creates new branch 'experimental'
$ echo 'hello world' > file.txt
$ git add file.txt
$ git commit -m "added file.txt"

$ git checkout master # master does not have file.txt
$ echo 'goodbye world' > file.txt
$ git checkout experimental
error: The following untracked working tree files would be overwritten by checkout:
    file.txt
Please move or remove them before you can switch branches.
Aborting

A good example of why you WOULD want to move between branches while making changes would be if you were performing some experiments on master, wanted to commit them, but not to master just yet...
$ echo 'experimental change' >> file.txt # change to existing tracked file
   # I want to save these, but not on master

$ git checkout -b experiment
M       file.txt
Switched to branch 'experiment'
$ git add file.txt
$ git commit -m "possible modification for file.txt"

A: I have faced the same question recently. What I understand is, if the branch you are checking in has a file which you modified and it happens to be also modified and committed by that branch. Then git will stop you from switching to the branch to keep your change safe before you commit or stash.

A: I've been struggling for a while with this thing too and I would like to give my two cents to the answer. First thing first, my understanding of the matter came from here: https://medium.com/swimm/a-visualized-intro-to-git-internals-objects-and-branches-68df85864037
The question was:

However, occasionally Git does allow me to checkout another branch without committing or stashing those changes, and it will carry those changes to the branch I checkout.
What is the rule here? Does it matter whether the changes are staged or unstaged? Carrying the changes to another branch doesn't make any sense to me, why does git allow it sometimes? That is, is it helpful in some situations?

When you create a branch out of any other branch, you are only creating a pointer to the same commit, so unless you have committed any change you had begun working on, you will be pointing at the same commit, and thus git will let you change branches that way. Only when you commit any change to the new branch is that commits begin to differ between branches and git will complain when trying to checkout those branches if there were any uncommitted changes.

A: In case you don't want this changes to be committed at all do
git reset --hard.
Next you can checkout to wanted branch, but remember that uncommitted changes will be lost.


text:
Q: Match elements with same name inside an array I have the following code that get all my filter elements and echo each of them with a Title (getName) and its inner elements (getHtml). What I want is to check the titles and merge the equal ones to show all inner elements together without repeating equal titles.
For example, if I have a filter named FILTER-AB with element 1 and 2, and a second filter also named FILTER-AB with elements 3 and 4, I want to echo just one table with title FILTER-AB and inner elements 1, 2, 3 and 4. See easier example below
EDIT For instance, the HTML elements are a list of elements, those which are not of great importance here. The Filter name is taken by the "getName" method on third line (written then as a dt class) and the elements are taken by "getHtml" method on 7th line (written then as inner Html elements  dd class)
I could not think any method to do this, please any help or guidance would be appreciated!

<?php foreach ($_filters as $_filter): ?>
             <?php if($_filter->getItemsCount()): ?>

<?php echo $this->__($_filter->getName()) ?>

                                 (Not important line)      <?php if($_searchFilter !== false): ?>
                                 (Not important line)        <dt class="attribute_value_search_box<?php if($_searchFilter !== true): ?> enabled<?php endif; ?>"><input type="text" placeholder="<?php echo $this->__('Search for option'); ?>" />

                                 (Not important line)      <?php endif;?>

<?php echo $_filter->getHtml() ?>

             <?php endif; ?>
<?php endforeach; ?>

EXAMPLE (What I have now)

Brand

Element 1

Brand

Element 2

Type

Element 3

RESULT EXPECTED

Brand

Element 1

Element 2

Type

Element 3

A: Map your data to a grouped array of arrays using the name as key. Then iterate that array to generate the html
Something like:
<?php
$data = array();
foreach ($_filters as $_filter) {
    if ($_filter->getItemsCount()) {
        $name = $this->$_filter->getName();
        $data[$name][] = $_filter->getHtml();
    }
?>

<?php foreach ($data as $name => $items): ?>

<?php echo $name ?>

                <dt class="attribute_value_search_box<?php if ($_searchFilter !== true): ?> enabled<?php endif; ?>">
                <input type="text" placeholder="<?php echo $this->__('Search for option'); ?>">

                <?php foreach ($items as $html): ?>

<?php echo $html ?>

                <?php endforeach; ?>

<?php endforeach; ?>

redpajama_set_name: RedPajamaStackExchange


text:
Q: Unified frontend side and backend side forms validation I'm working on some framework (library) for declarative HTML forms definition (let name this definition as metamodel). The metamodel is saved as some JSON where user who defined the new form could specify whether the field is required, need specific regex for validation, depends from other field, how it looks on the search view and a lot of typical business stuff.
Based on that metamodel the HTML form is generated (the metamodel is forwarded between frontend and backend as JSON and the form values are also sent as JSON by REST services) and we have to introduce the fields validation.
Of course the validation needs to be introduced also on frontend and backend side. I would prefer to unified the validation from both sides by single mechanism.
Does somebody have any ideas how I could unified the frontend and backend validation in order to avoid duplication? Does it make any sense or should I reject my idea of unification and implement separate HTML and server side validation.
Any ideas and hint are welcome :)
PS. On the backend side I'm using Spring, on the frontend side I'm using backbone.

A: Backend and front end validation are usually separate. For front end validation you might consider using backbone-validation library.
https://github.com/thedersen/backbone.validation


text:
Q: How to change Default login button in googleplus in ios? I am planning to implement Google plus for login in my app? The SDK has a default login button. But I don't want to use that button instead of that I have to "Sign in" with button which i have designed?

A: First of all you should call the sign in method on a action of your googlePlusSignInButton
So the code should be:
-(void) setGooglePlusButtons {

    self.googlePlusSignInButton = [[UIButton buttonWithType:UIButtonTypeCustom] retain];

    UIImage *backgroundButtonImage = [UIImage imageNamed:@"bt_search_cancel.png"];

    googlePlusSignInButton_.frame = CGRectMake(0.0f,
                                               0.0f,
                                               backgroundButtonImage.size.width,
                                               backgroundButtonImage.size.height);

    googlePlusSignInButton_.titleLabel.textColor = [UIColor whiteColor];
    googlePlusSignInButton_.titleLabel.font = [UIFont boldSystemFontOfSize:11.0f];
    googlePlusSignInButton_.titleLabel.numberOfLines = 2;

    googlePlusSignInButton_.titleLabel.shadowColor = [UIColor darkGrayColor];
    googlePlusSignInButton_.titleLabel.shadowOffset = CGSizeMake(0.0f,
                                                                 -1.0f);

    [googlePlusSignInButton_ setTitle:NSLocalizedString(@"UI_BUTTONS_LOGIN", @"")
                             forState:UIControlStateNormal];

    [googlePlusSignInButton_ setBackgroundImage:backgroundButtonImage
                                       forState:UIControlStateNormal];

    [googlePlusSignInButton addTarget:self action:@selector(signInGoogle:) forControlEvents:UIControlEventTouchUpInside];
}


text:
Q: How to use SignIn Manager and User Manager on C# pages ASP.NET Core MVC I'm trying to update a database by having the signed in user type a number and it adds that number from the database using the signin manager and usermanager. I want it to take the signed in user's account balance that's stored in the database and add it to the number they typed. Then i want to update the database with the combined number.
However, I'm stuck on how I would get the controller to use the sign in manager. With the razor page all I have to do is use
@inject SignInManager<CardUs> SignInManager and use
@inject UserManager<CardUs> UserManager and also import the Microsoft.AspNetCore.Identity
but when I try to use UserManager.GetUserAsync(User).Result.AccountBalance it throws a lot of errors.
One of them being:

Feature 'top-level statements' is not available in C# 8.0. Please use language version 9.0 or greater

So I updated from 8.0 to 9.0 but then that didn't work. Now it's saying

Cannot use local variable or local function 'SigninManager' declared in a top-level statement in this context

I tried looking at the Microsoft page but nothing came up. This is error code CS8801.
How do I use the signin manager and user manager variable inside the controller?
This project not finished. I haven't sent it to the database yet. All it does it take the user input and show it on the next screen
Code:
AccountController:
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Card.Areas.Identity.Data;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Card.Models;

SignInManager<CardUs> SignInManager;
UserManager<CardUs> UserManager;

namespace Card.Controllers
{
    [Authorize]
    public class AccountController : Controller
    {
        private readonly TransactionConnection _tc;

        public AccountController(TransactionConnection tc)
        {
            _tc = tc;
        }

        public IActionResult Index()
        {
            return View();
        }

        public IActionResult Transactions()
        {
            var results = _tc.TransactionHistory.ToList();
            return View(results);
        }

        [HttpGet]
        public IActionResult Deposit()
        {
            return View();
        }

        [HttpPost]
        public IActionResult Deposit(DepositModel model)
        {
            int test = model.AccountBalance + UserManager.GetUserAsync(User).Result.AccountBalance;

            return Content($"this is how much you entered {test}");
        }

        public IActionResult Transfers()
        {
            return View();
        }
    }
}

Deposit.cshtml:
@model Card.Models.DepositModel

@{
    ViewData["Title"] = "Deposit";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<form asp-action="Deposit" asp-controller="Account">

    <input asp-for="AccountBalance" placeholder="How much do you want"/>
    <input type="submit"/>
</form>

DepositModel:
using Microsoft.AspNetCore.Identity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Card.Areas.Identity.Data;

namespace Card.Models
{
    public class DepositModel
    {
        public int AccountBalance { get; set; }
    }
}

And here's how the sign in manager look on a razor page:
@using Microsoft.AspNetCore.Identity
@using Card.Areas.Identity.Data

@inject SignInManager<CardUs> SignInManager
@inject UserManager<CardUs> UserManager
@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@

<p1>Hello @UserManager.GetUserAsync(User).Result.FirstName welcome back!</p1>

account balance: $@UserManager.GetUserAsync(User).Result.AccountBalance

A: I figured it out. I was setting it up wrong. I had to add it to the constructor, and I had to create and assign fields.
Code:
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Card.Areas.Identity.Data;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Card.Models;

namespace Card.Controllers
{

    [Authorize]
    public class AccountController : Controller
    {
        private readonly TransactionConnection _tc;
        private readonly UserManager<CardUs> userManager;
        private readonly SignInManager<CardUs> signInManager;

        public AccountController(TransactionConnection tc, UserManager<CardUs> userManager, SignInManager<CardUs> signInManager)
        {
            _tc = tc;
            this.userManager = userManager;
            this.signInManager = signInManager;
        }
        public IActionResult Index()
        {
            return View();
        }
        public IActionResult Transactions()
        {
            var results = _tc.TransactionHistory.ToList();
            return View(results);
        }
        [HttpGet]
        public IActionResult Deposit()
        {
            return View();
        }
        [HttpPost]
        public IActionResult Deposit(DepositModel model)
        {

            int test = model.AccountBalance + userManager.GetUserAsync(User).Result.AccountBalance;

            return Content($"this is how much you entered {test}");
        }
        public IActionResult Transfers()
        {
            return View();
        }
    }
}

A: using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Card.Areas.Identity.Data;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Card.Models;

namespace Card.Controllers {
    SignInManager < CardUs > SignInManager;
    UserManager < CardUs > UserManager;

    [Authorize]
    public class AccountController: Controller {
        private readonly TransactionConnection _tc;

        public AccountController(TransactionConnection tc) {
            _tc = tc;
        }
        public IActionResult Index() {
            return View();
        }
        public IActionResult Transactions() {
                var results = _tc.TransactionHistory.ToList();
                return View(results);
            }
            [HttpGet]
        public IActionResult Deposit() {
                return View();
            }
            [HttpPost]
        public IActionResult Deposit(DepositModel model) {
            int test = model.AccountBalance + SignInManager.GetUserAsync(User).Result.AccountBalance;

            return Content($"this is how much you entered {test}");
        }
        public IActionResult Transfers() {
            return View();
        }
    }
}


text:
Q: Proving $f(x,y)$ is not Lipschitz but still has a unique solution to initial value problem Consider $g:\mathbb R\to\mathbb R$ defined by $g(y)=1+\sqrt |y|$. Let $h:\mathbb R\to \mathbb R$ be a continous function such that $h(x)\neq 0$ for all $x\neq 0$. I'm asked to prove the following:

*

*Prove the function $f(x,y)=\frac {h(x)}{g(y)}$ is not Lipschitz respect to $y$ around the origin.

*Prove the initial value problem associated with $(0,0)$ has a unique solution. Find the solution in the case $h(x)=1$.

The first point is clear since $\partial f(x,y)/\partial y \to \infty $ as $y\to 0$. My problem lies on the second point. My only tool for proving uniqueness is the Picard theorem but $f(x,y)$ is not Lipschitz so I don't know how to tackle this problem. I tried using the method of separating variables but don't really know if it ensures uniqueness. Any help is appreciated.

A: You can use the method of separating the variables.
Namely, let
$$
G(y) := \int_0^y g(\xi)\, d\xi,\quad y\in\mathbb{R},
\qquad
H(x) := \int_0^x h(s)\, ds, \quad x\in\mathbb{R}.
$$
Since $G'(y) = g(y) \geq 1$ for every $y$, the function $G$ is strictly monotone increasing and $\text{Im}(G) = G(\mathbb{R}) = \mathbb{R}$, hence $G$ is bijective with inverse $G^{-1} \colon \mathbb{R}\to \mathbb{R}$.
Moreover, any solution $y(x)$ of the Cauchy problem satisfies the implicit relation
$G(y(x)) = H(x)$,
at least for those values of $x$ satisfying $H(x) \in \text{Im} G$.
Since $\text{Im} G = \mathbb{R}$, the implicit relation gives a unique solution $y(x) = G^{-1}(H(x))$ defined for all $x\in\mathbb{R}$.


text:
Q: getting total count of employee with total number of transaction I have a employee table with
employeeid, country, state, and city

then i have transaction table with
transaction_id, employeeid, transaction-details

So I need
country state city total(no_of_employee), count(transactions), count(no_of_employee_done_transaction)

I've tried and able to get
country state city count(transactions), count(no_of_employee_done_transaction)

by using this query:
 select em.Country, em.state, em.city , count(transaction_id) as "count(transaction)" , count(distinct(employeeid)) as "count(number of employee done transaction)"
    from transaction tr
    right outer join employee em on tr.employeeid = em.employeeid
    where to_char(tran_date,'Mon-YYYY')='Jun-2014'
    group by em.country,em.state, em.city;

if i put count(employee_id) in select list then it always comes equal to count(transaction_id)
 what to modify to achieve count(employee_id) in above query.

A: It seems that at one place you want total count of employees from employees table and in the second place, you want employees who have done transaction from transactions table. Try :
 select em.Country,
        em.state,
        em.city ,
        count(distinct em.employeeid),
        count(transaction_id) as "count(transaction)" ,
        count(distinct tr.employeeid) as "count(number of employee done transaction)"
    from transaction tr
    right outer join employee em on tr.employeeid = em.employeeid
    where to_char(tran_date,'Mon-YYYY')='Jun-2014'
    group by em.country,em.state, em.city;

A: Use SQL Subquery.
select a.employeeid,a.country,a.state,a.city,
(select count(*) from employees) as count_employees,
(select count(*) from transactions) as count_transactions,
(select count(*) from employees where employee_id=a.employee_id) as no_of_employee_transactions
   from transactions a
where to_char(a.tran_date,'Mon-YYYY')='Jun-2014'
group by a.employeeid,a.country,a.state,a.city;

A: Not really clear on your requirement. Please see if this is what you want.
select em.Country, em.state, em.city , count(transaction_id) as "count(transaction)" , count(distinct(employeeid)) as "count(number of employee done transaction)",
(select count(distinct(employeeid)) as total(no_of_employee)
    from employee c
    where em.Country = c.Country
          em.state   = c.state
          em.city    = c.city)
    from transaction tr
    right outer join employee em on tr.employeeid = em.employeeid
    where to_char(tran_date,'Mon-YYYY')='Jun-2014'
    group by em.country,em.state, em.city;


text:
Q: SupportMapFragment still listening after being removed (GPS is not installed) This activity have nested fragments, one of these nested fragments is SupportMapFragment. If Google Play Services aren't installed, as fallback, it is replaced with another fragment who holds an ImageView.
An exceptions throws when I touch the ImageView, the exception is:
11-17 21:00:37.477: E/AndroidRuntime(6189): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://details?id=com.google.android.gms flg=0x80000 pkg=com.android.vending }

Google Play Services aren't installed, so the url 'market://' fails as expected. but:
why the click event still listening? The SupportMapFragment was removed at this point.
The relevant code parts:
public class DetailFragment extends Fragment {
  ///....
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    SupportMapFragment location = (SupportMapFragment) getChildFragmentManager()
            .findFragmentById(R.id.map);
    mGoogleMap = location.getMap();
    if (mGoogleMap != null) {
        // add markers here
    } else {
        final View map = view.findViewById(R.id.map);
        ViewTreeObserver viewTreeObserver = view.getViewTreeObserver();
        viewTreeObserver
        .addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
            @Override
            public void onGlobalLayout() {
                map.getViewTreeObserver().removeOnGlobalLayoutListener(this);
                int width = map.getWidth();
                int height = map.getHeight();

                String url = "http://maps.googleapis.com/maps/api/staticmap?center=" + mItem.lat + "," + mItem.lon + "&zoom=" + (int) mItem.zoom + "&size=" + width + "x" + height
                        + "&sensor=false&key=API_KEY_HERE";
                Bundle args = new Bundle();
                args.putString("url", url);

                ImageFragment img = new ImageFragment();
                img.setArguments(args);
                getChildFragmentManager().beginTransaction().replace(R.id.map, img).commit();
            }
        });
    }
}
...
} // DetailFragmentClass

XML Relevant
       <fragment
            android:id="@+id/map"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_marginBottom="10dp"
            android:layout_marginLeft="5dp"
            android:layout_marginRight="10dp"
            android:layout_marginTop="10dp"
            android:layout_weight="@dimen/promo_body_map_weight"
            class="com.google.android.gms.maps.SupportMapFragment" />

I guess that i missing some cleanup in some point. But i can't see what.
OPTION 2:
How can i eat the click event?
EDIT
As was recommended in comments, i also tried load the fragment onCreateView using a FragmentLayout in the XML but the problem still there.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.fragment_promo_datailed,
            container, false);
    //...

    mSupportMapFragment = new SupportMapFragment();
    getChildFragmentManager().beginTransaction().add(R.id.map, mSupportMapFragment).commit();

    // ...

    return rootView;
}

XML
     <FrameLayout
            android:id="@+id/map"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_marginBottom="10dp"
            android:layout_marginLeft="5dp"
            android:layout_marginRight="10dp"
            android:layout_marginTop="10dp"
            android:layout_weight="@dimen/promo_body_map_weight"
            />


text:
Q: SwiftUI: ScrollView Offset Scroll Content I'm trying to implement a ScrollView using SwiftUI that contains an HStack and ForEach() of calendar objects to scroll through back and forth to select a date to mimic below:

The array of dates would be say 30 days in the past of today's date  and 30 days in the future. When I initialize the ScrollView, it always starts on the 30th day in the past (Array index 0) but how could I offset the scroll of the ScrollView to where today's date is centered in the view? I've tried using .content.offset(x: offset) but it physically offsets the location of the scroll in the view, not the amount scrolled.
        ScrollView(.horizontal, showsIndicators: false) {

            HStack(alignment: .center, spacing: self.spacing) {

                ForEach(self.dateArray, id: \.self) { date in
                    CalendarObject(date: date)
                }
            }
        }
        .content.offset(x: -self.offset, y: 0)

A: In apple's example swiftUI Code, they just use padding of cell in ScrollView. Maybe it is an answer from apple.


text:
Q: Does strictly increasing continued-fraction-sequence imply transcendency?
Suppose $a$ is a real number with continued fraction $[0,c_1,c_2,\cdots]$. Suppose, the continued-fraction-sequence is strictly increasing ($c_1<c_2<\cdots$). Can we conclude that $a$ is transcendental ? If not, can we construct a concrete counter-example ?

It is clear that the minimal polynomial of $a$ (if existent) must have degree larger than $2$ because the continued fraction neither terminates nor gets eventually periodic.


text:
Q: how to relate documents in couchdb.when i have two differnet documents I am new to couchdb.Now I am working on a couchdb project in my university.My project is football schema,where I have to prepare documents for players and clubs.I have already created individual documents for players and clubs in couchdb.but I dont know how to relate the players documents to the clubs documents.I mean which player belongs to which club...

A: You can store a list of doc IDs of players in each club document and/or the doc ID of the club of the player in each player document.
Then you can use views and lists to find all players in a team for instance.
Note that it is your responsibility to keep the database consistent (that is to remove the doc ID of a player from its club when you remove the player from the DB for instance).


text:
Q: Backbone Events: logging all events when they are triggered I'm creating an events object using a bit of backbone and underscore as follows:
var appEvents = _.extend({}, Backbone.Events);

I'm then trying to create a function that will console.log all and any event triggered to this object, regardless of where, how or what listeners it has, but am kinda unsure how I'd do that. I'm still experimenting with Backbone.
I think using the listenTo method is the way to go... but again, not sure how I'd implement that.

A: You can just use Backbone's special all event:
appEvents.on("all", function(eventName){
    console.log(eventName + ' was triggered!');
});

A: var object = {};

_.extend(object, Backbone.Events);

object.on("alert:param1", function(msg) {
  alert("Сработало " + msg);
});

object.on("alert:param2", function(msg) {
  alert("Сработало " + msg);
});

object.on("all", function(eventName) {
  console.log(eventName);
});
object.trigger("alert:param2", "событие");
object.trigger("alert:param1", "событие");

A: Override the trigger function then.
var trigger = appEvents.trigger;
appEvents.trigger = function(name) {
  console.log('Event', name, 'triggered.');
  trigger.apply(this, arguments);
};

But I still find the whole story weird (again, that's only my opinion).

A: "add" (model, collection, options) — when a model is added to a collection.
"remove" (model, collection, options) — when a model is removed from a collection.
"update" (collection, options) — single event triggered after any number of models have been added, removed or changed in a collection.
"reset" (collection, options) — when the collection's entire contents have been reset.
"sort" (collection, options) — when the collection has been re-sorted.
"change" (model, options) — when a model's attributes have changed.
"changeId" (model, previousId, options) — when the model's id has been updated.
"change:[attribute]" (model, value, options) — when a specific attribute has been updated.
"destroy" (model, collection, options) — when a model is destroyed.
"request" (model_or_collection, xhr, options) — when a model or collection has started a request to the server.
"sync" (model_or_collection, response, options) — when a model or collection has been successfully synced with the server.
"error" (model_or_collection, xhr, options) — when a model's or collection's request to the server has failed.
"invalid" (model, error, options) — when a model's validation fails on the client.
"route:[name]" (params) — Fired by the router when a specific route is matched.
"route" (route, params) — Fired by the router when any route has been matched.
"route" (router, route, params) — Fired by history when any route has been matched.
"all" — this special event fires for any triggered event, passing the event name as the first argument followed by all trigger arguments.


text:
Q: Two pairs of consecutive values list python If you have a list in python like this:
list1 = [(1,2), (3,1), (4,1), (1,2), (3,1)]
If you have list1 in python and you want to find if two pairs of
consecutive values in a list in python are equal like (1,2) and
(3,1) is repeated twice and you want to update a variable lets say
i to 2 based on this.
How would you do this in python?

A: Here is how I got it, looped through the original list and made mini lists of every each pair, then I checked to see if that pair occurs twice.
lst = [(1,2), (3,1), (4,1), (1,2), (3,1)]

#iterate through list and append each pair of values
tmp = []
for i in range(0, len(lst)-1):
    tmp.append(lst[i] + lst[i+1])

#see if any of the pairs appear twice, if so add to new list and get the length of that list to be your count
output =  [x for x in tmp if tmp.count(x) > 1]
i = len(output)
print(i)


text:
Q: Why are int 32 bits? Both in Java and .net the default int is 32 bit. Does it have to do with the fact that when java and .net came around, most processors in use were 32 bit? Or was there some other reason to choose 32 as the default bit length for integers?

A: Yes, it is mostly due to the fact that most processors were 32bit. This shows in other parts of the Java Specification as well. For instance, it is explicitly not guaranteed that long and double (64bit) reads and writes are atomic, while for all other primitive types it is.

A: Java was based on C and some C++.
In C char is 8-bit, short is 16-bit and a long long is 64-bit.  An int could be 16-bit or 32-bit but for simplicity in Java they decided on byte being 8-bit, short is 16-bit, int is 32-bit and long is 64-bit. In Java char is 16-bit unsigned.
In short, from C there were four types and four sizes and so int ended up being 32-bit.


text:
Q: Dynamically changing Leaflet map bounds in Angular? I'm using Angular-leaflet-directive. I have a menu where the user taps an option. Each time the user clicks an option the map is updated with two new markers and the bounds should be adjusted so these markers are both visible. The markers get updated but the bounds seem to work differently. The first time the user clicks something the bounds are updated, but they don't update for each time after that. This is the code which is called each time the user selects an option:
    var updateMap = function() {
        setDirections();

        $scope.bounds = leafletBoundsHelpers.createBoundsFromArray([
            [$scope.thisPractice.end.k, $scope.thisPractice.end.D],
            [$scope.thisPractice.start.k, $scope.thisPractice.start.D]
        ]);

        $scope.markers = {
            end: {
                title: "Destination",
                lat: $scope.thisPractice.end.k,
                lng: $scope.thisPractice.end.D,
                focus: true,
                icon: local_icons.markerRed
            },
            start: {
                title: "Start",
                lat: $scope.thisPractice.start.k,
                lng: $scope.thisPractice.start.D,
            }
        }
    }

This is my map initialization code:
// Initialize the map
    angular.extend($scope, {
        center: {},
        bounds: {},
        paths: {},
        markers: {},
        scrollWheelZoom: false,
        layers: {
            baselayers: {
                googleRoadmap: {
                    name: 'Google Streets',
                    layerType: 'ROADMAP',
                    type: 'google'
                }
            }
        }
    });

This is the HTML where my map occurs:
<div id="map_canvas">
    <leaflet id="leaflet_map" bounds="bounds" center="center" markers="markers" paths="paths" height="300px" width="100%" layers="layers"></leaflet>
</div>

It's not an issue with my data since the markers are updated fine. Any ideas? It seems weird that the bounds wouldn't function in the same way as the markers do.
Edit:
So the following code utilises the standard Leafleat.js functions and works:
var bounds = L.latLngBounds([$scope.thisPractice.end.k, $scope.thisPractice.end.D], [$scope.thisPractice.start.k, $scope.thisPractice.start.D])
leafletData.getMap().then(function(map) {
        map.fitBounds(bounds);
});

It would be nice if the angular directive implemented fitbounds in the same way.


text:
Q: Using arrays inside a list in C# We are supposed to do is put log entries (title and entry) in a sort of journal. That means having a list with each containing an array with room for two strings.
Now. We've worked with arrays and lists but never together.
Considering this is a school assignment I'm only asking for guidance to point me in the right direction.
So creating a list that on each entry contains space for an array of size 2. How should I think about this concept baring in mind I've only used them separately before?

A: A List<string[]> is a perfectly valid data structure, although a List<Tuple<string, string>> or a  List<LogEntry> where LogEntry is a class with two string properties would be more idiomatic.
Note that there's not a declarative way to set the size of the underlying array (meaning that List<string[2]> is not a valid type.

A: Since you have to have a log title and entry, have you considered wrapping those in a separate class rather than using an array of two strings?
I mean doing something like this:
public class LogItem
{
    public string Item;
    public string Entry;
}

Then instead of having a list of arrays, you would just use a list of LogItem:
var myList = new List<LogItem>();

var myNewLogEntry = new LogItem {Title = "Entry title", Entry = "Entry message"};

myList.Add(myNewLogEntry);

A: You can easily make list of arrays:
var myList = new List<string[]>();

myList.Add(new [] { "Fruit", "Orange" });
myList.Add(new [] { "Car", "Toyota" });

Console.WriteLine(myList[0][1]); // Prints "Orange"
Console.WriteLine(myList[1][0]); // Prints "Car"

Note, that array length for the particular item may differ. There's no way to limit it.

A: I'm not sure if this goes against the assignment, but I would suggest thinking a bit object oriented about this, consider what you're asking for:

We are supposed to do is put log entries (title and entry) in a sort of journal.

In my head this translates to two classes:
First a class "Log" with two string properties, "Title" and "Entry"
Second a class "Journal" with a List<Log> property named Entries.
Code example:
public class Journal
{
    ...
    public List<Log> Entries { get; set; }
}

public class Log
{
    public string Title { get; set; }
    public string Entry { get; set; }
}

A: You can simply create it like that. Is that what you were looking for?
List<string[]> myList = new List<string[]>();

A: This is a completely valid data structure.
List<string[]> logList = new List<string[]>();
logList.Add(new string[] {"item 1", "item 2", "item 3"});

Besides this, I am not sure what you are looking for.


text:
Q: UIView take a screenshot when it is not visible I have a UIView that can be drawn like a finger paint application, but sometimes it is not visible. I want to be able to take a screenshot of it when it is not visible. Also, I want a screenshot where it is visible, but I don't want any subviews. I just want the UIView itself. This is the method I have tried:
func shapshot() -> UIImage? {
    UIGraphicsBeginImageContext(self.frame.size)
    guard let context = UIGraphicsGetCurrentContext() else {
        return nil
    }
    self.layer.render(in: context)
    let image = UIGraphicsGetImageFromCurrentImageContext()
    UIGraphicsEndImageContext()
    if image == nil {
        return nil
    }

    return image
}

func snapshot() -> UIImage {
    UIGraphicsBeginImageContextWithOptions(bounds.size, self.isOpaque, UIScreen.main.scale)
    layer.render(in: UIGraphicsGetCurrentContext()!)
    let image = UIGraphicsGetImageFromCurrentImageContext()
    UIGraphicsEndImageContext()
    return image!
}

A: To get view rendered as UIImage, you could introduce a very simple protocol and extend UIView with it.
protocol Renderable {
    var render: UIImage { get }
}

extension UIView: Renderable {
    var render: UIImage {
        UIGraphicsImageRenderer(bounds: bounds).image { context in
            layer.render(in: context.cgContext)
        }
    }
}

and now it's super easy to get the image of any view
let image: UIImage = someView.render

then if you plan to share it or save it, you probably want to convert it to Data
let data: Data? = image.pngData()

I am not sure what you mean with the "when it is not visible" but this should work as long as the view is in the view hierarchy and it's properly laid out. I have been using this method in many apps for sharing stuff and it never failed me.
And of course there is no need for a protocol, feel free to use only the render computed property. It's just a matter of preference.

Documentation:
UIGraphicsImageRenderer,  image(actions:)


text:
Q: Recommendation for getting TIF raster from modis HDF, for processing in R I've downloaded a set of modis mod13q1 HDF files, e.g. MOD13Q1.A2016097.h11v05.006.2016114040325.hdf.
I'd like to load the 250m_16_days_EVI and 250m_16_days_pixel_reliability bands into R as rasters.  My understanding is that I first need to use the modis reprojection tool (MRT) to create TIF files from the HDF. [Incorrect! The HDF file can be loaded directly into R; see answer and code below.]  I'm using 64-bit linux and I have the MRT installed in /home/my_username/mrt/bin/.
MRT gives several options for the output projection type.  I know very little about projections.  What parameters should I choose if my objectives are

*

*I'd like the conversion to run quickly

*I want to lose as little information as possible, i.e. I want to keep the 250 meter resolution of the original HDF file

*I need to be able to load the rasters into R

The ultimate goal is to extract raster values at a few thousand (say, 10,000) spatial points.
Edit:  additional information, in case it's helpful:

*

*I'm getting my HDF data from https://search.earthdata.nasa.gov/search. As far as I can tell there is no option to download TIF files, or any other format that can be loaded directly into R

*I have two sets of HDF files for which I'd like to run this procedure. The first are in the USA (lower 48), and the second set covers Brazil.

Here's a simple example that seems to work.  This borrows from Cannot properly import MODIS MOD07_L2 .hdf files into R using rgdal and mdsumner's answer.  It skips the MRT step entirely.
library(raster)
library(rgdal)

hdf_path <- "/home/my_username/my_modis_dir"
hdf_files <- list.files(hdf_path, pattern="^MOD13Q1.*\\.hdf$")
stopifnot(length(hdf_files) > 0)

infile <- hdf_files[1]  # MOD13Q1.A2000049.h11v04.006.2015136104609.hdf
## Modis h11v04 includes Wisconsin, parts of Michigan, parts of Illinois, ...

gdal_info <- GDALinfo(infile, returnScaleOffset=FALSE)  # Two warnings
## Two warnings: 1: In dim(x) : no bands in dataset; 2: In GDALinfo GeoTransform values not available

subdataset_metadata <- attr(gdal_info, "subdsmdata")
length(subdataset_metadata)  # 24 strings starting with SUBDATASET_1_NAME=, SUBDATASET_1_DESC=, ...

## Extract substring following SUBDATASET_2_NAME=
evi_subdataset <- subdataset_metadata[grep("250m 16 days EVI", subdataset_metadata)[1]]
evi_subdataset_name <- sapply(strsplit(evi_subdataset, "="), "[[", 2)  # "HDF4_EOS:EOS_GRID: ... "

spatial_grid_df <- readGDAL(evi_subdataset_name, as.is=TRUE)  # Careful, need as.is=TRUE
## readGDAL call prints "... has GDAL driver HDF4Image and has 4800 rows and 4800 columns"

str(spatial_grid_df)
## Formal class 'SpatialGridDataFrame' [package "sp"] with 4 slots
## @ data : 'data.frame':   23040000 obs. of  1 variable
## @ grid : Formal class 'GridTopology' [package "sp"] with 3 slots
## @ bbox       : num [1:2, 1:2] -7783654 4447802 -6671703 5559753
## @ proj4string:Formal class 'CRS' [package "sp"] with 1 slots
##   projargs: chr "+proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs"

summary(spatial_grid_df@data)
## band1 Min: -2000 Mean: 1249 Max: 9675 NAs:374180, plausible values for EVI
## See https://lpdaac.usgs.gov/dataset_discovery/modis/modis_products_table/mod13q1_v006

evi_raster <- raster(spatial_grid_df)
identical(crs(evi_raster), crs(spatial_grid_df))  # True
plot(evi_raster)  # Extent [-7783654, -6671703] for x, [4447802, 5559753] for y

## Sanity check: extract EVI values for points in Lake Michigan
n_points <- 1000
lat <- seq(42.5, 44, length.out=n_points)
lon <- -runif(n_points, min=86.6, max=87.4)
wgs84 <- "+init=epsg:4326 +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0"
points_in_lake_michigan <- SpatialPoints(coords=cbind(lon, lat), proj4string=CRS(wgs84))
evi_in_lake_michigan <- extract(evi_raster, spTransform(points_in_lake_michigan, crs(evi_raster)))
summary(evi_in_lake_michigan)  # 21 NAs, otherwise median around -200, plausible for water

## Points in Wisconsin
lat <- seq(44, 45, length.out=n_points)
lon <- -runif(n_points, min=89, max=90)
points_in_wisconsin <- SpatialPoints(coords=cbind(lon, lat), proj4string=CRS(wgs84))
evi_in_wisconsin <- extract(evi_raster, points_in_wisconsin)
summary(evi_in_wisconsin)  # Zero NAs, median around 1750

plot(evi_raster)
points(spTransform(points_in_lake_michigan, crs(evi_raster)), col="red")
points(spTransform(points_in_wisconsin, crs(evi_raster)), col="blue", pch=2)
## Plot above looks correct (but gets messed up if I resize the window)

usa <- getData("GADM",country="USA",level=1)
plot(subset(usa, NAME_1 %in% c("Wisconsin", "Illinois", "Indiana", "Michigan")), border="black")
points(points_in_lake_michigan, col="red")
points(points_in_wisconsin, col="blue", pch=2)  # Looks correct

A: I would just read directly from the source HDFs with raster, you'll need to make sure you have the right HDF libraries installed when GDAL is installed / built.  What Linux are you on? On Ubuntu with apt-get I use (something like) this install script:
https://github.com/mdsumner/nectar/blob/master/r-spatial.sh
That has fuller notes about RStudio and other libraries, so you'll have to interpret it for your needs.
Note that it really matters whether this is HDF4 or HDF5 - I'm assuming HDF4 but HDF5 is similar - you can check what's available with gdalinfo --formats at the command line.
It's also not so hard to install from source, but then you'll need library paths set and so on. The best guidelines I've seen are here: http://scigeo.org/articles/howto-install-latest-geospatial-software-on-linux.html
Often when you read an HDF4 via GDAL it doesn't come in fully georeferenced, but that's easy to fix if your grids are regular and predicbable. If you are looking at non-regular grids raster is still really powerful, but you have to treat the georeferencing as "index space" and deal with the x/y coordinates as values in separate "bands" or subdatasets.


text:
Q: Can indexer in azure search use any other character instead of , as a delimiter to break words and put in a collection type azure search index field? I am running indexer to seed data to azure search index and the data source for the indexer is a sql view. Azure uses Comma delimiter to split and put data into collection type field. Is there any other delimiter that I can configure to use instead of comma?
Let's say I have this list of strings that I want to be part of index collection type field 1.)"item1, test" 2.)"item2, test". From my sql view I return this data as item1~ test,item2~ test. I am replacing my , in each word with ~ because azure treats , as a delimiter for its collection type field and I don't want azure breaking my string in the wrong place. Now azure saves this data as "item1~ test", "item2~ test". When I am returning search results I replace ~ back with ,
The problem I am facing with this technique is that when a user searches for item1 it is treating item1~ as partial match because of ~ and weighing it's score down. In the background that's just item1 to me and I want that be treated as full match.
So I was wondering if I can use any other delimiter instead of , so that I don't have to replace it with special characters and replace it back in my search results.

A: Are you able to change the output of the view to return the SQL string to be a string that is a JSON array of strings?
A SQL string can be used to populate a Collection(Edm.String) field if the string represents a JSON array of strings: ["red", "white", "blue"]
[SQL data mapping]1


text:
Q: Pin tool,the static ins address (INS_Address(ins)) is different from the address of the instrumented instruction(IARG_INST_PTR) I want to print every rtn name, and instructions belong to this rtn. My code looks like this:
'''
for (SEC sec = IMG_SecHead(img); SEC_Valid(sec); sec = SEC_Next(sec))
{
    //OutFile << "SEC name: " << SEC_Name(sec) << endl;
    for (RTN rtn = SEC_RtnHead(sec); RTN_Valid(rtn); rtn = RTN_Next(rtn))
    {
        if(RTN_NumIns(rtn) >= 1){
            OutFile << RTN_Name(rtn) << ";" << std::dec << RTN_NumIns(rtn) << endl;

            RTN_Open(rtn);

            for (INS ins = RTN_InsHead(rtn); INS_Valid(ins); ins = INS_Next(ins))
            {
                OutFile << hex << INS_Address(ins) << ";" << INS_Disassemble(ins) << ";" \
                ...;
            }
            // to preserve space, release data associated with RTN after we have processed it
            RTN_Close(rtn);
        }
    }
}

'''
then i ues INS_AddInstrumentFunction to print memery trace.
'''
VOID RecordMemRead(VOID * ip, VOID * addr)
{
    fprintf(trace,"%p: R %p\n", ip, addr);
}
VOID RecordMemWrite(VOID * ip, VOID * addr)
{
    fprintf(trace,"%p: W %p\n", ip, addr);
}

VOID Instruction(INS ins, VOID *v)
{
    UINT32 memOperands = INS_MemoryOperandCount(ins);

    for (UINT32 memOp = 0; memOp < memOperands; memOp++)
    {
        if (INS_MemoryOperandIsRead(ins, memOp))
        {
            INS_InsertPredicatedCall(
                ins, IPOINT_BEFORE, (AFUNPTR)RecordMemRead,
                IARG_INST_PTR,
                IARG_MEMORYOP_EA, memOp,
                IARG_END);
        }
        if (INS_MemoryOperandIsWritten(ins, memOp))
        {
            INS_InsertPredicatedCall(
                ins, IPOINT_BEFORE, (AFUNPTR)RecordMemWrite,
                IARG_INST_PTR,
                IARG_MEMORYOP_EA, memOp,
                IARG_END);
        }
    }
}

'''
finally, i got different ins address, Why is it happen? I've been stuck here too long.

A: INS_Address(ins) print address where an instruction is loaded during the initial loading of image.
IARG_INST_PTR gives the address of the instruction when it is executing. Relocation of image happens at runtime. Hence addresses may be different.
see instruction point value of dynamic linking and static linking. Your question is similar. just worded differently.


text:
Q: How to use redux with graphql I like graphql. Because it has a single endpoint and I can only pull out the data I need.
So I use apollo-server for the server and apollo-client for the client.
Starting with apollo-client 3.0, state-management is supported.
The reactive variable function of the apollo-client is very convenient, but I prefer redux.
Redux toolkit also shortened the length of code that needs to be written.
The question is this.

*

*Can't I use apollo-client 3.0 and redux together?

*Can't I just use graphql without an apollo-client on redux? then How?
check please!

A: It's important to understand that GraphQL is just a protocol for describing requests and responses.  However, yes, "I'm using GraphQL" typically also implies using a smart client library like Apollo or Urql.
It is certainly possible to use Apollo and Redux in the same app, but the question becomes what you're using each of them for.  I've covered this in my posts When (and when not) to Reach for Redux and Redux - Not Dead Yet!.  Summarizing:

*

*You can use Redux for anything, including server state caching and client-side state

*Apollo is purpose-built for caching server state with GraphQL requests

*If the only thing you were using Redux for was caching server state, and you choose to use Apollo for that task, you really don't need Redux any more

*But, you can use GraphQL for requests and put that data in Redux if you really want to

It's worth noting that we have an "RTK Query" API for Redux Toolkit that provides a complete data fetching abstraction, and we even have a demo of using RTK Query to request and cache data with GraphQL.  You may want to try that out.


text:
Q: Update not commited on mysql server flask-sqlalchemy I am able to perform 'select' queries to my Mysql database.
However, the "insert" ones don't change the database, only the python objects. So when I restart the flask app, all the commited(?) editions are gone.
Views:
from flask import Flask, render_template, request, redirect, url_for, flash, Response
from sqlalchemy import exc
from models import *

app = Flask(__name__)
app.config['DEBUG'] = True
app.config['SECRET_KEY'] = 'kjhS7usfHGJHDez78'
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+mysqldb://admin:admin@127.0.0.1:3306/grenier'
app.config['SQLALCHEMY_ECHO'] = True
db = SQLAlchemy(app)

db.create_all()

@app.route('/ajax/submit_edition', methods=['POST'])
def submit_edition():
    if request.method == 'POST':
        given_id=1
        show = Shows.query.filter_by(id=given_id).first()
        show.short_description = "Hello"
        try:
            db.session.commit()
            db.session.flush()
            return "ok"
        except exc.SQLAlchemyError:
            return "Error in commiting the edition"

No particular exception is found. The route always returns "ok".
Models:
from sqlalchemy import Column, ForeignKey
from sqlalchemy.dialects.mysql import LONGTEXT, YEAR
from flask_sqlalchemy import SQLAlchemy

db = SQLAlchemy()

class Shows(db.Model):
    __tablename__ = "shows"

    id = Column(db.Integer, ForeignKey("programmation.id"), primary_key=True)
    date = Column(db.DATETIME)
    title = Column(db.VARCHAR(50))
    short_description = Column(db.VARCHAR(200))
    type = Column(db.VARCHAR(20))
    background_image = Column(db.VARCHAR(150))
    content = Column(LONGTEXT)

    def serialize(self, whatTo):
        result = {}
        if 'id' in whatTo:
            result['id'] = self.id
        if 'date' in whatTo:
            result['date'] = str(self.date)
        if 'title' in whatTo:
            result['title'] = self.title
        if 'short_description' in whatTo:
            result['short_description'] = self.short_description
        if 'type' in whatTo:
            result['type'] = self.type
        if 'background_image' in whatTo:
            result['background_image'] = self.background_image
        if 'content' in whatTo:
            result['content'] = self.content
        return result

class Programmation(db.Model):
    __tablename__ = "programmation"

    id = Column(db.Integer, primary_key=True)
    semester = Column(db.Integer)
    year = Column(YEAR)

When I look at the logs, the sql request is created for the select. But for the insert commit(), there is nothing.
Thank you !

A: The problem is usage of two different SQLAlchemy  instance. When you call db.create_all() method it creates all tables which which inherited from db.Model but in your views you don't have any model inherited from db =  SQLAlchemy(app). All your models inherited from other SQLAlchemy instance. To fix this import the db object from views to models module and use it as parent class for inheritance:
#models.py
from views import db

#db = SQLAlchemy() #remove this line
class Show(db.Model):
    ...


text:
Q: Entity Relations in Services I have such model relations: User, Task, each user can create his own tasks and can see All tasks. So obviously I'll have TaskService with methods getAllTasks(), getSortedTasks(String value), etc.
I'm confused where should I have createTask(Task task), updateTask(lond id, Task task) methods - in TaskService or in UserService, because I'm told I should have REST API looks like:
rather
post users/{id}/tasks

than
post /tasks

because "a task belongs to a particular user". So I can't choose between separate services,api for each entity and common services,api whre User is relations owner.

A: You should implement the endpoint for creating tasks in a task resource.
Both is possible:
POST your_root.com/api/{userId}/tasks/  ----> Creates task and takes the value of the creator from the uri.
But you could also go this way:
POST your_root.com/api/tasks/  ---> In this case you have to tell the server by JSON or XML who created the task. The body could look like this i.E.:
{

  "author": "user A",
  "assingee": null,
  "headline": "Login Page for my app",
  "text":"Build fancy login page"

}

Last variant and my preferred:
POST your_root.com/api/{userId}/tasks/
and the authorId in the body again:
{

  "authorId":"12"
  "author": "user A",
  "assingee": null,
  "headline": "Login Page for my app",
  "text":"Build fancy login page"

}

The advantage of the last variant is that you can check whether the userId in the uri equals the authorId of the body. So you can avoid that this request with a certain Id is made by accident.
Hope that helps.


text:
Q: AndEngine - move object I have two buttons on the screen and a player object. The first button must move the player to the left and the second to the right, but the player doesn't move smoothly. How I can make the player to move smoothly?
ButtonSprite rightButton = new ButtonSprite(360,700,this.resourceManager.RightButtonRegion,this.vertexManager)
{
    @Override
    public boolean onAreaTouched(TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY)
    {
        player.MoveRight();
        return super.onAreaTouched(pSceneTouchEvent, pTouchAreaLocalX, pTouchAreaLocalY);
    }
};

ButtonSprite leftButton = new ButtonSprite(50,700,this.resourceManager.LeftButtonRegion,this.vertexManager)
{
    @Override
    public boolean onAreaTouched(TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY)
    {
        player.MoveLeft();
        return super.onAreaTouched(pSceneTouchEvent, pTouchAreaLocalX, pTouchAreaLocalY);
    }
};

public class Player extends Sprite
{
    ...

    public void MoveLeft()
    {
        float x = this.body.getPosition().x -0.2f;
        float y =  this.body.getPosition().y;
        this.body.setTransform(x,y,0);
    }

    public void MoveRight()
    {
        float x = this.body.getPosition().x + 0.2f;
        float y =  this.body.getPosition().y;
        this.body.setTransform(x, y, 0);
    }
}

A: In your MoveLeft method you are adding a pre-fixed value, this will not scale to frame rate.
You should set a flag like "movingLeft = true" at this method, and at your processLogics you should move the position based on framerate.


text:
Q: removing duplicates from a list python I have two lists:
list1 = [IM12345, IM12346, IM12347, IM12348]
list2 = [ID300, ID404, ID300, ID601]

list2 associates with the corresponding list1 values. list1 has unique values where as list2 has duplicates.
I want to make list2 unique corresponding associated value will add in the that list2 value.
Dict= {ID300: {IM12345, IM12347}, ID404: IM12346, ID601: IM12348}

Above pattern can be in list, set or dictionary.
Which algorithm in python should I use to get the above result?

A: You could try collections.defaultdict:
from collections import defaultdict
d = defaultdict(set)

list1 = ['IM12345', 'IM12346', 'IM12347', 'IM12348']
list2 = ['ID300', 'ID404', 'ID300', 'ID601']

for key, value in zip(list2, list1):
    d[key].add(value)

Demo:
>>> d
defaultdict(<class 'set'>, {'ID300': {'IM12345', 'IM12347'}, 'ID404': {'IM12346'}, 'ID601': {'IM12348'}})
>>>
>>>
>>> for i, j in d.items():
...     print(i, j)
...
...
ID601 {'IM12348'}
ID300 {'IM12345', 'IM12347'}
ID404 {'IM12346'}

A: You can create a dict to save the dataset
list1 = ["IM12345", "IM12346", "IM12347", "IM12348"]
list2 = ["ID300", "ID404", "ID300", "ID601"]

dictResult=dict()
i=0
for item in list2:
    print item
    if dictResult.has_key(item):
        dictResult[item].append(list1[i])
    else:
        dictResult[item]=[list1[i]]
    i=i+1

print dictResult

Result:
{'ID404': ['IM12346'], 'ID300': ['IM12345', 'IM12347'], 'ID601': ['IM12348']}

A: Might not completely be a pythonic way but - here it goes:
Map the input:
map = dict(zip(list1, list2))

Now you can do an inverse mapping:
inv_map = {}
for k, v in map.iteritems():
    inv_map[v] = inv_map.get(v, [])
    inv_map[v].append(k)

Result for the example above:
>>> inv_map
{'ID404': ['IM12346'], 'ID300': ['IM12345', 'IM12347'], 'ID601': ['IM12348']}

A: Another way of doing it could be with list operations.
yourList = ["1","2","3","4","1","2"]
newList = []
for f in yourList:
    if f not in newList:
       newList.append(f)

A: Simple solution
from collections import defaultdict

list1 = ['IM12345', 'IM12346', 'IM12347', 'IM12348']
list2 = ['ID300', 'ID404', 'ID300', 'ID601']

d = defaultdict(list)

for n in range(len(list2)):
    d[list2[n]].append(list1[n])

print d.items()

Result:
[('ID404', ['IM12346']), ('ID300', ['IM12345', 'IM12347']), ('ID601', ['IM12348'])]

Python2.7 Documentation----defaultdict


text:
Q: Updating current passwords with password hashing I'm trying to run password_hash on current password values in my database...
$mysqli->query("UPDATE users SET password = '" . password_hash('password', PASSWORD_DEFAULT) . "');

I'm getting no error, but the password does not work after the update as expected. The only thing I can think of is the above query is not getting the current password value from the table.
No need for prepared statements as I'm just mucking about locally for this one.

A: You can't mix PHP and SQL like this. password_hash is a PHP function. You need to fetch the user data into PHP, iterate over it and save each record into the database. Use SQL transactions when doing so.
// Remember to always enable error reporting
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = new mysqli('localhost', 'user', 'pass', 'test');
$mysqli->set_charset('utf8mb4'); // always set the charset

$users = $mysqli->query('SELECT Id, password FROM users');

// start transaction and prepare a statement
$mysqli->begin_transaction();
$stmt = $mysqli->prepare('UPDATE users SET `password`=? WHERE Id=?');

foreach ($users as $user) {
    // make a hash out of the password
    $hash = password_hash($user['password'], PASSWORD_DEFAULT);
    $stmt->bind_param('ss', $hash, $user['Id']);
    $stmt->execute();
}

// commit the data to DB and end transaction
$mysqli->commit();

Always use prepared statements. There's absolutely no excuse not to use parameter binding! If you were to use parameter binding from the start you would have noticed much quicker that your approach is flawed. Now you have changed all passwords to the string password; every account has the same password.


text:
Q: Increase stack size with XCode I developed a command line application on Linux which needs its stack to be increased. On Linux I just used the workaround: ulimit -s unlimited before running the program. On Mac OS X, command line with G++, I add to the compilation options:
-Wl,-stack_size,0x10000000

and it works.
Now I am developing this program with XCODE, where should I add this option?

A: From the project window:
Targets > [Your target] > info > Build > Other Linker Flags > [your flags]

A: The answer is yes, you can, but under certain conditions. Lets see what does the Swift documenation says about this.
var stackSize: Int { get set }

This value must be in bytes and a multiple of 4KB. To change the stack
size, you must set this property before starting your thread. Setting
the stack size after the thread has started changes the attribute size
(which is reflected by the stackSize method), but it does not affect
the actual number of pages set aside for the thread.


text:
Q: Django-rest-framework tutorial internal server error on getting a particular snippet Following the tutorial part: http://www.django-rest-framework.org/tutorial/1-serialization/#testing-our-first-attempt-at-a-web-api
I get an internal server error: [01/Nov/2015 15:36:47] "GET /snippets/2/ HTTP/1.1" 500 27 when getting a particular snippet: /snippets/2/ getting all snippets with /snippets/ works fine.
The record exists and I see nothing special in the data. Debug is telling me:
Traceback:
File "/Users/xxxx/env/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  151.                                  % (callback.__module__, view_name))

Exception Type: ValueError at /snippets/2/
Exception Value: The view snippets.views.snippet_detail didn't return an HttpResponse object. It returned None instead.

I put some PRINT statements in views.py around snippet = Snippet.objects.get(pk=pk) like:
@csrf_exempt
def snippet_detail(request, pk):
"""
Retrieve, update or delete a code snippet.
"""
print '====='
print request
print pk

try:
    print 'get snippet'
    snippet = Snippet.objects.get(pk=pk)
    print 'snippet = ' + snippet
except Snippet.DoesNotExist:
    print 'not exist'
    return HttpResponse(status=404)

This is what I get in the terminal:
=====
<WSGIRequest: GET '/snippets/2/'>
2
get snippet
[01/Nov/2015 16:06:10] "GET /snippets/2/ HTTP/1.1" 500 27

Server error 500. If I try this:
>>> from snippets.models import Snippet
>>> from snippets.serializers import SnippetSerializer
>>> snippet = Snippet.objects.get(pk=2)
>>> print snippet
Snippet object
>>> print snippet.code
print "hello, world"

So everything should be fine... Anything else I could try?

A:
Exception Value: The view snippets.views.snippet_detail didn't
  return an HttpResponse object. It returned None instead.

Your view doesn't return a response, when the try block executes without an exception, it returns None because there is no return statement (Of course the block in except doesn't execute unless you run into an exception, so you need a return statement in the try block e.g. or after the whole try/except, like in the tutorial)
try:
    print 'get snippet'
    snippet = Snippet.objects.get(pk=pk)
    print 'snippet = ' + snippet
    # <--- There is no response returned here
except Snippet.DoesNotExist:
    print 'not exist'
    return HttpResponse(status=404) # <--- this response is only returned
                                    # if there is a Snippet.DoesNotExist exception

# <--- No response here neither, in case the try block executes without exception

[01/Nov/2015 16:06:10] "GET /snippets/2/ HTTP/1.1" 500 27

I see you are using a GET request, so like in the tutorial you can use this code after your try/exception
if request.method == 'GET':
    serializer = SnippetSerializer(snippet)
    return JSONResponse(serializer.data) # <-- this is the returned response


text:
Q: How do I configure the server deploy directory in eclipse? I have 2 workspaces. I can't configure the server deploy directory in the 2nd workspace.
Eclipse indigo. JBoss server 5.x.
The deploy directory is D:\Development2\projects2.metadata.plugins\org.jboss.ide.eclipse.as.core\JBoss_EAP_5.x_Runtime_Server1324558380698\deploy
I want it to be D:\Development\jboss-eap-5.1\jboss-as\server\default\deploy as it is for the server in the 1st workspace.
I have tried every preference and property related to this server, and I can't change it.  I'm all for editing an .xml file, I just can't find the one that has this information.
Any ideas?

A: When you doubleclick the server name, the window that opens has TWO TABS.  Look at THE BOTTOM OF THE WINDOW.  This information is changed in that window.
Sorry for the noise. Hope this helps someone as dense as I am.

A: I got this option in readonly mode.
So before making any change you have to undeploy/remove deployebles from jboss and then you can modify deployment directory operation


text:
Q: Taskbars/Unity are visible in the MythTV frontend even when the frontend is fullscreen When the MythTV frontend is full screen, the taskbars and/or Unity is still visible. How can I hide them?

A: Install compizconfig-settings-manager  using the following command.
sudo apt-get install compizconfig-settings-manager

*

*What are some of the issues with CCSM and why would I want to avoid it?
Go to Ubuntu Unity plugin and set the option for Hide launcher to auto-hide. Then, go to Workarounds and check the box for the option Legacy Fullscreen Support.
This method worked for me in 11.04.

A: For 11.04 and newer
Use compizconfig-settings-manager sudo apt-get install compizconfig-settings-manager from a terminal (CTRL+ALT+T), then run it from the dash, just open dash and type ccsm and then goto the Unity plugin and in there you can choose panel opacity to 0.  It's the best I can suggest without disabling compiz, and therefore unity.

*

*How can I configure Unity?

A: CCSM -> Workarounds -> Legacy Full Screen Suppot.
Restart mythfrontend
fixed

A: For 10.10 and older
This is caused by compiz. Disable Compiz by going to System > Preferences > Appearance (on your Gnome taskbar). Click on the Visual Effects tab, and select none.


text:
Q: How do I get div to work right in HTML and CSS? I am adding  sections to our website and all but one of them are working the way I want: i.e. no margin between sections.
I'm not able to get this one page's  sections to have no margin between sections; they have extra space beneath.  I have went over the code with a fine tooth comb and cannot find the error.
I am first including the code of a sample page that works correctly:

  <meta charset="windows-1252">

  <link href="favicon.ico" rel="shortcut icon" />
  <title>Vegan and Raw Vegan Books for Sale</title>
  <meta content="Choose poetry ebooks praising the benefits of veganism and vegetarian cuisine" name="description" />
  <meta content="width=device-width, initial-scale=1" name="viewport" />

Choose Vegan Books
Veganism kicks butt! Veganism kicks arse! Veganism kicks ass! These vegan poetry books call you to find fulfillment through veganism.

Hurray for Raw Foods and Raw Veganism: 40 Poems
When you combine two great things, veganism and the raw food diet, you create something even greater yet: raw veganism. Raw veganism can take the world by storm. Other books focus on explaining raw
    veganism and providing raw vegan recipes; this book focuses on celebrating raw veganism through poetry.

42 pages; 40 poems.

Choose Hurray for Raw Foods and Raw Veganism: 40 Poems

Let's Use Free Speech to Praise the Vegan Way
Some consider veganism tough; I consider it doable; Some consider veganism unsound; I consider it justified; Some consider veganism foolish; I consider it wise; And you will feel the same; After reading
    this poetry chapbook.

Do you want to go vegan yet need some encouragement? Have you already gone vegan and want to celebrate veganism? In either case, this book will give you what you need.

26 pages; 25 poems.

Choose Let's Use Free Speech to Praise the Vegan Way

&copy2017-2021 Free Press Media Press Inc.

Here is the code that is not working:

<!DOCTYPE html>

  <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

  <link href="favicon.ico" rel="shortcut icon">
  <title>Best Labor Unions Books for Sale</title>
  <meta content="Chose the best labor unions books promoting unions in texas and discussing labor unions pros and cons" name="description">
  <meta content="width=device-width, initial-scale=1" name="viewport">

Choose Union Books
Andrew Bushard's efforts to unionize Accenture has been inspiring people. Andrew Bushard filed a National Labor Relations Board (NLRB) unfair labor charge against his employer Accenture for violating his unionization rights.
    The NLRB agent "found merit" in his charge, so the NLRB prosecuted Accenture. Accenture capitulated and agreed to a settlement, so Andrew won the case. Victory! Andrew Bushard's unionizing success can empower you when you unionize and pursue other
    leadership endeavors.

Let's Use Free Speech to Unionize Accenture and Other Companies
Accenture doesn't pay its call center workers enough, so unions should intervene. This work discusses the problems of Accenture type leadership as well as advocates for the political
    and philosophical need for the unionization solution.

    36 pages. Cover illustration by rifatnaim.

 Choose Let's Use Free Speech to Unionize Accenture and Other Companies

Let's Use Free Speech to Promote Unions at Accenture and Other Places
Since you enjoyed my book Let's Use Free Speech to Unionize Accenture and Other Companies, you will enjoy this one as well. Since writing the first book, lots of things
    have happened and I have developed new insights, so read this book to learn more.

    28 pages. Cover illustration by rifatnaim.

Choose Let's Use Free Speech to Promote Unions at Accenture and Other Places

Let's Use Free Speech to #UnionizeAccenture and #UnionizeEverywhere
Despite opposition and obstacles, Andrew Bushard has continued to answer his calling to unionize the company of Accenture. Since the publication of his books Let's Use Free Speech to Unionize Accenture and Other Companies    and Let's Use Free Speech to Promote Unions at Accenture and Other Places, he has continued resisting management and he has experienced a paradigm shift realizing all unions are not the same. This work describes his encounters with bad and
    harmful unions, repressive and arrogant management, apathetic and hostile coworkers, and helpful and encouraging Syndicalists.

    32 pages. Cover illustration by rifatnaim.

Choose Let's Use Free Speech to #UnionizeAccenture and #UnionizeEverywhere

&copy2017-2021 Free Press Media Press Inc.

Can anyone tell me what I did differently in these two codes and how to correct the second one?

A: What you are experiencing is called "collapsing margins". Example: If there's an h2 as the first child element inside a div, and the div has no margins, the top margin of the h2 will "go outside the div" at the top - h1, h2 etc. tags have a default margins in practically all browsers (which is a browser setting). To prevent that, you can define all margins for according elements as zero, like I did below with
h1, h2 {
  margin: 0;
}

But of course this also will affect all other h1 and h2 tags, so you might want to use a class instead, or use a selector like div > h1, div > h2 { margin: 0; }

body {
  background: fuchsia;
  color: purple;
  font-size: 20px;
  font-family: Georgia;
  margin-left: 0px;
  margin-right: 0px;
  margin-top: 0px;
  margin-bottom: 0px;
  padding: 0 0 0 0px;
  clear: left;
}

option {
  background: yellow;
  color: purple;
}

table {
  background: yellow;
}

caption {
  font-weight: bold;
}

.copyright {
  color: white;
  font-size: 12px;
}

.logo {
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: 30%;
  padding-left: 280px
}

.cta {
  background: Red;
  color: white;
  font-size: 20px;
  font-family: Georgia;
  margin-left: 0px;
  margin-right: 0px;
  margin-top: 0px;
  margin-bottom: 0px;
  padding: 5 5 5 5px;
  clear: left;
}

.text {
  background: MediumSpringGreen;
  color: black;
  font-size: 20px;
  font-family: Georgia;
  margin-left: 0px;
  margin-right: 0px;
  margin-top: 0px;
  margin-bottom: 0px;
  padding: 5 5 5 5px;
  clear: left;
}

h1, h2 {
  margin: 0;
}

Choose Union Books
Andrew Bushard's efforts to unionize Accenture has been inspiring people. Andrew Bushard filed a National Labor Relations Board (NLRB) unfair labor charge against his employer Accenture for violating his unionization rights. The
  NLRB agent "found merit" in his charge, so the NLRB prosecuted Accenture. Accenture capitulated and agreed to a settlement, so Andrew won the case. Victory! Andrew Bushard's unionizing success can empower you when you unionize and pursue other leadership
  endeavors.

Let's Use Free Speech to Unionize Accenture and Other Companies
Accenture doesn't pay its call center workers enough, so unions should intervene. This work discusses the problems of Accenture type leadership as well as advocates for the political
  and philosophical need for the unionization solution.

  36 pages. Cover illustration by rifatnaim.

 Choose Let's Use Free Speech to Unionize Accenture and Other Companies

Let's Use Free Speech to Promote Unions at Accenture and Other Places
Since you enjoyed my book Let's Use Free Speech to Unionize Accenture and Other Companies, you will enjoy this one as well. Since writing the first book, lots of things
  have happened and I have developed new insights, so read this book to learn more.

  28 pages. Cover illustration by rifatnaim.

Choose Let's Use Free Speech to Promote Unions at Accenture and Other Places

Let's Use Free Speech to #UnionizeAccenture and #UnionizeEverywhere
Despite opposition and obstacles, Andrew Bushard has continued to answer his calling to unionize the company of Accenture. Since the publication of his books Let's Use Free Speech to Unionize Accenture and Other Companies  and Let's Use Free Speech to Promote Unions at Accenture and Other Places, he has continued resisting management and he has experienced a paradigm shift realizing all unions are not the same. This work describes his encounters with bad and
  harmful unions, repressive and arrogant management, apathetic and hostile coworkers, and helpful and encouraging Syndicalists.

  32 pages. Cover illustration by rifatnaim.

Choose Let's Use Free Speech to #UnionizeAccenture and #UnionizeEverywhere

&copy2017-2021 Free Press Media Press Inc.


text:
Q: Error al aplicar plugin Material Theme UI en Intllij idea Tengo instalado el plugin Material  Teme UI en mi IDE, Intellij. Este plugin lo que hace es aplicar un tema a la interfaz de forma integral (aplicando los cambios tanto en el color de la sintaxis como en las ventanas y/o panales del editor.
El problema que tengo es en la parte donde me muestra la estructura del programa que estoy haciendo (es una ayuda que permite ver de forma más gráfica los métodos, variables etc. de tu programa), y es que los íconos, de por ejemplo: los métodos y clases no se muestran como debieran
En la primera imagen muestro, señalando con el color verde cómo deberían verse los íconos señalados en rojo de la segunda imagen.
¿Se puede solucionar?
¿Cómo?


text:
Q: Table cell not displaying Image when populated from JQuery Question background:
I'm developing a simple table 'Cart'. I'm passing a populated ViewBag object (that contains a List of 'CartItem' objects) from the Controller to its associated Cart View.
The code:
The HTML table layout in the View:

        Item
        Brand
        Unit Price
        Quantity

The JQuery that populates the table rows from the passed ViewBag list:
@foreach (var cartItem in (List<LoginTest.Models.CartItem>)ViewBag.Data)
{

}

The issue:
Currently the above JQuery populates the table as shown:

Everything populates correctly except as shown the image is not displaying.
Inspecting the element in Chrome. Note I have ensured that the image exists in the Images folder If I put the img src outside of the JQuery function the image displays. What am I doing wrong?


text:
Q: How could I find what php is running when it slows down, like a sleep() command? Is there any built in debugging options or some way to monitor what php is doing? I have a few scripts that take long to load. Like is there a way to find a random sleep() input buried in the code? One script I had, I found a loose sleep command, but I found that accidentally, was wondering if I could've found it without explicitly looking for it.
Thanks

A: You want to make use of slow PHP-FPM logging.
E.g. this PHP-FPM pool configuration will log PHP traceback for scripts running 3 or more seconds:
slowlog = /srv/www/example.com/logs/slow.log
request_slowlog_timeout = 3s


text:
Q: perfect powers of the form $\frac{x^2-1}{y^2-1}$
Is there a natural number $k>1$ such that there are infinitely many
  pairs $(x,y)$ of natural numbers such that $\frac{x^2-1}{y^2-1}$ is a
  power of $k$?

In particular, is $k=2$ or $k=10$ good in this sense? (are there finitely or infinitely many solutions (in natural numbers) to equations $\frac{x^2-1}{y^2-1}=2^n$? or $\frac{x^2-1}{y^2-1}=10^n$?)

In case we put $x=y^2$, we would obtain equation $y^2+1=k^n$, which has been considered during investigations on Catalan conjecture.

A: Plugging in the fraction $\dfrac{x^2-1}{y^2-1}$ values $x=2^{2 n + 1} - 1;\;y=2^n$ we get
$$\dfrac{\left(2^{2 n+1}-1\right)^2-1}{2^{2 n}-1}=2^{2n+2}$$
so there are infinite pairs $(x,\;y)$ which give $2^k$
I think there are also infinite solution to $10^k$ but I still can't find a closed form
Hope this helps


text:
Q: AWS Linux API Patching I am having around 300 red hat server on AWS which are hosting application. I want to make sure that my Linux instances are up to date from security and other point of view. Also i can not launch a new linux instance and delete the old one to get update one.
Can anyone please suggest me how to patch the AWS linux instances from a centralize location to all 300 servers.
Thanks
Manu.

A: This seems like a DevOps type question there are many ways to script this use the AWS API and the like in many languages from Python (Using something like Paramiko) or even straight up bash.
Provided you have the keys to access these linux instances the script should be trivial:

*

*Get List of 300 servers from AWS using boto3 or awscli

*Iterate over the server set to find the IP which you can SSH (private/public)

*SSH to the instance and assume the root account

*perform the yum update | yum upgrade command

*Log out and move on to the next

*Get a coffee and wait

Hope that helps!
Thanks,
//P


text:
Q: Jaxb : Append field of Request XML without modfying JAXB java class I am using JAXB 2.0 for the Application Deveopment which is using RestFul Webservices .
Now there is a modification in the request , that is i  will be getting another filed/variable in the request XML .
<Root Id="567" att="758" />

Modified Request will be
 <Root Id="567" att="758" anotherfiledadded ="kiran" />

My question is , is it possible to automatically append that field (anotherfiledadded)in the UserData class (Without modifying the UserData ??)
The below is my UserData  class
@XmlRootElement(name = "Root")
@XmlAccessorType(XmlAccessType.FIELD)

public class UserData {

    @XmlAttribute
    private String Id;

    @XmlAttribute
    private String att;

// getters and setters

A: You can try adding the field at runtime with javassist. But... It looks like you would also require to add the Annotation @XmlAttribute and I don't know if javassist allows you to add annotations... Anyways give it a try.
See: Javassist Add

A: You could use XSLT to apply an attribute into your XML document.  All of the classes below are available in the JDK/JRE since Java SE 6.
JAXBContext jc = JAXBContext.newInstance(UserData.class);
JAXBSource source = new JAXBSource(jc, myUserData);

StreamResult result = new StreamResult(System.out);

TransformerFactory tf = TransformerFactory.newInstance();
StreamSource xslt = new StreamSource("addMyAttribute.xslt");
Transformer t = tf.newTransformer(xslt);
t.transform(source, result);

If you are implementing your RESTful service using JAX-RS you could plug-in this logic via a MessageBodyWriter:


text:
Q: How to load data from a JSON generated via mod-python I'm having some trouble while loading JSON data from a cgi written in python.
The python script sounds like this:
def get_data(req):
    #create a dictionary to be written as json
    req.write(str(dictionary)

I've used the same script with ext js so it's working, the problem is in the javascript.
I'm creating the chart but I don't know how to read data from a remote python script, I didn't find any example or docs about this. How is this done?


text:
Q: How can I plot a graph for two columns from a text file in python? I have a text file like this and I need to plot a graph for the last two columns:
! Initial pressure in atm
PRES   0.34833240
! Volume profile
! Time is s and volume in cm3
! Note: start time should be zero, since
! chemkin 3.7 doesn't make output on data with negative times (error)
VPRO  0.00000000      1.0000000
VPRO  0.54822008E-02 0.99950299
VPRO  0.65802743E-02  1.0026889
VPRO  0.73418149E-02 0.99627431
VPRO  0.90739698E-02  1.0158893
VPRO  0.96140946E-02  1.0028384
VPRO  0.97804742E-02  1.0070171
VPRO  0.10084646E-01 0.99990454
VPRO  0.10693270E-01  1.0107573

I tried the following code, but the output shows nothing:
import numpy as np
import matplotlib.pyplot as plt
for line in open("textfile.txt", "r").readlines():
    line = line.split()
    if len(line)>1 and line[0] == 'VPRO':
        column1 = line[1]
        column2 = line[2]
plt.plot(column1,column2)
plt.xlim(0,1)
plt.ylim(0,1)
plt.show()

A: you need to insert items to an array. column1 = line[1] this only sets the current value to column1 variable. Also, convert the text value to a proper type like float.
import numpy as np
import matplotlib.pyplot as plt

column1 = []
column2 = []

for line in open("d:/test/textfile.txt", "r").readlines():
    line = line.split()
    if len(line)>1 and line[0] == 'VPRO':
        column1.append(float(line[1]))
        column2.append(float(line[2]))

plt.plot(column1,column2)
plt.xlim(0,1)
plt.ylim(0,1)
plt.show()


text:
Q: hide menu after clicking (fade out) this simple html css menu.
now it working fine for page re-direction(href).
but i want hide after when click on it.
i just call on function when click on it which will call ajax request
http://jsfiddle.net/5TBFr/ code is here in link

A: I supose this is what you are looking for: http://jsfiddle.net/5TBFr/26/
I've added a click event on the a elements, and I'm returning false, so the request is stopped. You can add your ajax request there. I made a little work around, moving the "ul" element so the mouse leaves it and hides, then I'm moving it back to it's initial position.

A: First of all, if I understood you, for what you want you are going to need jQuery, why? Because javascript doesn't know what CSS properties are affecting to an specific element.
Second, the way you are using CSS is not the correct one, you are mixing desing and functionality and for the easiest task like this one you will encounter problems like this one. CSS is not intended to show or hide menus even if you can, CSS is to style things even dinamically but when the user interaction gets involved you are screwed. So be careful :P
In jQuery should be something like this:
$(document).ready(function()
{
    $('ul').on('click', 'li a', function()
    {
        $(this.parentElement.parentElement).hide();
    });
});

http://jsfiddle.net/5TBFr/25/


text:
Q: Creating a cell that updates to new value using multiple factors I was wondering if it is possible to create a formula that updates a cell that needs to update based on both numbers and letters or would I need to create a code in VBA.  What I need now is for the following values to update when the information is entered in to a designated cell:
If AA0 is entered in cell A1, then AA1 should populate in cell A2, (I would like to use AA0 all the way through AA9, and then go to AB0, which would then go to AC0 when AB9 is entered, and then if AZ9 is entered go to BA0 (I am hoping I am making since) when any of those values are entered in the cell.  I had tremendous help on here before for a similar question but this involves all three digits/numbers in the cell as a determining factor and I am struggling with a formula for it.  Thank you all in advance for any assistance.
Edited to add:  Everything would just be entered into one cell.  So if someone entered in A1 BC4, A2 would update to BC5.  I wouldn't need a running list, this is to keep track of what the previous value used was.
Edit 2 adding photos for clarity:

A: If you always start at AA0 put this in the first cell and copy down:
=LEFT(ADDRESS(1,INT((ROW(1:1)-1)/10)+27,4),2)&MOD(ROW(1:1)-1,10)

If you want the start to be dynamic then put this in A2 and copy down:
=IF(AND(MID(A1,2,1) = "Z",RIGHT(A1)="9"),CHAR(CODE(LEFT(A1))+1),LEFT(A1))&IF(AND(MID(A1,2,1) = "Z",RIGHT(A1)="9"),"A",IF(RIGHT(A1)="9",CHAR(CODE(MID(A1,2,1))+1),MID(A1,2,1)))&IF(RIGHT(A1)="9","0",RIGHT(A1)+1)