text:
Q: Swap two variables without using a temporary variable I'd like to be able to swap two variables without the use of a temporary variable in C#. Can this be done?
decimal startAngle = Convert.ToDecimal(159.9);
decimal stopAngle = Convert.ToDecimal(355.87);

// Swap each:
//   startAngle becomes: 355.87
//   stopAngle becomes: 159.9

A: Yes, use this code:
stopAngle = Convert.ToDecimal(159.9);
startAngle = Convert.ToDecimal(355.87);

The problem is harder for arbitrary values.  :-)

A: <deprecated>
You can do it in 3 lines using basic math - in my example I used multiplication, but simple addition would work also.
float startAngle = 159.9F;
float stopAngle = 355.87F;

startAngle = startAngle * stopAngle;
stopAngle = startAngle / stopAngle;
startAngle = startAngle / stopAngle;

Edit: As noted in the comments, this wouldn't work if y = 0 as it would generate a divide by zero error which I hadn't considered.  So the +/- solution alternatively presented would be the best way to go.
</deprecated>

To keep my code immediately comprehensible, I'd be more likely to do something like this.  [Always think about the poor guy that's gonna have to maintain your code]:
static bool Swap<T>(ref T x, ref T y)
{
    try
    {
        T t = y;
        y = x;
        x = t;
        return true;
    }
    catch
    {
        return false;
    }
}

And then you can do it in one line of code:
float startAngle = 159.9F
float stopAngle = 355.87F
Swap<float>(ref startAngle, ref stopAngle);

Or...
MyObject obj1 = new MyObject("object1");
MyObject obj2 = new MyObject("object2");
Swap<MyObject>(ref obj1, ref obj2);

Done like dinner...you can now pass in any type of object and switch them around...

A: With C# 7, you can use tuple deconstruction to achieve the desired swap in one line, and it's clear what's going on.
decimal startAngle = Convert.ToDecimal(159.9);
decimal stopAngle = Convert.ToDecimal(355.87);

(startAngle, stopAngle) = (stopAngle, startAngle);

A: For completeness, here is the binary XOR swap:
int x = 42;
int y = 51236;
x ^= y;
y ^= x;
x ^= y;

This works for all atomic objects/references, as it deals directly with the bytes, but may require an unsafe context to work on decimals or, if you're feeling really twisted, pointers. And it may be slower than a temp variable in some circumstances as well.

A: If you can change from using decimal to double you can use the Interlocked class.
Presumably this will be a good way of swapping variables performance wise. Also slightly more readable than XOR.
var startAngle = 159.9d;
var stopAngle = 355.87d;
stopAngle = Interlocked.Exchange(ref startAngle, stopAngle);

Msdn: Interlocked.Exchange Method (Double, Double)

A: int a = 4, b = 6;
a ^= b ^= a ^= b;

Works for all types including strings and floats.

A: a = a + b
b = a - b
a = a - b

َ

A: Beware of your environment!
For example, this doesn't seem to work in ECMAscript
y ^= x ^= y ^= x;

But this does
x ^= y ^= x; y ^= x;

My advise? Assume as little as possible.

A: The simple way to swap 2 numbers in just one line:
a=(a+b)-(b=a);

eg: a=1, b=2
Step 1: a=(1+2) - (b=1)
Step 2: a=3-1
=> a=2 and  b=1

Efficient way is to use:
C Programming:     (x ^= y), (y ^= x), (x ^= y);
Java:  x = x ^ y ^ (y = x);
Python: x, y = y, x
Note: Most common mistake people make:
//Swap using bitwise XOR (Wrong Solution in C/C++)
x ^= y ^= x ^= y;

Source: GeeksforGeek

A: C# 7 introduced tuples which enables swapping two variables without a temporary one:
int a = 10;
int b = 2;
(a, b) = (b, a);

This assigns b to a and a to b.

A: BenAlabaster showed a practical way of doing a variable switch, but the try-catch clause is not needed. This code is enough.
static void Swap<T>(ref T x, ref T y)
{
     T t = y;
     y = x;
     x = t;
}

The usage is the same as he shown:
float startAngle = 159.9F
float stopAngle = 355.87F
Swap(ref startAngle, ref stopAngle);

You could also use an extension method:
static class SwapExtension
{
    public static T Swap<T>(this T x, ref T y)
    {
        T t = y;
        y = x;
        return t;
    }
}

Use it like this:
float startAngle = 159.9F;
float stopAngle = 355.87F;
startAngle = startAngle.Swap(ref stopAngle);

Both ways uses a temporary variable in the method, but you don't need the temporary variable where you do the swapping.

A: The right way to swap two variables (at the time this question was asked(1)) is:
decimal tempDecimal = startAngle;
startAngle = stopAngle;
stopAngle = tempDecimal;

