Base 17 on a Suanpan (Chinese abacus)

Question: I recently discovered the Suanpan, which quickly became my favorite abacus design. Like the more common Soroban (Japanese abacus), the Suanpan has an upper rack and a lower one. The Soroban has 4 beads on the lower, and one bead on the upper. The Suanpan has 5 beads on the lower, and two beads on the upper. This is to allow for calculations involving base 16, like the classic Chinese weight system.
Suanpan Image (for reference)
I was intrigued by this versatility and I decided to see if bases other than 10 and 16 could be represented on a Suanpan. I discovered that bases 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, and 18 could be represented with relative ease. But 14 and 17 seemingly had no solution.
Eventually I found an okay solution for 14, but I'm at a loss for 17. So I task you to help solve this mystery.
Rules
These rules are stated in reference to one column.

The solution must be for a Suanpan, meaning it works for an abacus with 5 lower beads, and 2 upper beads.
The lower beads are of value one (2 lower beads=2), but the top beads can be of any value.
You may choose to not use any number of the beads. For example, Suanpans mimic Sorobans if you forget 1 lower bead and 1 upper bead. Suanpans can also perform binary math if you use 1 of the lower beads and nothing else.
The value of an upper bead must be within 1 of the amount of lower beads used (this includes the same value as beads used). For example, in Soroban mode, the upper bead is worth 5, 1 more than the amount of beads used in the lower rack. Additionally, in hexadecimal mode, the upper beads are worth 5, which is the same as the amount of beads used in the lower rack.
The layout/counting rules must not change when counting to the maximum value for the base (16). In another word: overflow must be consistent. The rule 3 lower beads not overflowing, but if 1 upper bead is counted it overflows would not be allowed.

These rules are intended to have the solutions mimic the traditional (and intuitive) use of the Suanpan.
I'm happy to provide any information on how my solutions work, to help you find the solution for base 17.
Comment: Not sure how to answer the question but here, I found you a tag you can use, [tag:number-systems].
Comment: The principal use of the "extra" beads on the suanpan is to facillitate base-10 calculations, because when a column totals more than 10, handling the carry into the next column can be deferred until it is convenient.  For example, when adding 999 + 111, one temporarily has the intermediate result `10 10 10`, and then one normalizes this to the final answer `1 1 1 0`.  The value of the extra beads for base-16 calculations is only secondary to this.
This being so, you shouldn't be concerned about allowing a column value of 17 in base-17 calculations; it makes things easier, not more difficult.
Answer: For base $14$, each lower bead is $1$ and each higher bead is $4$.  That allows you to represent each number from $0$ to $13$ in a column, which is all you need.  I don't see a solution for base $17$ without relaxing your rules a bit.  The closest I could come is $1$ for each lower bead and $6$ for each higher bead as you do for base $18$, then don't use the combination with all beads up.  This doesn't seem too bad to me.  You normally have one rule for carrying from the bottom to the top and a different one for carrying from one column to the next.  You still need those, but the number of lower beads that need to be up for a carry to the next column is not all of them.
Comment: I this would go against rules, but it is possible to expand the range of each column by using the center point of the rails as zero. Such would allow a soroban to reach base 23.  Of course that would go against rule 2 for the lower beads, and rule 4 in many cases for the upper beads.  But, could the first top bead be 5 and the second be 6? I'm not sure if that would violate rule 5. If not, then that would give base 17.

Base 17 on a Suanpan (Chinese abacus)


How to use grails  tag session scope?

Question: I am trying to use the g:set tag on my gsp. As long as I am in one page and the scope is default or page, it works fine. When I am trying to change the scope to session its not working.
My understanding is I should be able to access that variable not only on that page but also on others when the scope is session, however, I might be wrong.
In a brand new 2.0.3 application I have this script on my  index.gsp body and it works as expected.
<g:set var="bar" value="${new Date() - 7}" scope="page" />

${bar}

However if I change the scope to session it doesn't work,
    <g:set var="bar" value="${new Date() - 7}" scope="session" />

${bar}

neither on any other page.
Comment: Works for me under Grails 2.0.3
Answer: Have you tried:

${session.bar}

http://grails.org/doc/latest/guide/theWebLayer.html#variablesAndScopes
Comment: Great, I forgot to get it from the session.

How to use grails  tag session scope?


A followup question on surreal numbers and Collatz iteration game

Question: This question is not a duplicate of the previous, because here we use a different function and get different values for the games:
Let us define a game based on the modified Collatz function $T(n) = n/2$ if $n$ is even, otherwise $=(3n+1)/2$.
Each number $n$ represents a game played by left $L$ and right $R$:
$$g(n) = \{L_n | R_n \}$$
The rules of the game are:
If $n$ is even, the left player can play the game:
$$g(n) = \{g(n/2) |  \}$$
If $n \neq 1$ is odd, the right player can play the game:
$$g(n) = \{| g((3n+1)/2) \}$$
If $n=1$, the game is over as no player can make a move:
$$g(n)=g(1) = \{| \}$$
Assuming the Collatz conjecture is true, this game starting with an arbitrary number $n$, has always an end.
So these games define surreal numbers and we could add and multiply, negate those games, which I think would be fun.
Q: How do I find the numeric value of these surreal numbers and what interpretation can be given to these values?
Here are some examples, but I do not see any pattern, where $g(n)$ denotes the numerical value of $n$:
$n,g(n)$
1 0
2 1
3 -1
4 2
5 0
6 0
7 -2
8 3
9 -1
10 1
11 -1
12 1
13 0
14 0
15 -3
16 4
17 0
18 0
19 -1
20 2
21 0
22 0
23 -2
24 2
25 -1
26 1

Some more examples in SAGEMATH
Related question:  Conway's surreal numbers and the Collatz iteration as a game?
Comment: Does this answer your question? [Conway's surreal numbers and the Collatz iteration as a game?](https://math.stackexchange.com/questions/3892271/conways-surreal-numbers-and-the-collatz-iteration-as-a-game)
Comment: @JoséCarlosSantos After an answer was accepted to that other question, stackExchangeUser edited this question into it (~21 hours ago), and then posted it as this new question ~6 hours ago. Rather than mark this as a duplicate, I think the edit to the other question should be removed as this is a distinct and more subtle question.
Comment: @JoséCarlosSantos: This is not a duplicate question as explained by MarkS. I will remove the edit to the previous question.
Comment: @MarkS. Thanks for pointing out the difference in the questions. I will remove the edit to the previous question.
Answer: Setup
I have a characterization, but the answer is pretty complicated. These
definitions depend on the Collatz conjecture being true.
I will define a function related to the Collatz conjecture that associates
strings of "$\mathrm{E}$"s and "$\mathrm{O}$"s to the positive
integers. I will use multiplicative notation for concatenating strings,
so that $\mathrm{E}\left(\mathrm{OE}\right)=\mathrm{EOE}$ and $\mathrm{E}^{3}=\mathrm{EEE}$.
Define $C\left(1\right)$ to be the empty string. Then, for $n>1$,
define $C(n)=\begin{cases}
\mathrm{E}C\left(\frac{n}{2}\right) & \text{if }n\text{ is even}\\
\mathrm{O}C\left(\frac{3n+1}{2}\right) & \text{if }n\text{ is odd}
\end{cases}$. For example, $C\left(7\right)=\mathrm{OOOEOEEOEEE}$, with the tail
$\mathrm{OEEE}$ coming from $5\overset{\mathrm{O}}{\to}8\overset{\mathrm{E}}{\to}4\overset{\mathrm{E}}{\to}2\overset{\mathrm{E}}{\to}1)$.
We can abbreviate this as $C\left(7\right)=\mathrm{O}^{3}\mathrm{E}^{1}\mathrm{O}^{1}\mathrm{E}^{2}\mathrm{O}^{1}\mathrm{E}^{3}$.
Answer
We can express the values of $g$ in terms of $C$ in a relatively
simple way. Note that $g\left(1\right)=0$ by definition. For $n>1$,
we have the following piecewise formula, where $m\ge1$ is the length
of the initial run and $k\ge0$:
$$
g\left(n\right)=\begin{cases}
\begin{cases}
m-1 & \text{if }C\left(n\right)=\mathrm{E}^{m}\left(\mathrm{OE}\right)^{k}\mathrm{O}^{2}\cdots\\
m & \text{if }C\left(n\right)=\mathrm{E}^{m}\cdots\text{ otherwise}
\end{cases} & \text{if }n\text{ is even}\\
\begin{cases}
1-m & \text{if }C\left(n\right)=\mathrm{O}^{m}\left(\mathrm{EO}\right)^{k}\mathrm{E}^{2}\cdots\\
-m & \text{if }C\left(n\right)=\mathrm{O}^{m}\cdots\text{ otherwise}
\end{cases} & \text{if }n\text{ is odd}
\end{cases}
$$
In other words, using $\mathrm{A}$ and $\mathrm{B}$ as stand-ins
for $\mathrm{E}$ and $\mathrm{O}$ in some order, and $\left[\mathrm{A}=\mathrm{O}\right]=\begin{cases}
0 & \text{if }\mathrm{A}=\mathrm{E}\\
1 & \text{if }\mathrm{A}=\mathrm{O}
\end{cases}$, we have:
$$
g\left(n\right)=\left(-1\right)^{\left[\mathrm{A}=\mathrm{O}\right]}*\begin{cases}
m-1 & \text{if }C\left(n\right)=\mathrm{A}^{m}\left(\mathrm{BA}\right)^{k}\mathrm{B}^{2}\cdots\\
m & \text{otherwise}
\end{cases}
$$
Proof
Since $C\left(n\right)$ determines $n$, I will define $G:\text{strings}\to\mathbb{N}$
so that $g\left(n\right)=G\left(c\right)$ if $c=C\left(n\right)$.
In order to show that the above formula for $g$/$G$ is correct for
$n>1$, we can induct on the number of alternations between $\mathrm{O}$
and $\mathrm{E}$.
Base cases
Firstly, $G\left(\mathrm{E}^{m}\right)=m$ (including if $m=0$) by
a straightforward induction on $m$. And secondly, for $j\ge1$, $$G\left(\mathrm{O}^{j}\mathrm{E}^{m}\right)=\left\{ \mid G\left(\mathrm{O}^{j-1}\mathrm{E}^{m}\right)\right\} =\begin{cases}
G\left(\mathrm{O}^{j-1}\mathrm{E}^{m}\right)-1 & \text{if }G\left(\mathrm{O}^{j-1}\mathrm{E}^{m}\right)\le0\\
0 & \text{if }G\left(\mathrm{O}^{j-1}\mathrm{E}^{m}\right)>0
\end{cases}\text{.}$$ Note that we must have $m\ge3$ (as $1,2,4$ can't be reached from
an odd number $n>1$). Therefore, $G\left(\mathrm{E}^{m}\right)>0$
and $G\left(\mathrm{O}\mathrm{E}^{m}\right)=0$. By induction on $j$,
$G\left(\mathrm{O}^{j}\mathrm{E}^{m}\right)=1-j$. This agrees with
the formula since $m\ge3$, so this has the form $G\left(\mathrm{O}^{j}\left(\mathrm{EO}\right)^{0}\mathrm{E}^{2}\cdots\right)$.
Induction step
E
Assume, for induction purposes, that the formula for $G$ holds for
all strings with a given number of alternations that begin with $\mathrm{E}$,
so that $G\left(\mathrm{E}^{\ell}\cdots\right)=\begin{cases}
\ell-1 & \text{if }\mathrm{E}^{\ell}\left(\mathrm{OE}\right)^{k}\mathrm{O}^{2}\cdots\\
\ell & \text{otherwise}
\end{cases}$.
Then we have $$G\left(\mathrm{O}\mathrm{E}^{\ell}\cdots\right)=\begin{cases}
\begin{cases}
-1 & \text{if }\mathrm{O}\mathrm{E}^{\ell}\left(\mathrm{OE}\right)^{k}\mathrm{O}^{2}\cdots\\
0 & \text{otherwise}
\end{cases} & \text{if }\ell=1\\
0 & \text{if }\ell>1
\end{cases}=\begin{cases}
-1 & \text{if }\left(\mathrm{OE}\right)^{k+1}\mathrm{O}^{2}\cdots\\
0 & \text{otherwise}
\end{cases}\text{.}$$ And $G\left(\mathrm{E}\mathrm{O}\mathrm{E}^{\ell}\cdots\right)=\begin{cases}
0 & \text{if }\mathrm{E}\left(\mathrm{OE}\right)^{k+1}\mathrm{O}^{2}\cdots\\
1 & \text{otherwise}
\end{cases}$. Since those values are nonnegative, we can conclude that $G\left(\mathrm{E}^{m}\mathrm{O}\mathrm{E}^{\ell}\cdots\right)=\begin{cases}
m-1 & \text{if }\mathrm{E}^{m}\left(\mathrm{OE}\right)^{k+1}\mathrm{O}^{2}\cdots\\
m & \text{otherwise}
\end{cases}$.
For higher powers of $\mathrm{O}$, now consider $G\left(\mathrm{O}^{2}\mathrm{E}^{\ell}\cdots\right)=\begin{cases}
-2 & \text{if }\mathrm{O}\left(\mathrm{OE}\right)^{k+1}\mathrm{O}^{2}\cdots\\
-1 & \text{otherwise}
\end{cases}$. And so, for $j\ge2$, $G\left(\mathrm{O}^{j}\mathrm{E}^{\ell}\cdots\right)=\begin{cases}
-j & \text{if }\mathrm{O}^{j-1}\left(\mathrm{OE}\right)^{k+1}\mathrm{O}^{2}\cdots\\
1-j & \text{otherwise}
\end{cases}$. Since these are all negative, $G\left(\mathrm{E}\mathrm{O}^{j}\mathrm{E}^{\ell}\cdots\right)=0$,
and $G\left(\mathrm{E}^{m}\mathrm{O}^{j}\mathrm{E}^{\ell}\cdots\right)=m-1$.
Note that $\mathrm{E}^{m}\mathrm{O}^{j}\mathrm{E}^{\ell}\cdots$ has
the form $\mathrm{E}^{m}\left(\mathrm{OE}\right)^{0}\mathrm{O}^{2}\cdots$,
so this agrees with our formula.
O
The induction steps for adding two alternations that begin with $\mathrm{O}$
are completely analogous. Just flip signs and swap $\mathrm E$ and $\mathrm O$.
Commentary
The formula for $g$ depends on $C$, which basically requires us
to run through an unbounded amount of steps of the Collatz sequence
for a number, which is not ideal. It also doesn't have an obvious
tidy characterization that's not recursive, like "write the $\mathrm{EO}$
string with $1$s and $0$s in a certain way, and then do something
with the number to get the value of $G$".
Simple cases
The only thing I could think to do is collect together some simple
cases that have a fixed form; but nothing can be done for the general
case as that essentially requires you to prove Collatz.
For example, the numbers with $C\left(n\right)=\mathrm{E}^{m}$ are
the powers of $2$, with $g\left(2^{m}\right)=m$. These are A000079 in the OEIS.
The numbers of the form $\mathrm{O}\mathrm{E}^{n}$ are those of the
form $(4^{k}-1)/3$ for $k\ge1$ (A002450), and they
have $g\left(n\right)=0$.
The numbers of the form $\mathrm{O}^{2}\mathrm{E}^{m}$ are those
of the form $\left(64^{k}-10\right)/18$ for $k\ge1$ (A228871),
and they have $g\left(n\right)=-1$.
The numbers of the form $E^{m}\mathrm{O}\mathrm{E}^{\ell}$ are those
of the form $2^{m}(4^{k}-1)/3$ for $k\ge1$ (A181666),
and have $g\left(n\right)=m$.
The numbers of the form $E^{m}\mathrm{O^{2}}\mathrm{E}^{\ell}$ are
those of the form $2^{m}\left(64^{k}-10\right)/18$ for $k\ge1$ (no
OEIS entry), and have $g\left(n\right)=m-1$.
The numbers of the form $\mathrm{O}\mathrm{E}^{m}\mathrm{O}\mathrm{E}^{\ell}$
have one of the two forms $\dfrac{4^{3k+r}-4^{r+1}-6}{18}$ or $\dfrac{4^{3k+r}-4^{r+2}-48}{144}$,
etc.
Simpler Code
Your Sage code appears to be doing all of the work of the Conway notation. But since these games only have one move for one of the two players, you can calculate values of $g$ in a much more straightforward way. I imagine you could port the following code to Sage if desired:
Wolfram Language (Mathematica)
g[x_] := g[x] = If[x == 1, 0,
  If[Mod[x, 2] == 0, If[g[x/2] >= 0, g[x/2] + 1, 0],
   If[g[(3 x + 1)/2] <= 0, g[(3 x + 1)/2] - 1, 0]]];
