Is there a simpler closed form for $\sum_{n=1}^\infty\frac{(2n-1)!!\ (2n+1)!!}{4^n\ (n+2)\ (n+2)!^2}$

Question: I have the following infinite sum that can be expressed in terms of the generalized hypergeometric function:
$$\sum_{n=1}^\infty\frac{(2n-1)!!\ (2n+1)!!}{4^n\ (n+2)\ (n+2)!^2}=\frac{31}8-4\times{_4F_3}\left(-\frac12,\frac12,1,1;\ 2,2,2;\ 1\right)\\\ \\\approx0.008749644047541935203478962326551903908774780849356243615274...$$
I wonder if it can be expressed in terms of simpler functions and well-known mathematical constants.
Comment: Is there any motivation that led you to think that it has a closed form?
Comment: @sos440 No particular reason to expect it exists. I just wonder if there is one, because it would be nice.
Comment: My answer to [this post](https://math.stackexchange.com/questions/2123298) instantly solves the problem.
Answer: Ookay... Consider just the hypergeometric function and its closed form.
Take 16.5.2 from DLMF (with $a_0=1/2$, $b_0=2$) and write (I used Mathematica to substitute the special form for the hypergeometric function in the integrand; I don't really know how to do it by hand):
$$ F(-1/2,1/2,1,1;2,2,2;1) = \int_0^1 \frac{8 \sqrt{1-t} \left(4-4 \sqrt{1-t}+t\sqrt{1-t}-\log8+3 \log(1+\sqrt{1-t})\right)}{9 \pi  t^{3/2}}\,dt. $$
Mathematica can then do the integral in closed form to give
$$\frac{1}{9 \pi }8 \left(\frac{70}{3}+\frac{11 i \pi ^2}{4}+\pi  \left(-7+\log 512-6\log\left(1+\frac{1+i}{\sqrt{2}}\right)\right)+24 i \mathrm{Li}_2\left(-\frac{1+i}{\sqrt{2}}\right)-24 i \mathrm{Li}_2\left(1-\frac{1+i}{\sqrt{2}}\right)\right),$$
where $\mathrm{Li}_2$ is the polylogarithm.
Of this we take the real part only and do some more FunctionExpand:
$$-\frac{56}{9}+\frac{560}{27 \pi }-\frac{16 C}{3 \pi }+\frac{64 \Im\left(\mathrm{Li}_2(1-(-1)^{1/4})\right)}{3 \pi }+\frac{8 \log512}{9}-\frac{8}{3} \log\left(\frac{1}{2}+\left(1+\frac{1}{\sqrt{2}}\right)^2\right)+\frac{\psi_1\left(\frac{1}{8}\right)}{3 \sqrt{2} \pi }+\frac{\psi_1\left(\frac{3}{8}\right)}{3 \sqrt{2} \pi }-\frac{\psi_1\left(\frac{5}{8}\right)}{3 \sqrt{2} \pi }-\frac{\psi_1\left(\frac{7}{8}\right)}{3 \sqrt{2} \pi }, $$
where $\psi_1$ is the polygamma function and $C$ is the Catalan constant.
Now, the polylogarithm term there can be simplified using the identity (DLMF 25.12.6)
$$ \mathrm{Li}_2(x)+\mathrm{Li}_2(1-x)=\frac{\pi^2}{6}-\log x\log(1-x), $$
because $\mathrm{Li}_2((-1)^{1/4})$ is simpler.
After a further FunctionExpand (which gets rid of the polygamma functions also), ComplexExpand to get the real part, and FullSimplify to simplify the expression, the answer is
$$ -\frac{56}{9}+\frac{560}{27 \pi }-\frac{32C}{3 \pi }+\frac{16}{3} \log2$$
Comment: It is really amazing! I wonder if we ever see the time when CAS would be able to do such simplifications without human aid...
Comment: Is there any catalog of special values of hypergeometric function where we could submit such discoveries?
Comment: I did this by (systematic) trial and error: I looked through mathworld and DLMF to see if I could find any identity that would let me simplify ${}_4F_3$ into a ${}_3F_2$ or ${}_2F_1$, and eventually I found 16.5.2 which happens to do the trick with the right choice of which coefficients $a_0,b_0$ to use (with $a_0=1$, $b_0=2$ you get integrals of elliptic integral functions, which is a dead end). Without a CAS this is basically impossible because one's motivation would run out far earlier than one arrives at an answer.
Comment: The hypergeometric function in this question has a complicated closed form in terms of standard functions and $F(\frac32,\frac32,\frac32;\frac52,\frac52;\frac{1+\sqrt{1-x}}{2})$, $0<x\leq 1$, and that hypergeometric is special because the differences between top and bottom parameters are integers, so it is a (repeated) integral of a much simpler hypergeometric.
Comment: DLMF 16.4, and also mathworld list some special values of generalized hypergeometric functions, especially with argument 1. It would definitely be useful as a lookup table for a CAS (not for a human, given how rarely any given special value appears).
Comment: Coincidentally, [this post](https://math.stackexchange.com/a/3081779/4781) discusses  $\,_3F_2\big(\tfrac12,\tfrac12,\tfrac12;\tfrac32,\tfrac32;\alpha\big)$ and $\,_3F_2\big(\tfrac32,\tfrac32,\tfrac32;\tfrac52,\tfrac52;\alpha\big)$ while [this post](https://math.stackexchange.com/questions/3082938/) is about $S=\,_3F_2\big(\tfrac12,\tfrac12,\tfrac12;\tfrac32,\tfrac32;\tfrac14)$ where $S$ is the _Gieseking constant_. Perhaps you can shed more light on the latter post?
Answer: I can give a partial answer:
My program based on the TranscendentalRecognize algorithm using a wide set of commonly occuring constants after several hours of work discovered the following inequality:
$$\Bigg|\frac{16\ln2}{3}-\frac{32C}{3\pi}+\frac{560}{27\pi}-\frac{56}{9}-{_4F_3}\left(-\frac{1}{2},\frac{1}{2},1,1;2,2,2;1\right)\Bigg|<10^{-1000},$$
where $C$ is the Catalan constant.
I have no idea if the actual difference is exact $0$, or how to (dis-)prove it.
Comment: I think this is the correct closed form.
Comment: The actual difference is $0$, see the other answer! WOW!
Comment: Can your TranscendentalRecognize algorithm find some values for this expression? https://math.stackexchange.com/questions/2368960/closed-form-expression-of-a-hypergeometric-sum
Answer: Those calculations are really addictive.. Now, this sum is doable because the term in the sum can be written as a product of a binomial factor, a beta function and a rational function . Let me show how it goes. Firstly we have:
\begin{eqnarray}
(2n-1)!!&=& 2^n \frac{(n-\frac{1}{2})!}{(-\frac{1}{2})!}\\
(2n+1)!!&=& 2^n \frac{(n+\frac{1}{2})!}{(+\frac{1}{2})!}
\end{eqnarray}
Therefore the sum in question reads:
\begin{eqnarray}
&&\sum\limits_{n=1}^\infty \frac{(2n-1)!! (2n+1)!!}{4^n (n+2)[(n+2)!]^2}=\\
&&\sum\limits_{n=1}^\infty \frac{(n-\frac{1}{2})!}{(-\frac{1}{2})!} \frac{(n+\frac{1}{2})!}{(+\frac{1}{2})!} \cdot \frac{1}{(n+2)[(n+2)!]^2}\\
&&=\sum\limits_{n=1}^\infty \binom{n-\frac{1}{2}}{n} \cdot \frac{(n+\frac{1}{2})! (+\frac{1}{2})!}{[(+\frac{1}{2})!]^2(n+2)!} \cdot \frac{1}{(n+2)^2 (n+1)}\\
&&= \sum\limits_{n=1}^\infty (-1)^n \binom{-\frac{1}{2}}{n} \cdot \frac{1}{[(+\frac{1}{2})!]^2} \cdot \int\limits_0^1 t^{n+\frac{1}{2}} (1-t)^{\frac{1}{2}} dt \cdot \frac{1}{(n+2)^2 (n+1)}\\
&&= \frac{16}{3 \pi} \sum\limits_{n=1}^\infty (-1)^n\binom{\frac{3}{2}}{n+2} \cdot \int\limits_0^1 t^{n+\frac{1}{2}} (1-t)^{\frac{1}{2}} dt \cdot \underbrace{\frac{1}{(n+2)}}_{\int\limits_0^1 \theta^{n+1} d\theta}\\
&&=\frac{16}{3 \pi} \int \limits_0^1 t^{\frac{1}{2}} (1-t)^{\frac{1}{2}} \cdot \int\limits_0^1 \theta\underbrace{\left\{ \sum\limits_{n=1}^\infty \binom{\frac{3}{2}}{n+2} (-\theta t)^n\right\}}_{\frac{-3 t^2 \theta ^2+12 t \theta -8 t \theta  \sqrt{1-t \theta }+8 \sqrt{1-t \theta }-8}{8 t^2 \theta ^2}} d\theta dt\\
&&= \int\limits_0^1 (1-t)^{\frac{1}{2}} \cdot \\
&&\left( \frac{\left(-9 t-32 \sqrt{1-t}+72\right) t+32 \left(4 \sqrt{1-t}-4+\log (8)\right)-48 \log (t)-96 \tanh ^{-1}\left(\sqrt{1-t}\right)}{9 \pi  t^{3/2}}\right) dt =\\
&&\frac{31}{8}-\frac{128}{27 \pi} + \int\limits_0^1 (1-t)^{\frac{1}{2}}\cdot\left(\frac{32 \left(4 \sqrt{1-t}-4+\log (8)\right)-48 \log (t)-96 \tanh ^{-1}\left(\sqrt{1-t}\right)}{9 \pi  t^{3/2}} \right)dt=\\
&&\frac{1303}{72}-\frac{1664}{27 \pi} + \int\limits_0^1 (1-t)^{\frac{1}{2}}\cdot \left( \frac{-48 \log (t)-96 \tanh ^{-1}\left(\sqrt{1-t}\right)+32 \log (8)}{9 \pi  t^{3/2}}\right) dt=\\
&&\frac{1303}{72}-\frac{1664}{27 \pi} + \frac{32 (4 C-2+\pi -\pi  \log (4))}{3 \pi }=\\
&&\frac{128 C}{3 \pi }+\frac{2071}{72}-\frac{2240}{27 \pi }-\frac{32 \log (4)}{3}
\end{eqnarray}
which matches the answer given by Kirill.


C# What is the wrong in this reference master page code?

Question: I need to reference a master page to content pages in order to change the css style of the Home page which is referenced to the master page. This is my control which i need to change it, its located on the master page.

Home

About us

Collections

Register

I need to change the  style on each content page. I know that I should first reference the master page on the home page for example. But I dont know how to use the FindControl. This what I have on my server side.
HtmlGenericControl HomeLink = null;
HomeLink = (HtmlGenericControl)Master.FindControl("HomeLink");
HomeLink.Style.Add["Background-color"] = blue;

And of course its not working. Help me please.
Comment: Aren't you missing a runat="server" attribute on the td? Also, you misspelled the id in the findcontrol call.
Answer:
Add runat="server" to your td tags
FindControl is not recursive. MSDN says "This method will find a control only if the control is directly contained by the specified container; that is, the method does not search throughout a hierarchy of controls within controls"

http://msdn.microsoft.com/en-us/library/486wc64h.aspx
public static Control FindControl(Control control, string id)
{
     if (control.Id == id)
         return control;

     foreach(Control c in control.Controls)
     {
         Control res = FindControl(c, id);
         if (res != null)
              return res;
     }

     return null;
}

Comment: can i use this one? WebControl control = (WebControl)FindControl("HomeLink");
        control.Style["Background-Color"] = blue;


PostgreSQL merge COUNT and GROUP BY result

Question: select type, created_at::date , count(type)
from txns
group by created_at::date, type
order by created_at::date;

The above SQL query gives the following output:
  type   | created_at | count
---------+------------+-------
 full    | 2017-05-20 |     2
 virtual | 2017-05-20 |     2
 full    | 2017-05-21 |     1
 virtual | 2017-05-21 |     1
 full    | 2017-05-22 |     3

How can I group the above result by created_at to get the following output:
 created_at | full_count | virtual_count
------------+-----------------
 2017-05-20 |     2     |  2
 2017-05-21 |     1     |  1
 2017-05-22 |     3     |  0

I want to get the full and virtual type count by created_at in a single row.
Answer: this should work:
with so as (
select type, created_at::date , count(type) from txns group by created_at::date, type order by created_at::date
)
 select
  created_at
, sum(case when type = 'full' then count else 0 end) full_count
, sum(case when type = 'virtual' then count else 0 end) virtual_count
from so
group by created_at;

 created_at | full_count | virtual_count
------------+------------+---------------
 2017-05-20 |          2 |             2
 2017-05-21 |          1 |             1
 2017-05-22 |          3 |             0
(3 rows)

Comment: You are Awesome Thanks!
Waiting for other result other wise i will accept it Thanks A lot.
Answer: If you have more then two types, and in further processing you can deal with hstore:
WITH q AS ( SELECT type, created_at::date , count(type) FROM txns GROUP BY 1,2)
SELECT created_at, hstore(array_agg(type), array_agg(count::text))
FROM q GROUP BY 1;

Answer: I would do this without a CTE/subquery as:
select created_at::date,
       sum( (type = 'Full')::int ) as cnt_full,
       sum( (type = 'Virtual')::int ) as cnt_virtual
from txns
group by created_at::date
order by created_at::date;

Postgres often materializes CTEs, so this could even have a slight performance advantage.
Note:  You can also use filter in more recent versions of Postgres:
select created_at::date,
       count(*) filter (where type = 'Full') as cnt_full,
       count(*) filter (where type = 'Virtual') as cnt_Virtual
from txns
group by created_at::date
order by created_at::date;

Comment: this solution is better, and "type" shouldn't be in the group.


Is it possible to display Jacoco Coverage report on Jenkins dashboard?

Question: I have jenkins file which has publishHTML method to generate report with .html file of jacoco result. Is it possible to display that report on dashboard like 'Test Trend Result' ?
Answer: So I went through a bit then found a solution adding to the pipeline directly
<code>publishCoverage adapters: [jacocoAdapter('target/site/jacoco/jacoco.xml')]
</code>
Reference: https://github.com/jenkinsci/code-coverage-api-plugin
Comment: You can also surface everything in one report using the "mergeToOneReport" argument, such as:   publishCoverage adapters: [jacocoAdapter( mergeToOneReport: true, path: '**/reports/jacoco/jacocoTestReport/*.xml')]
Answer: You need to use the JaCoCo plugin

Get coverage data as part of your build First you need to get coverage
  calculated as part of your build/tests, see the JaCoCo documentation
  for details. You need at least one or more *.exec file available after
  tests are executed. Usually this means adjusting your Maven pom.xml or
  Ant build.xml file..
Set up coverage retrieval and publishing In order to get the coverage
  data published to Jenkins, you need to add a JaCoCo publisher and
  configure it so it will find all the necessary information. Use the
  help provided via the question-mark links for more information.
  Basically you specify where the *.exec files are, where compiled code
  can be found and where the corresponding source code is located after
  the build is finished to let the plugin gather all necessary pieces of
  information..


Using @OneToOne with @Where

Question: Let's assume that I have 2 entites: Body and Leg. Leg has field side (it's value can be either Left or Right) and also has foreign key to Body.
I'm sure that every instance of Body has only one left and only one right leg. So I want to create 2 One-To-One mappings between Body and Leg based on value of side field.
In other words, I have One-To-Many relation on database level, and want to get One-To-One in the model. Is it possible?
Body.scala

@Entity
@Table(name = "body")
case class Body(
    @(Id@field)
    var id: String = null,

    @(OneToOne@field)(cascade = Array(CascadeType.ALL), mappedBy = "body")
    var leftLeg: Leg = null,

    @(OneToOne@field)(cascade = Array(CascadeType.ALL), mappedBy = "body")
    var rightLeg: Leg = null
)

Leg.scala

@Entity
@Table(name = "leg")
case class Leg(
    @(Id@field)
    var id: String = null,

    @(OneToOne@field)
    @(JoinColumn@field)(name = "body_id")
    var body: Body = null,

    @(Column@field)
    var side: String = null
)

Of course, I can do it as One-To-Many and add 2 getters for each leg, but I also need to filter by left leg (for example) in reporsitory, so want to write something like this
@Query(value = "select b from Body b where b.id = ?1 and b.leftLeg.size = ?2)
def findBodyByLegSize(bodyId: String, size: String): Body

Answer: the Only solution is to duplicate Leg Class to LeftLeg and RightLeg and create two tables of Leg (you can use extends)
@Entity
@Table(name = "LeftLeg")
case class LeftLeg (
    @(Id@field)
    var id: String = null,

    @(OneToOne@field)
    @(JoinColumn@field)(name = "body_id")
    var body: Body = null,

    @(Column@field)
    var side: String = null
)

Using @OneToOne with @Where


Are there any C-like (in syntax) scripting languages other than JavaScript and PHP?

Question: I am looking for a general-purpose (considering PHP is actually made and initially meant (I understand they are be used different ways some times) for server side Web and JavaScript for client-side web) with C/C++/C#/Java-like syntax. Do you know of such?
Comment: You should probably be a bit more precise about what you mean by "Scripting" language. Dynamic typing? Interpreted? Have good system interface (e.g. can be used to write system "glue" scripts)?
Answer: Mythryl is a general-purpose scripting languages deliberately designed around C syntax.
Comment: Hmm... Curious. "Mythryl provides Perl-like scripting convenience in a typed, compiled language" (from the link above). I'm not sure if I should be excited at the idea or horrified :)
Answer: Perhaps Pike with Fins
Answer: There's also Ch, an embeddable C/C++ interpreter.
Answer: Just look through the Comparison of programming languages, and see which ones fit your needs best. You might look at the language with dynamic Type Systems, because those are scripting languages. Hyped languages include Scala, Ruby (with the Ruby on Rails web framework), Groovy and others, if you need a start.
Comment: I like Scala the best of all languages I've ever seen, but it seems that script mode is just of an auxiliary purpose there. I don't think I can just start a source file with something like  #!/usr/bin/scala and use it for system scripting.
Comment: Depends on your system. On Ubuntu, as I notices just one week ago, you can even start a C-program directly on the command line. It gets compiled and started on the fly, very impressive. And I am sure you can configure it to start a Scala script like this, too.
Answer: In general, Wikipedia's C language entry lists many: "C has directly or indirectly influenced many later languages such as Java, Perl, Python, PHP, JavaScript, LPC, C# and Unix's C Shell"
Specifically, for general-purpose "scripting" language that is very similar to C, I would strongly recommend Perl which fits the bill perfectly.
Perl's syntax (or at least a sub-set of it) is VERY C-like (to the point that ex-C programmers starting in Perl are unfortunately known to code in "C-ish Perl" style which is pretty much straight up C).
In additional to general syntax ideas, Perl supports a vast majority of C system functions and many other C-isms (e.g. fully functional printf, process control and IPC).
Perl these days is definitely a general purpose language - it is used for anything from web development (including modern frameworks like Catalyst MVC, Plack etc...), to enterprise software development including full blown servers, to system administration scripting and general "scripting" glue tasks.
In addition, it supports both Object Oriented programming (either using classic Perl OOP or using modern Moose), as well as functional programming.
Please note that when evaluating Perl, you should not rely on the numerous myths that exist out there - most of these are due to either people not being sufficiently familiar with Perl, or judging Perl based on a large mass of poor-code-quality dirty scripts written by system administrators who weren't software developers, or judging Perl based on its features in Perl versions that were popular 15 years ago (e.g. any criticism of Perl OOP circa 1998 is pretty much useless unless the person doing it is closely familiar with Moose).

P.S. Since your questions seems to be in  "...coming from PHP" context, you should also note that PHP is in fact very similar to a subset of Perl - by design. To quote from php.net:

The syntax itself was similar to that of Perl, albeit much more limited, simple, and somewhat inconsistent.

Matter of fact, PHP started out as a collection of Perl CGI scripts.
Answer: I am currently working on a new project called Cpy, using Python's execution engine, but wrting codes in C-syntax. It is built with ANTLR and Python. Take a look at it: http://www.ideawu.com/cpy/
Answer: Pawn. Not general purpose (depending on your definition) but very good as a small embedded language.


Are there multiple LTS distributions available?

Question: My distributed network consists of atleast 10 servers, all of which are running Ubuntu 12.04 LTS. This was a design decision, so that we would have a more consistent back-end, as far as the Operating System was concerned..
this is also so that we can more easily plan our maintenance workload, with anticipation of the distribution release cycle.
However, I have noticed that on one of our development machines, that which runs Ubuntu 12.04 LTS Desktop Distribution, that there was recently a Hardware Stack Upgrade.
We installed this to our machines within the distributed network, instead of upgrading to the latest version of Ubuntu. The idea being that we have the latest candidates for hardware and Kernel support, while still running the long term service distribution which is currently available.
I logged on the other day, to find out that Ubuntu 14.04 LTS has been released.

My Question(s) is this:

How does this effect the software/kernel/OS update, patch, and development cycle of Ubuntu 12.04 LTS?
Is Ubutnu 12.04 Still in service until 2017, such as it was that last time I checked?
Is there any reason to upgrade our machines to 14.04 LTS, or should be just wait until 12.04 LTS is no longer supported?
Thanks for your time, to whom ever answered this for me!
Answer: Let me explain a bit how the "enablement stack" model works for 12.04 and subsequent releases.
A problem with LTS releases was that hardware support became "frozen" to whatever the LTS kernel supported. However, a lot of new hardware may come out in the 2 years between LTS releases, and while this new hardware is added to non-LTS releases, there was no official mechanism to "backport" this support to the preceding LTS release.
The "enablement stack" model works as follows. When a new stable version of Ubuntu comes out, its kernel and graphics driver stacks get "backported" or packaged for the preceding LTS. This enables people using that LTS to upgrade only the kernel and graphics drivers and enjoy the added hardware support (and other features, maybe, as the kernel also gets new goodies all the time) of the most recent Ubuntu release.
For instance, 12.04 received:

The 3.5 kernel from Ubuntu 12.10 with the 12.04.2 point relase/stack.
The 3.8 kernel from Ubuntu 13.04 with the 12.04.3 point relase/stack.
The 3.11 kernel from Ubuntu 13.10 with the 12.04.4 point relase/stack.
The 3.13 kernel from Ubuntu 14.04 with the 12.04.5 point relase/stack.

In addition to providing new hardware support, this allows Canonical to consolidate support resources: as you noted, once an LTS is released (in this case, 14.04), its kernel gets backported to the previous LTS release (12.04) and that enablement stack will continue to be supported for the remaining 2.5 years before 12.04 ends its life.
This way, 12.04 users benefited from hardware support upgrades until a new LTS is available (14.04). At that point they can choose to continue with 12.04 (no additional hardware support, though it will receive security updates), or upgrade to 14.04.
Another rationale behind not adding new hardware support to 12.04 is that, if you buy new hardware and are installing from scratch, you may as well install 14.04 which is the most current LTS.

How does this effect the software/kernel/OS update, patch, and
  development cycle of Ubuntu 12.04 LTS?

As I mentioned, 12.04 will continue to receive security and other critical updates. However, only the 3.13 kernel for 12.04 will be upgraded; older kernels will not receive any more upgrades, so you really should update to the latest kernel. This is usually safe to do, as those kernels are very well tested. The rest of your applications and software stack stay the same and continue to receive updates until 2017.
Is Ubutnu 12.04 Still in service until 2017, such as it was that last time I checked?

Yes, it is, and it will continue to receive security updates until then. Note however, that there will be NO new "enablement" stacks; so the hardware support provided by the 14.04 enablement stack will be the last update it will receive. This means that 12.04 will probably not support new hardware that may come out.
Is there any reason to upgrade our machines to 14.04 LTS, or should be just wait until 12.04 LTS is no longer supported?

That's the whole point of the 5-year LTS support cycle. You can keep your hardware and 12.04 installed on them until then, no problem.
Comment: the other answer was basically that same, but yours was more detailed, and thorough. I would have selected yours as the answer, but but you were typing as I was reading the other users post. thanks for the detailed explanation however. I appreciate it!
Comment: Don't worry, I appreciate your comments and am always glad to provide useful information.
Answer:
Is there any reason to upgrade our machines to 14.04 LTS, or should be just wait until 12.04 LTS is no longer supported?

This depends on your needs.  If you're running a low end minecraft server (which I doubt you are) you have no need to upgrade.  But here are some of the Pros of upgrading:

More hardware support
Sometimes a new version of a software you wish to use may not be backwards ported to an older LTS
Extending LTS

But if you're fine using the software you are using right now, and feel there is no need to upgrade (i.e. your systems are hardened as is, no benefit from going forward, your system is running fine) there is no reason to since 12.04 is a LTS (its EOL is April 2017) it will continue to get security updates just like 14.04 will.
Personally, I would wait for a good time to upgrade your systems and then go for it.  But you have until April 2017 to do that.
Edit:  You should also watch release notes for software/tools you use and make sure that they are going to continue 12.04 LTS support.  Because that seems like it could be a limiting factory to how long you can wait to upgrade


Excel Formula/Equation for Finding How Many Units can fit in a Box (Hard)

Question: Column A = Units, Column B = Box and need to find Column C = Box2
Unit   Box   Box2
2      11    10(need a formula here to calculate this)
3      10    9
4      10    8

I need Column C to suggest appropriate box size to fit most possible units.
so for C2, since 11/2 = 5.5, so the box should suggest 10 to make a perfect fit.
for C3, 10/3 =3.33 so 9, and 10/4 = 2.5, so 8 and not 12.
Answer: In cell C2 and copied down:
=INT(B2/A2)*A2

Answer: FLOOR would also work
=FLOOR(B2,A2)


Unable to retrieve GET parameters using laravel

Question: I am working on a Laravel project and am trying to get GET parameters from a controller. Requesting a page with ?date={value} should return value as follows:
public function getIndex(Request $request) {
    return $request->input("date");
}

This does not work though. POST requests work as they should. I am using nginx through cloudflare. I tried making a plain PHP file with
echo $_GET["date"];

which works fine.
Comment: is this a copy of this question? http://stackoverflow.com/questions/31923484/cant-retrieve-get-variables-in-laravel/31927415#31927415 it is very identical
Comment: Just to be clear, this parameter that you want is been passed as a query string?
Comment: @Victor Yes, that is correct
Comment: What version of laravel are you using? 4.2, 5.0 or 5.1? What does your route that call that Method looks like? See if [this response](https://stackoverflow.com/questions/24744825/laravel-queries-strings) helps you.
Comment: @Victor I am using version 5.0. `Input::get("date")` does not work either. In routes.php I have `Route::controller('page', 'PageController');`.
Comment: @maytham None of the answers worked for me
Answer: I found my problem. In the nginx configuration for the site (/etc/nginx/sites-available/default), I had
location / {
    try_files $uri $uri/ /index.php?;
}

which should be
location / {
    try_files $uri $uri/ /index.php?$query_string;
}

Fixed, restarted, now it works.
Answer: My problem was in .htaccess file after remove index.php from url , just add this simple code in .htaccess  file  :
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

Answer: Maybe getIndex() and Request $request dont work with Route::controller. Use a get('/my-route'), It's more flexible.
Comment: Another page uses an explicit `Route::get('page', 'PageController@getIndex');`, but GET requests don't work there either.
Comment: You created another public function with the same param, works? (Change the function name and test)


Do shorn sheep regrow their wool?

Question: Following on from this question on dyed sheep the thought occurs "Do shorn sheep regrow their wool".

I know that shorn sheep stay that way for a while - I see them around and about.
I know that mobs disappear and then respawn when you leave and return to an area.

So if you have a shorn sheep will it regrow it's wool if you stay in vicinity for long enough?
I'm guessing that sheep that disappear and then respawn come back with a full coat.
Answer: Sheep can regrow wool by eating a grass block (converting it to dirt). In addition, if you dye the sheep and then shear it, the wool grows back coloured. So this way you can generate flocks of rainbow sheep.
History: In early versions, after eating three grass blocks, they would regrow their wool(source). This disappeared (sheep would no longer eat grass), and then was added again in Minecraft 1.1.
Comment: According to the [Minecraft Wiki](http://www.minecraftwiki.net/wiki/Sheep) that was only in Survival Test. Is it still true in Beta?
Comment: Did some more digging and found evidence that seems to suggest that they no longer do. Edited my answer and included a link to Minecraft Wiki. I can't confirm directly myself as the few times I've bothered to harvest wool recently have been by walking until I saw more sheep. I'm impatient. :)
Comment: @KevinReid I will admit that I don't play Minecraft any longer. Did some quick research and it seems they still regrow their wool and do so as the color they were dyed. Is this now incorrect?
Comment: Oops, my eyes skipped right over the strikethrough on the "No." Sorry for the trouble! Perhaps I'll edit for clarity.
Answer: No.
Sheep don't eat grass anymore, and cannot regrow their wool.
Most of the time, you will not see any more sheared sheep because they have gotten out of your render range and "disappear."
Comment: This is no longer correct, since sheep again eat grass to regrow wool.

Do shorn sheep regrow their wool?


Software with foldable/expandable view of multiple txt/md files

Question: I have many todo files in markdown format scattered on my directories tree. I like to keep it this way because my todo files stay in each project folder. But I also like to get a global overview of what to do in all my projects, so I'm using for now a small script that read a list of paths to those files, concatenate the files into a single file. I'm using geany for opening this file. If I want to modify anything, I need to open the original file, save it and reapply my script.
I'm wondering if anyone knows a software/geany plugin/atom plugin that would be able to open those multiple files in the same view.
Ideally, I would like to be able to:

fold/expand files one by one
save any modification in the view directly on the original .md file
syntax coloration, though I could do without
open source

Yet, I haven't found something closer to that than my concatenation. Any idea ?
Thanks a lot!
Comment: You could create a plain-text list of your todo files, then use right-click "Open selected file" in Geany to open just that file in a separate tab.
Comment: That's exaclty what I'm doing right now. The problem is that I can't fold/expand, and I need to open the files separately, and rerun my script
Answer: It seems that VNote will suite your needs.
See official screenshot below:

You can download it and use as AppImage:
<code>cd ~/Downloads
wget https://github.com/tamlok/vnote/releases/download/v2.4/VNote-2.4-x86_64.AppImage
chmod +x VNote-2.4-x86_64.AppImage
./VNote-2.4-x86_64.AppImage
</code>
Comment: Seem a interesting software!  I haven't found the way to open a note while keeping its original location on the disk... and neither how to have multiple/all my notes open in a raw
Comment: You can switch between raw and preview by pressing ``. Not sure about notes location.
Comment: sorry not "in a raw", but "in a row"
Answer: Another suggestion would be Zim, which you will find in Ubuntu Software. It also works based on text notes in markup language. It shows you a tree of your notes to the left, and allows to link between notes.
While you could work like you do now, it features a Todo plugin that takes a different approach. You can insert your todo's in any note using a checkbox. The plugin can then collect all these todo's from the different pages and show them in a list, ordered by due date and priorities.
Excellent software from a developer who clearly uses his software intensively himself.


.net dll instantiation on 32 and 64 bit machines

Question: I am fuzzy on when you can reference a 32 bit dll in visual studio (c# or vb) on a 64 bit machine.
I am trying to do one now (Interop.PDF2IMGOCXLib.dll or just PDF2IMGOCXLib.dll) and it errors out with the message:
Retrieving the COM class factory for component with CLSID {66BBFF81-C832-411C-B81E-883C3A96CFD8} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
This same code works on a 32 bit machine however.
It is a 3rd party dll, so I cannot edit it.
Please correct me where I am wrong.  I thought that Visual Studio was a 32 bit application that would allow reference to 32 and 64 bit references.
I have tried several things:

Ensure the compile>Platform setting is (x86) for 32 bit.
Registered the dll (in many places), including wow64 folder.  Registering it with regsvr32 errors out with standard "The module dllname was loaded but the entry point dllregisterserver was not found". Registering it with Regasm.  It says it worked fine.

The reference error that occurs in Visual Studio occurs right on the declare statement
Module Module1
<code>Sub Main()
    Dim x As New PDF2IMGOCXLib.Pdf2Img

    Return
End Sub
</code>
End Module
So, in general, when can 32 bit dlls be used in visual studio on a 64 bit machine?
Maybe something about the dll only working if it was just targeted for 32 bit systems, but not if targeted for for both 32 and 64 bit systems.
Any thoughts?
Comment: When you move from one machine to another, the stuff that does not normally move along as well are components that were installed on the old machine.  Which is the root cause of this exception message.  You can get a second opinion from SysInternals' Process Monitor.  You'll see your app searching the registry and not finding the key.  Compare against the trace on the old machine, verify what the trace tells you with Regedit.exe
Answer:
%systemroot%\SysWoW64\regsvr32.exe is for win32
systemroot%\System32\regsvr32.exe is for x64
you should use %systemroot%\SysWoW64\regsvr32.exe instead of %systemroot%\System32\regsvr32.exe to regist your COM control
make sure your exe is win32 only
by the way, if the windows versions of the two pc are different, try to use "Compatibility Mode" to start your exe.


Ubuntu login doesn't do anything. Left with only a cursor and background

Question: I've tried with lightdm, kdm, unity and kde4. Same results. I enter my password, hit enter and the login menu disappears, leaving just the cursor and greeter background. The window manager, whichever it is, simply doesn't start.
How can I fix it and which log files should I be looking at to track down this issue?
Answer: I've fixed it by removing the entire <code>~/.cache</code> directory. I read somewhere that it could be a permissions issue with a file there. Perhaps from running something as root/sudo. Still not sure of the right way to debug the problem, was just trial and error.


Error while updating "System does not contain Ubuntu-desktop"

Question: Here is the error I get when I am trying to install the updates suggested by the Update Manager in my Ubuntu 11.10. I have not installed and/or removed gnome/KDE/xfce or any other window manager. It is as it was at the time of installation.
Comment: No, I was merely trying to update the existing packages. No intention of upgrading to an alpha.
Answer:
I am trying to update my Ubuntu 11.10 in the regular fashion

What do you mean by "regular fashion"? Alternate cd upgrade?
What do you mean by "update"? Update to ubuntu 12.04? Which program are you using for your "regular fashion"?

Probably some package removed it.
If you use ubuntu (gnome), execute these commands:
<code>sudo apt-get update
sudo apt-get install ubuntu-desktop ubuntu-standard ubuntu-minimal
sudo apt-get dist-upgrade
</code>
This will install the meta-packages and perform a full upgrade (will not change ubuntu version). Reboot your computer.
Comment: Oh, I was trying to "Update", not "Upgrade", I have edited my post to make it unambiguous. And thanks, that did the update.


ValueError: "['f']" is not in list but it is

Question: I have this dictionary, below, which I turn into a list:
alphabet_dict_lowerCase = {'a': 1, 'c': 3, 'b': 2, 'e': 5, 'd': 4, 'g': 7, 'f': 6, 'i': 9, 'h': 8, 'k': 11, 'j': 10, 'm': 13, 'l': 12, 'o': 15, 'n': 14, 'q': 17, 'p': 16, 's': 19, 'r': 18, 'u': 21, 't': 20, 'w': 23, 'v': 22, 'y': 25, 'x': 24, 'z': 26}

list(alphabet_dict_lowerCase):
['a', 'c', 'b', 'e', 'd', 'g', 'f', 'i', 'h', 'k', 'j', 'm', 'l', 'o', 'n', 'q', 'p', 's', 'r', 'u', 't', 'w', 'v', 'y', 'x', 'z']
I am trying to see if intersectionLetter is in the list list(alphabet_dict_lowerCase using index():
    for line in data:

        first_half  = line[:len(line)//2]
        second_half = line[len(line)//2:]

        first_half = [str(line) for line in first_half if line.strip()]
        second_half = [str(line) for line in second_half if line.strip()]

                    newList = []
        for element in second_half:
            if element in first_half:
                newList.append(element.split())
                intersectionLetter = ''.join(map(str, newList))
                print(intersectionLetter)
                print(str(newList))

                if intersectionLetter in list(alphabet_dict_lowerCase).index(intersectionLetter):
                    print(intersectionLetter)

intersectionLetter prints: ['f']
Yet when I check with .index to see if ['f'] is in the list, it tells me it isn't there, when I can see it there...why is this happening?
Answer: Exactly what is written, so ['f'] is a one element list.
You are checking if this one element list is in another list, but it isn't.
Extract this single element and reassign it like so:
intersectionLetter = intersectionLetter[-1]

Then you'll be checking if f str is in the list and I guess it should be there.
Just to show you an example of what is happening:
chars = ["s","r","t"]
s_element = "s"
s_list = ["s"]

s_element in chars <- this evaluates to True
s_list in chars  <- this evaluates to False


Computability of a probability theory problem

Question: This is a problem I solved for a course and I was wondering if my solution is correct. I wouldn't normally post a pure mathematics problem, except that I believe that is is incomputable, and hence a computer science problem.
You are given:
P(S) = 10%
P(Theta1 | S) = P(Theta2 | S) = 96%
P(not Theta1 | not S) = P(not Theta2 | not S) = 98%
and no other information besides the usual axioms and definitions of probability theory.
In particular you are given no information about the independence of events.
You are asked to compute P(S | Theta1 and Theta2).
Is this solvable? If not, provide an incomputability proof.
Interesting, hey?
Comment: You can provide a proof this doesn't work by giving different values to P(Theta1 and Theta2) compatible with your assumptions and solving for P(S | Theta1 and Theta2).
Answer: No, it's not solvable without an assumption, such as Theta1 and Theta2 being independent.
However, that's not what computability means.
The problem is that you need a term of the form P(Theta1 and Theta2), but there's no way to get that without knowing how correlated they are.


Last Aggregation function in Dataframe Spark Scala

Question: I have a dataframe where I am aggregating on a column and picking last element but It returns different result every time, Is there way I can resolve this issue, with out diff result everytime and get the right one.
val sourceDF = Seq(
 (11,"a1", "a2"),
 (11,"b1", "b2"),
 (22,"c1", "c2"),
 (22,"d1", "d2"),
 (33,"e1", "e2")
).toDF("id","name", "city")

sourceDF.show(false)

sourceDF.groupBy("id").agg(
last("name"),
last("city")
).show(false)

+---+-----------------+-----------------+
|id |last(name, false)|last(city, false)|
+---+-----------------+-----------------+
|33 |e1               |e2               |
|11 |a1               |a2               |
|22 |c1               |c2               |
+---+-----------------+-----------------+

Thanks in advance.
Comment: from [pyspark `last` function documentation](https://spark.apache.org/docs/latest/api/python/pyspark.sql.html#pyspark.sql.functions.last) -> `The function is non-deterministic because its results depends on order of rows which may be non-deterministic after a shuffle.` Use an `order by` to get deterministic results.
Comment: Thanks Vamsi will try
Answer: If you have large dataset then this can be an issue try to give an order to your grouping column:
sourceDF.orderBy("id").groupBy("id").agg(
last("name"),
last("city")
).show(false)

Comment: Also if assigning an order will not work then try to give the order to the aggregation column.


Alternative to passing userid & password through Java applet?

Question: The applet will help the user to create java class objects which will be sent to the PHP server, which will store the object as a blob in a MySQL database. The reverse should work too - reading the data back.
The user will have to be logged into the PHP server anyway to view this applet. But at the same time I don't want to leave the applet 'open' to have access to the database (through PHP) without a password.
The connection will be like this:
Java Applet -- send URL stream --> PHP Script -- Authenticate -- if valid connect to DB --> MySQL DB
I want this process to authenticate the user but at the same time I don't want the user to have to log in again after having logged into the website, and at the same time I don't want the Applet to store any secure information because thats not safe.
Is there a way around here? Or will I have to look for an alternative? (If so, what alternative?)
Answer: Your applet should have the ability to read cookies from the page it is displayed on.  So, assuming the user has authenticated into the webpage, you could have it grab a session ID (or whatever) from the page, and use that to 'authenticate' into your server.  However, bear in mind that unless you're using an encrypted session (https), these cookies can be read in transit by 3rd parties.  Also, you need to be aware that any 3rd party scripts on your page will also be able to read these cookies.
I don't think this is as ideal from a security standpoint as having the user authenticate to the database again, but this is an alternative you can use.
Comment: The requests coming from the applet should be similar to the requests coming from the browser directly. They wil be part of the same session. If you don't have any session or if the session is not authenticated, then someone is using the applet without having been authenticated before, or the session has expired because nither the applet nor the browser has sent any request for some time.
Comment: I think the applet doesn't even has to get cookies from the browser. The Java plugin should automatically send the browser cookies with any HTTP request sent from the applet, just as if the request originated directly from the browser.
Comment: The devil is in the details, but yes, user1031312, this is the idea.  In addition to performing basic security checks (ensuring that the user's IP address and/or user-agent hasn't changed since creating the session, etc.), you should probably maintain an activity timer on the session (on the server-side) and timeout inactive sessions, but yes.
Comment: Provided I won't have any 3rd party scripts on the page, reading the cookies to see if anyone is logged in should be okay though?
Comment: Ohh okay, so those could be retrieved from the PHP page with $_SESSION variable?
Comment: Although I am going to accept this as the answer because of the comments I think it is important for anyone reading this after me to also read @AlexR 's answer below
Answer: The applet call should enter the same HTTP session that has already been created by server when user entered the site.
The session is created by server and server sends the session ID as a special Cookie. In case of java based servers it is typically jsessionid. The server sends cookies using HTTP response header named Set-Cookies. Client should send all the cookies back using header Cookies.
So, your applet should be able to access cookies hold by browser and send them. To access cookies of browser you should use LiveConnect API that allows mapplet to call javascript from containing page.
Comment: I have not mentioned any need to write code on server side. It does not matter which server are you using. You can use even ASP if you want. JB-NET's suggestion is very similar to mine.
Comment: So you concur with @JB-Nizet ? And btw I have PHP server I don't think my host has JSP


Set specific property in array

Question: I'm trying to set a specific property in a static array with no luck. The array I'm working with is in the code below. Its the default mime types array that WordPress returns. How would I to if I for example want to change the value 'image/gif' of the property 'gif'?
Code:
function my_myme_types($mime_types){
    //Creating a new array will reset the allowed filetypes
    $mime_types = array(
        'jpg|jpeg|jpe' => 'image/jpeg',
        'gif' => 'image/gif',
        'png' => 'image/png',
        'bmp' => 'image/bmp',
        'tif|tiff' => 'image/tiff'
    );
    return $mime_types;
}
add_filter('upload_mimes', 'my_myme_types', 1, 1);

Comment: Can i do something like if arr['gif'] == 'image/gif'?
Answer: Should be able to do something like:
// functions.php
function my_myme_types($mime_types){

    $mime_types['gif'] = 'your new value';

    return $mime_types;
}
add_filter('upload_mimes', 'my_myme_types', 1, 1);

Set specific property in array


How can a Peasant have several EVO2 heros?

Question: While fighting in the Arena earlier, I noticed an icon I don't ever remember seeing before:

Since the other player had decent army of heros with several EVO2 heroes, I thought it might be something very powerful (they were ranked around 2000 in the Arena) and looked in the wiki, just to realize it's the first title, Peasant!!
How can a user build such a strong hero army and still not gain enough might to level up the title?
Is this a bug in the game, or someone hacking it? Or can this be done in legit ways?

P.S.
I took the screenshot bit late, being shocked... there were other heros who died during the fight.
Answer: Since the arena update a few months ago there have been "AI teams" in arena sometimes. You can tell because they all have the following traits:

the username "Guard".
a random selection of double evo heroes.
the heroes are always below level 200 (most double evo teams from a normal player will have all level 200 heroes).
they have the nobility rank of Peasant.

I do not know why there are AI teams, or how often you will face them. I seem to face them more frequently after the weekly reset, so it probably has something to do with that.
Comment: Thanks, first time I hear about those "AI teams". While it makes sense, do you have any source for that? I did notice something similar in the Labyrinth, where many encounters are against teams with "cropped" levels, i.e. level of all heros is 100 while it's obvious the real level is higher. I assumed they take actual teams of real players, and just crop the level. And they appeared (along with the Labyrinth itself) around the same time as that Arena update. (With the weekly reset)
Comment: Found [this](https://www.reddit.com/r/CastleClash/comments/6yii6p/how_is_this_person_in_guard_might_rank_with_all/). While not official confirmation, looks like you're correct.


Binding ajax page in angular.js

Question: I tried coding with angular.js 1.5.

            개미생톡

            전문가생톡

            둥지생톡

            시황생톡

            생톡쇼핑

            더보기

You can see, I declared ng-bind-html="content" and this will be replaced that the menu is selected.
So I codeded app.js like this.
each menu's html code stored tabViews[tabName] from http ajax call.
When the menu is selected, then mainMenu.content stores tabViews[tabName].
(function(){
    var app = angular.module('stocktalkApp', []);
    app.controller('MainMenuController', function($scope, $http){

    this.tabViews = [];
    this.tab='ant';

     $http({
            method : "GET",
            url : "ant/view"
        }).then(function mySucces(response) {
            $scope.mainMenu.tabViews['ant'] = response;
            $scope.content = $scope.mainMenu.tabViews[$scope.mainMenu.tab];
        }, function myError(response) {
        });
     $http({
            method : "GET",
            url : "expert/view"
        }).then(function mySucces(response) {
            $scope.mainMenu.tabViews['expert'] = response;
        }, function myError(response) {
        });

    this.selectTab =  function(tabName){
        this.tab = tabName;
        this.content = this.tabViews[this.tab];
    };
    this.isSelected = function(tabName){
        return tabName === this.tab;
    }
});
})();

But, the error was occurred angular.js:13920Error: [$sce:unsafe] http://errors.angularjs.org/1.5.8/$sce/unsafe.
How can I show the page in html?
Updated :
I have updated my code in ajax call, response to response.data and declared function but same error occurred again.
This is updated html code

and this is my app.js code
$scope.makeTrusted = function(htmlCode) {
    return $sce.trustAsResourceUrl(htmlCode);
}

 $http({
        method : "GET",
        url : "ant/view"
    }).then(function mySucces(response) {
        $scope.mainMenu.tabViews['ant'] = response.data;
        $scope.content = $scope.mainMenu.tabViews[$scope.mainMenu.tab];
    }, function myError(response) {
    });
 $http({
        method : "GET",
        url : "expert/view"
    }).then(function mySucces(response) {
        $scope.mainMenu.tabViews['expert'] = response.data;
    }, function myError(response) {
    });

Answer: You need to inject the $sce service in the controller and trustAsResourceUrl the url there
Controller
App.controller('AppController', ['$http', '$scope', '$sce',
    function($http, $scope, $sce) {
     $scope.makeTrusted= function(html_code) {
        return $sce.trustAsResourceUrl(html_code);
    }
}

HTML

Comment: Thanks Sajeetharan, but $sce can't find in my code, where should I declare the `$sce`?
Comment: @MinkyuKim You need to add it to the controller, check the updated answer
Comment: Yes, I created a new Plunk, but I have been used first time, if any problem, please tell me.  https://plnkr.co/edit/9mit8WuiWe9mjumi1GkB?p=info

Binding ajax page in angular.js


TFS 2015 - On Site Build Failures

Question: Background: Had builds working for the past three months. Then, after getting failures I figured out the license was not valid for the Visual Studio install on our in house build server.
Steps to correct:
Fixed license issue. Along with installing all VS Updates and TFS Update 2.
Additional steps taken to correct the issue:
Builds were still failing so I deleted the agent and the build pool. Recreated a new pool and downloaded the agent.
Installed the agent on the server, using my network credentials as I'm an admin on the box and part of the agent pool admin and agent pool service account. Used my account to try an eliminate permission related issues.
Note: Everything else works with TFS. Can check in changes, can use the portal with full admin rights.
Here is the final entry in the logs

19:39:28.762991 Failed to start the job, could not create the http client with the given credentials.

The builds fail under a minute with no logs or reason on the tfs http interface.
Here are the only exceptions on the build server logs.

19:39:18.411788 Microsoft.VisualStudio.Services.WebApi.VssServiceResponseException: Bad Request
19:39:18.411788    at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.HandleResponse(HttpResponseMessage response)
19:39:18.411788    at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.d__79.MoveNext()
19:39:18.411788 --- End of stack trace from previous location where exception was thrown ---
19:39:18.411788    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
19:39:18.411788    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
19:39:18.411788    at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.d__76`1.MoveNext()
19:39:18.411788 --- End of stack trace from previous location where exception was thrown ---
19:39:18.411788    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
19:39:18.411788    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
19:39:18.411788    at Microsoft.VisualStudio.Services.Location.Client.LocationHttpClient.d__6.MoveNext()
19:39:18.411788 --- End of stack trace from previous location where exception was thrown ---
19:39:18.411788    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
19:39:18.411788    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
19:39:18.411788    at Microsoft.VisualStudio.Services.Client.VssServerDataProvider.d__39.MoveNext()
19:39:18.411788 --- End of stack trace from previous location where exception was thrown ---
19:39:18.411788    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
19:39:18.411788    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
19:39:18.411788    at Microsoft.TeamFoundation.DistributedTask.Agent.Common.ConnectionHelper.GetConnection(Uri serverUri, VssCredentials credentials)
19:39:18.411788    at Microsoft.TeamFoundation.DistributedTask.Agent.JobWriter.StartJob()
19:39:18.411788    at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.HandleResponse(HttpResponseMessage response)
19:39:18.411788    at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.d__79.MoveNext()
19:39:18.411788 --- End of stack trace from previous location where exception was thrown ---
19:39:18.411788    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
19:39:18.411788    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
19:39:18.411788    at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.d__76`1.MoveNext()
19:39:18.411788 --- End of stack trace from previous location where exception was thrown ---
19:39:18.411788    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
19:39:18.411788    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
19:39:18.411788    at Microsoft.VisualStudio.Services.Location.Client.LocationHttpClient.d__6.MoveNext()
19:39:18.411788 --- End of stack trace from previous location where exception was thrown ---
19:39:18.411788    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
19:39:18.411788    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
19:39:18.427410    at Microsoft.VisualStudio.Services.Client.VssServerDataProvider.d__39.MoveNext()
19:39:18.427410 --- End of stack trace from previous location where exception was thrown ---
19:39:18.427410    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
19:39:18.427410    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
19:39:18.427410    at Microsoft.TeamFoundation.DistributedTask.Agent.Common.ConnectionHelper.GetConnection(Uri serverUri, VssCredentials credentials)
19:39:18.427410    at Microsoft.TeamFoundation.DistributedTask.Agent.JobWriter.StartJob()
19:39:18.427410 ---------------------------------------------------------------------------
Answer:
Make sure the account that the agent is run under is in the "Agent Pool Service Account" role.
Make sure the queue is provisioned in the collection ( https://your-tfs-server:8080/tfs/your-collection/_admin/_AgentQueue ). If not - select "New queue.." and select the existing queue.
Make sure you deploy the Windows build agent by exactly following this article.
Try to change a domain account which is a member of the Build Agent Service Accounts group and belongs to "Agent Pool Service Account" role, to see whether the agent would work or not.
Check the Firewall inbound rule, check vNext build on TFS 2015 hangs on MSBuild step and produces no log files

TFS 2015 - On Site Build Failures


Search bar - Top Nav vs Left Nav? Which is better suited?

Question: In the search bar which experience is better? That is having a left nav or navigation below/above the search bar.

Cons for the top nav: Scalability wise left nav works the best.
I've seen many websites like google.com, bing.com, yahoo.com, algolia, etc. have navigation below the search. In a few other websites like swiftype, atlassian, etc. have the left navigation.
By experience wise which is better and why?
Answer: The 1st screenshot shows search facets, the 2nd show filters.
A navigation menu works independently of the search results. It should be clearly separated (typically above the search field).
Filters are usually just above the list of results to narrow down results.
Facets are typically located in a left side-bar, as you can drill down facets through multiple hierarchical levels.
For more information on the difference between the last two, see Filters vs. Facets
Answer: At first, you should make a good benchmark to see what your competitors are doing and what the other website that your user access doing. Try to keep the pattern to avoid the need to teach the users.
Usage:

Top filters: Good for few options (like simple searches tool)
Left/Right filters: Good for a lot of options (like e-commerces)

Exceptions: Some e-commerces start to use a top filter but as a dropdown not a link like on your examples because this makes the page looks cleaner and reduce the pagination.


Error compiling Java code written in TextEdit: Illegal character 8218

Question: I am beginning to learn how to develop Java programs on a Mac OS/X Yosemite system. I've downloaded the JDK and JRE from the relevant websites and written my first program using TextEdit:
public class MyFirstApp
{
    public static void main (String[] args)
    {
        System.out.println("I Rule!");
        System.out.println("The World");
    }
}

When I tried to compile, I got the following errors:

How can I fix this?
Comment: Duplicate: http://stackoverflow.com/questions/29719591/compiling-java-in-terminal-gives-illegal-character-errors-within-a-string
Comment: You should change the " and " characters with the " character.
Comment: Don't use TextEdit. You probably saved as RTF, which is why you got the wrong quote marks. Get something good like Sublime Text.
Answer: Replace the curly quote with a normal quote i.e: " to ".
This usually happens when you copy and paste code from rich text source like a word document or PDF.
Answer: You are source code which has replaced double quotes with equivalent but more fancy unicode characters showing start and stop of the quote.  Most likely because you copied the code from a web page not presenting code snippets correctly or using an editor not intended for source code.
You must replace these fancy quotes with the simple,  normal quotes ( " and ') and recompile.  Consult a Java tutorial to learn which ones to use when.


MIPS Boolean Branching Output

Question: I'm not entirely sure how to go about writing this program, and desperately need help:
Instructions:
Write a MIPS program that does the following:

Places a positive integer n into register $a0 (e.g., li $a0,13)
If the integer is even, replace the register contents with n/2; otherwise, replace the register contents with 3n + 1. (Don't use the MIPS multiply operation; figure out another way.)
Print the register contents with a syscall
Comment: So you needed an answer that practically said "google 'mips instruction set' and 'mips syscall list'"?
Comment: So you want us to do your homework for you? If you're not entirely sure, then where have you failed?
Comment: What have you tried so far? If you google for "mips instruction set" and "spim syscall list" you should find all the info you need to solve this.
Comment: I wasn't exactly asking for the full answer, just direction. The second answer given by Michael was all I needed. Much thanks
Comment: honestly, I wasn't sure what to google. There is quite a large sum of programming information on the internet
Answer: I know this joint can be pretty rough if it looks like you haven't consulted the Google. But I think you have a valid question on your second bullet - or at least, here are the questions that it would trigger for me:

How do I figure out if an integer is even?

In a HLL, you would use modulo arithmetic: if (n % 2 == 0) { // is even }. But in assembly, you have to do it a different way. Look at the last bit - if it's zero, it's even.
andi $t1, $t0, 0x01
beq $t1, $zero, isEven

How do I replace register contents with n/2 without using multiply or divide?

That's one of my favorite things about assembly. Multiplying and dividing by two is as easy as falling off a log. You just shift the bits. In decimal, you multiply by the base (10) by shifting the digits, so 123 * 10 = 1230 and 1230 / 10 = 123. Same in binary (base 2): 0111 * 2 = 1110 and 1110 / 2 = 0111. So all you have to do to (int) divide $t2 by 2 is:
srl $t2, $t2, 1

I assume you can just use add functions for 3n+1. I don't know a "cute" way to do that.

MIPS Boolean Branching Output


What size of lumber should I use for the mounting rail for shelves and cabinets?

Question: I recently scrounged some steel shelving that I'd like to hang in my garage. This used to be in an office, its for paperwork but will work great for some things in my garage.
The mounting holes on these shelves are not going to be centered on my studs. What I think I need to do to hang these is to screw two boards to the studs and then mount the shelves to that.
How do I determine what size of board to use? Is it based on size/weight of the shelves?
The shelves are basic steel box shelves. They are roughly 4' long, 10" deep, and 12" tall. It's a steel box open to the front and there is a slight flange on the back.
The garage wall is finished. Just has drywall and paint.
Comment: are these free standing or just metal shelves with no frame at all?
Comment: Can you change the location of the mounting holes (drill new ones)?
Comment: Is the garage wall finished (covered in plaster), or are the studs exposed?
Answer: Several different factors weigh in to what size of board you need.

Weight - Definitely the major factor.
Stud spacing - I'm assuming you've got standard 16" OC studs, and that you're attaching the support board to every one it spans.
Location of Mounting Points - The closer the mounts for the shelving are to centered between studs, the higher the bending load on the board.
Fastener Type - The thicker the fasteners used to fasten the board to the wall and the shelves to the board, the higher the stress concentration at those areas. Standard wood screws should be fine for fastening the board to the wall.
Use a Wide Board - The bending strength of a board goes up by a factor of width squared, and only linearly with thickness. So if you're flush mounting against a wall and don't have to worry about torsion, a 1x6 will be stronger than a 2x4.

Did you have a rough order of magnitude for the weight you'd like to hang? Just shooting from the hip, I'd think you'd be OK with a 1x4, or a 1x6 if you wanted to be safe.
Comment: The shelves themselves are around 25 pounds (11 kilos?). I'd have to guess at 70lbs of weight on them tops. Intend to put things like motor oil, manuals, and other individually light items on them. I can see many small items adding up, but these aren't holding up bags of sand or anything.
Comment: nice details on the torsion and dimensions :)
Comment: @Mark: Can't help it, I'm an engineer. :)
Answer: From what you have described, I'd probably use a 1x4.


UITextView border in swift 3

Question: Is there any way to set the active border color and inactive border color to UITextView?
For example, if textview is focused to input text, then border color will be red, otherwise textview border color set to gray.
Thank you.
Comment: Not natively, you'd have to implement that yourself.
Comment: Keep in mind that red typical indicates an error. And don't forget to consider people with vision impairments.
Comment: thank you. that's the example. my goal is when textview is in input state then border to some color(for example green), and otherwise border to gray. Thanks for your concern and advice
Answer: One way would be to implement textViewDidBeginEditing(_:) and textViewDidEndEditing(_:) from UITextViewDelegate in your class where you want to change borderColor property:
class ViewController: UIViewController, UITextViewDelegate {

  ...

  override func viewDidLoad() {
    super.viewDidLoad()
    self.textView.delegate = self
    self.textView.layer.borderWidth = 1.0
  }

  func textViewDidBeginEditing(_ textView: UITextView) {
    textView.layer.borderColor = UIColor.redColor.cgColor
  }

  func textViewDidEndEditing(_ textView: UITextView) {
    textView.layer.borderColor = UIColor.clearColor.cgColor
  }
}

UITextView border in swift 3


Dual monitors and HiDPI display struggling to scale properly

Question: Hello I have been trying to setup a second monitor for my laptop under Ubuntu 18.04 and I can't seem to be able to scale the second monitor properly.
My monitors are :

XPS 15 4k built-in display (3840x2160)
Dell 24" (2560x1440)

As most people using 4K resolution on a 15" display, I scaled the display to 200% using GNOME.
The issue comes from the fact that gnome cannot scale different displays in different ways. So when I hook up my other monitor I get a zoom to important on my 24" monitor.
Aster looking online for a while I tried using arandr to no avail and I then stumbled upon this post.
It explains very well how to set up 2 displays using XrandR. Unfortunately It seems not to work for my problem.
Given that I want my second monitor on the left of my laptop screen and that my xrandr -q returns :
Screen 0: minimum 320 x 200, current 6400 x 2160, maximum 8192 x 8192
eDP-1 connected primary 3840x2160+2560+0 (normal left inverted right x axis y axis) 344mm x 194mm
   3840x2160     60.00*+  59.98    59.97
   3200x1800     59.96    59.94
   2880x1620     59.96    59.97
   2560x1600     59.99    59.97
   2560x1440     59.99    59.99    59.96    59.95
   2048x1536     60.00
   1920x1440     60.00
   1856x1392     60.01
   1792x1344     60.01
   2048x1152     59.99    59.98    59.90    59.91
   1920x1200     59.88    59.95
   1920x1080     60.01    59.97    59.96    59.93
   1600x1200     60.00
   1680x1050     59.95    59.88
   1600x1024     60.17
   1400x1050     59.98
   1600x900      59.99    59.94    59.95    59.82
   1280x1024     60.02
   1440x900      59.89
   1400x900      59.96    59.88
   1280x960      60.00
   1440x810      60.00    59.97
   1368x768      59.88    59.85
   1360x768      59.80    59.96
   1280x800      59.99    59.97    59.81    59.91
   1152x864      60.00
   1280x720      60.00    59.99    59.86    59.74
   1024x768      60.04    60.00
   960x720       60.00
   928x696       60.05
   896x672       60.01
   1024x576      59.95    59.96    59.90    59.82
   960x600       59.93    60.00
   960x540       59.96    59.99    59.63    59.82
   800x600       60.00    60.32    56.25
   840x525       60.01    59.88
   864x486       59.92    59.57
   800x512       60.17
   700x525       59.98
   800x450       59.95    59.82
   640x512       60.02
   720x450       59.89
   700x450       59.96    59.88
   640x480       60.00    59.94
   720x405       59.51    58.99
   684x384       59.88    59.85
   680x384       59.80    59.96
   640x400       59.88    59.98
   576x432       60.06
   640x360       59.86    59.83    59.84    59.32
   512x384       60.00
   512x288       60.00    59.92
   480x270       59.63    59.82
   400x300       60.32    56.34
   432x243       59.92    59.57
   320x240       60.05
   360x202       59.51    59.13
   320x180       59.84    59.32
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
DP-1-1 connected 2560x1440+0+0 (normal left inverted right x axis y axis) 526mm x 296mm
   2560x1440     59.95*+
   1920x1200     59.95
   2048x1080     60.00    24.00
   1920x1080     60.00    60.00    50.00    59.94    24.00    23.98
   1600x1200     60.00
   1680x1050     59.88
   1280x1024     75.02    60.02
   1280x800      59.91
   1152x864      75.00
   1280x720      60.00    50.00    59.94
   1024x768      75.03    60.00
   800x600       75.00    60.32
   720x576       50.00    50.00
   720x480       60.00    60.00    59.94    59.94
   640x480       75.00    60.00    59.94    59.94
   720x400       70.08
DP-1-2 disconnected (normal left inverted right x axis y axis)
DP-1-3 disconnected (normal left inverted right x axis y axis)
DP-2-1 disconnected (normal left inverted right x axis y axis)
DP-2-2 disconnected (normal left inverted right x axis y axis)
DP-2-3 disconnected (normal left inverted right x axis y axis)

Here is what I tried :
xrandr --output DP-1-1 --scale 2x2 --fb 6400x2160 --pos 0x0
xrandr --output eDP-1 --scale 1x1 --pos 2560x0

Unfortunatly here is what it gives:
xrandr: specified screen 6400x2160 not large enough for output DP-1-1 (5120x2880+0+0)

And I get my 2 displays overlapping.
It's really been messing with me lately so if any of you have any idea how to fix this it would be greatly appreciated.
Thank you.
Answer: use arandr to position your windows and scale using below commands
xrandr --output eDP1 --scale 2x2 --mode 3840x2160
xrandr --output DP1 --scale 1x1 --mode 2560x1440

installing arandr
aptitude install arandr

Answer:
xrandr --output eDP1 --scale 2x2 --mode 3840x2160

Although it didn't seem quite right I tried it anyway and got this :
xrandr: screen cannot be larger than 8192x8192 (desired size 10240x4320)

edit:
Just in case, if you meant
xrandr --output DP-1-1 --scale 2x2 --mode 2560x1440
xrandr --output eDP-1 --scale 1x1 --mode 3840x2160

I tried it, the screen still overlapped and arandr didn't let me set them appart :
Comment: did you solve it?
Answer: To answer Shinigami and for any other persons stumbling upon this thread, I did find a way to make it work.
What I ended up doing was set the DPI and the final size of both screen together:
xrandr --dpi 331 --fb 7424x2448

Followed by :
xrandr --output DP-1-1 --scale 1.7x1.7 --pos 0x0

and
xrandr --output eDP-1 --scale 0.8x0.8 --pos 4352x0

This is fine tuned to my problem but I can explain it more extensivly if anybody asks.


What's the procedure for diluting bitumen mastic with a solvent?

Question: The can of bitumen mastic says I can add up to ten percent solvent to make the mastic easier to apply. Applicable solvents list follows. The problem is the mastic is so stiff tat if I put a stick vertically into the mastic it doesn't fall - just stands still so it's unclear how I would mix the mastic with the solvent such that it mixes uniformly and the process takes reasonable amount of time.
What's the procedure for such dilution?
Answer: Leave the can in the sun on the next sunny day for several hours (if the ambient air temperature is warm). The sealer should be sufficiently softened to add the prescribed amount of solvent and stir with a sturdy mixing stick. (If the directions on either the solvent or the sealers label states otherwise always follow those instructions).
Comment: I'm not sure if this answers the question. The OP was asking what kind of solvent to use to soften it.
Comment: He stated the problem was the mastic was so solid that he couldn't stir the solvent into the mastic. I suggested a solution that would enable him to do that.


singleTask activity not loading properly

Question: I have an activity 'A' defined in Manifest like below:
<activity
    android:name=".A"
    android:launchMode="singleTask"
    android:screenOrientation="portrait">

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

</activity>

When I launch my APP,  that activity is always loaded from the start. It wont start from my prev activity.
When I remove android:launchMode, then it works as I expect.
Comment:  means that the current activity is the started point of your application.
Answer: Since you set android:launchMode="singleTask", the activity A will always be the root of your activities.
From DOCS:

In contrast, "singleTask" and "singleInstance" activities can only begin a task. They are always at the root of the activity stack. Moreover, the device can hold only one instance of the activity at a time — only one such task.

Default mode is standard. So, when you remove android:launchMode="singleTask", your APP returns to standard launch mode.
That's why if you app is always starting Activity A.
Comment: for deeplick should i cr8 empty activity?
Comment: @andro you should also put the `category.DEFAULT` in the intent filter if you want it to work correctly and not `LAUNCHER`
Answer: If you would like to start a different Activity on launch replace that in the xml name attribute that contains LAUNCHER
<activity
    android:name=".ActivityB"
    android:launchMode="singleTask"
    android:screenOrientation="portrait"
  >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>

</activity>

Where Activity B is an alternate activity.
Comment: i want a to be open but when my app is in memory and i click on app icon it should start from act where it was not from a activity


Flutter: TextField onChanged handler silently swallows exceptions

Question: When an exception is thrown and unhandled in a TextField.onChanged handler it doesn't bubble up to the global Flutter.onError handler so it's silently missed. Is there a way to globally handle these errors so that I'm at least aware that they're thrown when developing?
It appears to be caught and converted into an object in MethodChannel._handleAsMethodCall(), but I don't understand how it's handled from there.
main() {
  runApp(Test());
}

class Test extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: TextField(
            decoration: InputDecoration(
              labelText: "Input",
            ),
            onChanged: (input) {
              throw Exception(); // <-------- swallowed by framework
            },
          ),
        ),
      ),
    );
  }
}

Answer: The problem is that you have to call WidgetsFlutterBinding.ensureInitialized() before you can assign your custom error handler - the following code works for me:
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
void main() {
  WidgetsFlutterBinding.ensureInitialized(); // <- this needs to happen before assigning your error handler
  FlutterError.onError = (FlutterErrorDetails details) => print('custom error handling');
  runApp(Test());
}

class Test extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: TextField(
            decoration: InputDecoration(
              labelText: "Input",
            ),
            onChanged: (input) {
              print(input);
              throw Exception();
            },
          ),
        ),
      ),
    );
  }
}

The console output when writing 'uiae':
Performing hot restart...
Syncing files to device Chrome...
Restarted application in 434ms.
u
custom error handling
ui
custom error handling
uia
custom error handling
uiae
custom error handling

You may also want to take a look at Flutter: How to implement FlutterError.OnError correctly and Flutter catching all unhandled exceptions as they seem to be related to your problem.


TWO ORIGINAL SWITCHES - ONE three-way and one single cant figure out wiring for SAFE UPGRADE

Question: (I'll attach photos and a diagram)
I read through other posts on switch upgrades and learned a lot - thank you!
My switch upgrade seems similar, but slightly unique and I can't figure out correct wiring for the upgrade.
My single car garage has a main light (controlled by a three-way switch) -- and a single, smaller light  over the door into the house. Both switches are next to the door into the house and those are the switches I would like to upgrade to Lutron Dimmer switches (TGCL-153P).
Turned off breaker for the garage at panel. Removed switch wall-plate and unscrewed & pulled out switches.
I have three Cables coming into the box.
The three-way switch on the left controls main light.
Single switch on the right controls small light.
Trying to figure out what is going on in the box and which cable is my Line-In & my Load-Out...
I can see the two switches are daisy-chained together with the short black connecting wire going from the black (line in) terminal on the single switch to the common/dark screw on the three-way switch.
Can anyone help me sort this out?
Is my Line-In coming from cable #3 and powering the three-way switch first and then jumping power to the single switch?
Or is my Line-In the center Cable #2, powering the single switch first, jumping power to the three-way switch? Is Cable #1 just travelers - carrying switched power to the fixture?
...and if so, why is the White neutral in cable #1 tied to the Red in the center Cable #2?
Greatly appreciate any feedback and explanation/education and any suggestions for determining what wiring would be best on the new switches.
I am hesitant to just transfer over this set-up to the new switches without understanding it... or learning if there a better way?
Thanks again for any help.

enter image description here

updated diagram 7pm
updated diagram 7pm[EDITED MONDAY 05/25/2020 Updated DIAGRAM]
Thanks to @Harper - Reinstate Monica and @JACK, I have edited my diagram of what I currently have so that I can better understand how the wiring is set up.
I'm attaching the updated diagram - it includes the wiring that I see in/out of the two light-fixture boxes.
Each Light Fixture has a (2-wire + Ground) cable coming in and the (3-wire + Ground) cable going to the switches.
I think @Harper - Reinstate Monica said either Cable #2 or Cable #3 is bringing the hot feed, from before the the light fixture box, (and through the light fixture box) on it's black wire.
So, if I assume for a moment that the power is coming in (on 2-wire Cable "B") through the small fixture and down to the switch on Cable #3, I can trace the path of the black feed, and I see it comes in to the dark/common screw on the three-way switch, it daisy chains to get power to the single-pole switch, then continues out the other Cable (#2) and runs up through the main overhead light fixture box and continues downstream on 2-wire Cable "A" to power something else on the circuit (like a receptacle)...
So, the small light-fixture gets it's switched-hot from the red wire in Cable #3 and the Main Light-fixture gets it's switched hot from the red wire in Cable #2?
Is this a correct diagram and summary??
Lastly, if I have the diagram correct,
If I simply transfer over the wires to my new switches, do I just follow the same wiring pattern?
And, with regard to the three-way switch and single-pole switch -- rather than daisy chain, would it be wise to join the black wire from Cable #2 and Black wire from Cable #3 in a wire-nut and pigtail down to each switch?
Thanks again for checking my work and sorting out my understanding of this.

(updated diagram 7pm)
Comment: What model of dimmer are you installing?
Comment: With the power off unhook and separate the black wire going to both switches. Turn on power and check each black for voltage to ground with a meter, not a wonder stick. The wire with 120V  is your feed.
Comment: @JACK, Thanks! (Will use voltage meter) So, I believe it's either either coming in from #2 or #3 (Cable#1 must be the travelers to the other 3-way switch and the switched hot coming back)? Should I rewire my new switches the same way? Is this a sound/safe wiring?
Comment: @ThreePhaseEel I am planning on installing Lutron TGCL-153P dimmer switches. The light fixtures are simple pan surface mount with integrated, dimmable LEDs.
Answer: On cables 2 and 3, black and white are hot and neutral, respectively.
Each of cables 2 and 3 goes to a light.
Those 2 facts seem in contradiction to each other, but they're not.  Power comes in at one of the lights, through this switch, onward to the other light, and then onward to points beyond.

which cable is my Line-In & my Load-Out...

It's not wired that way.  Line-in and Load-out are happening in the same cable.  Line-in is the black, and Load-out is the red.
Cable #1 is a 3-way "spur" to the other 3-way switch, which has only one cable interacting with it.  Red and black are travelers and I recommend you get yellow tape and re-mark them yellow on both ends.  White is the switched-hot for that lamp.  You MUST remark that some sort of suitable hot color on both ends.  I recommend red, since it's a switched-hot.
As far as installing any smart switches, you must install the smart switch "master" at this location.  The only thing that can go at the other end is a smart switch remote.
Comment: Thank you for the information. Can I ask a follow-up Question? If the power comes in hot on Black in both cable(s) 2 and 3, and cable 2 feeds single switch and cable 3 feeds 3-way switch, why are they daisy-chained together?
Comment: @SPinNJ You are thinking only of your switch installation here. Power is also used in other locations in this circuit, on the far side of both lights.  In other words cables 2 and 3 aren't here *just* for the 2 switches, they also have other duties, used for onward power to other applications.
Comment: Thanks for clarifying. I appreciate it. Will label my switched-hot, and the two travelers in Cable #1. Thanks for the help!


Android fragment state using navigation drawer

Question: I'm creating an application that I am porting from windows phone 8 to android.
My knowledge of android development are limited.
I'm using a navigation drawer.
I've already done some implementation, the problems / issues I'm facing are restoring state of view when switching between them.
I'm using arcgis android sdk.
View 1: geospatial data in a listview, fetched from the internet.
View 2: a map showing your location and locations selected (tapped) in view 1
View 3: a settings view to increase or decrease the radius to fetch items from view 1.
When switching between views I'd like the views to maintain their states (restore state).
What's the best practice in a scenario like this? Right now I'm using fragments.
Problem is that when switching fragments onSaveInstanceState is not being called.
This is my code to switch fragments, it's not working very well at all :)
private void selectItem(int position) {
    // Create a new fragment and specify the planet to show based on position
    Fragment f;
    FragmentTransaction ft = fragManager.beginTransaction();
    switch(position) {
    case 0:
        if((f = fragManager.findFragmentByTag("home")) == null) {
            f = Fragment.instantiate(this, HomeFragment.class.getName());
            f.setRetainInstance(true);
            ft.add(R.id.content_frame, f, "home");
        } else {
            ft.attach(f);
        }
        break;
    case 1:
        if((f = fragManager.findFragmentByTag("map")) == null) {
            f = Fragment.instantiate(this, MapFragment.class.getName());
            f.setRetainInstance(true);
            ft.add(R.id.content_frame, f, "map");
        } else {
            ft.attach(f);
        }
        break;
    case 2:
        if((f = fragManager.findFragmentByTag("settings")) == null) {
            f = Fragment.instantiate(this, SettingsFragment.class.getName());
            f.setRetainInstance(true);
            ft.add(R.id.content_frame, f, "settings");
        } else {
            ft.attach(f);
        }
        break;
    }
    ft.commit();
    // Highlight the selected item, update the title, and close the drawer
    mDrawerList.setItemChecked(position, true);
    setTitle(tabs[position]);
    mDrawerLayout.closeDrawer(mDrawerList);

}

Comment: do you want to put your fragments into backstate?
Answer: Here is the sample code for restore fragment state:
public void addFragments(Fragment fragment,
        boolean addToBackStack, String tag) {

    FragmentManager manager = getSupportFragmentManager();
    FragmentTransaction ft = manager.beginTransaction();

    if (addToBackStack) {
        ft.addToBackStack(tag);
    }
    ft.replace(R.id.content_frame, fragment);
    ft.commit();
}

Here fragment= your fragment that you want to replace.
Comment: What if I don't want to `Fragment` to back stack ?
Comment: pass second parameter of method false.


Kernel 4.10/4.12 with AMDGPU-PRO?

Question: Is it possible to use AMDGPU-PRO driver with a newer Kernel under Ubuntu 16.04?
I couldn't find much information, sorry if I missed something.
So I converted my friend to linux. Since Linux Mint 18.2 was released yesterday and it's based on Ubuntu, I installed it for him with kernel 4.10.
He got a XFX Fury. I tried installing the driver from AMD (AMDGPU-PRO for Ununtu 16.04) but after rebooting, I got black screen with an underscore (not blinking). Tried with kernel 4.8, 4.10, 4.12.
Rebooting in recovery mode, I found out there is an error with the display in xorg.log. Trying to boot with nomodeset works in software rendering mode.
I reinstalled Linux and now everything is running perfectly without this driver, but Overwatch need a videocard installed :P. (Running kern. 4.10)
I personally have an old graphic card (GTX 580) which runs beautifully under Kernel 4.12, released yesterday, with both closed-source driver and nouveau.
I was wondering why the AMD driver wasn't working. Unfortunatly I don't remember the exact error message - but I'll try to find the same message ont he internet and update this question. In the mean time I though maybe someone had a solution.
Thanks to anyone how may have some tips for us!
Cheers!
Comment: This site is only for official Ubuntu flavors. For Linux Mint, please ask on [the Unix & Linux Stack Exchange](https://unix.stackexchange.com).
Comment: Why bother with amdgpu-pro anyway? Fury and Fury X work just fine with the open source drivers.
Answer: EDIT: AMDGPU-PRO 17.30 supports 4.10+ kernels.
AFAIK, at the moment, there's no support for 4.9+ kernels coming from AMD. Since I was having the same issue, I had to switch to the normal amdgpu module. For the moment it works pretty well, I suggest to give it a try.
Here's some info: https://wiki.archlinux.org/index.php/AMDGPU
Sorry for not giving you a proper answer anyway.
Comment: Nah it's alright - thanks bud! The issue is Overwatch need a proper driver for the GPU in order to play in Wine. Thansk for your answer I couldn't find this anywhere! So I guess if I use Kernel 4.87 I can use the pro driver? Thanks!!
Comment: There's a new version of AMDGPU-PRO drivers (17.30) but it's still not compatible with the 4.10+ kernels. Actually I'm adding a new comment here only to suggest a read: http://www.phoronix.com/scan.php?page=article&item=amdgpu-1730-radeonsi#=1
Comment: Thansk! I'll read ;)

Kernel 4.10/4.12 with AMDGPU-PRO?


Angular.js - can't inject external module

Question: I'm trying to make the simplest possible website setting, where I have an Angular.js app with single module depending on one external module (for example Restangular).
I don't know why, but I can not get it working. I'm getting get this kind of error:
Error: [$injector:unpr] http://errors.angularjs.org/1.2.17/$injector/unpr?p0=restangularProvider%20%3C-%20restangular

Actually, it doesn't matter that it's restangular - I've tried it with other modules and the result was analogical.
I have created a plunker that shows my problem:
http://plnkr.co/edit/3ZUoDYtd4sVTT7nLpURi?p=preview
But there is not that much code - I will paste it here too.
In my index.html file I include angular.js, lodash.js (required by restangular), restangular.js and my application's script.js files with  tags.
This is the body of my html:

Take a look into console... Restangular can not get injected. What am I doing wrong?

And this is the content of script.js:
var app = angular.module( 'example', ['restangular'])

app.controller('AppCtrl', ['$scope', 'restangular', function($scope, Restangular) {
    console.log(Restangular);
}]);

As a note - in the console I can do this:
angular.module('restangular')

but, this does not work:
angular.injector(["ng"]).get('restangular')

It seems that I'm missing something basic about Angular.js. Help will be appreciated...
Answer: Could it be this?
app.controller('AppCtrl', ['$scope', 'Restangular', function($scope, Restangular) {

Restangular hast to be written with a capital R
You wrote
app.controller('AppCtrl', ['$scope', 'restangular', function($scope, Restangular) {

At least now I see in the console
URL visited /edit/3ZUoDYtd4sVTT7nLpURi
editor-0.7.30.js
Object { configuration={...}, requestParams={...}, defaultHeaders={...}, more...}

Comment: Yes, it was indeed this issue. I find it a bit misleading that while declaring my module I have to declare this dependency like this: ['Restangular'], but than later in a controller in this way: ['restangular'].