In other words, use a temporary variable.
There you have it. No clever tricks, no maintainers of your code cursing you for decades to come, no entries to The Daily WTF, and no spending too much time trying to figure out why you needed it in one operation anyway since, at the lowest level, even the most complicated language feature is a series of simple operations.
Just a very simple, readable, easy to understand, t = a; a = b; b = t; solution.
In my opinion, developers who try to use tricks to, for example, "swap variables without using a temp" or "Duff's device" are just trying to show how clever they are (and failing miserably).
I liken them to those who read highbrow books solely for the purpose of seeming more interesting at parties (as opposed to expanding your horizons).
Solutions where you add and subtract, or the XOR-based ones, are less readable and most likely slower than a simple "temp variable" solution (arithmetic/boolean-ops instead of plain moves at an assembly level).
Do yourself, and others, a service by writing good quality readable code.
That's my rant. Thanks for listening :-)
As an aside, I'm quite aware this doesn't answer your specific question (and I'll apologise for that) but there's plenty of precedent on SO where people have asked how to do something and the correct answer is "Don't do it".

(1) Improvements to the language and/or .NET Core since that time have adopted the "Pythonic" way using tuples. Now you can just do:
(startAngle, stopAngle) = (stopAngle, startAngle);

to swap values.

A: For binary types you can use this funky trick:
a %= b %= a %= b;

As long as a and b are not the exact same variable (e.g. aliases for the same memory) it works.

A: I hope this might help...
using System;

public class Program
{
    public static void Main()
    {
        int a = 1234;
        int b = 4321;

        Console.WriteLine("Before: a {0} and b {1}", a, b);

        b = b - a;
        a = a + b;
        b = a - b;

        Console.WriteLine("After: a {0} and b {1}", a, b);
    }
}

A: we can do that by doing a simple trick
a = 20;
b = 30;
a = a+b; // add both the number now a has value 50
b = a-b; // here we are extracting one number from the sum by sub
a = a-b; // the number so obtained in above help us to fetch the alternate number from sum
System.out.print("swapped numbers are a = "+ a+"b = "+ b);

A: Sometimes I wish it were possible to write a function in MSIL inline in C#, similar to how you can write inline assembler in C.
For the record, I once wrote a helper library for C# with various functions for things that were impossible to write in C# but can be written in MSIL (non-zero-based arrays for example). I had this function:
.method public hidebysig static void Swap<T> (
        !!T& a,
        !!T& b
    ) cil managed
{
    .maxstack 4

    ldarg.1      // push a& reference
    ldarg.2      // push b& reference
    ldobj !!T    // pop b&, push b
    ldarg.2      // push b& reference
    ldarg.1      // push a& reference
    ldobj !!T    // pop a&, push a
    stobj !!T    // store a in b&
    stobj !!T    // store b in a&
    ret
}

And no locals needed. Of course this was just me being silly...

A: A binary XOR swap with a detailed example:
XOR truth table:
a b a^b
0 0  0
0 1  1
1 0  1
1 1  0

Input:
a = 4;
b = 6;

Step 1: a = a ^ b
a  : 0100
b  : 0110
a^b: 0010 = 2 = a

Step 2: b = a ^ b
a  : 0010
b  : 0110
a^b: 0100 = 4 = b

Step 3: a = a ^ b
a  : 0010
b  : 0100
a^b: 0110 = 6 = a

Output:
a = 6;
b = 4;

A: In C# 7:
(startAngle, stopAngle) = (stopAngle, startAngle);

A: Not in C#. In native code you might be able to use the triple-XOR swap trick, but not in a high level type-safe language. (Anyway, I've heard that the XOR trick actually ends up being slower than using a temporary variable in many common CPU architectures.)
You should just use a temporary variable. There's no reason you can't use one; it's not like there's a limited supply.

A: For the sake of future learners, and humanity, I submit this correction to the currently selected answer.
If you want to avoid using temp variables, there are only two sensible options that take first performance and then readability into consideration.

*

*Use a temp variable in a generic Swap method. (Absolute best performance, next to inline temp variable)

*Use Interlocked.Exchange. (5.9 times slower on my machine, but this is your only option if multiple threads will be swapping these variables simultaneously.)

Things you should never do:

*

*Never use floating point arithmetic. (slow, rounding and overflow errors, hard to understand)

*Never use non-primitive arithmetic. (slow, overflow errors, hard to understand) Decimal is not a CPU primitive and results in far more code than you realize.

*Never use arithmetic period. Or bit hacks. (slow, hard to understand) That's the compiler's job. It can optimize for many different platforms.

Because everyone loves hard numbers, here's a program that compares your options. Run it in release mode from outside Visual Studio so that Swap is inlined. Results on my machine (Windows 7 64-bit i5-3470):
Inline:      00:00:00.7351931
Call:        00:00:00.7483503
Interlocked: 00:00:04.4076651

Code:
class Program
{
    static void Swap<T>(ref T obj1, ref T obj2)
    {
        var temp = obj1;
        obj1 = obj2;
        obj2 = temp;
    }

    static void Main(string[] args)
    {
        var a = new object();
        var b = new object();

        var s = new Stopwatch();

        Swap(ref a, ref b); // JIT the swap method outside the stopwatch

        s.Restart();
        for (var i = 0; i < 500000000; i++)
        {
            var temp = a;
            a = b;
            b = temp;
        }
        s.Stop();
        Console.WriteLine("Inline temp: " + s.Elapsed);

        s.Restart();
        for (var i = 0; i < 500000000; i++)
        {
            Swap(ref a, ref b);
        }
        s.Stop();
        Console.WriteLine("Call:        " + s.Elapsed);

        s.Restart();
        for (var i = 0; i < 500000000; i++)
        {
            b = Interlocked.Exchange(ref a, b);
        }
        s.Stop();
        Console.WriteLine("Interlocked: " + s.Elapsed);

        Console.ReadKey();
    }
}

A: First of all, swapping without a temporary variable in a language as C# is a very bad idea.
But for the sake of answer, you can use this code:
startAngle = startAngle + stopAngle;
stopAngle = startAngle - stopAngle;
startAngle = startAngle - stopAngle;

Problems can however occur with rounding off if the two numbers differ largely. This is due to the nature of floating point numbers.
If you want to hide the temporary variable, you can use a utility method:
public static class Foo {

    public static void Swap<T> (ref T lhs, ref T rhs) {
        T temp = lhs;
        lhs = rhs;
        rhs = temp;
    }
}

A: startAngle = (startAngle + stopAngle) - (stopAngle = startAngle);

A: If you want to swap 2 string variables:
a = (a+b).Substring((b=a).Length);

An helper method accordingly:
public static class Foo {
    public static void SwapString (ref string a, ref string b) {
       a = (a+b).Substring((b=a).Length);
    }
}

Usage would be then:
string a="Test 1";
string b="Test 2";
Foo.SwapString(a, b);

A: You can try the following code. It is much more better than the other code.
a = a + b;
b = a - b;
a = a - b;

A: Very simple code for swapping two variables:
static void Main(string[] args)
{
    Console.WriteLine("Prof.Owais ahmed");
    Console.WriteLine("Swapping two variables");

    Console.WriteLine("Enter your first number ");
    int x = Convert.ToInt32(Console.ReadLine());

    Console.WriteLine("Enter your first number ");
    int y = Convert.ToInt32(Console.ReadLine());

    Console.WriteLine("your vlaue of x is="+x+"\nyour value of y is="+y);

    int z = x;
    x = y;
    y = z;

    Console.WriteLine("after Swapping value of x is="+x+"/nyour value of y is="+y);
    Console.ReadLine();
}

A: var a = 15;
var b = -214;
a = b | !(b = a);

This works great.

A: Here another approach in one line:
decimal a = 159.9m;
decimal b = 355.87m;

a = b + (b = a) - b;

A: Here is some different process to swap two variables
//process one
a=b+a;
b=a-b;
a=a-b;
printf("a= %d  b=  %d",a,b);

//process two
a=5;
b=10;
a=a+b-(b=a);
printf("\na= %d  b=  %d",a,b);

//process three
a=5;
b=10;
a=a^b;
b=a^b;
a=b^a;
printf("\na= %d  b=  %d",a,b);

//process four
a=5;
b=10;
a=b-~a-1;
b=a+~b+1;
a=a+~b+1;
printf("\na= %d  b=  %d",a,b);

A: this model is very useful
        var a = 10;
        var b = 20;

        (int a,int b)  c = (a,b);

        a = c.b ;
        b = c.a ;


text:
Q: Maven: properties not being substituted I'm using a maven plugin for install4j in my project, located here. That plugin lets you pass variables to install4j using the <compilerVariables> section. Here's the relevant section of my pom:
<plugin>
    <groupId>com.google.code.maven-install4j</groupId>
    <artifactId>maven-install4j-plugin</artifactId>
    <version>0.1.1</version>
    <configuration>
        <executable>${devenv.install4jc}</executable>
        <configFile>${basedir}/newinstaller/ehd.install4j</configFile>
        <releaseId>${project.version}</releaseId>
        <attach>false</attach>
        <skipOnMissingExecutable>false</skipOnMissingExecutable>
        <compilerVariables>
            <property>
                <name>m2_home</name>
                <value>${settings.localRepository}</value>
            </property>
        </compilerVariables>
    </configuration>
</plugin>

The problem is that ${settings.localRepository} is not being substituted with the actual directory when I run the plugin. Here's the command line script that install4j is generating:
[INFO] Running the following command for install4j compile: /bin/sh -c /home/zach/install4j/bin/install4jc --release=9.1-SNAPSHOT --destination="/home/zach/projects/java/ehdtrunk/target/install4j" -D m2_home=${settings.localRepository} /home/zach/projects/java/ehdtrunk/newinstaller/ehd.install4j

Is this the fault of the plugin? If so, what needs to change to allow the substitution to happen?

A: The following POM just works for me (with Maven 2.2.1):
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.stackoverflow</groupId>
  <artifactId>Q2828732</artifactId>
  <version>1.0-SNAPSHOT</version>
  <dependencies>
    ...
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <phase>validate</phase>
            <configuration>
              <tasks>
                <echo>${settings.localRepository}</echo>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

And running mvn process-ressources produces the following output:

$ mvn validate
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Q2828732
[INFO]    task-segment: [validate]
[INFO] ------------------------------------------------------------------------
[INFO] [antrun:run {execution: default}]
[INFO] Executing tasks
     [echo] /home/pascal/.m2/repository
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Thu May 13 19:28:38 CEST 2010
[INFO] Final Memory: 3M/54M
[INFO] ------------------------------------------------------------------------

Does the above work for you? Are you using M2Eclipse? Could it be related to MNGECLIPSE-299?

A: The plugin in question accepts a parameter which is a Properties instance. For whatever reason, expressions used to configure Properties instances are not automatically evaluated. I had to change the plugin to use a org.apache.maven.plugin.PluginParameterExpressionEvaluator to evaluate ${settings.localRepository}.

redpajama_set_name: RedPajamaStackExchange


text:
Q: 'if we were to go with them' vs 'if we were to have gone with them' What is the difference between the two tenses?
1. If we were to go with them.
2. If we were to have gone with them.

A: Both are subjunctive, which means here that they're hypothetical/contrary-to-fact statements. #1 takes place in the present--the opportunity to go with them has not yet passed, and we're contemplating what might happen if we go. #2 takes place in the past, which is indicated by use of the perfect--the opportunity to go with them has already passed, and we're explaining  what would have been the result of the trip that we didn't take with them.
For example:

*

*They're planning a trip to Hawaii and they invited us. We're probably not going to go, because if we were to go, we would eat too much pineapple and die. We probably shouldn't go!

*They invited us to Hawaii, but we declined. We did not go with them. If we were to have gone, we would have eaten too much pineapple and died. Thanks heavens we didn't go!


text:
Q: Complex Float calculations from different tables Machine1 | Machine2 | Machine3 | Shift |
   abc   |    pqr   |  xyz     |First  |

Machine |SetupTime |OpnTime |
  abc   |   80     |   30   |
  pqr   |   60     |   40   |
  xyz   |   40     |   50   |

Shift | Time |
First |  440 |

I want the total addition of OpnTime for all machines divides with shift Time which substracts with
addition of setupTime as
((OpnTime+Opntime+OpnTime)/Time-(SetupTime+SetupTime+SetupTime))*100

((30+40+50)/440-(80+60+40))*100

(120/440-180)*100

(120/260)*100

(0.46)*100

46%

Could you please help me how to simply solve this complex calculations

A: You can try this:-
SELECT (SUM(TAB2.OpnTime) / (TAB3.Time - (SUM(TAB2.SetupTime))) * 100
FROM TAB2, TAB3;

This might help you.

A: As you said thet all my assumptions in your comments section were right, here is a solution:
select
  (m1.opntime + m2.opntime + m3.opntime) /
  (s.time - m1.setuptime - m2.setuptime - m3.setuptime) * 100
from t
join m1 on m1.machine = t.machine1
join m2 on m2.machine = t.machine2
join m3 on m3.machine = t.machine3
join s on s.shift = t.shift;

It is just a matter of setting parentheses correctly. As there is only one record in t and only one record per machine in m and only one record per shift in s, this is the easiest and fasted approach. No need for aggregation for example. (Given that, I wonder what your actual problem was. It seems so easy. Where did you fail?)
EDIT: If your columns aren't decimals, but integers, then you must convert to decimal. In integer math 120 / 260 is 0. In decimal math 120 / 260 is 0.4615...
select
  cast(m1.opntime + m2.opntime + m3.opntime as decimal) /
  cast(s.time - m1.setuptime - m2.setuptime - m3.setuptime as decimal) * 100
from t
join m1 on m1.machine = t.machine1
join m2 on m2.machine = t.machine2
join m3 on m3.machine = t.machine3
join s on s.shift = t.shift;


text:
Q: Convert SVG SMIL animation to CSS3 animation My current SVG is animated using SMIL animation
<svg viewBox="0 0 64 64">
  <g>
   <circle r="5" cx="24" cy="0" transform="translate(32,32)" stroke-width="0">
     <animate attributeName="fill-opacity" dur="750ms" values="1;.9;.85;.7;.4;.3;.3;.3;1" repeatCount="indefinite"></animate>
  </circle>
  <circle r="5" cx="16.970562748477143" cy="16.97056274847714" transform="translate(32,32)" stroke-width="0">
     <animate attributeName="fill-opacity" dur="750ms" values=".3;1;.9;.85;.7;.4;.3;.3;.3" repeatCount="indefinite"></animate>
  </circle>
  <circle r="5" cx="1.4695761589768238e-15" cy="24" transform="translate(32,32)" stroke-width="0">
     <animate attributeName="fill-opacity" dur="750ms" values=".3;.3;1;.9;.85;.7;.4;.3;.3" repeatCount="indefinite"></animate>
  </circle>
  <circle r="5" cx="-16.97056274847714" cy="16.970562748477143" transform="translate(32,32)" stroke-width="0">
     <animate attributeName="fill-opacity" dur="750ms" values=".3;.3;.3;1;.9;.85;.7;.4;.3" repeatCount="indefinite"></animate>
  </circle>
  <circle r="5" cx="-24" cy="2.9391523179536475e-15" transform="translate(32,32)" stroke-width="0">
    <animate attributeName="fill-opacity" dur="750ms" values=".4;.3;.3;.3;1;.9;.85;.7;.4" repeatCount="indefinite"></animate>
  </circle>
  <circle r="5" cx="-16.970562748477143" cy="-16.97056274847714" transform="translate(32,32)" stroke-width="0">
    <animate attributeName="fill-opacity" dur="750ms" values=".7;.4;.3;.3;.3;1;.9;.85;.7" repeatCount="indefinite"></animate>
  </circle>
  <circle r="5" cx="-4.408728476930472e-15" cy="-24" transform="translate(32,32)" stroke-width="0">
    <animate attributeName="fill-opacity" dur="750ms" values=".85;.7;.4;.3;.3;.3;1;.9;.85" repeatCount="indefinite"></animate>
  </circle>
  <circle r="5" cx="16.970562748477136" cy="-16.970562748477143" transform="translate(32,32)" stroke-width="0">
    <animate attributeName="fill-opacity" dur="750ms" values=".9;.85;.7;.4;.3;.3;.3;1;.9" repeatCount="indefinite"></animate>
  </circle>
</g>

SVG SMIL animation is not supported in IE. So I would like to replace the animation part by CSS animation, making the animation more widely supported.
How can I replace the above SVG SMIL animation by a CSS animation?

A:

circle {
    animation: fade 800ms infinite;
}
circle:nth-child(1) { animation-delay: -700ms; }
circle:nth-child(2) { animation-delay: -600ms; }
circle:nth-child(3) { animation-delay: -500ms; }
circle:nth-child(4) { animation-delay: -400ms; }
circle:nth-child(5) { animation-delay: -300ms; }
circle:nth-child(6) { animation-delay: -200ms; }
circle:nth-child(7) { animation-delay: -100ms; }

@keyframes fade {
     0% { fill-opacity: 1; }
    12% { fill-opacity: .9; }
    25% { fill-opacity: .85; }
    37% { fill-opacity: .7; }
    50% { fill-opacity: .4; }
    62%, 87% { fill-opacity: .3; }
   100% { fill-opacity: 1; }
}
<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 64 64">
 <g transform="translate(32,32)" stroke-width="0">
  <circle r="5" cx= "24" cy=  "0" />
  <circle r="5" cx= "17" cy= "17" />
  <circle r="5" cx=  "0" cy= "24" />
  <circle r="5" cx="-17" cy= "17" />
  <circle r="5" cx="-24" cy=  "0" />
  <circle r="5" cx="-17" cy="-17" />
  <circle r="5" cx=  "0" cy="-24" />
  <circle r="5" cx= "17" cy="-17" />
 </g>
</svg>


text:
Q: How to format this string in java? How can a String be formatted in Java?
My String contains only numbers like "1234.0" and I want to return the formatted number.
For example, given the string "1234.0" the result should be the String "1234".

A: You can use regular expressions as well:
String n = "1234.0";
n.replaceAll("\\.0*$", "");

A: Use DecimalFormat like this:
DecimalFormat myFormatter = new DecimalFormat("####");
String output = myFormatter.format(value);

You can find more here

A: try {
   String formatted = String.valueOf((int)Double.parseDouble("12345.0"));
} catch (ParseException e) {
   // input is not a number
}


text:
Q: GWT Acegi alternative I'm starting new project. The client interface is based on GWT (and GXT) I have no say it's predetermined. However I can pick and choose as far as server side so I can have some fun and hopefully learn something new in the process. Some requirements are :

*

*Exchange with server will be through use of JSON, most if not all of UI will be generated by GWT (JS) on the client, so the client/serve exchange will be limited to data exchange as much as possible

*No Hibernate (it's not really supported on the proprietary db I will be connecting to). In the past projects people would use JDBC or iBATIS

*Some sort of IoC (I'm thinking Guice just to stick with Google)

*Some sort of Security framework based on LDAP. In the past we would use Spring security (Acegi) but it wasn't ideal and we had to customize it a lot

So basically should I stick with tried-and-true Spring/Acegi or try something based on Guice? And what that "something" would be and how mature is it?

A: Have a look at Apache Shiro. It seems to be gaining ground, with no reference to Spring.

A: If you'd like to do IOC on client and server, go with Guice. You can use Guice on the server, and its brother GIN on the client.

A: Since nether of the above answers gave me any practical ideas (or almost any) here's formula I ended up with:
Maven + GXT + GWT and Guice + iBaGuice


text:
Q: PowerPivot / DAX Parent Child Hierarchy function PATH Calculation Error I'm looking into the Parent Child Hierarchy in PowerPivot/DAX. Below are some useful articles I have found.
parent-child-hierarchies-in-tabular-with-denali
PowerPivot Denali: Parent child using DAX
PATH Function (DAX)
However, when I tried to implement the PATH function in DAX, I got the following error.
=path(rptHierDate_rptHierDate[TREE_NODE_ID],rptHierDate_rptHierDate[PARENT_TREE_NODE_ID])

Below is a screenshot of my dataset. I have checked column TREE_NODE_ID has no duplication, and all values in column PARENT_TREE_NODE_ID exist in TREE_NODE_ID

I'm not sure why am I getting this error. Any idea is appreciated!


text:
Q: How to retrieve a list of WooCommerce orders which use a particular coupon? I'm trying to write a function that retrieves a list of WooCommerce orders which use a specified coupon code and are in a specified date range, then sums the total discounts applied to those orders.
After a little googling I feel like I should be using something like
$customer_orders = get_posts( array(
    'numberposts' => -1,
    'meta_key'    => ???,
    'meta_value'  => $CouponToSearchFor,
    'post_type'   => wc_get_order_types(),
    'post_status' => array_keys( wc_get_order_statuses() ),
) );

I've tried:
'meta_key' => 'coupon'
'meta_key' => 'shop_coupon'
'meta_key' => '_coupon'

But none of those work. How can I find out which meta_key/meta_value terms will give me what I need?
Additionally I think meta_query can be used to perform the date filtering as part of this get_posts() query, is that correct?

A:
Your code is not working because by default WooCommerce does't store
  used coupon code in wp_postmeta table. It stores in
  wp_woocommerce_order_items table, under order_item_type =>
  coupon and order_item_name => YOUR_CODE.

You have to first get all the Order ID(s), then you have to loop it to get the desired total, or tax or discount.
Here is the code:
function wh_getOrderbyCouponCode($coupon_code, $start_date, $end_date) {
    global $wpdb;
    $return_array = [];
    $total_discount = 0;

    $query = "SELECT
        p.ID AS order_id
        FROM
        {$wpdb->prefix}posts AS p
        INNER JOIN {$wpdb->prefix}woocommerce_order_items AS woi ON p.ID = woi.order_id
        WHERE
        p.post_type = 'shop_order' AND
        p.post_status IN ('" . implode("','", array_keys(wc_get_order_statuses())) . "') AND
        woi.order_item_type = 'coupon' AND
        woi.order_item_name = '" . $coupon_code . "' AND
        DATE(p.post_date) BETWEEN '" . $start_date . "' AND '" . $end_date . "';";

    $orders = $wpdb->get_results($query);

    if (!empty($orders)) {
        $dp = ( isset($filter['dp']) ? intval($filter['dp']) : 2 );
        //looping throught all the order_id
        foreach ($orders as $key => $order) {
            $order_id = $order->order_id;
            //getting order object
            $objOrder = wc_get_order($order_id);

            $return_array[$key]['order_id'] = $order_id;
            $return_array[$key]['total'] = wc_format_decimal($objOrder->get_total(), $dp);
            $return_array[$key]['total_discount'] = wc_format_decimal($objOrder->get_total_discount(), $dp);
            $total_discount += $return_array[$key]['total_discount'];
        }
//        echo '<pre>';
//        print_r($return_array);
    }
    $return_array['full_discount'] = $total_discount;
    return $return_array;
}

Code goes in function.php file of your active child theme (or theme). Or also in any plugin php files.
USAGE
$orders = wh_getOrderbyCouponCode('my_code', '2016-09-17', '2016-10-07');
echo 'Total Discount : ' . $orders['full_discount'];
//print_r($orders);

Please Note:
All dates are in YYYY-MM-DD format.
print_r(array_keys(wc_get_order_statuses())); will output something like this:
Array
(
    [0] => wc-pending
    [1] => wc-processing
    [4] => wc-on-hold
    [5] => wc-completed
    [6] => wc-cancelled
    [7] => wc-refunded
    [8] => wc-failed
)

Code is tested and works.
Hope this helps!


text:
Q: Can an ndjson file be saved using xdmp.save? I have a requirement to gather certain JSON documents from my database and save them in an outside drive as one file for a downstream consumer.
Using server-side Javascript I can combine the documents in a JSON object or array. However, they need to be saved into this singular file in ndjson format.
Is there any way to do this using xdmp.save in MarkLogic? I thought of saving the documents as a sequence but that throws an error.

A: xdmp.save() expects a node() for the second parameter.
You could serialize the JSON docs and delimit with a carriage return to generate the Newline Delimited JSON, and then create a text() node from that string.
const ndjson = new NodeBuilder()
  .addText(cts.search(cts.collectionQuery("json")).toArray().join("\n"))
  .toNode();
xdmp.save("/temp/ndjson.json", ndjson);


text:
Q: Best architecture to work with JMenuBar in Java (similar to MVC) I searched many places trying to find information or examples of how to incorporate a JMenuBar in mvc architecture. And I fail to understand how to do this.
The idea is that each menu item has its own associated panel. These panels are inserted in the main frame depending on the selection menu.
In this context, the best way to approach this is to have a great driver for all views or a sub-controller for each view?
And if this was not the most appropriate. MVC is the best architecture to do this or is there another more appropriate architecture?


text:
Q: Automatically download sources in Gradle project In Maven projects, there is an option to automatically download sources (and javadoc) for all libraries. For Gradle project I found no option, just to open a class and click "Search in internet". This is very annoying if you have a lot of libraries. Is there any way to automatically attach sources from the internet (maven repo)?

A: I know that this is an old topic, but in case someone reaches here and does not want to gradle idea, you can also use a plugin and then it will resolve sources automatically.
e.g. both idea and eclipse compatible build.gradle
plugins {
  id "java"
  id "idea"
  id "eclipse"
}

idea {
  module {
    downloadSources = true
  }
}

eclipse {
  classpath {
    downloadSources = true
  }
}

dependencies {
  compile group: 'commons-io', name: 'commons-io', version: '2.6'
}


text:
Q: Exposing Neo4J REST within TomCat I have an SDN 2.3.1 application running 1.9 Neo4J embedded which is deployed on Tomcat 7. All good when running both embedded and rest. However, I'm now looking to try and expose the REST interface having followed This Post so that I cuse Linkurious to explore the embedded data.
The exception I get on deployment is:
com.sun.jersey.api.container.ContainerException: No WebApplication provider is present

My XML config is
<bean id="graphDatabaseService" class="org.neo4j.kernel.EmbeddedGraphDatabase" destroy-method="shutdown">
    <constructor-arg index="0" value="${neo4j.datastore}"/>
    <constructor-arg index="1">
        <map>
            <entry key="allow_store_upgrade" value="true"/>
            <entry key="enable_remote_shell" value="true"/>
        </map>
    </constructor-arg>
</bean>
<bean id="serverWrapper" class="org.neo4j.server.WrappingNeoServer" init-method="start" destroy-method="stop">
    <constructor-arg ref="graphDatabaseService"/>
</bean>

I have the static-web and neo4j-server in my pom.xml
My guess is it's a conflict with Jetty and Tomcat around who's allowed to deploy to a context. Is my config even possible and if so, what step might I be missing?

A: Missing transitive dependency on Jersey which I didn't spot in documentation.
   <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-servlet</artifactId>
        <version>1.17.1</version>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-server</artifactId>
        <version>1.17.1</version>
    </dependency>

The web admin interface is throwing an exception but I can at least run embedded and expose a RESTful interface to Neo4J- Yay!
Thanks to this post for the pointer


text:
Q: How to animate svg paths with different speeds, by fixing a rotation center point? 1. Introduction
I have an image that i want to animate its specific 'paths' around a center point.
For example 'path1' will rotate at t=1s, and 'path2' at t=3s.
2. The question:
How can this be done?
3.Clarification
The image is on a simple index page.
4.This is the source image file
           <g id="first">
            <path id="path1" fill="#ed1c24" opacity="1.00" d=" M 7.01 7.01 C 104.67 6.99 202.33 6.99 299.99 7.01 C 300.01 104.67 300.01 202.33 299.99 299.99 C 202.33 300.00 104.67 300.01 7.01 299.99 C 7.00 202.33 6.99 104.67 7.01 7.01 M 33.01 32.01 C 32.99 113.67 32.99 195.33 33.01 276.99 C 114.00 277.01 195.00 277.01 275.99 276.99 C 276.01 195.33 276.00 113.67 275.99 32.01 C 195.00 31.99 114.00 31.99 33.01 32.01 Z" />
            </g>
            <g id="second">
            <path id="path2" fill="#000000" opacity="1.00" d=" M 153.11 60.95 C 153.80 60.95 155.19 60.95 155.89 60.95 C 164.16 84.01 170.90 107.63 178.27 131.00 C 193.87 131.15 209.34 132.65 225.03 131.99 C 231.77 133.78 238.79 132.61 245.68 133.11 C 247.47 134.01 247.60 136.84 245.75 137.75 C 228.10 151.08 210.95 165.34 193.10 178.24 C 200.20 200.70 205.97 223.63 212.89 246.17 C 213.90 248.26 211.70 251.09 209.51 249.75 C 191.40 237.05 173.47 224.11 155.49 211.23 C 154.51 210.75 153.61 210.91 152.79 211.69 C 135.34 224.34 117.79 236.83 100.20 249.29 C 98.13 251.48 94.85 248.71 96.11 246.17 C 103.03 223.63 108.79 200.70 115.90 178.24 C 98.05 165.34 80.90 151.08 63.25 137.75 C 61.40 136.84 61.52 134.01 63.32 133.12 C 70.21 132.61 77.23 133.78 83.97 131.99 C 99.66 132.65 115.13 131.15 130.73 131.00 C 138.19 107.66 144.91 84.03 153.11 60.95 Z" />
            </g>

A: I found a simpler way to rotate specific paths of an svg file with your desired speed.
Here is the code that worked for me:

<svg width="100pt" height="100pt" viewBox="0 0 160 160" version="1.1" xmlns="http://www.w3.org/2000/svg">
  <g id="first">
    <path id="path1" fill="#ed1c24" opacity="1.00" d=" M 7.01 7.01 C 104.67 6.99 202.33 6.99 299.99 7.01 C 300.01 104.67 300.01 202.33 299.99 299.99 C 202.33 300.00 104.67 300.01 7.01 299.99 C 7.00 202.33 6.99 104.67 7.01 7.01 M 33.01 32.01 C 32.99 113.67 32.99 195.33 33.01 276.99 C 114.00 277.01 195.00 277.01 275.99 276.99 C 276.01 195.33 276.00 113.67 275.99 32.01 C 195.00 31.99 114.00 31.99 33.01 32.01 Z" />
    <animateTransform attributeName="transform" type="rotate" from="0 80 80" to="360 80 80" begin="0s" dur="1.00s" repeatCount="indefinite" />
  </g>
  <g id="second">
    <path id="path2" fill="#000000" opacity="1.00" d=" M 153.11 60.95 C 153.80 60.95 155.19 60.95 155.89 60.95 C 164.16 84.01 170.90 107.63 178.27 131.00 C 193.87 131.15 209.34 132.65 225.03 131.99 C 231.77 133.78 238.79 132.61 245.68 133.11 C 247.47 134.01 247.60 136.84 245.75 137.75 C 228.10 151.08 210.95 165.34 193.10 178.24 C 200.20 200.70 205.97 223.63 212.89 246.17 C 213.90 248.26 211.70 251.09 209.51 249.75 C 191.40 237.05 173.47 224.11 155.49 211.23 C 154.51 210.75 153.61 210.91 152.79 211.69 C 135.34 224.34 117.79 236.83 100.20 249.29 C 98.13 251.48 94.85 248.71 96.11 246.17 C 103.03 223.63 108.79 200.70 115.90 178.24 C 98.05 165.34 80.90 151.08 63.25 137.75 C 61.40 136.84 61.52 134.01 63.32 133.12 C 70.21 132.61 77.23 133.78 83.97 131.99 C 99.66 132.65 115.13 131.15 130.73 131.00 C 138.19 107.66 144.91 84.03 153.11 60.95 Z" />
    <animateTransform attributeName="transform" type="rotate" from="0 80 80" to="360 80 80" begin="0s" dur="3.00s" repeatCount="indefinite" />
  </g>
</svg>


text:
Q: How to Ignore Whitespaces using preg_match() I have a string that looks like:
">ANY CONTENT(<a id="show

I need to fetch ANY CONTENT. However, there are spaces in between
 and ((.*?)\s*\(loadHTML($data);
$span = $dom->getElementsByTagName('span');
$content = $span->item(0)->textContent;

A: I just had to:
">
define the above properly, because "> were too many in the page, so it didn't know which one to choose specficially. Therefore, it returned everything before "> until it hits (

Solution:
.">

Sample:
$success = preg_match('#\.">(.*?)\s*\(<a id="show#s', $basicPage, $content);


text:
Q: Vector inner product in terms of norms using fundamental theorem of optimization I read here under Lipschitz functions section that using the fundamental theorem of optimization, the vector inner product of $u$ and $v$ can be written like this:
$$\langle u, v\rangle \;= \frac{1}{2} (||u||^2 + ||v||^2 - ||u-v||^2)$$
The only property I know that lets me write dot product in terms of norms is the Cauchy–Schwarz inequality but that looks vastly different. Can someone explain this property to me and maybe show it's proof? I don't want to blindly apply it in my sum. And I could not find a proof for it anywhere else.

A: As @StefanLafon notes, for a vector space over $\Bbb R$ we get$$\Vert u-v\Vert^2=\langle u-v,\,u-v\rangle=\langle u,\,u\rangle-\langle u,\,v\rangle-\langle v,\,u\rangle+\langle v,\,v\rangle=\Vert u\Vert^2-2\langle u,\,v\rangle+\Vert v\Vert^2.$$Now rearrange. Complex spaces require something different, because $\langle v,\,u\rangle=\langle u,\,v\rangle^\ast$ differs from $\langle u,\,v\rangle$ in general.


text:
Q: How to find the nth multiline block of text using sed So I have a file which contains blocks that looks as follows:
menuentry ... {
....
....
}

....

menuentry ... {
....
....
}

I need to look at the contents of each menu entry in a bash script. I have very limited experience with sed but through a very exhaustive search I was able to construct the following:
cat $file | sed '/^menuentry.*{/!d;x;s/^/x/;/x\{1\}/!{x;d};x;:a;n;/^}/!ba;q'

and I can replace the \{1\} with whatever number I want to get the nth block. This works fine like that, but the problem is I need to iterate through an arbitrary number of times:
numEntries=$( egrep -c "^menuentry.*{" $file )
for i in $( seq 1 $numEntries); do

    i=$( echo $i | tr -d '\n' ) # A google search indicated sed  encounters problems
                                # when a substituted variable has a trailing return char

    # Get the nth entry block of text with the sed statement from before,
    # but replace with variable $i
    entry=$( cat $file | sed '/^menuentry.*{/!d;x;s/^/x/;/x\{$i\}/!{x;d};x;:a;n;/^}/!ba;q')

    # Do some stuff with $entry #

done

I've tried with every combination of quotes/double quotes and braces around the variable and around the sed statement and every which way I do it, I get some sort of error. As I said, I don't really know much about sed and that frankenstein of a statement is just what I managed to mish-mosh together from various google searches, so any help or explanation would be much appreciated!
TIA

A: sed is for simple substitutions on individual lines, that is all, and shell loops to manipulate text are immensely slow and difficult to write robustly. The folks who invented sed and shell also invented awk for tasks like this:
awk -v RS= 'NR==3' file

would print the 3rd blank-line-separated block of text as shown in your question. This would print every block containing the string "foobar":
awk -v RS= '/foobar/' file

and anything else you might want to do is equally trivial.
The above will work efficiently, robustly and portably using any awk in any shell on any UNIX box. For example:
$ cat file
menuentry first {
    Now is the Winter
    of our discontent
}

menuentry second {
    Wee sleekit cowrin
    timrous beastie,
    oh whit a panic's in
    thy breastie.
}

menuentry third {
    Twas the best of times
    Twas the worst of times
    Make up your damn mind
}

.
$ awk -v RS= 'NR==3' file
menuentry third {
    Twas the best of times
    Twas the worst of times
    Make up your damn mind
}

$ awk -v RS= 'NR==2' file
menuentry second {
    Wee sleekit cowrin
    timrous beastie,
    oh whit a panic's in
    thy breastie.
}

$ awk -v RS= '/beastie/' file
menuentry second {
    Wee sleekit cowrin
    timrous beastie,
    oh whit a panic's in
    they breastie.
}

If you find yourself trying to do anything other than s/old/new with sed and/or using sed commands other than s, g and p (with -n) then you are using constructs that became obsolete in the mid-1970s when awk was invented.
If the above doesn't work for you then edit your question to provide more truly representative sample input and expected output.

A: I see the problem. You are trying to use $i inside single quotes. $i will be left as $i As I posted below correcting it with single quotes around $i so that bash will see it as 3 strings
'one string'"$twostrings"'three strings'
#!/bin/bash
#filename:grubtest.sh

numEntries=$( egrep -c "^menuentry.*{" "$1" )
i=0
while [ $i -lt $numEntries ]; do
    i=$(($i+1))
    # Get the nth entry block of text with the sed statement from before,
    entry=$( cat "$1" | sed '/^menuentry.*{/!d;x;s/^/x/;/x\{'"$i"'\}/!{x;d};x;:a;n;/^}/!ba;q')

    # Do some stuff with $entry #
    echo $entry|cut -d\' -f2

done

this returned my grub items when ran like so
./grubtest.sh /etc/grub2.cfg

A: How about splitting this work up?
First search for lines, where a menu entry starts (for personal reasons, I here use grub, not grub2, adjust to your needs):
entrystarts=($(sed -n '/^menuentry.*/=' /boot/grub/grub.cfg))

Then, in a second step, choose a starting val from the array, for the n-th entry ${entrystarts[$n]} and proceed from there? Afaik, the entry end is easy to detect by a single closing curly brace.
for i in ${entrystarts[@]}
do
    // your code here, proof of concept (note grub/grub2):
    sed -n "$i,/}/p" /boot/grub/grub.cfg
done


text:
Q: CSS inline-block images won't align horizontally I've done this a million times but I can't figure out why this won't work now. I'm trying to get 4 images of the same size to sit in a straight line horizontally however they are appearing slightly diagonal from each other.
Here is my html

And my CSS:
.homepage_images {
display:block;
}
.homepage_images img{
display:inline-block;
float:left;
width:240px;
opacity:0.8;
}

And here is a link to the site, the images that are misaligned are near the bottom of the page
http://www.one-event.org.uk

A: You have a line break between each line. You haven't put it in the code you posted, but in the code from the site,

you have a line break between each div. Removing that fixes the problem.
Basically change it to what you posted;

A: Somehow br tag added after each anchor tag in that div. just check from where that tag is getting added and make necessary changes.


text:
Q: Ghostscript Batch file - execute and quit I am trying to execute GhostScript in a batch file.
batch.bat
gswin32.exe ^
  -dNOPAUSE ^
  -sDEVICE=pdfwrite ^
  -sOUTPUTFILE=output1.txt ^
  -dBatch ^
   "file1.txt" "file2.txt"

gswin32.exe ^
  -dNOPAUSE ^
  -sDEVICE=pdfwrite ^
  -sOUTPUTFILE=output2.txt ^
  -dBatch ^
   "file1.txt" "file2.txt"

Problem is when first line is executed, it opens GhostScript window. i have to manually type quit or close the window to return the control to parent to execute the next command in batch.
How can we modify batch file so it executes ghost script? Originally I am calling this file from C# program using Process.Start(ProcessInfo). Suggestions are welcome

A: *

*To avoid Ghostscript opening a window, don't use gswin32.exe.
Use gswin32c.exe instead. (The c in the name is to indicate it's for console only...)

*Also, be aware that Text files cannot serve as input to Ghostscript.
Ghostscript can only process PostScript, Encapsulated PostScript or PDF files.

*You can name your output file as you please.
But your -sDEVICE=pdfwrite will produce PDF output, so you are well advised to use a .pdf suffix for the output file if you want to avoid confusion later.

*The spelling for -dBATCH is case sensitive.
-dBatch will not work.
(-dBATCH causes Ghostscript to return after the last page of the job being completed -- otherwise it would switch to interactive mode and show its GS> prompt... It's not for processing 'batches of input files', as you appear to assume.)

*Your 2 commands in the batch file are using both the same input parameters.
That means the 2 output files will be the same, just have different filenames.
I recommend the following commandline scheme to use:
gswin32.exe ^
  -dNOPAUSE ^
  -dBATCH ^
  -sDEVICE=pdfwrite ^
  -sOUTPUTFILE=output2.pdf ^
   "file1.ps" "file2.pdf" "file3.eps"

A: Use gswin32c instead. This is a console application and won't create a window you need to manually close.


text:
Q: javascript not working in I.E. 9 as well as Firefox Greetings fellow stackoverflow members,
I am having quite the dilemma as of late.  The code provided below is quite lengthy, however, most of it is duplicate code for each 3 main containers labeled (General, Kills, and Scores).
I am having issues with the javascript I have written up which coincides with jquery 1.9.1 - the slider doesn't slide - it works perfectly in Chrome, but doesn't in I.E.9 as well as Firefox for some reason...I've revised it all countless of times, but do not see any issues as to why it's not working in those browsers.  If you can look it over and provide me with what or where I am going wrong in my javascript I'd greatly appreciate it as I'm thinking it will be easier for you guys/gals to spot the issue since it's fresh to your eyes.
DEMO: http://jsfiddle.net/aeJtx/3/
JAVASCRIPT:
/* ===== Start of 'Slider - My Statistics (Achievements - General)' ===== */
$(function () {
    $('input.field').focus(function () {
        if (this.title == this.value) {
            this.value = '';
        }
    }).blur(function () {
        if (this.value === '') {
            this.value = this.title;
        }
    });
    var currentPage = 1;
    $('#slider_achievements_general .buttons_achievements_general span').on('click', function () {
        var timeout = setTimeout(function () {
            $("img").trigger("slidermove");
        }, 100);
        var fragments_count = $(this).parents('#slider_achievements_general:eq(0)').find('.fragment_achievements_general').length;
        var fragment_width = $(this).parents('#slider_achievements_general:eq(0)').find('.fragment_achievements_general').width();
        var perPage = 1;
        var numPages = Math.ceil(fragments_count / perPage);
        var stepMove = fragment_width * perPage;
        var container = $(this).parents('#slider_achievements_general:eq(0)').find('.con_achievements_general');
        var firstPosition = 0;
        var lastPosition = -((numPages - 1) * stepMove);
        if ($(this).hasClass('next')) {
            currentPage++;
            if (currentPage > numPages) {
                currentPage = 1;
                container.animate({
                    'left': firstPosition
                });
                return;
            }
            container.animate({
                'left': -((currentPage - 1) * stepMove)
            });
        }
        if ($(this).hasClass('prev')) {
            currentPage--;
            if (currentPage < 1) {
                currentPage = numPages;
                container.animate({
                    'left': lastPosition
                });
                return;
            }
            container.animate({
                'left': -((currentPage - 1) * stepMove)
            });
        }
    });
});

/* ===== Start of 'Slider - My Statistics (Achievements - Kills)' ===== */
$(function () {
    $('input.field').focus(function () {
        if (this.title == this.value) {
            this.value = '';
        }
    }).blur(function () {
        if (this.value === '') {
            this.value = this.title;
        }
    });
    var currentPage = 1;
    $('#slider_achievements_kills .buttons_achievements_kills span').on('click', function () {
        var timeout = setTimeout(function () {
            $("img").trigger("slidermove");
        }, 100);
        var fragments_count = $(this).parents('#slider_achievements_kills:eq(0)').find('.fragment_achievements_kills').length;
        var fragment_width = $(this).parents('#slider_achievements_kills:eq(0)').find('.fragment_achievements_kills').width();
        var perPage = 1;
        var numPages = Math.ceil(fragments_count / perPage);
        var stepMove = fragment_width * perPage;
        var container = $(this).parents('#slider_achievements_kills:eq(0)').find('.con_achievements_kills');
        var firstPosition = 0;
        var lastPosition = -((numPages - 1) * stepMove);
        if ($(this).hasClass('next')) {
            currentPage++;
            if (currentPage > numPages) {
                currentPage = 1;
                container.animate({
                    'left': firstPosition
                });
                return;
            }
            container.animate({
                'left': -((currentPage - 1) * stepMove)
            });
        }
        if ($(this).hasClass('prev')) {
            currentPage--;
            if (currentPage < 1) {
                currentPage = numPages;
                container.animate({
                    'left': lastPosition
                });
                return;
            }
            container.animate({
                'left': -((currentPage - 1) * stepMove)
            });
        }
    });
});

/* ===== Start of 'Slider - My Statistics (Achievements - Scores)' ===== */
$(function () {
    $('input.field').focus(function () {
        if (this.title == this.value) {
            this.value = '';
        }
    }).blur(function () {
        if (this.value === '') {
            this.value = this.title;
        }
    });
    var currentPage = 1;
    $('#slider_achievements_scores .buttons_achievements_scores span').on('click', function () {
        var timeout = setTimeout(function () {
            $("img").trigger("slidermove");
        }, 100);
        var fragments_count = $(this).parents('#slider_achievements_scores:eq(0)').find('.fragment_achievements_scores').length;
        var fragment_width = $(this).parents('#slider_achievements_scores:eq(0)').find('.fragment_achievements_scores').width();
        var perPage = 1;
        var numPages = Math.ceil(fragments_count / perPage);
        var stepMove = fragment_width * perPage;
        var container = $(this).parents('#slider_achievements_scores:eq(0)').find('.con_achievements_scores');
        var firstPosition = 0;
        var lastPosition = -((numPages - 1) * stepMove);
        if ($(this).hasClass('next')) {
            currentPage++;
            if (currentPage > numPages) {
                currentPage = 1;
                container.animate({
                    'left': firstPosition
                });
                return;
            }
            container.animate({
                'left': -((currentPage - 1) * stepMove)
            });
        }
        if ($(this).hasClass('prev')) {
            currentPage--;
            if (currentPage < 1) {
                currentPage = numPages;
                container.animate({
                    'left': lastPosition
                });
                return;
            }
            container.animate({
                'left': -((currentPage - 1) * stepMove)
            });
        }
    });
});

CSS:
/* ===== Start of 'Achievement Details - (General)' ===== */
 #general_wrapper {
    width: 650px;
    height: 150px;
    padding: 0;
    margin: 0 auto;
    background: #333;
    border: 2px solid #444;
    -moz-border-radius: 12px;
    -webkit-border-radius: 12px;
    border-radius: 12px;
    -moz-box-shadow: 0 28px 24px -24px #000, inset 0 -0.3em 0.9em 0.3em #000;
    -webkit-box-shadow: 0 28px 24px -24px #000, inset 0 -0.3em 0.9em 0.3em #000;
    box-shadow: 0 28px 24px -24px #000, inset 0 -0.3em 0.9em 0.3em #000;
    position: relative;
    top: 20px;
}
#general_wrapper h2 {
    width: 626px;
    height: 20px;
    padding: 6px 0 6px 0;
    margin: 0 12px;
    border-bottom: 1px solid #444;
    float: left;
    color: #AB9B68;
    font: 20px Arial, Helvetica, sans-serif;
    font-weight: bold;
    font-variant: small-caps;
    text-shadow: 1px 1px 1px #000, -2px -2px 2px #000;
    filter: progid:DXImageTransform.Microsoft.Shadow(direction=315, strength=2, color=000000);
}
#slider_achievements_general {
    width: 577px;
    height: 96px;
    padding: 0;
    margin: 0 auto;
    background: #222;
    border: 2px solid #444;
    -moz-box-shadow: inset 0 0.3em 0.9em 0.3em #000;
    -webkit-box-shadow: inset 0 0.3em 0.9em 0.3em #000;
    box-shadow: inset 0 0.3em 0.9em 0.3em #000;
    position: relative;
    top: 40px;
}
.buttons_achievements_general {
    position: absolute;
    top: -2px;
    right: -25px;
    z-index: 101;
}
.buttons_achievements_general span {
    position: absolute;
    display: block;
    width: 22px;
    height: 62px;
    padding: 34px 0 0 0;
    cursor: pointer;
}
.buttons_achievements_general span.prev {
    color: #111;
    font: 20px Arial, Helvetica, sans-serif;
    font-weight: bold;
    right: 602px;
    background: rgba(204, 204, 204, 0.5);
    border: 2px solid #444;
    -moz-border-radius: 8px 0 0 8px;
    -webkit-border-radius: 8px 0 0 8px;
    border-radius: 8px 0 0 8px;
    -moz-box-shadow: inset 0 -0.15em 0.45em 0.15em #000;
    -webkit-box-shadow: inset 0 -0.15em 0.45em 0.15em #000;
    box-shadow: inset 0 -0.15em 0.45em 0.15em #000;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.7);
}
.buttons_achievements_general span.next {
    color: #111;
    font: 20px Arial, Helvetica, sans-serif;
    font-weight: bold;
    right: 0;
    background: rgba(204, 204, 204, 0.5);
    border: 2px solid #444;
    -moz-border-radius: 0 8px 8px 0;
    -webkit-border-radius: 0 8px 8px 0;
    border-radius: 0 8px 8px 0;
    -moz-box-shadow: inset 0 -0.15em 0.45em 0.15em #000;
    -webkit-box-shadow: inset 0 -0.15em 0.45em 0.15em #000;
    box-shadow: inset 0 -0.15em 0.45em 0.15em #000;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.7);
}
.holder_achievements_general {
    width: 577px;
    height: 96px;
    position: relative;
    top: -31px;
    overflow: hidden;
}
.con_achievements_general {
    width: 100000px;
    height: 96px;
    position: absolute;
}
.fragment_achievements_general {
    width: 577px;
    height: 96px;
    float: left;
    display: inline;
}
/* ===== Start of 'General Medals Wrapper inside Fragment' ===== */
 #general_medals_wrapper {
    width: 576px;
    height: 96px;
    float: left;
}
/* ===== Start of 'Achievement Details - (Kills)' ===== */
 #kills_wrapper {
    width: 650px;
    height: 150px;
    padding: 0;
    margin: 0 auto;
    background: #333;
    border: 2px solid #444;
    -moz-border-radius: 12px;
    -webkit-border-radius: 12px;
    border-radius: 12px;
    -moz-box-shadow: 0 28px 24px -24px #000, inset 0 -0.3em 0.9em 0.3em #000;
    -webkit-box-shadow: 0 28px 24px -24px #000, inset 0 -0.3em 0.9em 0.3em #000;
    box-shadow: 0 28px 24px -24px #000, inset 0 -0.3em 0.9em 0.3em #000;
    position: relative;
    top: 50px;
}
#kills_wrapper h2 {
    width: 626px;
    height: 20px;
    padding: 6px 0 6px 0;
    margin: 0 12px;
    border-bottom: 1px solid #444;
    float: left;
    color: #AB9B68;
    font: 20px Arial, Helvetica, sans-serif;
    font-weight: bold;
    font-variant: small-caps;
    text-shadow: 1px 1px 1px #000, -2px -2px 2px #000;
    filter: progid:DXImageTransform.Microsoft.Shadow(direction=315, strength=2, color=000000);
}
#slider_achievements_kills {
    width: 577px;
    height: 96px;
    padding: 0;
    margin: 0 auto;
    background: #222;
    border: 2px solid #444;
    -moz-box-shadow: inset 0 0.3em 0.9em 0.3em #000;
    -webkit-box-shadow: inset 0 0.3em 0.9em 0.3em #000;
    box-shadow: inset 0 0.3em 0.9em 0.3em #000;
    position: relative;
    top: 40px;
}
.buttons_achievements_kills {
    position: absolute;
    top: -2px;
    right: -25px;
    z-index: 101;
}
.buttons_achievements_kills span {
    position: absolute;
    display: block;
    width: 22px;
    height: 62px;
    padding: 34px 0 0 0;
    cursor: pointer;
}
.buttons_achievements_kills span.prev {
    color: #111;
    font: 20px Arial, Helvetica, sans-serif;
    font-weight: bold;
    right: 602px;
    background: rgba(204, 204, 204, 0.5);
    border: 2px solid #444;
    -moz-border-radius: 8px 0 0 8px;
    -webkit-border-radius: 8px 0 0 8px;
    border-radius: 8px 0 0 8px;
    -moz-box-shadow: inset 0 -0.15em 0.45em 0.15em #000;
    -webkit-box-shadow: inset 0 -0.15em 0.45em 0.15em #000;
    box-shadow: inset 0 -0.15em 0.45em 0.15em #000;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.7);
}
.buttons_achievements_kills span.next {
    color: #111;
    font: 20px Arial, Helvetica, sans-serif;
    font-weight: bold;
    right: 0;
    background: rgba(204, 204, 204, 0.5);
    border: 2px solid #444;
    -moz-border-radius: 0 8px 8px 0;
    -webkit-border-radius: 0 8px 8px 0;
    border-radius: 0 8px 8px 0;
    -moz-box-shadow: inset 0 -0.15em 0.45em 0.15em #000;
    -webkit-box-shadow: inset 0 -0.15em 0.45em 0.15em #000;
    box-shadow: inset 0 -0.15em 0.45em 0.15em #000;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.7);
}
.holder_achievements_kills {
    width: 577px;
    height: 96px;
    padding: 0;
    margin: 0;
    position: relative;
    top: -31px;
    overflow: hidden;
}
.con_achievements_kills {
    width: 100000px;
    height: 96px;
    position: absolute;
}
.fragment_achievements_kills {
    width: 577px;
    height: 96px;
    float: left;
    display: inline;
}
/* ===== Start of 'Kills Medals Wrapper inside Fragment' ===== */
 #kills_medals_wrapper {
    width: 650px;
    height: 150px;
    float: left;
}
/* ===== Start of 'Achievement Details - (Scores)' ===== */
 #scores_wrapper {
    width: 650px;
    height: 150px;
    padding: 0;
    margin: 0 auto;
    background: #333;
    border: 2px solid #444;
    -moz-border-radius: 12px;
    -webkit-border-radius: 12px;
    border-radius: 12px;
    -moz-box-shadow: 0 28px 24px -24px #000, inset 0 -0.3em 0.9em 0.3em #000;
    -webkit-box-shadow: 0 28px 24px -24px #000, inset 0 -0.3em 0.9em 0.3em #000;
    box-shadow: 0 28px 24px -24px #000, inset 0 -0.3em 0.9em 0.3em #000;
    position: relative;
    top: 80px;
}
#scores_wrapper h2 {
    width: 626px;
    height: 20px;
    padding: 6px 0 6px 0;
    margin: 0 12px;
    border-bottom: 1px solid #444;
    float: left;
    color: #AB9B68;
    font: 20px Arial, Helvetica, sans-serif;
    font-weight: bold;
    font-variant: small-caps;
    text-shadow: 1px 1px 1px #000, -2px -2px 2px #000;
    filter: progid:DXImageTransform.Microsoft.Shadow(direction=315, strength=2, color=000000);
}
#slider_achievements_scores {
    width: 577px;
    height: 96px;
    padding: 0;
    margin: 0 auto;
    background: #222;
    border: 2px solid #444;
    -moz-box-shadow: inset 0 0.3em 0.9em 0.3em #000;
    -webkit-box-shadow: inset 0 0.3em 0.9em 0.3em #000;
    box-shadow: inset 0 0.3em 0.9em 0.3em #000;
    position: relative;
    top: 40px;
}
.buttons_achievements_scores {
    position: absolute;
    top: -2px;
    right: -25px;
    z-index: 101;
}
.buttons_achievements_scores span {
    position: absolute;
    display: block;
    width: 22px;
    height: 62px;
    padding: 34px 0 0 0;
    cursor: pointer;
}
.buttons_achievements_scores span.prev {
    color: #111;
    font: 20px Arial, Helvetica, sans-serif;
    font-weight: bold;
    right: 602px;
    background: rgba(204, 204, 204, 0.5);
    border: 2px solid #444;
    -moz-border-radius: 8px 0 0 8px;
    -webkit-border-radius: 8px 0 0 8px;
    border-radius: 8px 0 0 8px;
    -moz-box-shadow: inset 0 -0.15em 0.45em 0.15em #000;
    -webkit-box-shadow: inset 0 -0.15em 0.45em 0.15em #000;
    box-shadow: inset 0 -0.15em 0.45em 0.15em #000;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.7);
}
.buttons_achievements_scores span.next {
    color: #111;
    font: 20px Arial, Helvetica, sans-serif;
    font-weight: bold;
    right: 0;
    background: rgba(204, 204, 204, 0.5);
    border: 2px solid #444;
    -moz-border-radius: 0 8px 8px 0;
    -webkit-border-radius: 0 8px 8px 0;
    border-radius: 0 8px 8px 0;
    -moz-box-shadow: inset 0 -0.15em 0.45em 0.15em #000;
    -webkit-box-shadow: inset 0 -0.15em 0.45em 0.15em #000;
    box-shadow: inset 0 -0.15em 0.45em 0.15em #000;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.7);
}
.holder_achievements_scores {
    width: 577px;
    height: 96px;
    padding: 0;
    margin: 0;
    position: relative;
    top: -31px;
    overflow: hidden;
}
.con_achievements_scores {
    width: 100000px;
    height: 96px;
    position: absolute;
}
.fragment_achievements_scores {
    width: 577px;
    height: 96px;
    float: left;
    display: inline;
}
/* ===== Start of 'Kills Medals Wrapper inside Fragment' ===== */
 #scores_medals_wrapper {
    width: 650px;
    height: 150px;
    float: left;
}