Table[g[x],{x,1,10000}]//Print

Try it online!
Comment: Ok thanks I am reading "Lessons in Play, An introduction to Combinatorial Game Theory", which is pretty good and I hope to gain some insight from this. Thanks again for your help!
Comment: Thanks for your very detailed answer. (+1) I will need some time to understand what you have written and accept the answer.
Comment: @stackExchangeUser I want to emphasize that the bulk of my answer has nothing to do with Collatz, really. It's more answering something like "if you switch between two cases and jump to other numbers by some rule (e.g. Collatz), how does the 'Left game and right game' construction produce values?" I can't think of an application/reason for the left game and right game construction (if there's more context, add to your question) and my answer certainly cannot shed any light on Collatz, by design.
Comment: It would be interesting to investigate what happens, when we add two games known to iterate to $1$ by the modified Collatz function.
Comment: @stackExchangeUser all of these games are integers. So we would just get the sum of those integers.
Comment: Yes I mean what happens to play those added games?
Comment: @stackExchangeUser The winner is Left if the number is positive, the second player if the number is zero, and Right if the number is negative. For games of this sort, Left should move in a positive summand if they can, and Right should move in a negative summand if they can. This is true of any one-option-to-an-integer games, not just test Collatz ones.
Comment: Thanks for the clarification.
Comment: Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/115880/discussion-between-mark-s-and-stackexchangeuser).
Comment: Are two games equivalent if and only if their numerical values are equal?
Comment: @stackExchangeUser what do you mean by "equivalent"? If you mean two games $G$ and $H$ are such that $G+X$ and $H+X$ have the same outcome (same winner if left goes first and same winner if right goes right) for all games $X$: then for games that have numerical values like these, the answer is "yes". I would strongly recommend that rather than ask me/others questions like that one-by-one, you work through some of an intro text in combinatorial game theory. Then you'll be in a good position to answer millions of questions.


How to make classes in NACHOS (C++)

Question: I am trying to implement a player class, so I created two files in my threads folder,
player.cc and player.h
player.h goes like this :
#ifndef PLAYER_H
#define PLAYER_H
#include "utility.h"

class Player()
{
  public:
   //getPlayerID();
};

#endif

then player.cc goes like
#include "player.h"

class Player()
{
  string playerID;
  int timeCycle;
}

Then in my main.cc and threadtest.cc , I add in #include player.h and then I start to errors and it fails to compile. I am new to nachos and a little bit unfamiliar with c++, so I am confused as to how to resolve this problem. Nachos does not provide a solution through the compiler either.
When I type gmake, it says two things for errors.
1. parse error before '(' in player.h (referring to Player())
2. * [main.o] Error 1
Comment: IIRC, NachOS is an academic operating system (which means this is probably homework). What are you trying to do?
Comment: well it supports c or c++ to some extent as a lot of these files are .cc  //On a second note, it might not implement a full C++ runtime, but it is capable of running c++ files and I just need to figure how to get mine to work ^^
Answer: Let's go through line-by-line:
#ifndef PLAYER_H
#define PLAYER_H
#include "utility.h"

So far so good, you might check if your compiler supports #pragma once, but the macro will work perfectly fine.
class Player()

() aren't allowed in a class name, take them off
{
  public:
   //getPlayerID();
};

#endif

The rest of the header file is ok.  Let's look at the implementation file:
#include "player.h"

Perfect.  Putting a class in a header is the best way to make sure you only have one definition used in your whole program.
class Player()

Parentheses aren't allowed, but here you have a bigger problem.  You already have a class with that name.  Let the header provide the class definition, the implementation file just needs to provide the non-inline member functions (and any helper code).
{
  string playerID;
  int timeCycle;
}

Here's a complete corrected version:
#if !defined(PLAYER_H)
#define PLAYER_H

#include <string>
#include "utility.h"

class Player
{
     std::string player_id;
     int time_cycle;

public:
     // this is how you make a constructor, the parenthesis belong here, not on the class name
     Player(std::string id, int time);

     std::string getPlayerId() const;
};

#endif /* !defined(PLAYER_H) */

and implementation file
#include "player.h"

// and this is how you write a non-inline constructor
Player::Player(std::string id, int time)
    : player_id(id)
    , time_cycle(time)
{}

std::string Player::getPlayerId() const
{
    return player_id;
}

All of these problems are really basic C++ stuff, nothing to do with NachOS.
Comment: This works great and it compiles now. But now let's say I wanted to initialize a player with both a playerID and timeCycle.

I originally put player() because I wanted to change it to player(string playerID, int timeCycle) .

From what I know, getters and setters are done differently in c++
Comment: @krikara: The constructor declaration goes INSIDE the class.  I'll edit with an example.
Comment: #include  should be #include  . Otherwise you include the C file.
Comment: and in the constructor u miss the namespace :-)
Answer: Did you modify the Makefile.common in the root nachos directory? I think you should add some value to THREAD_H, THREAD_O and THREAD_C.

How to make classes in NACHOS (C++)


BladeCenter basics

Question: Every manufacturer seems to have different standards for what ships with their hardware; mounting rails, cable arms, power cables etc. I've got used to that for standard rack-mounted gear, but now I've been asked to spec out an IBM BladeCenter installation, and I'm not sure what parts I need.
Assuming an H model chassis and (say) 6 blades, maybe something like:

BladeCenter H chassis
Power cable  (what kind?) x 2
Power supply x 2
HS22 x 6
SAS HDD (Hot swap) x 12

Now some questions:

Do I need a power distribution unit of some sort?
Are the twin GbE connectors on each HS22 used as the interconnect between blades?
Do I need to add a networking module for external connectivity?
What about a management module?

Basically, I'm open to any suggestions that'll help me understand what I need to be buying.
Comment: I accepted Dan's answer below, but both were very helpful. Thank you for your efforts.
Comment: You should push back on your vendor to assist you with this configuration. This isn't something you should be worried about. That being said, the provided answers are good. I recommend the Cisco 3012 ESMs. (I do these configs for our clients)
Answer: The options can be a bit overwhelming to newcomers.
To start with a new H-series will come bundled with the following items:

Chassis populated with media tray and blowers.
PSUs (pack of two).
Advanced Management Module (AMM).

Besides your actual blades you will need the following as a minimum:

Connectivity - Ethernet
Unless you have some very specific requirements from pre-existing switches then avoid Copper Passthru Modules (CPM). They aren't that much cheaper, can be fumblesome and you won't benefit from the blade simplicity. Go for an Ethernet Switch Module (ESM). This will provide internal Ethernet switching between all blades and a handful of external ports to take connectivity out of the chassis.
Each blade's onboard NIC is hard-wired to an I/O module in the chassis, so if you wish to use both NICs then you'll need to purchase two ESMs. The choice is between Cisco or Nortel (aka Blade Networks). If you don't have any ties to Cisco then I'd thoroughly recommend the Nortels. If your requirements are simple then the L2/3 model will do fine.
Power
There are five choices of power cables. The most suitable here in the UK is the 3x 16A IEC (25R5785). For each power connector on the back of the chassis, the cable splits out, in the form of two IECs for blades (allow 14A each) and one IEC for blowers (allow 5.5A).
You'll need to purchase two of these cables for redundancy and a C19 PDU. Ideally you should be running two PDUs from two separate power sources and then connect the Bladecenter in a fashion whereby the load of the IECs is both distributed and redundant.
Be sure to spec your power requirements carefully. Our PDUs have ammeters built-in so that we can observe the load and they all terminate to 32A Ceeform feeds. IBM provide a free utility called Power Configurator which can help you calculate your power requirements.

All of the above assumes that you have 6 blades with no additional I/O requirements. You may then wish to consider the following:

Redundant AMM
There is space for two Management Modules in each chassis. When two are installed, they will run in a primary and secondary arrangement, so that the secondary takes over in the event of the primary's failure. It's always worth having two.
PSUs
All BladeCenters are divided into two power domains. With the two bundled PSUs you will be able to run blades in slots 1-7 and I/O modules in bays 1-4 and 7-10. If you wish to expand and run blades or I/O modules in the remaining spaces then you will need to purchase an additional pack of two PSUs. Thankfully there is only one 2900W rating to choose from for the H-series.
Connectivity
If you want to expand on the connectivity of your blades, such as additional NICs, FibreChannel or InfiniBand, then you can purchase expansion cards for the blades and I/O modules for the chassis.

Finally the IBM Redbook entitled "IBM BladeCenter Products and Technology" is absolutely essential reading. It contains details all the available options, compatibility matrices and detailed descriptions about I/O use.
Answer: As I recall it (correct me if I'm wrong cause it's been a while) you can add "cheap" copper pass-through modules if you don't want to take the networking module cost up-front. That way you can access the blade NICs from the center backside - but it kinda defeats the purpose with a bladecenter.
There should be a couple of different networking module options, cheaper and more expensive depending on whether you want - say Cisco manageable level 3 routing in them or not and so on, see the tech sheets list.
The chassis I'm used to hard-routed one blade NIC to one networking module bay and the other blade NIC to the other networking bay - so if you needed both NICs on a blade you needed two networking modules. You could also add another two networking modules (or FC modules and so on) and the corresponding module to a blade to get two additional interconnects of your choosing.
There are loads to regard, the power modules power specific blade and expansion module slots (first two included power modules power blade bay 1-7 and expansions bay 1-4 - to use blade bay 8-14 and expansion module 5-10 you need two additional power modules).
The center should come with at least one management module, otherwise you need to add one. The blowers are fun to play with (rebooting management module ;)
Most questions should be answered by your hardware partner or vendor imho as it gives you the chance to ask more intricate questions about interoperability, licensing and additional costs.
Here's a list of tech sheets for different modules and the center itself and this is the installation user guide which is fairly detailed.