HTML:

General

 »  «

Hi

World

Kills

 »  «

Hello

World

Scores

 »  «

New

Slider

A: I believe I may have the solution to this.  I ended up adding the above code to my site on a different script to see where the issue may be and think that this may be where you are having that issue of where it doesn't work in either FF or IE - as it happened to me as well in the past and sure enough once I implemented your above code it did the same thing.
Check how your html page is referencing your javascript page(s) if you have multiple js pages located in different folders/directories.
For example, Do THIS:

Rather than THIS:

If you have multiple folders/directories using JS on your site, you need to make sure whatever page you are working on can check the JS script for the page you are working on first opposed to any other JS scripts you may be using in other folders/directories.  So if you use the first example above that I have provided you, it should work with no problem at all in all browsers.  This happened to me several months ago and it literally took me forever to figure out what was going on.
You want to make sure any jquery you are using is written up and be referenced first on all html pages, then any js scripts you may have should follow that, but make sure they are in the correct order on whatever html page you are working on.
Example of a setup:
Main directory:
--> css folder
-------> Your_css_Script.css
--> images folder
--> js folder (inside 'js folder' you have:)
-------> Your_js_Script.js
-------> JQuery folder
------------> jquery-1.9.1.min.js
--> index.html
--> Another folder - (inside 'Another folder' you have:)
-------> css folder
------------> Your_css2_Script.css
-------> images folder
-------> js folder
------------> Your_js2_Script.js
-------> index2.html
I apologize for the bad diagram above, but hopefully that helps you understand the structure.  So, if you are working on index2.html, and also Your_js2_Script.js, but also need to reference what you have on Your_js_Script.js as well as your jquery script on your index2.html, you would need to reference those scripts on your index2.html page like so:

By the way, that's a pretty slick looking setup you got going on!  And I hope what I provided helps.


text:
Q: How to write "for x in list" in Java? I was wondering how to express a certain type of for loop in Java.
In Python I would use:
for x in lst1:
       return 10

How would I do this in Java?
I know for the range for-loops, I use
for(int i=0; i<100; j++) {
   return "asdf"
}

I just want to know how to do the other type of loop

A: int[] myints = {1, 2, 3, 4, 5};
for(int i : myints) {
    System.out.println(i);
}

A: int[] lst1 = {1,2,4,5,6,7,8,9};
for (int x : lst1){
    return 10;
}

That's--as far as I'm aware--the exact conversion of your python code. I recently did a video tutorial on iterating through a list that you and other's will most likely benefit from watching.
Good luck!


text:
Q: Javascript updatepanel problem I am having a problem with a javascript code. I want to update 2 update panels with javascript.  here is the code.  The updPnlLoadPmt has 3 triggers but the 2nd updatePanel does not have any triggers.  Could that be a problem?  Thank you!
    function pageLoadedHandler(sender, args) {
        var updatedPanels = args.get_panelsUpdated();
        var loadpmtPnlID = '<%=updPnlLoadPmt.ClientID %>';
        var AdvancepmtPnlID = '<%=UpdPnlAdvances.ClientID %>';
        if (updatedPanels.length > 0) {
            if (loadpmtPnlID == updatedPanels[0].id) {
                document.getElementById('<%=txtTotalDueAmount.ClientID %>').value = document.getElementById('<%=loadDueAmount.ClientID %>').value;
            } else if (AdvancepmtPnlID == updatedPanels[0].id) {
                document.getElementById('<%=txtTotalDueAmount.ClientID %>').value = document.getElementById('<%=hdnadvanceDue.ClientID %>').value;
            }
        }
    }