(source: keenzo.com)
About the power cords, they're most likely not what you're used to and may need some local help from your electrician - order the specific BladeCenter H power cables. They each need three "standard" UPS power outlets which powers different parts of the chassis (so some can be left unplugged if you've only filled half the center with blades as I recall). During startup or when the management module is rebooting/offline - the blowers are uncontrolled, creating a decently sized storm and drawing a lot of power.

BladeCenter basics


Listar Dias faltantes do período no SQL Server

Question: Como seria possível fazer com o que no SQL Server ao confrontar uma tabela que guarda os registros de status de um determinado código com uma tabela virtual do período (Calendário de dias) ele me traga todos os códigos que estão faltando nesses determinados dias
Por Exemplo minha tabela guarda apenas os registros validos
DATA - COD - STATUS
01/07/2018 - 123456 - Ok
01/07/2018 - 987654 - Ok
02/07/2018 - 123456 - Ok
03/07/2018 - 123456 - Ok
04/07/2018 - 987654 - OK
05/07/2018 - 987654 - OK
06/07/2018 - 123456 - Ok
08/07/2018 - 987654 - OK
09/07/2018 - 123456 - Ok
09/07/2018 - 987654 - Ok
10/07/2018 - 123456 - Ok

Seria possível obter o seguinte resultado por Select onde me traga os dias que estão faltando por exemplo?
DATA - COD - STATUS
01/07/2018 - 123456 - Ok
01/07/2018 - 987654 - Ok
02/07/2018 - 123456 - Ok
02/07/2018 - 987654 - Fail
03/07/2018 - 123456 - Ok
03/07/2018 - 987654 - Fail
04/07/2018 - 123456 - Fail
04/07/2018 - 987654 - OK
05/07/2018 - 123456 - Fail
05/07/2018 - 987654 - OK
06/07/2018 - 123456 - Ok
06/07/2018 - 987654 - Fail
07/07/2018 - 123456 - Fail
07/07/2018 - 987654 - Fail
08/07/2018 - 123456 - Fail
08/07/2018 - 987654 - OK
09/07/2018 - 123456 - Ok
09/07/2018 - 987654 - Ok
10/07/2018 - 123456 - Ok
10/07/2018 - 987654 - Fail

Complemento - 30/07/2018
SELECT B.COD, B.DATA, B.[E] ENTRADA, B.[S] SAIDA
  FROM (SELECT P.COD, P.DATA, P.TPMARCA, P.HORA
          FROM PREG P
         WHERE P.DATA BETWEEN '20180701' AND '20180715'
           AND P.COD = '003100'
           AND P.TPMC <> 'D'
           AND P.REP <> ' '
       ) A
 PIVOT (SUM(A.HORA)
   FOR A.TPMARCA IN ([E], [S])) AS B

Esse é o meu SELECT e esse é o resultado dele
COD DATA    ENTRADA SAIDA
003100  20180701    6,53    19,13
003100  20180702    7,18    18,03
003100  20180706    6,54    19,06
003100  20180707    6,34    13,08
003100  20180708    7,18    NULL
003100  20180709    NULL    18,9
003100  20180712    6,48    18,43
003100  20180714    7,02    18,11

Porém o resultado que eu preciso é
COD DATA    ENTRADA SAIDA
003100  20180701    6,53    19,13
003100  20180702    7,18    18,03
003100  20180705    NULL    NULL
003100  20180706    6,54    19,06
003100  20180707    6,34    13,08
003100  20180708    7,18    NULL
003100  20180709    NULL    18,9
003100  20180710    NULL    NULL
003100  20180711    NULL    NULL
003100  20180712    6,48    18,43
003100  20180713    NULL    NULL
003100  20180714    7,02    18,11
003100  20180715    NULL    NULL

Ou seja, preciso que traga também os dias que não existem registros
Comment: Seria isso? https://pt.stackoverflow.com/questions/62925/not-in-ou-not-exists-qual-usar
Answer: Seu exemplo não está claro. Devemos considerar somente os CODs do período listado?
Independente da resposta para a questão acima:
Sim, é possível gerar uma lista contínua de datas virtualmente (sem precisar nem mesmo criar uma tabela temporria) assim:
Select data from(
SELECT TOP (365) DATEADD(day, ROW_NUMBER() OVER (ORDER BY number), '2018/01/01') as data FROM [master]..spt_values) datas
where data between '2018-07-01' and '2018-07-31'

veja funcionando no SQLFiddle.
O problema é saber quais CODs que você quer.
Eu criei um exemplo extamente com a sua amostra de dados e chamei a tabela de ATIVIDADE.
Podemos supor que toda a amostra de COD esta no seu exemplo, então a query abaixo é válida:
select aux2.data, aux1.cod from
(select distinct cod from atividade) aux1
cross join
(Select data from(
SELECT TOP (365) DATEADD(day, ROW_NUMBER() OVER (ORDER BY number), '2018/01/01') as data FROM [master]..spt_values) datas
where data between '2018-07-01' and '2018-07-31') aux2

veja no SQLFiddle
Isso cria um resultado com todas as datas e CODs possíveis.
Agora é só cruzar as informações usando o left join
select distinct aux3.data, aux3.cod, coalesce(atividade.status,'fail') as status
FROM
(select aux2.data, aux1.cod from
  (select distinct cod from atividade) aux1
   cross join
  (Select data from(
       SELECT TOP (365) DATEADD(day, ROW_NUMBER() OVER (ORDER BY number), '2018/01/01') as data FROM [master]..spt_values) datas
   where data between '2018-07-01' and '2018-07-31') aux2) aux3
left join atividade on atividade.data=aux3.data and atividade.cod=aux3.cod
 order by aux3.data, aux3.cod

Mais uma vez, aqui esta o SQLFiddle
Nota:
Caso existam CODs que deveriam aparecer, mas não estão no seu exemplo,  basta subsitituir
select distinct cod from atividade

por
select cod from CODs  -- lista de CODs válidos para o período.

Comment: Eu entendi o que você colocou, irei deixar um exemplo mais concreto do que realmente estou precisando
Comment: Será sempre um unico COD, ex.  `P.COD = '003100'`, e sempre um intervalo de datas fixo?
Comment: pode conter vários códigos e vai sem sempre em um intervalo, por exemplo, os últimos 15 dias ou 7 dias
Comment: Nós precisamos que você nos forneça um exemplo daquilo que voce quer fazer. A idéia sera sempre a mesma, fazer um join com um conjunto sequencial de datas. O que vai mudar é a determinação do conjunto de CODs. Se forem vários CODs a query será diferente de um unico COD.
Comment: O Exemplo está bem definido, coloquei apenas um código para não ficar muito extenso, preciso apenas que o SELECT também preencha os dias que não existam nessa tabela, trazendo de alguma forma esses registros inexistentes.
Comment: Deste jeito fica complicado. A cada instante sua necessidade muda. Aqui está um fiddle mais ou menos génerico para o núcleo da sua query. Ela vai trazer todos os CODs e datas da tabela PREG mais as datas faltantes para cada COD. Não tenho como fornecer sua query completa porque nao tenho suas tabelas. Caso queira algo completo, forneça um fiddle com um exemplo minimo realizavel do que você quer fazer. Verifique se é isto: http://sqlfiddle.com/#!18/a4505/5
Comment: A necessidade não mudou, eu que mudei os exemplos para tentar facilitar um entendimento, pois a necessidade é que o SELECT também traga os dias que não existem.
Comment: Analise o ultimo fiddle. Verifique se é bem isso o que você quer. Caso contrário, forneça um fiddle com um modelo de dados testável.


On the zeta sum $\sum_{n=1}^\infty[\zeta(5n)-1]$ and others

Question: For p = 2, we have,
$\begin{align}&\sum_{n=1}^\infty[\zeta(pn)-1] = \frac{3}{4}\end{align}$
It seems there is a general form for odd p. For example, for p = 5, define $z_5 = e^{\pi i/5}$.  Then,
$\begin{align} &5 \sum_{n=1}^\infty[\zeta(5n)-1] = 6+\gamma+z_5^{-1}\psi(z_5^{-1})+z_5\psi(z_5)+z_5^{-3}\psi(z_5^{-3})+z_5^{3}\psi(z_5^{3}) = 0.18976\dots \end{align}$
with the Euler-Mascheroni constant $\gamma$ and the digamma function $\psi(z)$.

Anyone knows how to prove/disprove this?
Also, how do we split $\psi(e^{\pi i/p})$ into its real and imaginary parts so as to express the above purely in real terms?

More details in my blog.
Comment: Neither polygamma nor gamma split particularly nicely into real/imaginary parts (in particular the argument is a rather complicated expression), so I doubt that there's a clean solution for your second problem.
Comment: I came across a similar problem recently where the sum was real, but the terms were complex. Fortunately, it was only Arcsin[(-1)^(1/p)] which Maple was able to split (as pointed out by R. Israel) hence one could simplify the expression to contain only real terms. But I'm happy with Zander's elegant answer.
Answer: $$
\begin{align}
\sum_{n=1}^\infty\left[\zeta(pn)-1\right] & = \sum_{n=1}^\infty \sum_{k=2}^\infty \frac{1}{k^{pn}} \\
& = \sum_{k=2}^\infty \sum_{n=1}^\infty (k^{-p})^n \\
& = \sum_{k=2}^\infty \frac{1}{k^p-1}
\end{align}
$$
Let $\omega_p = e^{2\pi i/p} = z_p^2$, then we can decompose $1/(k^p-1)$ into partial fractions
$$
\frac{1}{k^p-1} = \frac{1}{p}\sum_{j=0}^{p-1} \frac{\omega_p^j}{k-\omega_p^j}
= \frac{1}{p}\sum_{j=0}^{p-1} \omega_p^j \left[\frac{1}{k-\omega_p^j}-\frac{1}{k}\right]
$$
where we are able to add the term in the last equality because $\sum_{j=0}^{p-1}\omega_p^j = 0$. So
$$
p\sum_{n=1}^\infty\left[\zeta(pn)-1\right] = \sum_{j=0}^{p-1}\omega_p^j\sum_{k=2}^{\infty}\left[\frac{1}{k-\omega_p^j}-\frac{1}{k}\right]
$$
Using the identities
$$
\psi(1+z) = -\gamma-\sum_{k=1}^\infty\left[\frac{1}{k+z}-\frac{1}{k}\right]
= -\gamma+1-\frac{1}{1+z}-\sum_{k=2}^\infty\left[\frac{1}{k+z}-\frac{1}{k}\right]\\
\psi(1+z) = \psi(z)+\frac{1}{z}
$$
for $z$ not a negative integer, and
$$
\sum_{k=2}^\infty\left[\frac{1}{k-1}-\frac{1}{k}\right]=1
$$
by telescoping, so finally
$$
\begin{align}
p\sum_{n=1}^\infty\left[\zeta(pn)-1\right]
& = 1+\sum_{j=1}^{p-1}\omega_p^j\left[1-\gamma-\frac{1}{1-\omega_p^j}-\psi(1-\omega_p^j)\right] \\
& = \gamma-\sum_{j=1}^{p-1}\omega_p^j\psi(2-\omega_p^j)
\end{align}
$$
So far this applies for all $p>1$. Your identities will follow by considering that when $p$ is odd $\omega_p^j = -z_p^{2j+p}$, so
$$
\begin{align}
p\sum_{n=1}^\infty\left[\zeta(pn)-1\right]
& = \gamma+\sum_{j=1}^{p-1}z_p^{2j+p}\psi(2+z_p^{2j+p})\\
& = \gamma+\sum_{j=1}^{p-1}z_p^{2j+p}\left[\frac{1}{1+z_p^{2j+p}}+\frac{1}{z_p^{2j+p}}+\psi(z_p^{2j+p})\right] \\
& = \gamma+p-1+S_p+\sum_{j=1}^{p-1}z_p^{2j+p}\psi(z_p^{2j+p})
\end{align}
$$
where
$$
\begin{align}
S_p & = \sum_{j=1}^{p-1}\frac{z_p^{2j+p}}{1+z_p^{2j+p}} \\
& = \sum_{j=1}^{(p-1)/2}\left(\frac{z_p^{2j-1}}{1+z_p^{2j-1}}+\frac{z_p^{1-2j}}{1+z_p^{1-2j}}\right) \\
& = \sum_{j=1}^{(p-1)/2}\frac{2+z_p^{2j-1}+z_p^{1-2j}}{2+z_p^{2j-1}+z_p^{1-2j}} \\
& = \frac{p-1}{2}
\end{align}
$$
which establishes your general form.
I don't have an answer for your second question at this time.
Comment: Zander: Beautiful! I was trying to find a formula for even p as well, but you not only found the general formula for all integer p > 1, it's wonderfully concise, too. Thanks!


How can I reproduce the choppy synth in "Come on Home" by Franz Ferdinand?

Question: I want to prepare a base so we can play with my band a cover of this song:

I have a Korg R3 and Garageband.
Can you hear the "choppy" synth at the beginning?
How could I reproduce it well?
Which kind of sound / effect should I choose?
Answer: The rythmic effect can be achieved by filtering some signal through a lowpass VCF (12 dB/8ve, little resonance) heavily modulated (~ 800 Hz down to 20 Hz) by a sawtooth LFO. That gives the basic "choppy" thing. Then you can try all kinds of stuff to get the actual sound; perhaps start with a PWM-square or sawtooth VCO and ring-modulate it with a triangle after the VCF, then a fixed bandpass filter with a little saturation.
Comment: That sounds so tron! :D

I hope I can hack my way through finding this in garageband or logic or anything!
I'll keep you posted and then vote for answer: thanks for now.
Comment: My money is on the signal being distorted *before* it gets to the filter, and in fact, my money is on the signal being a power chord played through the same amp, with the exact same configuration as the "main" guitar part.
Answer: I think it's just a standard power chord played on guitar, possibly looped, then fed through a low pass VCF with some resonance, modulated by a sawtooth LFO.
Some additional equalizing should give you a really close approximation.
Comment: Definitely a possibility; at any rate the sound blends in very well with all the guitars on the album – though, there are quite a few definitive keyboards on that track. You don't have a reference that it was done this way in the original?
Comment: Not at all, I'm sorry.
I *did* feed my guitar through the same configuration on a track I cut a long time ago, and it sounded like the OP's video :)


drupal 7 parent menu item will not hide for authenticated user

Question: Could any one give me some ideas on what i need to check please?
I wish i could just show the site, but of course it' for my company, so I can't,  but I have a menu bar at top of my page home, contact, meet the authors, books;
Under "Meet the authors", i have several authors, I created an authors content type and have one for each author. When you hover over "Meet the Authors" you see the drop-down list/sub-menus of the authors - only five of them now.
so using panels and views, when you click of "meet the authors" you see a list of the authors on the page and can click in for more detail.
Using the access control module, I only want this link to appear for anonymous users, once logged-in, this link should disappear but the link will not hide itself after login, but here is what's really odd, the sub-links which are the authors, those links/sub-menu do/does hide when the user logs in and only displays for the anonymous user
so for example, this enable menu should appear for the anonymous user
Meet the authors
 - ----Kim Fields
 - ----Tony Bruewer
 - ----Harris Carlton
 - ----John Brown
and should be completely hidden for the authenticated user, but what is happening though, upon login, the user sees the parent menu:
Meet the authors
but the sub menus have hidden themselves as they should, i just can't get the parent menu to hide itself.
I have checked the access control to make sure I have selected things properly.  I even created test content type and menus to test and everything worked, so I assume there is something different, but I just can't see what and where.
Any ideas and guidance would be greatly appreciated. Thank you.
Notes: the parent menu about [Meet the authors] is pointing to a panel page that contains a view to display the list of authors.  I do not have access setting on the panel.
More Information:
So for my own sanity, I slowly created another content type, a view for that content type and a panel page.  Saved, cleared cache, ran cron.  Change settings in control access module.  Here is what I now see-- The sub-menus of the parent menu [Meet the authors]are following the authentication rule, the top menu just displays all the time.  I create this mention from the Structure->Menus navigation.  So the top menu item is pointing to the panel whereas the sub-menu items are actually the content types.
Still more Info:
Here is what I think the issue that I still have not found a way around.  I create the view, create the panel, place the view in the panel, give the panel page a normal menu entry.  So that is my menu item that appears.  If I click on that top parent link, it takes me to the panel with my view, but the menu item won't display/hide as needed.  So i realized that the menu I am creating in the panel has nothing to do with the content type and the content type is needed to manage the access control module.  So I go into my content type, change one of it's types and change the menu to point to the panel url I created.  Well when I do that, that url is assigned to that content type node, not panel, but the menu item does, now, display/hide based on the selection from the access control module.
Can anyone give me a way around this?  What i think I need is a way to point one of my node content types to the panel.  Does this make sense.  I love Drupal, but sometimes...
Comment: what happens if you click on the parent item? i.e. is the access control actually working to restrict access to the page.
Comment: Hi Geoff - see the "still more info" note i added above.
Answer: The easiest way with the least amount of programming would be do it with css:
<code>body.logged-in .my-menu-name-or-css-class {
  display:none;
}
</code>
The most standards compliant way would be to use hook_menu_alter and unset the menu if $user->uid returns true: https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_menu_alter/7
However, in this case you're probably looking at maybe saving 10kb of bandwidth by unsetting the menu vs. just using CSS to hide it.
Answer: Ok, i finally resolved this issue, or figured out what is going on.  This is a very specific issue, so posting my solution here, should someone else run into this exact problem.
Ok, so I am using panels in my sites, inside the panels, i have views based on the content types.  My top level/parent menu item is pointing to the Panel that holds the View.
The menu item is NOT a menu created of/from the content type consequently, the "control access module" didn't do anything with the menu item, because it does not consider it a content type and that is actually correct.
So you know the saying "there's a module for that" -- there is a menu_per_role module that allowed me to update visibility based on user role, so I could hide that menu for the authenticated user.


Applet não executa no browser

Question: Não executa o Applet. Só da esse retorno.

Essa é minha classe java.
public class SiteSelector extends JApplet {

private HashMap<String, URL> sites; // nomes e URLs de site
private ArrayList<String> siteNames; // nomes de sites
private JList siteChooser; // lista do sites a escolher

//le os parametros e configura a GUI
public void init(){
    sites = new HashMap<String,URL>();
    siteNames = new ArrayList<String>();

    //otem os parametros do documento XHTML
    getSitesFormHTMLParmeters();

    //cria componentes GUI e a interface layout
    add( new JLabel("Choose a stie to browser"), BorderLayout.NORTH);

    siteChooser = new JList(siteNames.toArray()); // preenche a JList
    siteChooser.addListSelectionListener(new ListSelectionListener() {
        //vai ao site selecionado pelo usuário
        @Override
        public void valueChanged(ListSelectionEvent arg0) {
            // TODO Auto-generated method stub

            //obtem o nome do site selecionado
            Object object = siteChooser.getSelectedValue();

            //utiliza o nome do site para localizar a URL correspondente
            URL newDocument = sites.get(object);

            //obtem o conteiner de applets
            AppletContext browser = getAppletContext();

            //instrui o conteiner de applets a mudar as paginas
            browser.showDocument(newDocument);
        }
    }); // classe interna anonima

    add(new JScrollPane(siteChooser),BorderLayout.CENTER);
}

//obetem os paramentros do documento XHTML
private void getSitesFormHTMLParmeters(){
    String title; // titutlo do site
    String location = ""; // localização do site
    URL url; // URL da localização
    int counter = 0; // conta o nuemro de sites

    title = getParameter("title" + counter); // obtem o primeiro titulo do site

    //faz um loop até que não haja mais parametros no documento XHTML
    while(title != null){
        //obtem a localização do site
        location = getParameter("location" + location);

        try{//coloca titulo/URL no HashMap e titulo na ArrayList
            url = new URL(location); // converte a localização em URL
            sites.put(title,url); // coloca titulo/URL no HashMap
            siteNames.add(title); // coloca o titulo no ArrayList
        }catch(MalformedURLException urlException){
            urlException.printStackTrace();
        }
        ++counter;
        title = getParameter("title" + counter); // obtem o proximo titulo do site
    }
}

}
Esta é a minha HTML.

O que estou fazendo de errado?
O arquivo html coloquei no diretorio /bin jundo com .class
Comment: Isso mesmo. E é um exemplo de um livro de java do Deitel.
Comment: Por mais que eu procure, não encontro a informação se pode ou não executar um applet no sistema de arquivos local, sem servidor... Vou deixar que alguém com experiência recente em Java responda, então, infelizmente não me lembro mesmo desse detalhe.
Comment: Tenta colocar nas configurações do java o caminho para o arquivo como site seguro ou permitido de execução de applets
Comment: Como você está abrindo esse arquivo HTML? Você está usando algum servidor local? Simplesmente abrindo o arquivo HTML no browser? Sua janela me lembra muito o appletrunner (ou apppletviewer, não sei - faz anos que não mexo com Applets), você estaria por acaso usando um comando assim pra tentar abrir seu applet?
Comment: Estou abrindo no browser de forma normal.
Comment: Tipo, `file:///caminho/pro/arquivo.html`?
Comment: Tranquilo mgibsonbr. Agradeço pela atenção.
Comment: O browser chega a lhe fazer as perguntas de permissão de execução para este applet?
Comment: Chega sim. Dou a permissão. E não executa o applet. Já baixei de segurança e mesmo assim não consigo executar.
Comment: Achou alguma solução? Poste como resposta para ajudar outras pessoas.
Answer: Assumindo que ainda não deste com o problema, noto que no teu HTML tens alguns erros que causam uma visualização incorreta ou nula do teu Applet.
Tag applet
Onde defines a altura, tens um erro de escrita em que heiht deveria ser height:
<applet codebase="." code="solo.SiteSelector.class" width="300" heiht="75">

</applet>

Deveria ser:
<applet codebase="." code="solo.SiteSelector.class" width="300" height="75">

</applet>

Isto pode dar origem a que o teu applet fique com altura igual a zero, onde apesar de estar em execução, acabas por não o visualizar.
Nota:
Como pode ser visto na documentação (Inglês), trata-se de uma atributo obrigatório, o que por si só, o erro de digitação é suficiente para justificar o teu problema.
Atributo code
No teu atributo code na tag applet tens escrito:
code="solo.SiteSelector.class"

Mas como não sei de onde vem o solo, a julgar pelo código na tua pergunta deverias ter apenas:
code="SiteSelector.class"

Pode ver na documentação (Inglês) que o atributo code é suposto conter o nome da classe, e a tua classe chama-se SiteSelector.
Nota:
Por outro lado, podes também passar packagename.classname.class, ou seja, meuPacote.minhaClasse.class conforme pode ser visto na documentação nesta página (Inglês).
No teu caso será pacote solo e a classe SiteSelector se for essa a realidade.
Atributo codebase
O atributo codebase serve para indicar o caminho para para os ficheiros. O mesmo é utilizado em conjunção com o valor do atributo code.
No teu caso estás a indicar que o ficheiro está em:
./solo.SiteSelector.class

O . seguido do solo.SiteSelector.class deveria dar um caminho válido, confirma se é o teu caso.
Tag param
Na tua segunda tag <param/> tens o atributo que contém o valor com o nome mal escrito:
<param name="location0" valeu="http://java.sun.com/">

Deveria ser:
<param name="location0" value="http://java.sun.com/">

Após resolução do em cima indicado poderás ter o problema resolvido ou poderás ter ultrapassado parte do problema.
Ficam umas ideias para melhor explorar a situação caso tenhas apenas ultrapassado parte do problema:

Alterar a cor de fundo da tab  para saberes se o Applet está ou não a ser executado, pois o fundo deverá ficar verde e o teu Applet terá um fundo de cor diferente, provavelmente branco:

Normalmente os navegadores são 32Bit, mas já tens versões 64Bit disponíveis, verifica se estás a usar a versão de Java 32 bit ou 64Bit e cruza a informação com o navegador para saberes se ambos partilham a mesma arquitetura.

Experimenta o teu Applet com o appletviewer (Inglês) que podes executar a partir do terminal:
appletviewer meuFicheiro.html

Applet não executa no browser


Sound-to-color synesthesia - a good and helpful thing?

Question: In hearing about sound-to-color synesthesia, or rather Chromesthesia1, I have always been rather jealous, and wanted to experience this unexplainable phenomenon for myself.
I have read up a little bit about it, and from what I hear, it sounds like a good thing to have. However, I am still very uncertain as to what it actually is...
Image from wikipedia link on chromesthesia

That's pretty much the best I can picture it as ; 'thinking' different colors for different notes.

My questions in regards to musical performance/practice:

Does chromesthesia help when trying to find a certain note? Does it
help in attaining absolute/perfect pitch?
Does it make it easy to tell whether notes are in tune or not?

Regarding musical composition:

Would chromesthesia make one more creative in composing? Would seeing a mix of colors in ones head help in writing music?
Or, would chromesthesia make this a hard process, constricting natural musical ideas.

I don't know about you, but I can just picture someone coming up with a beautiful melody and deleting it because it  uses a color they don't like... :)