text:
Q: Taylor Functions for Complex and Real Valued Functions Some days ago, I asked in which situations we may apply Taylor Series for Real Valued Functions. In the question (Proof Verification and Taylor Series), I wrote a statement about the applicability of the series, however, by counterexample, it was shown to be incorrect. After that, I searched on the internet and also in the recommended books, specially Elon's, about the series.
But ... I'm not sure, it was not clear to me. So, just to be sure, again, let me show in which situations they seem, to me, may be applied.
QUESTION 1: Are the two following propositions correct?
P1 Let $f: D \to \mathbb{R}$ be an analytic (1) real-valued function in its domain $D$ and $x,x_0 \in D$. Then, we may apply the Taylor's Theorem and the series do converge:
$$ f(x) = \displaystyle\sum_{n=0}^\infty \left\lbrace \frac{f^{(n)}(x_0)(x-x_0)^n}{n!} \right\rbrace$$
Now, about complex-valued functions (2):
P2 Let $f: D \to \mathbb{C}$ be an analytic complex-valued function in its domain $D$ and $|z-z_0|<R \in D$. Then, we may apply the Taylor's Thereom for Complex Functions and the Series do converge:
$$\cdots$$
Observations:
(1) In some sources, they say "infinitely differentiable" instead of "analytic". Would like to know why since, as answered previously in the another question, it needs to be "analytic". That makes me even more confused....
(2) As far as I know, a real-valued analytic function is an infinitely differentiable one that possess a convergent Taylor Series around its center. But, what about the Complex? Just need to verify Riemann-Cauchy's Theorem?
Thanks in advance
Where I searched:

*

*Elon Lages' Curso de Análise I, Elon;

*https://en.wikipedia.org/wiki/Analytic_function;

*https://en.wikipedia.org/wiki/Taylor%27s_theorem;

*Some other texts out there...
EDIT
QUESTION 2:
Okay, from the answers bellow, now I'm sure how to determine if $f$ is complex analytic or not. However, if they are, will the power series converge absolutetly?

A: Your first proposition is not a proposition. At least, not in Elon's book (and in none of the mains sources I know, including Wikipedia) - it's a definition. By definition, an alayitic (real) function is one whose Taylor series converges.
I will quote Elon's definition (my translation - you can check on the section X.4 of the book).

A function $f: I \longrightarrow \Bbb{R}$, defined in an open interval $I$ is called analytic when it's $C^{\infty}$ and, for every $x_0 \in I$ there is $r>0$ such that $x \in (x_0-r, x_0+r)$ implies $x_0 \in I$ and that
$$f(x)=f(x_0)+f'(x_0)(x-x_0)+\dots+\dfrac{f^{(n)}(x_0)}{n!}(x-x_0)^n+\dots$$

You see, this is not a theorem. I am not proving anything. I am giving a name to the functions who have a convergent Taylor series, and whose Taylor series converges to the function.
Let's take a look on Taylor's Theorem now. This theorem concerns a broader class of functions. I'll use Wikipedia's version of the Theorem, but you can check Theorems 9 and 10 of Elon's book, for example.
Quoting Wiki:

Let $k ≥ 1$ be an integer and let the function $f : \mathbb{R} → \mathbb{R}$ be $k$ times differentiable at the point $a \in \mathbb{R}$. Then there exists a function $h_k : \mathbb{R} \rightarrow \mathbb{R}$ such that

$$f(x)=f(a)+f'(a)(x-a)+\frac {f''(a)}{2!}(x-a)^{2}+\cdots +\frac {f^{(k)}(a)}{k!}(x-a)^{k}+h_{k}(x)(x-a)^{k},$$
with $\lim_{x \rightarrow a}h_k(x)=0$.
We demand much less of the function on Taylor's theorem - it needs to be only $k$ times differentiable. However, the theorem gives us much less to: we only have an polynomial aprroximation of degree $k$.
The point you seem to be misunderstanding is: we can't cheat and say "well, since for a $k$ times differentiable function we have an approximation by a polynomial of degree $k$, with $k=\infty$ we must have an approximation by an 'infinite-order polynomial'". This is not true. I gave you a counterexample on your previous question, The function
$$f(x)=\begin{cases}e^{-1/x^2}, & \text{if } \ x \neq 0; \\ 0,& \text{if } \  x=0\end{cases}.$$
This function is not analytic at $0$.
Note that we can apply Taylor's Theorem to $f$ for any value of $f$. In fact, since $f^{(k)}(0)=0$ for every $k$, it suffices to take $h_k(x)=f(x)x^{-k}$ for every $k$.
but Taylor's Theorem applies only for finite values of $k$. That's why we need an special name for function who are not only $C^{\infty}$, but whose Taylor series also converges.
Now, the complex case. You can take a look on Conway's book on Complex Analysis, its a standard source. However, I will use the book I have at home at the moment: Complex Analysis, by Ian Stewart and David Tall.
We define analytic functions in the same way we do for real functions, mutatis mutandis (i.e. we replace the open interval by an open disk, etc). But we are happier in the complex case. If we prove that a function $f$ is once time differentiable in every point of an open disk, then it's analytic on this disk. That is really nice :) There is no simple way to characterize real analytic funtions like this one.
in other words,

Let $D$ be an open disk containing $z_0$. If $f:D \rightarrow \Bbb{C}$ is differentiable in $D$, then, for every $z \in D$,
$$f(z)=\sum_{n=0}^{\infty} \dfrac{f^{(n)}}{n!}(z-z_0)^n.$$

That's why some authors say that a complex function is analytic if it is differentiable in an open set - that's all you need to guarantee the existence and convergence of its Taylor series.
Why is this, though? The point is, complex-differentiability is way stronger than real-differentiability.

A: P1 is incorrect (here $D$ a real interval finite or infinite and even if $|x-x_0| < $distance $(x_0, \partial D)$) but P2 is correct if we assume $|z-z_0| < $ distance $(z_0, \partial D)$ (here $D$ is a complex open connected set) and that shows one of the big differences between real-analytic and complex-analytic.
First to clear up a little confusion - a real analytic function $f$ (on some interval $I$) is one that satisfies two conditions:
1: f is infinitely differentiable ($f \in C^{\infty}(I)$)
2: for any $x_0 \in I$ there is a small (relatively open) interval $x_0 \in I_{x_0} \subset I$ for which the Taylor series of $f$ centered at $x_0$ converges to $f(x)$ for all $x \in I_{x_0}$ (we may allow $I$ to be closed at one or both ends, $x_0$ to be an end etc)
Here things may break two ways - the Taylor series may not converge for some $x_0$ at any point near it (its radius of convergence is $0$ or if you wish $|f^{(n)}(x_0)/n!|$ has a large subsequence for which $|f^{(n_k)}(x_0)/n_k!|^{1/n_k} \to \infty$, or the Taylor series may converge near $x_0$ (and even on the whole $I$ or even the whole real axis) but not to $f$ and actually we may have convergence to $f$ on one side of $x_0$ but not on the other (for this last type of breakdown $x_0$ is assumed to be interior to $I$) - $C^{\infty}$ functions with compact support in some interval $[a,b]$ present this breakdown at the ends of the interval where they have zero Taylor series so it definitely converges to the respective end outside $[a,b]$ but not inside assuming they are not identically zero near $a$ or $b$;
Even if the function is real analytic on $I$ the Taylor series at any point may not converge for all $x$ for which $|x-x_0| < $ distance $(x_0, \partial D)$
(a simple example is $1/(1+x^2)$ which is real analytic on the whole real line but the Taylor series at zero has radius of convergence $1$)
Many weird things can happen - for example, one can have $C^{\infty}$ functions that are not analytic at any point on an interval $[a,b]$ (and perforce their Taylor series must diverge on an everywhere dense $G \subset [a,b]$, while conversely there are $C^{\infty}$ functions with convergent Taylor series at every point of $[a,b]$ (in other words the radius of convergence $\rho(x) >0$ for all $x \in [a,b]$)  but which fail to be analytic at an arbitrary nowhere dense closed set (which can be quite big if we think of Cantor like sets); a non-trivial theorem of Pringsheim-Boas shows that if $\rho(x)>\delta >0$ for all $x$ in $I$, $f$ is analytic and various results (Bernstein, Boas, Schaeffer) give sufficient conditions for $f$ to be analytic in terms of the zeroes of all its derivatives (the most general such result is that if all derivatives of $f$ have no more than a fixed amount $p$ of zeroes (each being allowed $p$ or less zeroes of course on $I$), then $f$ analytic
2, A complex function on some domain (open connected) $D \subset \mathbb C$ is analytic if and only if it is complex differentiable on $D$ (so complex differentiability once on an open set implies infinite differentiability and analyticity too; then the Taylor series of $f$ at $z_0$ converges for all $z$ for which  $|z-z_0| < $ distance $(z_0, \partial D)$
None of the above weird things from the real analytic world happens in the complex analytic world


text:
Q: Finding minimum and maximum of a function inside a triangle I have an assignment I will hand in for grading.
First part
I want to see if I have understood the consept correctly.
Determine max and min of $f(x,y)=xy $ on the triangle T with the corners $(0, 0), (0, 1)\:and\:(1, 0)$
I derived and got a critical point at $(0,0)$ which I evaluated to $0$.
Secondly I inspected the boundary lines of which only the hypotenuse was interesting x+y=1 where I only found one critical point and that was larger than 0.
Is it correct minimum value was 0?
Second part
Are there any analytical online tools where I can write functions and boundaries and get the max and min values?

A: I was surprised to find this question abandoned, so I thought I'd finish it.
It is clear that Farmor has already noted that setting $ \ \frac{\partial f}{\partial x} = y \ $ and $ \ \frac{\partial f}{\partial y} = x \ $ equal to zero locates the critical point at $ \ (0,0) \ , $ at which $ \ f(0,0) = 0 \ . $  The function is also zero at the boundaries of the triangle and at all three vertices (thus responding to Daryl's remark, although OP may well have already done that if that is what was meant by having inspected the boundaries).  So the minimum value of the function in the region is zero, but that is not localized to a "critical point".
As for the boundary on $ \ x + y = 1 \ $  ,  the single-variable approach is to write $ \ f(x,y) = xy \ $ as $ \ f(x) = x \cdot (1-x) = x - x^2 \ , $ which has its maximum at $ \ f(\frac{1}{2}) = \frac{1}{4} \ $ (so identified since $ \ f'(\frac{1}{2}) = -2 \cdot \frac{1}{2} < 0 \ $ ) ; this can be found even without calculus by noting the properties of the "downward-facing" parabola $ \ y  = x - x^2 \ . $
Alternatively, we can use Lagrange multipliers with the function $ \ f(x,y) = xy \ $ under the constraint $ \ g(x,y) =  x + y - 1 \ , $ producing the equations
$$\begin{array}{cc}f_x \ = \ \lambda \ \cdot \ g_x\\f_y \ = \ \lambda \ \cdot \ g_y\end{array} \ \Rightarrow \ \begin{array}{cc}x \ = \ \lambda \ \cdot \ 1\\y \ = \ \lambda \ \cdot \ 1\end{array} $$
$$ \Rightarrow \ \lambda \ = \ x \ = \ y \ = \ \frac{1}{2} \ . $$
So we find what proves to be a local and absolute maximum, $ \ f(\frac{1}{2} , \frac{1}{2}) = \frac{1}{4} . $  The standard discriminant $ \ f_{xx} \cdot f_{yy} - ( f_{xy} )^2 = 0 \cdot 0 - 1^2 \ $ is of no help, however, in characterizing critical points for this function.


text:
Q: How to enable two view controllers in the same window I'm trying to develop a slide menu in my application which should open the menu view from the left (or the right) depending on the swipe direction.
What I did till now:
1- Create a main View Controller A
2- Create left (or right) View Controller B
3- When Slide button tapped, add B ViewController as a sub View for the A View Controller.
4- here's my code:
CGRect currentLeftFrame  = self.leftVC.view.frame;
    currentLeftFrame.origin  = CGPointMake(-1.0f * self.view.frame.size.width, 0.0f);
    self.leftVC.view.frame   = currentLeftFrame;
    [self addChildViewController:self.leftVC];
    [self.view addSubview:self.leftVC.view];
    [self.leftVC didMoveToParentViewController:self];

The problem is that buttons in the B View controller are not clickable.
Do one know how to solve this problem?
Thanks in advance.

A: Use UIView for slide panel and add the slide view as subview on viewController's view or on app window.


text:
Q: read a specific area in excel using R I am using R and I need to read data form specific area in my excel file. For example read data in this area : C8:I21
How can we do that using R ? there is a specific package for it ?
some help would be appreciated

A: There are a number of packages that will read Excel files.
I favour openxlsx as it doesn't have any Java dependencies.
You can set the rows and columns you want to read with rows and cols.
For example, if I wanted to read ten rows, from row 18 and 5 columns from column 7:
library(openxlsx)

my_dat <- read.xlsx(xlsxFile = "./latest_data/NHS_England_downloads/Beds-Open-Overnight-Web_File-Final-Q1-2015-16-52341.xlsx",
                    sheet = 1, rows = c(18:27), cols = c(7:11),
                    colNames = FALSE)
head(my_dat)
        X1       X2 X3      X4 X5
1 748.5055 692.5055  0 56.0000  0
2 759.5824 727.5824  0 32.0000  0
3 692.8022 655.8022  0 37.0000  0
4 153.1758 153.1758  0  0.0000  0
5 205.7582 198.7582  0  0.0000  7
6 553.0110 525.7143  0 27.2967  0


text:
Q: I can build Armv7 + Arm64 architecture but not Armv7 alone Building a unified API app (after migration) with Armv7 + Arm64 architecture works fine, and the app runs well on iPhone 5 and iPhone 6. but it fails to run on iPhone 4S due to incompatible architecture.
Trying to build it with only Armv7 architecture fails.
These are the errors I get:
Error MT5210: Native linking failed, undefined symbol: _res_9_init. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. (MT5210)
Error MT5210: Native linking failed, undefined symbol: _xmlDocGetRootElement. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. (MT5210)
And 6 more like these...
how can I compile this on Armv7 only?

A: The solution:
Armv7 build failed due to missing link flags in the Oyala binding linkWith file.
After fixing the flags (LinkerFlags="-lstdc++ -lz -lxml2 -lresolv") the Armv7 build was completed with no errors.
It still doesn't explain why Armv7+Arm64 (the fat build) did not fail.
It just skipped the Oyala build.
This is probably a Xamarin bug.

A: This looks like a bug in Xamarin.iOS, it's not including certain libraries in the fat (armv7+arm64) build, while those (problematic) libraries cause problems in the armv7-only build.
That said, I believe the build problems will be solved by adding -gcc_flags -lxml to the additional mtouch arguments in the project's iOS Build options.
In addition I recommend filing a bug (http://bugzilla.xamarin.com) for the difference in the fat vs thin builds.


text:
Q: The "right way" to use sysdig? remote? I was wondering if it is possible to let sysdig run as a background process and rotate the logfile just for an example every time it gets over 100mb or every 7 day?
and is there anyway i could setup a remote server for the sysdig files?
just so i won't have to destroy my ssd instant where my webservers are running?. ( I all ready have a Graylog server running if that could do the job)

A: Sysdig developer here.

*

*Yes. Take a look at this blog post https://sysdig.com/sysdig-continuous-capture-with-file-rotation/.

*This is not a feature of sysdig yet, so you would have to build your own solution. A way to do it could be extending sysdig through a Lua script (we call them chisels, and you can find more infor at this URL: https://github.com/draios/sysdig/wiki/Chisels%20User%20Guide)

A: For the second question you can use Filebeats (from ELK stack) or similar


text:
Q: Drop Down List that is created by code behind refresh the page I am trying to create a list of DDL using code behind as you can see here :
public List<DropDownList> ddll = new List<DropDownList>();
for (int i = 0; i < 15; i++)
{
    DropDownList ansList = new DropDownList();
    ansList.AutoPostBack = false;
    ansList.DataSource = values1;
    ansList.DataBind();
    ddll.Add(ansList);
 }

As you can see i set the autopostback attribute on false .But it doesn't work any my pages are refreshed when the user changes the selectedindex.
I added DDL using this :
Span1.Controls.Add(ddll[0]);
Span2.Controls.Add(ddll[1]);
Span3.Controls.Add(ddll[2]);
Span4.Controls.Add(ddll[3]);
Span5.Controls.Add(ddll[4]);
Span6.Controls.Add(ddll[5]);
Span7.Controls.Add(ddll[6]);
Span8.Controls.Add(ddll[7]);
Span9.Controls.Add(ddll[8]);
Span10.Controls.Add(ddll[9]);
Span11.Controls.Add(ddll[10]);
Span12.Controls.Add(ddll[11]);
Span13.Controls.Add(ddll[12]);
Span14.Controls.Add(ddll[13]);
Span15.Controls.Add(ddll[14]);

In html code i have this :

A: Look at your code
       for (int i = 0; i < 15; i++)
        {
            DropDownList ansList = new DropDownList();
            ansList.AutoPostBack = false; // Here You have set it false
            ansList.DataSource = values1;
            ansList.DataBind();
            ansList.AutoPostBack = true; // Here You have set it true again
            ddll.Add(ansList);
        }

A: You first set AutoPostBack to false and later to true right after two statements. The false is overwritten by true and it should do postback now when the selected index is changed.
ansList.AutoPostBack = false;
   //...

ansList.AutoPostBack = true;

Edit You can also use loop to add the list in the spans using FindControl(string id) to get the spans by id.
for(int i=0; i < 15; i++)
   this.FindControl("Span"+i).Add(ddll[i]);


text:
Q: What is the effect of constant wind on a hot air balloon? If a hot air balloon is being carried by a continuous wind current in a particular direction, in which direction will the flags on its basket wave?

A: The balloon will asymptotically approach the wind velocity.  As it gets close, the force due to drag will decrease because the apparent wind will be small.  To the extent it matches the wind velocity, flags will hang straight down.  To the extent it is (barely) below wind velocity, the flags will point (just a little) in the direction of the wind.  If the wind slows down a bit, the flags will point backwards until the balloon slows down to the new velocity.


text:
Q: Puppet masterport You can have Puppet listen on a custom port as port 80 instead of 8140 as I have seen it.
It can be set in etc/puppet/puppet.conf as

masterport=80

There is a command, don't know if I use it right puppet agent --server puppetmaster --masterport 80 to tell the agent to listen on port 80. Yet after changing the conf file on the master and restarting puppet it still listens on port 8140 on the master.
Reference:

*

*Puppet Configuration

A: The change needs to be done in these two configuration files:
/etc/puppet/puppet.conf
[main]
...
user=root
masterport=80

/etc/default/puppet
...
PORT=80


text:
Q: Display volley response as text in toast I'm using Volley library in my android app. I'm trying to create a registration function. Everything seems to work fine, I can register, however I cannot display any response from the PHP file as a toast on android. The toast does not even appear. Maybe I should show you my code first:
Response.Listener<String> listener = new Response.Listener<String>() {
       @Override
       public void onResponse(String response) {
         try {
              JSONObject jsonResponse = new JSONObject(response);
              String result = jsonResponse.getString(response);

              if(result == "Registered!") {
                    Toast.makeText(RegActivity.this, result, Toast.LENGTH_LONG).show();
                    } else {
                    Toast.makeText(getApplicationContext(),"Could not register!", Toast.LENGTH_LONG).show();
                    }

                  } catch (JSONException e) {
                       e.printStackTrace();
                }
            }
         };
     RegRequest regRequest = new RegRequest(username, password, email, listener);
     RequestQueue queue = Volley.newRequestQueue(RegActivity.this);
     queue.add(regRequest);

Here's my regRequest class:
public class RegRequest extends StringRequest {

private static String regURL = "http://chicpiq.com/android/android_register.php";
private Map<String, String> params;

public RegRequest(String username, String password, String email, Response.Listener<String> listener) {
    super (Method.POST, regURL, listener, null);
    params = new HashMap<>();
    params.put("username", username);
    params.put("password", password);
    params.put("email", email);
}

@Override
public Map<String, String> getParams() {
    return params;
    }
}

Here's my PHP:
require "../database/database.php";

$username = mysqli_real_escape_string($database, $_POST['username']);
$password = mysqli_real_escape_string($database, $_POST['password']);
$email = mysqli_real_escape_string($database, $_POST['email']);
$joindate = date("y.m.d");

$encryptpass = password_hash($password, PASSWORD_DEFAULT);
$register = mysqli_query($database, "INSERT INTO users (username, password, email, joindate) VALUES ('$username', '$encryptpass', '$email', '$joindate')");
mysqli_execute($register);
$response = "Registered!";

echo json_encode($response);

As I mentioned, I have no problem with registering, I can do that. My problem is that I want to change PHP code to check whether a user exists etc. and I want to display other messages. I can't seem to get to display response from PHP as a Toast. Has anyone got any ideas?
Cheers

A:     JSONObject js = new JSONObject();
    try {

        js.put("username", username);
        js.put("password", password);

    } catch (JSONException e) {
        e.printStackTrace();
    }

    JsonObjectRequest request = new JsonObjectRequest(Request.Method.POST, constants.LOG_IN_URL, js,
            new Response.Listener<JSONObject>() {
                @Override
                public void onResponse(JSONObject response) {

                    try {
                        System.out.println("status" + response.get("status").toString().contains("success"));
                        if (response.get("status").toString().contains("success")) {

                           profileId.setText(response.getJSONArray("data").getJSONObject(0).getString("fname"));
                           userProfession.setText(response.getJSONArray("data").getJSONObject(0).getString("profession"));
                           userLocation.setText(response.getJSONArray("data").getJSONObject(0).getString("placeOfBirth"));
                            String url = "http://50.78.27.70:8080";
                            url =url.concat(response.getJSONArray("data").getJSONObject(0).getString("displayPicture"));
                            System.out.println("string" + response.getJSONArray("data").getJSONObject(0).getString("displayPicture"));
                            if(response.getJSONArray("data").getJSONObject(0).getString("displayPicture").equals("null"))
                            {
                                     profilePic.setScaleType(ImageView.ScaleType.CENTER_INSIDE);

                            }
                            else{
                                Glide.with(getBaseContext()).load(url).into(profilePic);
                                System.out.println("hello by default  2");
                            }

                        } else {
                        }
                    } catch (JSONException e) {

                        e.printStackTrace();
                    }

                }
            },
            new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    Toast.makeText(TimeLine.this, "Wrong Id or Password", Toast.LENGTH_SHORT).show();
                    error.printStackTrace();
                }
            });

   Singleton.mInstance(TimeLine.this).addrequestqueue(request);


text:
Q: phpMyAdmin Auth Method and Force SSL Not Working as expected I've gone through several Q&As on here regarding this an scoured Google, but am at a loss.
I've installed phpMyAdmin and I want to force SSL for login. I also want to use cookie based authentication and the HTML login screen. From what I can tell, everything is set up correctly. For instance, I'm using the $cfg['Servers'][$i]['auth_type'] = 'cookie'; directive and I have a blowfish secret configured under 42 characters. However, when I visit my page, I get the popup for username and password as in basic authentication.
Additionally, I have the $cfg['ForceSSL'] = true; directive specified. However, when I visit the page, I'm not redirected to the https:// version of the page.
Any ideas? I have AllowOverride All set in my Apache httpd.config. I also have the rewrite and SSL modules enabled.
Below is my clean conf.inc.php file if that helps.
<?php
/*
 * Generated configuration file
 * Generated by: phpMyAdmin 3.5.7 setup script
 * Date: Sat, 30 Mar 2013 04:36:10 +0000
 */

/* Servers configuration */
$i = 0;

/* Server: My Database [1] */
$i++;
$cfg['Servers'][$i]['verbose'] = 'My Database';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['ssl'] = true;
$cfg['Servers'][$i]['connect_type'] = 'socket';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['compress'] = true;
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = '';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['CountTables'] = true;
$cfg['Servers'][$i]['tracking_version_auto_create'] = true;

/* End of servers configuration */

$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
$cfg['blowfish_secret'] = 'mysuperawesomesecret';
$cfg['ForceSSL'] = true;
$cfg['UserprefsDeveloperTab'] = true;
$cfg['ShowPhpInfo'] = true;
$cfg['LeftDisplayServers'] = true;
$cfg['DisplayServersList'] = true;
$cfg['SQLValidator']['use'] = true;
$cfg['SQLQuery']['Validate'] = true;
$cfg['QueryHistoryDB'] = true;
$cfg['RetainQueryBox'] = true;
$cfg['DefaultLang'] = 'en';
$cfg['ServerDefault'] = 1;
?>

A: OK. I figured it out. As I suspected, it was something stupid.
I used the following package from EPEL: phpMyAdmin.noarch                    3.5.7-1.el6                        @epel.
As it turns out, this package places a file in a location I was unaware of, namely /etc/phpMyAdmin/config.inc.php. That file was overriding every directive I was specifying in my phpMyAdmin root folder.
I am using centOS 6.2. Hopefully this answer can help someone in the future :-)


text:
Q: Remove label in Primefaces Line Chart I have a primefaces line chart that appears between the graph series its values.
I followed the primefaces documentation, but instead of showing the "LinearChart", it shows "CategoryChart"
I need to disable these labels, how do I do this?
Below image of my chart.
line graphic - I want to remove the labels that are embedded in the graph lines

A: I solved the problem!
There was the following code in my method ...
lcm.setShowPointLabels(true); // lcm is LineCharModel

It made appear the labels in line chart.


text:
Q: How can I check with SQL if a column contains a comma seperated list / string? How can I check with SQL if a column contains a comma seperated list / string?
My query looks like this:
$modulare = $this->Database->prepare("
    SELECT id, titel, sorting, kuerzel
    FROM cc_produkte
    WHERE veroeffentlichen = 1
    AND kuerzel = ? // Here commas have to be filtered
    ORDER BY sorting, id ASC
")
->execute($pid);

The "kuerzel" column contains the shortcuts of individual products as a comma-separated string. But there are also products that have only a shortcut. Only one of the entries should be read. Unfortunately I can not do anything with the linked post.
Is there a possibility in SQL for this? For example, how does the explode function of PHP?


text:
Q: How to populate the form fields through routing in angularjs I am new to angularjs,can someone please help to resolve my issue.I have an index.html page,where it has a logo and some message,along with that i have a text box where i ask employeeID as a input.On entering the employeeID i would want the page to be routed to portal.html ,where i will have to display the the employee details in a form.But the form displays blank input fields.I am using restservice which would return a JSON object as below
[
{
Emp_Id: 123,
Emp_Name: "abc",
Email: "abc@jkl.com",
Primary_Skill: "angularjs",
}
]
index.html
<!DOCTYPE html>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width initial-scale=1">

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="CSS/basicPage.css">

portal.html
<!DOCTYPE html>

Employee Details

<form>
Employee Id : <input type="text" ng-model="empPortal.Emp_Id" required>

Employee Name : <input type="text" ng-model="empPortal.Emp_Name" required>

Email Id : <input type="text" ng-model="empPortal.Email" required>

Primary Skill : <input type="text" ng-model="empPortal.Primary_Skill" required>

</form>

main.html
<form>

Welcome to the portal!

COMPETENCY MANAGEMENT is the system's ability to connect various competencies/skill sets.

Please enter your Employee ID

        Employee ID:
        <input ng-model="empID" size= "15" required>
        <button type="submit" class="btn btn-default btn-sm" ng-click="submit()">Submit</button>

</form>

app.js
var routeApp = angular.module("routeApp", ["ngRoute"]);
routeApp.config(function($routeProvider) {
    $routeProvider
    .when("/", {
        templateUrl : "partials/main.html",
        controller : "empDetailsCtrl"
    })
     .when("/submit", {
        templateUrl : "partials/portal.html",
    })
    .otherwise({
        redirectTo:'/'
    });
});

routeApp.controller("empDetailsCtrl",['$scope','$http','$log','$location',function ($scope,$http,$log,$location) {
    $scope.image = "http://hrm-storitve.si/uploads/files/slika_13x.jpg";
    $scope.submit = function(){
        if ($scope.empID != null){
            $http.get('http://localhost:5555/com.vog.jersey.first/rest/empService/getEmployeeDetails?employeeId='+$scope.empID')
                    .success(function(data)
                            {
                          $scope.empPortal = data;
                          $location.path('/submit');
                            })
                     .error(function(err){
                         $log.error(err);
                     })
        }
            else
                {
                $location.path('/');
                }
        };
}]);


text:
Q: Sequence points in C++ and exceptions Can compiler reorder variable setting and throw() op in C++? Or, does standard C++ 14882-1998 allows or prohibit compiler of this transform?
For code:
bool funct()
{
    bool succeeded = false;
    bool res_throw = false;

        try {
            throw("it");
            succeeded = true;
        }
        catch(...) {
            res_throw = true;
        }

        cout << "Result of throw: " << res_throw << endl;
        cout << "succeeded: " << succeeded << endl;

    return succeeded;
}

Can the output be a
Result of throw: true
succeeded: true

The Standard says: "[intro.execution]#7":

modifying an object .. are all side
  effects, which are changes in the
  state of the execution environment
At certain specified points in the execution sequence called sequence points, all side effects of previous evaluations shall be complete and no side effects of subsequent evaluations shall have taken place

Is throw statement a sequence point?

A: The semicolon is a sequence point.  The throw happens before succeeded is set to true
EDIT:  To clarify:  succeeded will not be set to true

A: Yes, there is a sequence point associated with the throw statement, because there is a sequence point at the end of every statement.
So succeeded must remain false in your example.
I don't have the C++98 Standard, but in the C++03 Standard:

1.9p16: There is a sequence point at the completion of each full-expression.

A statement is the simplest kind of "full-expression", but the Standard is worded to include other expressions that are not technically part of any statement.