Does anyone here have this ability? If so, could you then explain to me how you find sound-to-color synesthesia to be useful, and more specifically, in the settings I imagined?
If you don't happen to have this ability, please think very carefully before answering, and include many credible sources... I'm not sure how much I trust you... :)

1 Throughout this question, I am assuming that this "condition" really exists. As many people claim to have it, I don't see why it should be assumed otherwise. Also, as jjmusicnotes noted: "synesthesia not only affects my own compositional process, but has also affected historically significant composers as well. Thus this subject falls under "musical practice" which I interpret to include pedagogy - underwhich this subject may be included." Please take this into consideration before voting to close, like a few have already done...
Comment: @WheatWilliams - As I established in my answer, synesthesia not only affects my own compositional process, but has also affected historically significant composers as well.  Thus this subject falls under "musical practice" which I interpret to include pedagogy - underwhich this subject may be included.
Comment: I do not see what this question has to do with musical practice and performance. Synesthesia is an unusual neurological condition that might even be described as a mental illness or aberration. If you don't already have it, you can't acquire it. It's my understanding that few medical professionals accept that such a condition really exists, labeling it a figment of certain peoples' overactive imagination. So what is the use of asking "Would chromesthesia make you more aware"? I cannot take this question seriously.
Comment: @WheatWilliams  Take a look at some of Oliver Sacks' writings.  I'd say that synesthesia in general is quite well-established. Whether you treat it as an aberration or just part of a range of human brain operations is largely subjective.  However, I fully agree that one type of audio synesthesia or another can help or can hurt musical ability, and certainly it's not something one can "choose" to have in any case.
Comment: I do not have synesthesia, but how do you distinguish middle C or middle A or a Cb chord in the upper registry or a Drop 2 F#13 chord. If the F chord is Blue, is it Blue in all octaves and all forms of spellings? What about half diminished 7th chords which have different names for the same notes? Also the upper and lower harmonics of a note, 2 notes, 3 notes, 4 notes etc...and how they differ between instruments and people. Synesthesia, mental illness, probably not. Is it proven in the musical sense to be a real enhancement? Not even close. The test are only gathering how many and how much alm
Comment: Does this question presume that chromesthesia can be acquired by colouring your keys? That's like saying you can acquire synesthesia by using a different coloured pen for each letter you write. You can't just impose a neurological condition onto yourself like that. Other than this part, I think this is a very interesting question.
Comment: @LeeWhite no, I wasn't presuming that. Actually, I was sure that Chromesthesia was not something that could be acquired if you didn't have it. The question was merely about how it would affect musical practice and composition.
Answer: I have absolute pitch and associate colors with specific keys. I have had this ability for as long as I can remember and only discovered in adolescence that others did not have it; the two are very much intertwined in terms of how I think about music.  FWIW, absolute pitch runs in my family on both sides, with my mother possessing it and my paternal grandfather. Neither of them report any sort of synesthesia.
My major keys/colors map together as follows.  The minor keys correspond to their major counterpart, but are without exception darker and greyer in my mind. Atonal music along the lines of Schoenberg or Stockhausen inevitably appears brilliant white; music that skirts along the edge of tonality, such as that of John Adams or Elliott Carter, varies.

C - brilliant red
C# - deep black-red (similar to the color of a blood clot)
D - golden brown
Eb - pale yellow-green
E - emerald green
F - yellow
F# - deep forest grey-green
G - gold
G# - greyish purple
A - royal blue
Bb - grey
B - brilliant purple

My synesthesia leads me to favor certain keys when I compose. For example, I have never written anything in the key of B-flat because I simply don't like it and the color is not as intense or beautiful as, say, C#, F#, C, or G, which I tend to favor.  However, this leads to a chicken/egg question: do I like these keys more because the colors are stronger, or are the colors stronger because I like the keys more? I have no idea.
Synesthesia is also helpful when tuning instruments. When tuning my guitar, for example, I know there's a certain richness I associate with the golden color of G that just isn't there until I've gotten the G string just right. Also interesting is the fact that when I tune the A string, I know the color of the "proper" A440, but my ear prefers a sharper A442. The color is more vivid this way, even though it's technically "incorrect". When my guitar is flat, the color is still there but loses its vividness in my mind.  It is not clear to me how having synesthesia would make absolute pitch easier to attain.
The biggest drawback I can think of to synesthesia/absolute pitch is the difficulty of transposing. It is virtually impossible for me to play a keyboard with the "transpose" setting on; playing middle C and hearing a B come out is jarring to the point of being completely disabling. A lesser problem is tunings on a guitar; I have to learn each tuning as a completely different instrument and takes me noticeably longer than someone without absolute pitch.
I hope this is helpful; if I can clarify anything, please let me know.
Comment: Fascinating. A question - do you see all octaves of a note the same colour or are they different?
Comment: BTW I don't think the keyboard-transpose difficulty is necessarily due to your condition, I know a few good pianists who feel the same way and attribute it to having [near-]perfect pitch.
Comment: I can attest to that, @Mr.Boy. I do not have pitch, but I am absolutely unable to play a song in a key of which I know it is incorrect. Once I have the key figured out, I can't play the song in any other key.
Comment: @LeeWhite - interesting. How do you know which is the 'correct' key for a song? The original written key may well differ from that of the first/most popular recording, and subsequent keys that are different from those are often used. Elvis, for example, lowered a lot of his keys later in life. So, were they then non-authentic songs? I often play a particular tune in a particular key, but that's only because I've learnt it that way, and am reluctant to re-learn a complex song in another key. But if a singer asked, it would have to be done!
Answer: There are many different types of synesthesia, and it is only recently that it has been taken seriously as psychological phenomena.  For anyone who is unfamiliar (or too bored to click the links in the OP's question,) synesthesia is essentially where a person's brain is hard-wired to experience sensory stimulation in multiple, simultaneous ways.
For example, some people associate colors with letters and numbers, some people hear colors, and others taste colors - my grandfather tastes green beans whenever he hears the word "green" and experiences similar connections with other colors.
Not much is known exactly about synesthesia due to lack of knowledge about how the brain works and the limited amount of scholarly research undertaken, however, synesthesia typically runs in families (my grandfather, my mother, and myself, for example.)  It is also inconsistent between people in terms of color association and degree of correlation (some people experience it more vividly than others.) In the present state of understanding, it is not considered for it to be possible to teach.
Notable composers such as Scriabin and Messiaen admitted to having synesthesia - the former even adamant about constructing what he called a "light organ" that would light up the corresponding colored lights with the appropriate notes so that everyone could see music the way he saw music.

To answer your questions:

Seeing as I like to 'compose' music, I was wondering how useful this would actually be when writing a song? Would it make me more imaginative and creative, or would it perhaps be more of a curse?

I personally use it / notice it the most when I'm improvising - especially on piano. Of all the keys I prefer f# minor because to me, it offers the most beautiful colors. Sometimes it influences my compositional choices, but rarely.  If anything, it's actually made me more indifferent to pitch choice because as I experience writing the music, pitches all seem incidental.
The only thing that limits your ability to be creative is the type of experiences you've had and your willingness to find new solutions.

Would chromesthesia make you more aware as to if you are in tune or not? ('Oops, that was the wrong shade of green') Or even better, would it make perfect-pitch easy to attain?

To my knowledge, there is no known documented evidence of composers using synesthesia to differentiate between gradations of intonation.  Some composers have incredibly, incredibly sensitive ears (able to hear if something is 1-2 cents out of tune!) but their sensitivity was not aided by synesthesia.
With respect to "perfect-pitch", I just want to clarify here that if you can match pitch (i.e. sing in tune,) then you have "perfect-pitch."  What you're actually referring to is absolute pitch - the ability to recall or produce any pitch at will without prompting.
In my experience, no.  There are "perfect-pitch" courses out there that train you to "hear colors" and for me, I found it confusing because I didn't agree on the color choices, so it was actually detrimental for me personally.  Having absolute pitch doesn't make a good composer anymore than having a the best microphone or guitar make you the best vocalist or guitarist.  True skill comes from relentless, dogged determination to master countless exercises in problem solving, self-discipline, and the unwavering focus of continual self-improvement.
Other than that, to me, your keyboard's colors are wrong.
Comment: Wikipedia and my music encylopedia disagree:  perfect == absolute,  and "relative" refers to matching pitch.  Otherwise, very well written response.
Comment: @CarlWitthoft - you know, in the early part of the 20th century, doctors advocated smoking because everyone thought it was either good for your or not harmful.  We've had this discussion long ago in a different question.  I can't take wikipedia as a seriously cited source, and your musical encyclopedia definitions need to be updated / edited.
Comment: @jjmusicnotes OK, then can you cite sources for your definitions?  I'm happy to use them over wiki.
Answer: I am 16 and I have chromesthesia, the type of synesthesia being discussed where I hear sounds and see colors. I think it might be of interest to you to learn that this is genetic in my family (my father and my paternal grandmother and myself) and we all have the same colors for the same notes or songs. If it matters to you which are which this is it:

A = bright red
B = lighter blue
C = very very light yellow or clear
D    = darker blue
E = very bright yellow
F = lighter green
G = darker green

(the minors are just a darker/ greyer version of these)
We all have absolute pitch but not perfect pitch, but I don't know how much the colors have to do with that.
In regards to composing, I don't necessarily use the colors, they're just kind of there, although I do see how you could use them. I don't think they would prevent you from putting any phrases together because the colors don't really clash, they just kind of coexist.
When I am playing the piano or any other instrument, it is very apparent to me if I play a note with even a half step difference because it changes the whole color and feel of the chord.
I was born with this condition, as were my dad and grandmother. My grandmother was an artist and taught music and my dad is a professional successful conductor and trombone player, so I believe that synesthetic people have more of an inclination to the arts. I have a real problem with remembering my right and left, especially when driving, but not a lot of problems with numbers.
Hope this helped you!
Comment: Hmmm... Colour discrimination varies a _lot_ from person to person, as does pitch discrimination. You would have to posit a one-to-one correspondence between a person's (different) limits of discrimination for the two, and that is problematical. How does colour line up against sound? By the musical octave or along the continuum of sound frequencies? Positive or negative correlation to frequency? Even allowing for octave duplication, we're seeing islands of blue between red and yellow - the synaesthetes are _not_ experiencing a continuum of colour frequencies corresponding to rising pitch.
Comment: Hey thanks for the answer. I find it very interesting that it seems to be genetic in your family and that you all have the same colors... However, I'm wondering how you don't have perfect pitch? I thought if you see colors for notes, you would easily be able to find the notes you want?
Comment: SuperMusicman, it's hard to discriminate between exact flat or sharp because although the color does have slightly different... textures I guess it's still the same color. However if you tell me to sing a red I can sing an A with no reference note.
Comment: Patrx2, I'm not even sure what all of those words mean, are you asking a question? If so could you dumb it down a little if you would like an answer?
Answer: It was said that Hendrix experienced it but he wasn't born with it. apparently it was induced by lots of LSD, which probably isn't a good thing. the E7#9 chord was referred to as the purple chord, hence purple haze.
I remember reading about Synesthesia a couple of years back and its do do with the sensory connections in the brain, we tend to have different sections of the brain dedicated to different sensory activities. As far as i can gather, synesthesia is when two or more different sensory areas of the brain have inexplicably strong links and in turn, the two senses turn into one and the same.
there are reports of people hearing numbers, tasting names and seeing sounds, its all subjective and while some people might have the same type of synesthesia, they might experience coloured sounds differently.
Answer: I have this as well, but strangely enough it's more associated with composers than keys.  I have no idea why.  Mozart is generally red.  Chopin is deep blue, with some exceptions: for example the Ab Polonaise is red.  Brahms is green.  Schumann and Liszt are both purple.  Beethoven has different colors for different pieces.  Bach is often white, the only one I get white with.  The only orange composer is Grieg.  Haendel is yellow, and so is Haydn.  Funny.  The only time I really found it of much use was in college when we were doing "guess the composer" exam questions.  I could sometimes use it to tell similar composers apart.
Answer: A guy who has  done a lot of research into this can be found at www.vichyland.com
I occasionally have pupils who experience these phenomena, but it's very rare, and comes in many different forms. More often, something like a major chord evokes happy, whilst a minor one evokes sad. This is a more general thing, but you are asking about very specific things.
Sometimes there may be something of a memory throwback - A smell - perfume,maybe, reminds you of the red dress your partner wore the first time that perfume was used. Thus smell=colour.The whole thing is, in my opinion,very, very personal, and, as such, cannot be used to any great purpose, although it's fascinating, and can be harnessed as a teaching tool :" a major 7th sound makes me feel dreamy".
However, to me it's all black and white...
Comment: Synesthesia has little to do with associations between stimulus and how they make you feel.  Ol' factory senses are the strongest memory markers, so your brain naturally makes learned correlations.  This is not synesthesia.  Synesthesia is saying, "the letter "A" is red, "B" is black, "C" is white because you perceive those letters that way - and you are consistent with those colors every time because you can't change the way you perceive letters and numbers.
Comment: @jjm. Have you done the acid test, and had someone play a note, and you say, for example, it's red, so it's F#. Of course, if absolute  pitch is available, it would muddy the waters.
Comment: That particular test would not work for me as I do not experience sound in that way (although other synesthetes do.) If you were to ask me what color F major was, I would say "Blue" and if you asked me again in 10 years, I would still say "Blue."
Answer: I have a mild form where I assign colors to numbers, letters, and combinations of those. I don't actually see every letter in a different color but if someone told me to paint a letter 'i' I would definitely go for white. A green 'i', for example, would look very wrong.
I mostly use it (usually subconsciously) as a memory aid. When performing, I can for example remember that the next chord is dark forest green, thus I have to play a F# minor chord. Or the next section is bright yellow and therefore in the key of E major. It has nothing to do with sound, though. For example E flat is a kind of yellow whereas D sharp is a kind of red. It's still pretty useful; for other things, too, like remembering dates.
Answer: In my case, I never realized other people didn't have it. I am an audio guy. I mold sounds into stereo. I use my gift to create dimensions in sound. I can recognize color and frequencies in the space, and I find a relationship between the fundamentals and harmonics.
Answer: I am author of the site ,, Synesthesia interactive music visualization", which is at least good visible in Internet .
Now I think that instead synesthesia music visualization must take in bearings such firmly asserted phenomena as conditional reflex, prediction,expectation, satisfaction. In a matter of fact namely these phenomena are referred to my program.
Conditional reflex is formation of connection between  phenomena of  different senses. This connection provides prediction of secondary one.
If music visualization program is built so that, for example, movement of melody calls movement of same direction in the visualization picture then by observation of such visualization predictions  and pleasant feelings from their fulfillment arise.
Creetings
Yuri Vilenkin
Answer: I am a chromesthete, but a fairly weak one as far as I can tell. Colors only present themselves with musical sounds (yes, this influences what I define as "music"), and I have yet to derive a particular pattern. I'm fairly certain it has something to do with chord structure and overtones, but I am not completely sure. I have anxiety and PTSD so my state of mind can greatly influence the extent of what I see, and whether or not it is overwhelming and discernible. I also have acute hyperacousis due to viral activity, making my auditory senses a right mess. Anyway, I find that it does help me remember music- if I can remember the way the music looks I can replicate it easier. It works more with singing than playing for me. I also write music and the reason I love to write it is so I can take the notes and turn them into colors I want to see. Maybe my chords are strange because of that, but I love what I write. I have not found that it helps with identification of structures. I can tell if I've heard something before, but not always what it is. I am very good at tuning two instruments together by ear, however, as I just point one of them up or down until the two are coordinated.


Making a Content Type the subpage of a Views page for the sake of Breadcrumbs

Question: I have a Content Type named Cars and a Views page which lists all those cars. Is it possible to put the Cars content type under The Views page so my breadcrumbs would come out as Home > Cars > Sample Car. Cars is the Views page, Sample Car is the Content Type.
Answer: Alternate way.... Using Custom module.
function hook_node_view($node, $view_mode, $langcode){
  if($view_mode == 'full' && $node->type =='cars'){
    $bc[] = l('Home', '<front>');
    $bc[] = l('Cars', url('cars'))
    $bc[] = l($node->title, url('node/'. $node->nid));

    drupal_set_breadcrumb($bc);
  }
}

Comment: I'll give this a try.
Comment: I pasted it in my module and it still showed the default breadcrumbs. Am I forgetting something?
Answer: For this you will have to use Menu Breadcrumb and Path module
Define your view's path as cars and define path for your Cars type nodes as cars/sample-car
Menu Breadcrumb will do the magic for you to arrange hierarchy of your view and nodes in bread crumb
Comment: Is there a way to do it without the Menu Breadcrumb module? There's no D7 version yet and the dev module seems buggy.
Answer: The Menu Position module should allow you to do this, and it works for Drupal 7.
Answer: Use the Crumbs module (7.x-1.2 +).
Go to Admin > Structure > Crumbs > Node parent,
here you can configure a parent path for each node type, with token support.


Neural Network with 3 input signal and single output, Matlab

Question: I have 3 different wavelength signals to use as an input to predict single output. BTW I have extracted 9 features per each signals. Now I'm training the classification NN with Matlab. I want to use 30 datasets (each set contain of 3 different wavelength) of signals to classify into 3 classes. what should my input matrix be? I have tried to create a cell of 3 different signals inside but the nprtool is not working with it. Please help me, I am new and not familiar with Neural Network.
Answer: I assumed signal is vector and output will be the class value in binary so we need 3 digits for 9 classes.
x = [signl1 signl2 singl3]; %all verctors in one row
label = [0 1 0]; %class 2 in binary
net = patternnet(10);
view(net)
[net,tr] = train(net,x,label);

Now you can use net as signal classifier for new signals after validating your NN with dataset you never use before.
estimiated_class = net(new_signal)

this is my vague idea if not work try deep learning


global variable for path

Question: In my project I want to provide path of some files from root directory. Path has repeated 4 to 5 time in one module so I am thinking that put one global variable and access that variable in same module?
I have try (dirname(__FILE__).'\sound\new'); realpath; drupal_realpath ; pathinfo; .
Answer: You can get the path using drupal default function drupal_get_path();
It return path to any module or theme from root of installation.
If i want to access path of any module e.g. mymodule
Then i just need to use,
$path = drupal_get_path('module','mymodule');   //path to module directory

If i want to access path of my theme e.g. mytheme
$path =  drupal_get_path('theme','mytheme');   //path to theme directory

Now you can make the path variable global..
Comment: Thakns its working with this...
Answer: In Drupal 7 you can use variable_set and variable_get to make the variable global.

Set the variable

variable_set('MYMODULE_PATH', base_path() . drupal_get_path('module','YOUR_MODULE_NAME'));

Get the variable

variable_get('MYMODULE_PATH');

Also you can assign multiple values the variable, if you dont want to create multiple variables
  variable_set('MYMODULE_PATHS',
    array(
      'm1' => base_path() . drupal_get_path('module','YOUR_MODULE_NAME'),
      'm2' => base_path() . drupal_get_path('module','YOUR_MODULE_NAME'),
      ...
    )
  );
  $values = variable_get('MYMODULE_PATHS');
  //Read as $values['m1'], $values['m2'] ..

Answer: You can declare your global variables with multiple ways: for ex: in settings.php file - $conf['some_name'] = 'some_value', or with variable_set and variable_get (these functions store variable in db instead of defining them as global), or with builtin $GLOBALS array, etc..
But as Raj10 mentioned above, drupal_get_path($type, $name) is the best way to get the path to modules or themes..
Comment: Thaks for your time..!

global variable for path


How to enable CBA for EWS managed API authentication

Question: Microsoft has provided a class named ClientCertificateCredentials in EWS library. What exactly is needed for anyone to start using it? For example, is there any Exchange server side configuration required to enable CBA for EWS? Also, what should be the certificate passed to the ExchangeService object in order to authenticate the user? Should it be only the public key or both public-private keys of the cert? Not able to find any example for CBA with EWS managed API
Comment: Although its not what you need, but maybe it will help you to get started; we have done CBA for Excahnge ACtiveSync once, here is a link  https://blogs.technet.microsoft.com/exchange/2012/11/28/configure-certificate-based-authentication-for-exchange-activesync/
Comment: Looking at it makes me think that maybe EWS, being a separate service like EAS, requires similar configuration in order to start accepting certificates for authenticating users.
Answer: I used the sample code here: https://learn.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-authenticate-an-ews-application-by-using-oauth
<code>var cca = ConfidentialClientApplicationBuilder
    .Create(AppId)
    .WithTenantId(TenantId)
    .WithCertificate(certificate)
    .Build();
var authResult = cca.AcquireTokenForClient(scopes)
    .ExecuteAsync()
    .Result
    .AccessToken;
</code>
You can get your certificate via thumbprint:
<code>    X509Certificate2 GetLocalCertificateByThumbprint(string thumbprint)
    {
        X509Certificate2 cert = null;
        using (var store = new X509Store(StoreName.My, StoreLocation.LocalMachine))
        {
            store.Open(OpenFlags.ReadOnly);
            var certCollection = store.Certificates;
            var currentCerts = certCollection.Find(X509FindType.FindByTimeValid, DateTime.Now, false);
            var signingCert = currentCerts.Find(X509FindType.FindByThumbprint, thumbprint, false);
            cert = signingCert
                .OfType<X509Certificate2>()
                .OrderByDescending(c => c.NotBefore)
                .FirstOrDefault();
        }

        return cert;
    }
</code>


posterior distribution of a Poisson mixture model

Question: This is a Poisson-gamma model with mixture prior, thus mixture posterior. I am having some trouble finding the posterior weightings.
I have the prior weightings $p_1=1/3$; $p_2=2/3$. The 2 component priors are $\theta_1$~$\Gamma_{220,10}$, and $\theta_2$~$\Gamma_{110,14}$. I am given 7 data points with Poisson counts for each $\{y_1,...,y_7\}$. So $y_1,...,y_7|\theta_j$~ $Poisson_{\theta_j}$;j can be 1 or 2. $\Sigma y_i= 189$.
I have tried to derive the analytic form of the posterior, which looks like this:

Please help me with the posterior weightings. Thanks in advance.
The code I have done so far. The term 'gamma(b1+n-y)' is causing the troubles:
<code>#a. mixture prior:
N=1000
a1<-200; b1<-10
a2= 110; b2=4
a<-c(a1,a2); b<-c(b1,b2)
# the prior weightings are (1/3, 2/3):
gamma=1/3

# MC simulation of mixture prior:
lambda<-seq(0,1,0.01)
g<-rbinom(N,1,gamma)+1  # generate random bernoulli rvs+1 = {1,2} according to prior weightings
gprior<-rgamma(N,a[g],b[g]) # g being 1 or 2 indicates the parameter to use in rbeta

# plot prior:
par(mfrow=c(1,1))
plot(density(gprior),xlab="lambda",lwd=2,lty=2,col="gray",main="Mixture of conjugate priors",cex.main=0.8,cex.axis=0.8)

#b. posterior:
data= c(28,26,26,19,22,38,30)
n= length(y)
y= sum(data)

# The posterior normalising constant (inverse):
k= (10^220)*gamma(409)/(3*gamma(220)*17^409)+ 2*4^110*gamma(299)/(3*gamma(110)*11^299)
gamma.star= (1/k)*10^220*gamma(409)/(3*gamma(220)*17^409)

# use the log-gamma to rescale:
k= log(10^220)*lgamma(409)/(3*lgamma(220)*log(17^409))+ 2*log(4^110)*lgamma(299)/(3*lgamma(110)*log(11^299))
gamma.star= (1/k)*log(10^220)*lgamma(409)/(3*lgamma(220)*log(17^409))

</code>
Comment: The posterior weights are not correct.
Comment: @Xi'an Yes thank you for pointing out. I realise that those weights are for the binomial sampling model. However as I tried straight derivation, the huge gamma functions and exponents are giving me troubles. Rescaling by log() and lgamma() does not entirely solve the problem as log(17^409) is still Inf-valued. What can I do about that?
Answer: When computing the posterior weights the normalising constant is not needed:
\begin{align*}
\gamma^* &\propto \frac{1}{3}\frac{10^{220}\Gamma(409)}{\Gamma(220)17^{409}}\\
1-\gamma^* &\propto \frac{2}{3}\frac{4^{110}\Gamma(299)}{\Gamma(110)11^{299}}
\end{align*}
means that
$$\gamma^*=\dfrac{\frac{1}{3}\frac{10^{220}\Gamma(409)}{\Gamma(220)17^{409}}}{\frac{1}{3}\frac{10^{220}\Gamma(409)}{\Gamma(220)17^{409}}+\frac{2}{3}\frac{4^{110}\Gamma(299)}{\Gamma(110)11^{299}}}$$
can be simplified as
$$\gamma^*=\dfrac{1}{1+2\frac{4^{110}\Gamma(299)}{\Gamma(110)11^{299}}\frac{\Gamma(220)17^{409}}{10^{220}\Gamma(409)}}$$
and the term in the denominator remains manageable:
<code>> lgamma(299)+lgamma(220)-lgamma(110)-lgamma(409)+
  110*log(4)+409*log(17)-299*log(11)-220*log(10)
[1] 1.915338
</code>
Comment: Yes,$$\gamma^*=\dfrac{1}{1+2\exp\{1.915\}}$$with the data provided in the question
Comment: Hi I would just like to confirm that I will need to take exp to 1.915338 before calculating the gamma* term? My lecturer changed the data magnitude in the previous problem so I did not use your method. But here I am with some huge real data following a bimodal Poisson model...


Solving regularized least squares problems using Matlab optimization toolbox

Question: I am trying to solve a least squares problem where the objective function has a least squares term along with L1 and L2 norm regularization. I am unable to find which matlab function provides the ability to perform such an optimization in addition to specifying constraints. I looked into the MATLAB optimization toolbox which also does not provide too much freedom to specify own objective functions (although I hope I am wrong in this case!) in the case of leastSquares optimization problems. If anyone knows how to model such an optimization problem in matlab please do help me out. The optimization problem is as follows:

Here aj is an m X 1 vector and A is an mXn matrix , wj is an n x 1 vector. I don't know how to incorporate the two additional regularization terms into the optimization problems as they only accept 2 matrices and perform the least squares operation on them. I would like to know how to implement this objective function and pass it into matlab optimization toolbox leastSquares function. Any help would be appreciated.
Comment: This should run out of the (tool)box at least the statistics toolbox. Have a look at [lasso](http://www.mathworks.de/de/help/stats/lasso.html?s_tid=doc_12b) at bottom of the page under the header "Elastic net".
Answer: If you don't have the Statistics Toolbox or cannot use lasso for some reason, consider the following:
function myfun
load hald
A = [ones(13,1),ingredients];
fmincon(@(w) myobj(A,heat,w,1,0),rand(5,1),[],[],[],[],zeros(5,1))

function out = myobj(A,a,w,beta,lambda)
resid = a - A*w;
out = 0.5*norm(resid)^2 + (beta/2)*norm(w)^2 + lambda*sum(abs(w));

This formulates the problem as a general optimization problem rather than as least squares. The call to fmincon starts at random initial values and specifies zero as the lower bound for all coefficients. The first input is an invocation of the myobj subfunction with the w parameter allowed to vary but with the other variables set to the values shown.
I've run this on the Hald data from the Statistics Toolbox and created a design matrix that includes a constant. It may make sense to modify the objective function so that the intercept does not contribute to the L1 or L2 penalty. For example, use w(2:end) rather than w in the penalty terms.
I didn't understand your constraint on w(j,j) as I thought w was a vector.


How Can I align Text In Center

Question: I am trying to create a Link with glyphicon and I want my Icon and text to aligned in center. I tried with padding and marging  both but it moves both the icon and text and I want to move text only.
This is my code

.quick-links{
    margin-left: 15px;
    line-height: 2;
    font-family: 'arial rounded MT';
    border:1px solid;
}
.text-position{
  display:inline-block;
  font-size:18px;
  padding:0px 0px 0px 5px;
  margin: 0px 0px -15px 0px;
}

.quick-link-text a{
  font-weight:500;
}

.quick-link-text a:hover{
  text-decoration: none;
  font-weight:1000;
}

.glyphicon-plus-sign{
  font-size:24px;
}
<link rel ="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css">

            Quick Links

  First Link

 Second Link

Comment: What do you want in the middle ? Quick Links or first , second link ?
Comment: first and second link to align in center in comparison to icon.
Answer:

.quick-links{
    margin-left: 15px;
    line-height: 2;
    font-family: 'arial rounded MT';
    border:1px solid;
}
.text-position{
  display:inline-block;
  font-size:18px;
  padding:0px 0px 0px 5px;
  margin: 0px 0px -15px 0px;
}

.quick-link-text a{
  font-weight:500;
  display: flex;
align-items: flex-start;
}

.quick-link-text a:hover{
  text-decoration: none;
  font-weight:1000;
}

.glyphicon-plus-sign{
  font-size:24px;
}
<link rel ="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css">

            Quick Links

  First Link

 Second Link

Comment: Thanks a lot it worked. btw is there any other way doing without using flexbox?
Answer: Don't want to use flexbox? you can use position property.
.quick-link-text a {
  font-weight: 500;
  position: relative;
  padding: 0 25px;
}
.glyphicon-plus-sign:before {
  position: absolute;
  bottom: -5px;
  left: 0px;
}

Comment: thanks i wanted to do it this way however i used the solution you had given earlier.

How Can I align Text In Center


Relation of criteria selection and AUROC

Question: I am comparing few classifiers and I am slightly confused now. I will call the classifiers A, B, C.
If I draw ROC curve, and estimate AUROC, the result points that the classifier A is the best and the classifier C is the worst.
If I draw dependency of the accuracy on the criteria (position of threshold) and integrate the area under the curve, the classifier A is the far best one.
In case of implementation, I can imagine the classifier that is less dependent on criteria (what can be difficult to set in practice) is better than classifier that scores high in AUROC.
My questions:

Does some common metric like "area under accuracy on criteria dependency curve" exists, or it is wrong/useless practice?
Is it possible that this area is not corresponding with AUROC?
Answer: This answer assumes a balanced dataset, with as many positive and negative observations. I believe it is enough to show my point.
What does ROC analysis teach us? Let's take a plot of the ROC space:

ROC analysis tells us that any classifier can be represented by a monotone curve, that goes from the bottom left (when threshold is high and everything is classified as negative) to the top right (when threshold is low and everything is classified as positive).
What about the accuracy? It is maximal at the top left corner (perfect classification) and minimal at the bottom right (100% wrong classification). If your classifier performs no better than random, the ROC curve will follow the diagonal line, and the accuracy will be 50% regardless of the threshold.
Again: all classifiers will need to go from the bottom left to the top right corner, both having 50% accuracy. How can we have a classifier whose accuracy doesn't depend on the threshold?
Easy: follow the diagonal line with a classifier that performs no better than random.
In other words, the accuracy of a useful classifier has to depend on the threshold. So your following statement is incorrect:

In case of implementation, I can imagine the classifier that is less
  dependent on criteria (what can be difficult to set in practice) is
  better than classifier that scores high in AUROC.

and therefore an "area under accuracy on criteria dependency curve" would be useless.
Comment: Thanks a lot! How do you suggest to measure this dependency? Just by ROC curve? Because ROC produces much different values than  "area under accuracy on criteria dependency curve". I would like to use some criteria in my study. And I am afraid the ROC is misleading for practical application - it does not cover the threshold change linearly.
Comment: I suggest this dependency is not useful. Updated my answer to reflect that more precisely.
Comment: Thanks again, but I still need a bit of clarification. Let us consider threshold in range 0-1. The dependency of accuracy on criteria shows what accuracy I will get exactly with any criteria. Thus the sum of the area under this curve reflect my chances to get best classification (if I pick the threshold "randomly"). I think I cannot say the same think about AUROC - it can describe only part of threshold range (depends on data and ability of classifier). Is it clear? What part of this assumption is not correct? Maybe I miss something basic.
Comment: "Thus the sum of the area under this curve reflect my chances to get best classification" I just showed this is not the case. Also I'm not sure what the "curve" would be here - only that it wouldn't be useful.


Insert JavaScript variable in Django tag

Question: I'm working on an app that uses Django and jQuery for various things. I'm trying to assemble an AJAX request with jQuery that requires that I use Django's {% url %} template function. One of the arguments needed for the url call is stored in a JavaScript variable. Is it possible to insert the value of the JS var into the {% url %} tag? Something like
var jsvar = somestuff;
{% url some.view arg1=jsvar %}

Answer: No. Pass a sentinel (e.g. %s) to url which you replace in JavaScript with the actual value.


Given radius, and many vertices on it, how can I find center of a sphere?

Question: I have a sphere, I know its radius. I also have the coordinates of 500 vertices which are on the sphere. How can I find the center coordinates of a sphere? Is there an easy way to do that? Thanks.
Comment: Assuming the sphere is in $\mathbb{R}^3$ its equation is $(x-a)^2 + (y-b)^2 + (z-c)^2 = r^2$ where $(a,b,c)$ is the center and $r$ is the radius. Just plug in some of the coordinates of your points and get some equations to solve for $a,b,c$.
Comment: Or look at Simon Watfa's answer here (http://steve.hollasch.net/cgindex/geometry/sphere4pts.html) for a nice way of doing it given $4$ non-coplanar points on the sphere (it turns this is enough to get a unique sphere).
Comment: If you know four points, but you don't know the radius, then you can find the center of the sphere. In this problem, you have a bit more information than you need.
Comment: Isn't this just solving simultaneous equations?
Answer: You need just four vertices $A,B,C,D$. Let $O_A$ be the circumcenter of $BCD$ and $l_A$ the line through $O_A$ that is orthogonal to the $BCD$-plane. Let $O_D$ be the circumcenter of $ABC$ and $l_D$ the line through $O_A$ that is orthogonal to the $ABC$-plane. Then $l_A$ and $l_D$ meet in the centre of the sphere.


Change CSS for dateRangeInput

Question: Given a Shiny app with a dateRangeInput widget, how does one use background color using CSS to modify the separator value (defaults as "to") between the two dates?  The darkly theme overrides the background color to white and white text when combined with the "useShinydashboard()" function:
library(shiny)
library(shinydashboard)
library(shinythemes)

ui <- fluidPage(

useShinydashboard(),

  tags$head(
    tags$link(rel = "stylesheet", type = "text/css", href = "pi_style.css")
  ),

  # Open navbar page and customize the theme
  navbarPage(
    theme = shinytheme("darkly"),
  ),

# Date Input
################################################################################
sidebarLayout(
  sidebarPanel(

    # Date selector
    dateRangeInput("dates", label = h3("Date range"),
                   start = "2023-01-01", end = "2023-12-31"),

    ) # Close mainPanel
  ) # Close sidebar
) # Close fluidPage

server <- function(input, output, session) {}

shinyApp(ui = ui, server = server)

And I tried adding this into my custom CSS file (pi_style), based on inspection of the HTML in the app:
.input-group-text {
  color: red; background-color: red;
}

Comment: Your code is not self-executable without errors. Also, if this question is still relevant, could you clarify the problem and why the given answer does not address it properly?
Answer: .input-group-text { color: red !important; background-color: red !important; }
Answer: Finally figured it out after some CSS sleuthing and added this to my pi_style.css file:
/* Controls background color of the dateRangeInput "to" box */
.input-group-addon.input-group-prepend.input-group-append {
  background-color: #464545;
}

Change CSS for dateRangeInput


Existe como criar um certificado valido para localhost Apache?

Question: Veja só no meu desenvolvimento local tenho feito uso de https://localhost, criei o certificado pelo openssl do apache, funciona beleza.
Acontece que como não é um certificado que esta em uma fonte externa o navegador diz que não é seguro e coloca aquela pagina de confirmação.
No firefox podemos adicionar o certificado e ele não pergunta mais, mas no chrome que ultimamente esta adotando políticas chatas não deixa você adicionar um certificado á lista (procurei e não encontrei), então toda vez que você fecha e abre ele mostra essa bendita pagina.
Tem como criar um certificado valido pra usar em localhost em todos os meus Virtuais Hosts para desenvolvimento?
Lendo na internet vi que existe o letsencrypt.org que gera certificados gratuitos, porém os programas usados são em vários sistemas, menos no Windows, no servidor CentOS eu consegui habilitar os certificados, mas como minha maquina de desenvolvimento é Windows eu precisava que fosse para este sistema operacional.
Nota: Não gostaria de usar maquinas virtuais, consomem um bom recurso da maquina.
Answer: Por desenho localhost não é um dominio reconhecido fora de um PC e portanto não é permitido, pelas autoridades emissoras de certificados publicas (CA's - como a letsencrypt.org) gerar certificados reconhecido publicamente para este domínio.
Dito isto, nada impede a criação de uma CA só sua. E com ela assinar um certificato emitido por si, para o dominio localhost. Este certificado será reconhecido só onde a sua CA for reconhecida como sendo de confiança.... este é o principio da cadeia de confiança SSL/TLS. "Só confiamos nos certificados assinados porque alguém em quem confiamos".
Para isso só é necessário criar uma CA. Basicamente um certificato assinado por ele próprio (Self-Signed Certificate - Ver https://stackoverflow.com/questions/10175812/how-to-create-a-self-signed-certificate-with-openssl) e depois emitir um certificado para o dominio localhost e assinalo com o certificado referido anteriormente (https://stackoverflow.com/questions/21297139/how-do-you-sign-a-certificate-signing-request-with-your-certification-authority).
Na posse destes dois certificados, usa-se o certificado localhost, depois de assinado na configuração do servidor Apache e importa-se a componente publica (não a chave!!!!) do certificado assinado por ele proprio, nos browsers para que o certificados assinados por este sejam reconhecidos e se tenha uma cadeia de confiança.
No chrome também é possível adicionar certificados (a não ser que as permissões não o permitam)- Seguir https://support.securly.com/hc/en-us/articles/206081828-How-to-manually-install-the-Securly-SSL-certificate-in-Chrome


admissible ideals

Question: How to prove the following conclusion :
For any finite quiver $Q$, an ideal $I$ of $KQ$, contained
in $R^2_Q$, is admissible if and only if, for each cycle
$\sigma$ in $Q$, there exists $s \geq 1$ such that $ \sigma^s \in I$, where, $R_Q$ is the arrow ideal of the path algebra $KQ$.
This conclusion comes from page 53 of the book named " Elements of the Representation Theory of Associative Algebras Volume1" , but I do not know how to prove it, I need a detailed proof.
For any finite quiver $Q$, a two-sided ideal $I$ of $KQ$ is said to be admissible
if there exists $m \geq2$ such that $R^m_Q\subseteq I\subseteq R^2_Q$
Answer: If I understood this paper correct. They are wrong here. Golod and Shafarevich provided in their paper On Classfield Towers a counterexample to the fact that every finitely generated nil ring is nilpotent.
Rewriting this in quiver terms means that if you take the one-vertex quiver $Q$ with $d\geq 2$ loops, then there exist infinitely many (even homogeneous) linear combinations of paths $f_j$ of degree $\geq 2$ such that the ideal $I$ spanned by the $f_j$ is such that $kQ/I$ is infinite-dimensional, but $kQ^+/I$ is nil, i.e. every element in $kQ^+/I$ is nilpotent. In particular every path to some power lies in $I$ and $kQ/I$ is of course not admissible since $kQ/I$ is infinite-dimensional.
Comment: Thanks, you gave a beautifull counterexample to my question!

admissible ideals


Extract text between HTML tags ( )

Question: I'm trying to extract the text between all

 tags in a string and print them.
use strict;
use warnings;

my $HTML = '

11111
11111
11111
11111

22222
22222
22222
22222

33333
33333
33333
33333

';

while($HTML =~ /data_2="1">(.*)<\/tr>(\R)/sg) {
    print "$1\n\n";
}

The output should be:
11111
11111
11111
11111

33333
33333
33333
33333

How do I do that and extract the content from each
 tag?
Answer: Editing answer to include new restriction on which
's are wanted
my $HTML = '

11111
11111
11111
11111

22222
22222
22222
22222

33333
33333
33333
33333

';

while($HTML =~ /
]*data_2=\"1\"[^>]*>(.*?)<\/tr>/msg) {
    print "$1\n\n"; }

Output:
11111
11111
11111
11111

33333
33333
33333
33333

Comment: Where is the parsing-HTML-with-regex police?
Comment: The output is not wrong, because I need to extract only the content from  tags that contains `data_2="0"`
Comment: I guess that I do not see that anywhere in the question.  Also,  do you mean that you want `data_2="1"`?   That would seem to better match your proposed output
Comment: My mistake, sorry. I mean data_2="1"
Comment: Changed to match additional restriction

Extract text between HTML tags ( )


How to add calendar events to everyone's calendar?

Question: I currently work at a University and we have a request to add our campus holidays and academic calendar to everyone's individual calendars. This way the holidays will show up by default on everyone's calendar. We also would like these events NOT to block off that day and prevent scheduling.
Is this possible? Would a shared calendar be a better solution than importing events? (If it is possible, how would one go about doing this task.)
I can provide more information if this was unclear. Thank you in advance for any help!
Comment: Have you considered, or stated that this is far from the best approach to this problem?  Most large organizations maintian a calendar for organizational events for a reason, namely that it's a better tool for handling this kind of thing.
Answer: You could have a shared calendar for holidays but there is no way to add it to every user's individual calendar unless you take advantage of Exchange Web Services. There are a couple articles about this
http://gsexdev.blogspot.com/2012/02/ews-managed-api-and-powershell-how-to.html and http://gsexdev.blogspot.com/2012/02/ews-managed-api-and-powershell-how-to_22.html