Multivariate normal and multivariate Bernoulli

Question:
Say I only have the mean vector and the covariance matrix of some multivaraite distribution X, where all single-variable marinals are normal (note: this is not generally a multinormal distribution). Is there some maximum distance, measured perhaps by some (multivariate) divergence like KL or JS  Divergence,  between X and Y, where Y is the multinormal defined by the mean vector and covraince matrix?
Say I now only have a mean vector and the covariance matrix of a multivariate Bernoulli distribution. Is there a simple way to express the joint distribution probabilities of some multivariate Bernoulli that has such a mean vector and covariance matrix?
Answer: Regarding the second part of the question: say ${\bf X} = \{X_1, X_2 ... X_d\}$ is a $d-$dimensional Bernoulli random variable. The joint probability function, in general, takes $2^d$ values, though the condition $\sum p({\bf x})=1$ leaves us with $2^d-1$ degrees of freedom. To represent it in some compact and handy way, the following representation is possible (I devised it some years ago for some problem I had at hands; I guess it's well known).
I assume that our Bernoulli takes values in $\{-1,1\}$ instead of the more usual
$\{0, 1\}$. Then, the joint probability can be written as
$$P_{\bf X}(x_1,x_2,\cdots x_d)=\frac{1}{2^3} \sum_{S_\lambda} a_{S_\lambda} \prod_{k \in S_\lambda} x_k$$
where $S_\lambda$ are all the subsets of the set $\{1, 2, \cdots ,d\}$ and  $a_{S_\lambda} = E[\prod_{k \in S_\lambda} X_k]$ ($a_{\emptyset}=1$).
For example, for $d=3$:
$$P_{\bf X}(x_1,x_2,x_3)=\\
=\frac{1}{2^3}\left( a_{123} x_1 x_2 x_3 +
a_{12} x_1 x_2  + a_{23} x_2 x_3  + a_{13} x_1 x_3  +
a_{1} x_1 + a_{2} x_2  + a_{3} x_3   + 1
\right)$$
where $a_{123}=E[X_1 X_2 X_3]$ $a_{12}=E[X_1 X_2]$, $a_{2}=E[X_2]$, etc.
This representation has two advantages: first, the coefficients do not change if we add or suppress (marginalize) components: if we have the above formula and want to compute $P(x_1,x_2)$ or $P(x_1,x_2,x_3,x_4)$, we only must add or suppress terms, (and change the normalization factor). Second, independent components (recall that independent is the same as uncorrelated here) are easily spotted: for example, if $x_2$ is independent from $x_1$, then we'll have: $a_{12}=a_{1} a_2$. Further, $cov(X_1,X_2)=a_{12} - a_1 a_2$
A disadvantage of this representation is that, the condition $|a_{i...k}|\le1$ is necessary but not sufficient to guarantee that it corresponds to a valid probability function. To check that, we must recover the values of the probability function. But the relation between this ${\bf p} =(p_{\emptyset},p_1,p_2 ... p_{12} ... p_{123})$ and the coefficients ${\bf a} =(a_{\emptyset},a_1,a_2 ... a_{12} ... a_{123})$ is straightforward: ${\bf a} = {\bf M p} $ with $m_{i,j}=\pm 1$ (the sign depends on the parity of common elements in the sets corresponding to that matrix row and column), and ${\bf M^{-1}}= {\bf M}^t / 2^d$ (I leave some details out, I doubt they will be missed).
So, if we are given the first and second moments of ${\bf x}$, we automatically have the first and second order coefficients. The rest of the coefficients are arbitrary, except for the restriction that they must lead to a valid probability function ($0 \le p_{i..k} \le 1$).
Regarding the first question, the idea is interesting, but I doubt there is some "maximum" distance. A mere suggestion: given that we are restricting to a variable with fixed first and second moments, to compute its deviation from the corresponding multivatiate gaussian I'd try with the entropy (substracted for the entropy for the corresponding gaussian, which should be bigger).
Added: To get explicitly ${\bf M}$:
Note that in my notation for the joint probability function ${\bf p} =(p_{\emptyset},p_1,p_2 ... p_{12} ... p_{123})$ the subindexes denote the components that take positive value; hence, for example $p_{1}=P(X_1=1,X_2=-1,X_3=-1)$, $p_{23}=P(X_1=-1,X_2=1,X_3=1)$, etc.
Say we want to compute $a_{12}$.
$$a_{12}=E(X_1 X_2) = p_{123} (1)(1) + p_{12} (1)(1) + + p_{23} (-1)(1) + \cdots + p_1 (1)(-1) + p_{\emptyset}(-1)(-1)$$
Or
$$a_i = \sum_j  (-1)^{\#(S_i \setminus S_j)} p_j$$
where the indexes $i,j$ run over the $2^n$ subsets, and $\#(S_i \setminus S_j)$ is the cardinality of the difference set operation. That term, then, gives the elements of the matrix ${\bf M}$
Update: The matrix ${\bf M}$ is a type of Hadamard matrix, specifically (if I'm not mistaken)  a Walsh matrix.
Comment: Thanks, leonbloy. However, I have two issues: [1] I need the Bernoulli values to be from {0,1}, since my mean vector and covariance matrix are based on this coding. [2] I actually need a closed form formula, that takes the mean vector and the covariance matrix and returns the joint probability, indexed say by k, where the binary coding of k of length d corresponding to (x1, x2,...xd). Your scheme is really an algorithm, whereas I need an expression (to insert as an element in a formula of mine). Note: if I assume all high moments are zero, is that sufficient to assure validity...?
Comment: @Omri: [1] the conversion from {0,1} to {-1,1} is rather trivial, $x = 2z-1$, from this you get the transformed means and covariance
Comment: @Omri: [2] `I need a closed form... that returns the joint probability` But: for the multivariate gaussian mean and covariance determine the joint probability; with multivariate Bernoulli, they dont: any valid multivariate probability with that mean and covariance, and taking the values in $\{0,1\}^n$ is a multivariate Bernoulli, there is not a "canonical" one, AFAIK.
Comment: yes, of course, there is no canonical form, but I just wanted a closed form for p=(...). I guess I'm also not sure about how to construct M, where you write "the sign depends on the parity of common elements in the sets corresponding to that matrix row and column"...?
Comment: @Omri: I added the explanation. I'm afraid you won't find it very "closed". The problem here is that, given moments and covariance there is no unique (or even priviledged) $p$. You can try some arbitrary values for the higher unknown $a$ (the value 0 only seems reasonable if the media is zero), and check if the result $p$ is valid. Perhaps this helps http://ideas.repec.org/a/eee/jmvana/v32y1990i2p256-268.html (I've not read it, all this is an old derivation of mine).
Comment: Put in other words: a valid ${\bf p}$ lives in the unit hypercube $[0,1]^d$. Moments are (for the bernoulli) linear functions of  ${\bf p}$. Hence,  specifying the means and covariances is the same as specifying an undetermined matrix linear equation, and we must find some solution in the intersection of that space with the hypercube. One could, for example, seek the maximum entropy density, using some simplex-like algorithm. In any case, this must be numerically.
Comment: @leonbloy What if we had more information, could we then determine a unique distribution? For instance suppose that we demand the trials to be independent conditional on another bernoulli variable.


images on django site from matplotlib

Question: I am looking to have an entry form where you can enter in a server name and end up getting several png images displayed that are created from matpotlib.
I can create the form, and have the scripts written that create the image files. I am wondering what the best way to deal with the images are. Is there a way I can display the resulting png file to the browser but not save it to disk?
Want to avoid cluttering up a directory with the generated images after they are displayed the the browser. Should I just delete the image after its rendered?
Answer: <code>response = HttpResponse(mimetype="image/png")
img.save(response, "PNG")
return response
</code>

images on django site from matplotlib


Weird SSIS Error (Process Exit Code 255)

Question: I'm having an issue with an SSIS job I recently created that is breaking with a strange error.
Background Info
This is an SSIS package (.dtsx) that is being run with a SQL job (SQL Server 2008, job created with SSMS) using the type SQL Server Integration Services Package as you would expect. The job runs fine in our development environment, but not in our test environment. The package uses a configuration file (.dtsConfig) to maintain the connection strings for the different environments. What the package is actually doing is pretty simple; it truncates some staging tables, and then fills then with data pulled from an Oracle database using 8 data flow tasks in a sequence container, with each task breaking down into Source (Oracle) -> Data Conversion (for unicode strings) -> Destination (SQL Server). Because of the Oracle connection that needs to be made, the package contains the user/pass for that connection and as such has a protection level of 'EncryptSensitiveWithPassword'to maintain that. The server that this job is being run on is running Windows Server 2008 R2 SP1. I believe thats it as far as background info, but if I missed anythign let me know.
The Actual Error
This is the only useful message in the broken job's job history:

The step did not generate any output. The return value was unknown.
  The process exit code was 255. The step failed.

As you can see, not very helpful. The real kicker is that when I run this job manually using DTEXEC on the server, it runs fine. This leads me to believe that it may be a permissions issue with the sqlagentadmin or something, but everything that I look at seems fine. I checked out what was happening using procexplorer and it was running the correct DTEXEC command. The application event viewer does pop up with this though (so maybe its an oracle driver issue):
<code>Faulting application name: DTExec.exe, version: 2007.100.5500.0, time stamp: 0x4e7b1ed6
Faulting module name: OraClient11.Dll, version: 22.214.171.124, time stamp: 0x4bb1dcae
Exception code: 0xc0000005
Fault offset: 0x0000000000057106
Faulting process id: 0x2d94
Faulting application start time: 0x01cd66b0d360164d
Faulting application path: C:\Program Files\Microsoft SQL Server\100\DTS\Binn\DTExec.exe
Faulting module path: c:\app\product\11.2.0\client_1\bin\OraClient11.Dll
Report Id: 118a2173-d2a4-11e1-b1ec-001517955142
</code>
I've looked around the internet for hours and I've tried some things. I changed the Delay Validation property to 'True' on all data flow tasks. I've tried setting up the job with the integrated SSIS GUI, and with the operating system option to just run the dtexec, both fail.
Any suggestions? Sorry for the wall of text, but I just wanted to make sure I covered everything.
Thanks!
Comment: Hey everyone, thanks for your comments. The problem was in the oracle driver as was pointed out. We had recently done some reinstalling of that driver, and it turns out that sqlagentadmin was referencing an old driver, whereas windows was referencing the correct driver (hence working manually but not with the job). It's all set now, thanks again!
Comment: It looks like the Oracle driver that you are running is not functioning properly. The 2nd last line of your error output tells that the error is within OraClient11.Dll. Can you try running this on another machine?
Comment: Can you please promote the final comment into an answer and mark the question as answered?
Comment: I assume you do not have package logging turned on?
Comment: The account that runs the package in test, is that the same as the SQL Agent account or do you have a proxy? Is it set up the same, as best as you can tell, in your dev environment?
Comment: Are you able to connect to the Oracle instance using sqlplus?
Answer: I got the following error :

' The step did not generate any output . The return value was unknown
. The process exit code was 255. The step failed. '

To solve my problem , I checked for privileges for reading the source data.
I did not have the right privileges. Got the correct privileges and restarted my job solved the problem .
I could suggest that the API between SSIS as the executing task and in my case DB2 data source provider should assign fault with better information.
Problem solved by getting reading privileged to source data.
Answer: Is your server a 64 bit server?  What about the Oracle server?  We had very similar issues issues when using SSIS to connect to an Oracle server.  We had to install both the 64 bit and the 32 bit client tools on our 64 bit server.
In addition, there's a flag that you may have to set in the SQL Agent job to tell it not to use 64 bit.  Look at the properties for the Step.  Go to the Configuration tab, then click on the Advanced tab (it may be a little different in SQL 2008) and check off "32-bit runtime" then try it again.  This could be why it works when debugging but doesn't work as a job.
Answer: when I gave access to the folder that contained the console program (access to all server users) it ran smoothly.
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).


merging folders via Cyberduck

Question: I want to upgrade my existing MODX install and this is the message that was in the upgrade instructs: "Do Not Overwrite Directories! Make sure your FTP program merges directories and does not overwrite them!"
So when dragging new folders from local server over existing folders in the remote server, Cyberduck is asking me what I want to do but I don't see the option "merge" - there is only "resume", "overwrite", "rename" and "skip". How do I merge files?
Comment: Check the preferences for the merging option
Answer: I am not on my Mac right now, but a quick google resulted into this. Altough it is an old post, I think it is still possible (I use cyberduck myself a lot, but not this option).
You should not replace or upload the folder directly, but rather hit Synchronize in the 'File' dropdown menu. Then it merges the two folders.

merging folders via Cyberduck


Light switch sizzled

Question: I had maintenance turn off my breaker and fix the pull tab on my ceiling fan. Then turned it back on... Few minutes later.... I turned on a light switch and it made a sizzling noice! Maintenance came back and flicked it off and on about 20 times and said it was fine and could have been a power surge! Is that true or should it get replaced??? Also i might fix myself..... But the wires are confusing.... What would happen if I get them mixed up?
Comment: Hello, and welcome to Home Improvement. If you don't feel comfortable working with electricity, then you should probably listen to your instincts; it could kill you. And, please [take our tour](//diy.stackexchange.com/tour) so you'll know how best to participate here.
Comment: Good for you. Asking questions before you dismantle everything and get into trouble.  As @Harper mentioned, take pictures before doing anything.  If the experts here (not me) know where the wires were, they can tell you where they should go. Good luck
Answer: Shoot photos of the wiring and let us walk you through it.
The usual place people get derailed is in 3-way switches; they count on the screw positions or wire colors meaning anything at all.  The screw positions vary on every switch, and the colors are worse than random in 3-ways. I even recommend you mark the travelers with yellow tape; doing so makes things easy.
Even on a 2-way you sometimes see more than 2 non-ground wires; almost always two always-hot wires  and the installer just used the switch terminals as a lazy way to splice them.  More logical is a pigtail; but a novice switch replacer usually does not have the supply of wire,  wire-nuts and stripper needed to do a pigtail.
But the #1 complication is dumbth; people not being conscious that they have outranged their skills and thinking they can just blunder about and get lucky. It's less of a risk on switches, but on other things, experientation can lead to many combinations that work but kill you later.  Skills are so easy to acquire that I advise to do so.

Light switch sizzled


Chaining up two solar panels of different wattage?

Question: I have a 30 watt solar panel and I'm looking to add a 80 watt solar panel to help power an 85AH battery. I know I need to connect them in parallel (positive to positive, negative to negative) but I wonder if the difference between the wattage of the two panels would cause a problem?
Comment: There's very little information here to make any kind of sound judgement. But if these are indeed panels (strings of solar cells), then the voltage of the larger panel will probably be a lot higher than that of the smaller panel. Connecting them in parallel may back-bias the smaller panel and damage it.
Answer:
If you have blocking diodes in each panel you will do no harm to the panels by paralleling them.

I assume that the panels are both of the same nominal voltage - ie made for use with the battery voltage you are using. If a 12 V battery they are probably 36 x PV cell panels with a nominal voltage of about 18v. This allows them to be loaded to about 80% of their rated no or low load voltage and still do all the things that a lead aci battery may need done to it.
IF they have the same Maximum Power point voltage (Vmpp) then they will parallel up well.
If Vmpp of one panel is lower than that of the other the low Vmpp panel will take most of the load until the load exceeds the panel capacity and then the other one will join in. No harm will be done but loading is not even.
This imbalance occurs because the low Vmpp panel will produce  a greater percentage of its output at a given voltage.
If you REALLY want balance (and there is no real reason to have it) then place a resistor of value about R = 0.5/Imax in series with each panel where Imax is the maximum rated current  of the panel concerned. These  resistors will drop (by design) half a volt at full power which should be enough to help them track each other. Power rating of resistors = > 0.5 x Imax.
Example.
85 Watt panel at 12v probably has Imax ~~ 85/15 = 5.7 A.
 30 Watt panel Imax probably ~~ 30/15 = 2A.
*Iuse 15V as a guess at likely Vmpp
Resistor for 85 Watt panel = V/I = 0.5/5.7A = 0.18 ohms.
 This resistor is so low that just including extra wiring length in the high wattage panel may be enough.
 Power dissipation = Vr x Ir = 0.5 x 5.7 = 2.9 Watts. A 5 Watt resistor would notionally suffice.
Comment: Thanks Russel, just as an fyi the Solar Panel I have is here: http://www.ebay.com/itm/160686793693 and the one I'm interested in getting is here: http://www.ebay.com/itm//150713604636?pt=LH_DefaultDomain_0&hash=item23173b1a1c


How to remove some features of a feature layer in the mobile cache

Question: I have a Hand-Held (HH) device in which I have downloaded to the MobileCache a limited amount of Features from a FeatureLayer. Now I need to remove from the cache all features of a certain type. We were able to delete them from the cache but this places them into a table called fs_table0_deleted_features in the MobileCache.db file. We are only doing a one-way synchronize (download), but if we ever did a two-way synchronize then these features would be deleted from the server too, which is not what we want. Also, if we try to re-synchronize the now deleted features from the server they are not removed from the deleted features table and the deleted features are not placed back into the fs_table0_current_features table; this behavior is causing issues with our application.
We also tried to use the MobileCache.RemoveData method, but this only accepts an Envelope (extent) and a list of FeatureSource. What I want to do is only remove a subset of Features that have been cached leaving the rest cached.  Other solutions we have considered have been:

Copy in memory from the MobileCache the features we want to save, Call RemoveData, then insert into the MobileCache the features that we saved.
RemoveData from the MobileCache and then synchronize with the server for all the features we want
Delete the MobileCache and then copy a backup that was previously made to replace the now deleted MobileCache.
Find the Extent of all the features we want to remove and then call RemoveData with those extents.

Of these, I think #1 or #3 may the better solutions, but they seem overly complex and it could be resource intensive(#1), or may have problems with stale data(#3).
We don't like #2 because the load for synchronizing our devices may be heavy (thousands of devices all must synchronize in a very limited time frame)
The last one, #4 could be a potential problem if there are overlapping features in which we only want to remove one and not all.
Here is how we tried the delete, which is not working and isn't a valid solution.
public void PurgeCacheData(string whereClause)
{
    if (!Cache.IsOpen) return;

    var qFilter = new QueryFilter { WhereClause = whereClause };
    var featureSources = Cache.FeatureSources;

    foreach (var fSource in featureSources
             .Where(fSource => fSource.GetFeatureCount(qFilter) > 0))
    {

        using (var featReader = fSource.GetDataReader(qFilter))
        {
            while (featReader.Read())
            {
                featReader.Delete();
                featReader.Update();
            }
        }

        // Here we tried to delete the entries in the Delete table
        // but this doesn't work. Nothing happens.
        using (FeatureDataTable featureDataTable =
               fSource.GetDataTable(null, EditState.Deleted, null))
        {
            foreach (FeatureDataRow row in featureDataTable.Rows)
            {
                row.Delete();
            }
        }

    }
 }

Answer: You are missing SaveEdits on the featureSource:
fSource.SaveEdits(featureDataTable);

this after the last foreach (row.Delete()) . Saving edits lets's you commit the changes to the layer. It Returns the rows affected with the deletion.


Circuit redraw. Series and parallel resistors

Question: I just wanted to ask you if I redrew the circuit correctly and if you could help me what to calculate first or if you could help me to redraw this circuit even simpler. And to tell me a few tips for knowing if resistors are in parallel or series.
Answer: You are correct.  A simpler answer is shown bellow, which is closer to the given question.

simulate this circuit – Schematic created using CircuitLab
For R1, pivot on B and pull rest of circuit to straighten out R1.
Pivot on D to straighten out R3.


Who had the sacred knowledge of Bhagavat Gita before Arjuna?

Question: Who had the sacred knowledge of Bhagavat Gita before Arjuna?
I am not sure but I listen that lord Shiva and lord Sun know it before Arjuna?
How did they come to know?
Comment: Please see this answer https://hinduism.stackexchange.com/a/22423 of your one of the questions...
Comment: Possible duplicate of [Bhagavad Gita was first recited to whom?](https://hinduism.stackexchange.com/q/18152)
Answer: Krishna briefly describes it who learned the knowledge contained in the Bhagavad Gita previously in chapter 4 of the Bhagavad Gita:

I instructed this imperishable science of yoga to the sun-god, Vivasvān, and Vivasvān instructed it to Manu, the father of mankind, and Manu in turn instructed it to Ikṣvāku. This supreme science was thus received through the chain of disciplic succession, and the saintly kings understood it in that way. But in course of time the succession was broken, and therefore the science as it is appears to be lost. That very ancient science of the relationship with the Supreme is today told by Me to you because you are My devotee as well as My friend and can therefore understand the transcendental mystery of this science.

This is referring to the passing down of the Pancharatra tradition, and it's described in more detail in this chapter of the Shanti Parva of the Mahabharata:

During the seventh birth of Brahma due to the lotus, O king, that sprang from the navel of Narayana, this cult was once more declared by Narayana himself, unto the Grandsire of pure soul, the Creator of all the worlds, in the beginning of this Kalpa. The Grandsire gave it in days of yore to Daksha (one of his sons created by a fiat of his will). Daksha, in his turn, imparted it to the eldest of all the sons of his daughters, O monarch, viz., Aditya who is senior in age to Savitri. From Aditya, Vivaswat obtained it. In the beginning of the Treta Yuga, Vivaswat imparted the knowledge of this cult to Manu. Manu, for the protection and support of all the worlds, then gave it to his son Ikshaku. Promulgated by Ikshaku, that cult over-spreads the whole world. When the universal destruction comes, it will once more return to Narayana and be merged in Him. The religion which is followed and practised by the Yatis, has, O best of kings, been narrated to thee before this in the Hari Gita, with all its ordinances in brief. The celestial Rishi Narada got it from that Lord of universe, viz., Narayana himself, O king, with all its mysteries and abstract of details. Thus, O monarch, this foremost of cults is primeval and eternal. Incapable of being comprehended with ease and exceedingly difficult of being practised, it is always upheld by persons wedded to the attribute of Sattwa.

The Hari Gita is another name for the Bhagavad Gita, and as the passage says it encapsulates the teachings of Pancharatra.
Answer:

"Who had the sacred knowledge of Bhagavat Gita before Arjuna?"

May not be the current "Bhagavad Gita" as it is, but at least the core message about Yoga system was told before.

BG 4.1 - The Blessed Lord said I imparted this imperishable Yoga to Vivasvan, Vivasvan taught this to Manu, and Manu transmitted this to Ishavaku.
  BG 4.2 - The king-sages knew this (yoga) which was received thus in regular succession. That Yoga, O destroyer of foes, is now lost owing to a long lapse of time.

Many translators have translated Vivasana as Sun.

"How did they come to know?"

Similar Qn was asked by Arjuna as well:

BG 4.4 - Arjuna said, 'Your birth was later, [whereas] the birth of Vivasvan was earlier. How am I to understand this that You instructed [him] in the beginning?'

Now, Krishna doesn't answer to that directly. But we have to infer from the below verse that, during any of his previous births, Krishna would have departed the knowledge of Yoga to Vivasana.

BG 4.5 - The Blessed Lord said O Arjuna, many lives of Mine have passed, and so have yours. I know them all, (but) you know not, O scorcher of enemies!

Note: All the translations by Gambhirananda
Answer: Who heard the Sacred Knowledge of Gita before Arjuna.? How Bhagawan Shiva and Suryadev knows it.?
Sri Ishwara Gita Chapter 1.:
In badarikashrama, a group of celestial sages were doing penance desirous to know about the atman-tatva. They were all blemishless at heart. They wanted to know about the Brahman.

सनत्कुमारः सनकस्तथैव च सनन्दनः ।
अङ्गिरा रुद्रसहितो भृगुः परमधर्मवित् ॥ १.१६॥
कणादः कपिलो योगी वामदेवो महामुनिः ।
शुक्रो वसिष्ठो भगवान् सर्वे संयतमानसाः ॥ १.१७॥
परस्परं विचार्यैते संशयाविष्टचेतसः ।
तप्तवन्तस्तपो घोरं पुण्ये बदरिकाश्रमे ॥ १.१८॥
"The sages like Sanatkumara, sanaka, sanandana, angira, rudra, bhrigu, kumada, kapila, garga, vamadeva, sukra, vashishtha, and all such sages, whose mind were under control, consulting among themelves, had performed the severe penance at Badarikashrama".
अपश्यंस्ते महायोगमृषिं धर्मसुतं शुचिम् ।
नारायणमनाद्यन्तं नरेण सहितं तदा ॥ १.१९॥
Meaning: - Then they behold the son of Dharma, Narayana who is without begin or end accompanied by Nara.

Then all those sages prayed to those two great personalities with various hymns and offered their salutations to sage narayana. Sage narayana although being aware of the desire of the sages, yet asks them what was their desire.

विज्ञाय वाञ्छितं तेषां भगवानपि सर्ववित् ।
प्राह गम्भीरया वाचा किमर्थं तप्यते तपः ॥ १.२१॥
Meaning: - "Becoming aware of the desire of the sages, the omniscient lord spoke in deep voice, "what for are you performing the tapas (penance)?"".
किं कारणमिदं कृत्स्नं कोऽनुसंसरते सदा ।
कश्चिदात्मा च का मुक्तिः संसारः किंनिमित्तकः ॥ १.२६॥
कः संसारपतीशानः को वा सर्वं प्रपश्यति ।
किं तत् परतरं ब्रह्म सर्वं नो वक्तुमर्हसि ॥ १.२७॥
Meaning: - Who is the cause of this creation? What always moves in the world? What is Liberation? What is main purpose behind this Creation? Who is the lord of Universe? What is Brahman beyond all this? Kindly solve our doubts' requested yogins.

Then Sage Narayana turned Into Lord Vishnu himself and called Bhagawan Shiva secretly through yoga.

एवमुक्ता तु मुनयः प्रापश्यन् पुरुषोत्तमम् ।
विहाय तापसं रूपं संस्थितं स्वेन तेजसा ॥ १.२८॥
विभ्राजमानं विमलं प्रभामण्डलमण्डितम् ।
श्रीवत्सवक्षसं देवं तप्तजाम्बूनदप्रभम् ॥ १.२९॥
Meaning: - Saying thus sages look upon Narayana who appeared in his real form (the form of Sri Hari Vishnu) possessing the excellent lustre. Bearing "Srivatsa" mark on his chest.
शङ्खचक्रगदापाणिं शार्ङ्गहस्तं श्रियावृतम् ।
न दृष्टस्तत्क्षणादेव नरस्तस्यैव तेजसा ॥ १.३०॥
Meaning: - Nara-Rshi became invisible due to the brilliant lustre of Narayana holding Shanka, Chakra, Mace and was accompanied by Devi Lakshmi.
तदन्तरे महादेवः शशाङ्काङ्कितशेखरः ।
प्रसादाभिमुखो रुद्रः प्रादुरासीन्महेश्वरः ॥ १.३१॥
Meaning: - There appeared Lord Rudra known as Maheshwara having crescent Moon on his head.

The sages prayed to Bhagawan Shiva with various hymns.

संस्तुतो भगवानीशस्त्र्यम्बको भक्तवत्सलः ।
समालिङ्ग्य हृषीकेशं प्राह गम्भीरया गिरा ॥ १.३६॥
किमर्थं पुण्डरीकाक्ष मुनीन्द्रा ब्रह्मवादिनः ।
इमं समागता देशं किं वा कार्यं मयाऽच्युत ॥ १.३७॥
Meaning: - On listening to the prayer of all yogins and devotee that Lord Isa possessing three eyes and who is dear to his devotee clasp Vishnu and further told in firm voice 'for what purpose these yogins have gathered here, O Hrsikesha? For what reasons do you require me here, O Achyuta?
आकर्ण्य भगवद्वाक्यं देवदेवो जनार्दनः ।
प्राह देवो महादेवं प्रसादाभिमुखं स्थितम् ॥ १.३८॥
इमे हि मुनयो देव तापसाः क्षीणकल्पषाः ।
अभ्यागतानां शरणं सम्यग्दर्शनकाङ्क्षिणाम् ॥ १.३९॥
यदि प्रसन्नो भगवान् मुनीनां भावितात्मनाम् ।
सन्निधौ मम तज्ज्ञानं दिव्यं वक्तुमिहार्हसि ॥ १.४०॥
त्वं हि वेत्सि स्वमात्मानं न ह्यन्यो विद्यते शिव ।
ततस्त्वमात्मनात्मानं मुनीन्द्रेभ्यः प्रदर्शय ॥ १.४१॥
Meaning: - On hearing the words of Mahadeva, the Janardana then replied to him. O Lord, these yogis and sages are devoid of any sins and since you are the refuge of all ascetics who adores you and are willing to realise your accurate vision. In case, you are pleased with these rishis, then you kindly bestow your divine knowledge on them in my presence. O Siva, only you are well aware about yourself, there is none else who knows you better.

Note.: Sages asked about Brahman and Atman but Lord Vishnu told Bhagawan Shiva to tell about himself in his presence.
As for who else knew this knowledge.:
After giving his sacred knowledge, Bhagawan Shiva left and Lord Vishnu told the sages thus.:
Sri Ishwara Gita Chapter 11.:

नारायणोऽपि भगवांस्तापसं वेषमुत्तमम् ।
जग्राह योगिनः सर्वांस्त्यक्त्वा वै परमं वपुः ॥ ११.१२०॥
ज्ञानं भवद्भिरमलं प्रसादात् परमेष्ठिनः ।
साक्षाद्देव महेशस्य ज्ञानं संसारनाशनम् ॥ ११.१२१॥
गच्छध्वं विज्वराः सर्वे विज्ञानं परमेष्ठिनः ।
प्रवर्त्तयध्वं शिष्येभ्यो धार्मिकेभ्यो मुनीश्वराः ॥ ११.१२२॥
Meaning: - Bhagawaan Narayana too discarding his pArmarthik (Vishnu) form, took the form of yogi (Narayana) and told to all yogins – You all have received the spotless knowledge – which destroys bondage of the world by grace of Parmesthin (Maheshwara). Hence all of you becoming devoid of sufferings, talk this knowledge of Parmeshtin with your righteous disciples.
इदं भक्ताय शान्ताय धार्मिकायाहिताग्नये ।
विज्ञानमैश्वरं देयं ब्राह्मणाय विशेषतः ॥ ११.१२३॥
Meaning: - This knowledge related to Ishwara should be imparted only to calm devotees, righteous person or Agni-hotri Brahmin.
एवमुक्त्वा स विश्वात्मा योगिनां योगवित्तमः ।
नारायणो महायोगी जगामादर्शनं स्वयम् ॥ ११.१२४॥
Meaning: - By saying that, foremost among yogins, that Maha-yogi, viswAtma Narayan himself goes invisible.
तेऽपि देवादिदेवेशं नमस्कृत्य महेश्वरम् ।
नारायणं च भूतादिं स्वानि स्थानानि लेभिरे ॥ ११.१२५॥
Meaning: - All the yogins and sages present there too, prostrating to the Adi-deveshwar Maheshwar and Bhutaadi Narayan, went to their respective place.
सनत्कुमारो भगवान् संवर्त्ताय महामुनिः ।
दत्तवानैश्वरं ज्ञानं सोऽपि सत्यव्रताय तु ॥ ११.१२६॥
सनन्दनोऽपि योगीन्द्रः पुलहाय महर्षये ।
प्रददौ गौतमायाथ पुलहोऽपि प्रजापतिः ॥ ११.१२७॥
अङ्गिरा वेदविदुषे भरद्वाजाय दत्तवान् ।
जैगीषव्याय कपिलस्तथा पञ्चशिखाय च ॥ ११.१२८॥
पराशरोऽपि सनकात् पिता मे सर्वतत्त्वदृक् ।
लेभेतत्परमं ज्ञानं तस्माद् वाल्मीकिराप्तवान् ॥ ११.१२९॥
ममोवाच पुरा देवः सतीदेहभवाङ्गजः ।
वामदेवो महायोगी रुद्रः किल पिनाकधृक् ॥ ११.१३०॥
Meaning: - After that, this divine knowledge was imparted to Samvarta by Sanatkumara, again Samvarta impated the same to his disciple -Satyavrata. Sage Phulaha received this divine knowledge from Sanandana – the yogiswara and again Phulaha imparted the same to Gautama. Sage Bharadvaja – well versed in the knowledge of vedas, received this knowledge from Angiraj. Kapila too imparted this knowledge to Jagisvaya and Pacasikha.  Sanaka gave this divine knowledge to my father Parasara. Valmiki was imparted this knoweldge by Parasara. Earlier, controller of kAla, Rudra- Vaamdeva - the great yogi emerged  out of body of sati,  bestowed this knowledge to me (Vyasa).

This same knowledge of Bhagawan Shiva was transferred to Arjuna by Lord Krishna even though he heard it as Sage Nara but he forgot it due to rebirth as also told in B.G. 4.5.: "The Blessed Lord said, O Arjuna, many lives of Mine have passed, and so have yours. I know them all, (but) you know not, O scorcher of enemies!!!"

नारायणोऽपि भगवान् देवकीतनयो हरिः ।
अर्जुनाय स्वयं साक्षात् दत्तवानिदमुत्तमम् ॥ ११.१३१॥
Meaning: - Hari – the son of Devaki who is also known as Narayan himself transferred this knowledge to Arjuna.
यदाहं लब्धवान् रुद्राद् वामदेवादनुत्तमम् ।
विशेषाद् गिरिशे भक्तिस्तस्मादारभ्य मेऽभवत् ॥ ११.१३२॥
Meaning: - My (Vyasa's) devotion towards the Bhagawaan Girisha begins after I received this knowledge from Lord Vamadeva.
शरण्यं शरणं रुद्रं प्रपन्नोऽहं विशेषतः ।
भूतेशं गिरशं स्थाणुं देवदेवं त्रिशूलिनम् ॥ ११.१३३॥
Meaning: - I have taken the special refuge of that Lord who is supreme refuge of all refugees, Lord of beings, Girisha, sthAnu, Lord of all Lords holding trident in his hands, Rudra.

Vyasa also gave this knowledge to sages and his desciples such as Lomaharsana, Suta, Suka, Vaishampayana, etc and Lord Kurma Vishnu also gave this knowledge to various devas and sages as mentioned in the I.G. itself.
That's how Bhagawan Shiva knows it as it was Originally his knowledge only.
As for Suryadeva.:
Ishwara Gita Chapter 6.:

यो हि सर्वजगत्साक्षी कालचक्रप्रवर्त्तकः ।
हिरण्यगर्भो मार्त्तण्डः सोऽपि मद्देहसंभवः ॥ ६.१०॥
तस्मै दिव्यं स्वमैश्वर्यं ज्ञानयोगं सनातनम् ।
दत्तवानात्मजान् वेदान् कल्पादौ चतुरो द्विजाः ॥ ६.११॥
Meaning: - The Sun-God (Martand) who is also known as Hiranya-Garbha, is witnessing the world, due to him (Sun) wheel of time is moving, that Sun is emerged from Me (Lord Shiva). For the very same reason, O Sages at the beginning of every Kalpa, I bestow upon him the eternal Knowledge of four Vedas and Divine Glories of mine.

So, it is clear that it is Bhagawan Shiva only who gives gita gyan to Sun in every kalpa. This, no question of Kalpa-Bheda.
This was also confirmed by Svetaswatara Upanishad itself.:

"yadaa.atamastaanna divaa na raatriH na sannachaasachchhiva eva kevalaH |
tadaxara.n tat.h saviturvareNyaM praGYaa cha tasmaat.h prasR^itaa puraaNii |" (Svetaswatara Upanishad 4:18).
"When there is complete absence of the darkness of ignorance, then what is experienced is neither day nor night; neither existence or non-existence; only one pure Siva is there; that is indestructible; that is adorable light and god of even Savitar (Sun) also; from that (Shiva) the ancient wisdom proceeded all over the world".

So, Bhagwad Gita is nothing but Ishwara Gita itself. Thus, taking this into account other person who knew this knowledge from the Sun were as follows.:
Sri Bhagwad Gita Chapter 4.:

I instructed this imperishable science of yoga to the sun-god, Vivasvān, and Vivasvān instructed it to Manu, the father of mankind, and Manu in turn instructed it to Ikṣvāku. This supreme science was thus received through the chain of disciplic succession, and the saintly kings understood it in that way. But in course of time the succession was broken, and therefore the science as it is appears to be lost. That very ancient science of the relationship with the Supreme is today told by Me to you because you are My devotee as well as My friend and can therefore understand the transcendental mystery of this science.

Should also add Sanjaya and Dhitrasta to the list as they have also got this knowledge at the same time as Arjuna.
For more info you can check this and this answers of mine.
I hope this clarifies all your queries. Prd..
Answer: The eternal knowledge of Bhagvad Gita was first instructed by supreme lord Krishna  to Vivisvan, the sun god. Vivisvan instructed it to Manu. Manu revealed it to Ikshvaku. So,
Lord Krishna - Vivisvan - Manu - Ikshvaku.
However eventually the chain was broken and the knowledge was forgotten. Through Arjuna, lord Krishna again restored this knowledge on the world.
The Blessed Lord said: I instructed this imperishable science of yoga to the sun-god, Vivasvan, and Vivasvan instructed it to Manu, the father of mankind, and Manu in turn instructed it to Iksvaku.
https://asitis.com/4/1.html
This supreme science was thus received through the chain of disciplic succession, and the saintly kings understood it in that way. But in course of time the succession was broken, and therefore the science as it is appears to be lost.
https://vedabase.io/en/library/bg/4/2/
Shanti parva further elaborates on this confirming that the source of the knowledge is the eternal Narayana ( Vishnu ) himself. Hence as it came from Narayana ( Hari ), the Bhagvad Gita is also known as the Hari Gita.


IE Addin with WebServices under Vista

Question: I have an application that uses Add In Express (a product which creates Internet Explorer Add ons) and it consumes Web Services from within the browser.  It works great under XP however - due to I am guessing Vista security it breaks down. I reference http://www.add-in-express.com/forum/read.php?FID=5&TID=3948&MID=18878&phrase_id=1622760#message18878
I am thinking that to solve this I would need to create a windows service and then roll my own messaging back and forth between that service to actually consume the webservice. After reading about WCF I was wondering if could I use WCF using Self Hosting to consume the Web Services.  Would Vista allow that or would the security prohibit this as well?
Thanks
Mark
Answer: You probably should take some of the information from that link and edit it into your question, so we don't all have to go clicking that link to find out what the problem is.

IE Addin with WebServices under Vista


Jhipster: hide entities from non-admin

Question: Greetings java hipsters!
I just generated a jhipster project and created some entities. I'd like to hide some entities by restricting them to only the admin user.  How do I achieve this ?
Thanks!
Answer: First read Spring Security doc then look at your project source code that was generated by JHipster: it's full of such examples, pay attention to:

SecurityConfiguration.java
@Secured(AuthoritiesConstants.ADMIN) in UserResource.java

Then for the angular part, you can add a requirement for admin role in a state's definition like in src/main/webapp/app/admin/configuration/configuration.state.js (search for authorities: ['ROLE_ADMIN']). So for a bank-account entity, main state would be defined in src/main/webapp/app/entities/bank-account/bank-account.state.js.
This is for JHipster 3.x
Comment: One more thing: To hide the entities from menu, look into navbar.html - hiding from non-admins is already implemented there for some of the menu items. All you need to do is adding
    has-authority="ROLE_ADMIN"
to the menu element.
Comment: thank you so much, that answer is very helpful
Answer: I just describe how i blocked new entity("folder") on a bit more fresh version (JHipster 4.7.0):
to block access to endpoint I added new line in a file: src/main/java/package path/config/SecurityConfiguration.java:
.antMatchers("/api/profile-info").permitAll()
.antMatchers("/api/folders").hasAuthority(AuthoritiesConstants.ADMIN) //new line
.antMatchers("/api/**").authenticated()

change src/main/webapp/app/entities/folder/folder.route.ts:
 data: {
    authorities: ['ROLE_USER'], // old
    authorities: ['ROLE_ADMIN'],// new
    pageTitle: 'jmediaApp.folder.home.title'
 },

and to hide item from navbar you need to add *jhiHasAnyAuthority="'ROLE_ADMIN'" in
 tag in /src/main/webapp/app/layouts/navbar/navbar.component.html:

Answer: On the Gateway UI By Using react.js server following process can be followed.

Open src/main/webapp/app/app.tsx which contains all routing mechanism. Check the component
on mapStateToProps there is a function by the name isAdmin to check if the logged-in user is an admin. (Change this according to your ROLE. I am using ROLE_ADMIN so I left as it is.)
Go to src/main/webapp/app/shared/layout/header/header.tsx. This file contains all the navigation to the entities under <EntitiesMenu > component. pass the isAdmin prop to the EntitiesMenu component as <EntitiesMenu admin={props.isAdmin} />
Now Go to src/main/webapp/app/shared/layout/menus/entities.tsx change the respective path to
{
     props.isAdmin && (
         <MenuItem icon="asterisk" to="/entity/institute">
            <Translate contentKey="global.menu.entities.institute"
            />
         </MenuItem>    )
}
This helps in hiding the navigation links.
But if the user enters the specific path on the browser url, There is no validation on that. So change src/main/webapp/app/entities/index.tsx from <ErrorBoundaryRoute ../> to

<PrivateRoute path={${match.url}/institute} component={Institute} hasAnyAuthorities={[AUTHORITIES.ADMIN]} />
After this even if the user open the URL by mentioning it in the browser search bar, Jhipster validates if the user has got the role or not. If not simply access denied page will be shown.

Jhipster: hide entities from non-admin


Upgrade Problem with 12.04

Question: I want to upgrade from ubuntu 12.04, but the update manager doesn't show me that any upgrades are available. What do I do?
Answer: You may follow this documentation : http://www.ubuntu.com/download/desktop/upgrade
In your case since you are under 12.04, I think you will have to dist-upgrade twice... So you may consider a clean install. I mean, backup your system (system and data partitions), in case something goes wrong and you want to get back to your actual configuration. Download Ubuntu 13.04 an install it... If you have 2 partitions '/' and 'home' you can re-use them during the installation. You just have to tell the installer that you don't want to format your 'home' partition so only you system will be re-install. If everything goes well you will recover you data and don't even need your backups. The only thing you will have to do is re-installing and configuring your system.
You could save the list of your installed package and restore it with this command :
dpkg --get-selections > packages.txt
Once your new install is done you can restore your packages like this :
dpkg --set-selections < packages.txt
Forgot you will need these commands after the precedent to effectively restore your packages (installed them) :
aptitude install
apt-get -u dselect-upgrade
Reference about get-selections : Restoring all data and dependencies from dpkg --set-selections '*'
Richard

Upgrade Problem with 12.04


How to analyze the file activities due to process?

Question: I need to analyze the file i/o operations caused due to a process.
So I would like to know, which all files are affected by this program. Is there a tool for this particular use case?.
One of our debugging for a slow URL processing got the culprit being the file being read each time a URL was processed by the system. So I would like to get recommendations for a tool which would monitor the file activities per process.
Any suggestions?
Answer: You can use lsof with the -p flag, like this : lsof -p $PID .
Answer: mainly you use ps for evaluating the pid of the process and use the proc filesystem to see the used files by the specific process.
https://www.cyberciti.biz/faq/howto-linux-get-list-of-open-files/


Why do low-rated comments not appear with a high quantity of comments?

Question: I'm curious as to why, when there are many comments on an answer on SE sites, the comments shown aren't the most recent ones but the ones with the highest ratings. I understand the principle that the highest-rated comments are (supposedly) the ones that you want to see. But I find the system disruptive when reading comments, especially when people have written replies to someone whose comment is invisible until you click "Show more comments". I would prefer a system where the x newest comments were displayed, where x is some reasonable number, probably the same amount of comments that are displayed normally. Why is the current system better?
Comment: This is an appropriate place for this question and I strongly doubt it will be closed (unless there is a duplicate). As this is your first meta question I should let you know that votes here can mean agree/disagree so if it is downvoted then don't take it personally. Personally I see where you're coming from. Especially on the replys to hidden comments bit
Comment: Understood. I did find a question - probably on meta SO - asking why comments were hidden but not why the particular system of comment hiding is in place, but annoyingly I can't find the question again.
Comment: I think I may have misread your request;  if there are 100 comments on a post are the most recent 5 displayed or the oldest 5
Comment: Hm. I realise I hadn't actually thought of that. I think the oldest 5 is probably the best.
Comment: Ah I had misunderstood you. What's so special about those 5? If you're going to do that you may as well show none by default
Comment: It's my fault, I wasn't specific enough. If you mean what's so special about the number 5, then I don't know: it could be more or less, it just seems like a good number. Comments are already shown selectively - to me it seems only logical that this should be done in the order they were posted, without comments excluded because they have low rep.
Comment: no I mean the oldest 5, rather than the newest 5, or 5 from the middle. Or a random 5
Comment: Actually, the newest 5 makes sense. If there is an extended discussion in comments, you want to see the most recent posts because those will be the ones you reply to. And yes, I'm being somewhat arbitrary.
Comment: Now that I can get behind. I still prefer my hybrid approach but the newest 5 could quite often make sense
Answer: I definitely agree with a lot of what you're saying here. Especially out of context highly upvoted replies being basically useless without seeing what they are in reply to. That said often these highly upvoted comments are useful just on their own and if there are twenty of thirty comments on a post then it can make sense to just see those.
So I would propose a best of both worlds modification

Comments are always in order, no matter what (as in the current system
Comments are more likely to be shown if they are upvoted.
Comments are more likely to be shown if they are newer.
Comments are more likely to be shown if they are replied to by a comment that is shown [may not be technically possible as usernames change but comments don't].

This has the benefit of showing simultaneously things which have high relevance currently and also showing things which are marked as important.
Comment: I don't know that I agree, though I won't downvote. Though it wouldn't be hard for someone to implement, I don't see why it needs to be so complex. What's wrong with simply displaying the first five or so comments, as Facebook does on comment threads?
Comment: @Leo because facebook is much more linear. Important comments are likely to remain important
Comment: Okay, but again, why does it need to be so complex? I'd far rather a single criterion - newest first, oldest first, most votes - was used instead of weighing a mix of criteria.
Comment: @LeoKing To be honest out of those I'd strongly support the current system; most votes. Those posts are clearly marked as being the most important. The added complexity is trying to accomodate your legitimate points regarding hidden replys and new posts also being likely to be relevant
Comment: I don't understand how that would be more complex. The system already accommodates hidden replies and new posts. If anything it seems less complex: rather than selecting which comments to hide, the process is indiscriminate. I think this makes comments far more readable.
Comment: @LeoKing I'm confused again, when you say "that" which system do you mean. The system as it is now, the system you propose or the system I propose
Comment: Sorry, I meant that I don't know how the system *I* propose would be more complex than the system as it is now.
Comment: @Leo Ah thats why I was confused.  I'm not saying it would be more complex.  I'm saying it wouldn't be as good
Comment: let us [continue this discussion in chat](http://chat.meta.stackexchange.com/rooms/728/discussion-between-leo-king-and-richard-tingle)


Are there better tires for heavy riders?

Question: I have upgraded the backwheel on my hybrid bike to one suitable for a 285 pound rider. Are there tires suited for 285 pound (130 kg) riders?
Comment: How heavy? I suggest looking at tyres for touring and/or tandem use. I think this has been covered in some detail here before.
Comment: Given @Criggie's comment about winter use, I'd still stick with the marathon series: [the 26x2.0](https://www.schwalbe.com/en/spike-reader/marathon-winter.html) for example, is rated to a load of 105kg per tyre (230lbs).  That should be plenty even with around 2/3 your weight on the back wheel (just don't do any wheelies!) This doesn't really change things compared to the linked question
Comment: A touring tire with the largest diameter your bicycle will take.
Comment: I think you will require snow/ice studded tyres more, given this fatbike was for winter riding.
Comment: Acknowledged I edited heavy and substituted 285 pounds. These tires are for my Yorkville hybrid which is ridden three seasons. The fatbike didn't work out.
Answer: I would go as wide as your frame and fork will allow. The increased volume will support the weight better than a skinnier tire at higher pressure.
Answer: As suggested I am going with touring tires for my Norco hybrid.
A Schwalbé Marathon supreme on the back and a Schwalbé Marathon supreme on the front.
Answer: My suggestions would be go for the broader ones with advanced polymer (synthesised ones) with larger tread blocks for a better grip on the roads.
Comment: The usual thought is that tread does nothing on a plain flat road.  Tread with blocks actively decreases the road contact surface area while increasing the pressure on the blocks, and larger (ie taller) blocks contribute to sideways squirm when cornering.  Even siping on the tyre does nothing because a bike tyre is a lot thinner+rounder than a car tyre and cannot aquaplane at human speeds.


How could we extend Kuramoto Model to Arbitrary Dimensions?

Question: The generalised version of a theory describing synchronisation in an ensemble shows that coherence arises differently depending on whether number of dimensions is even or odd.  But how could you extend the Kuramoto model to arbitrary dimensions?
Comment: The original Kuramoto model where each of the oscillators ($i=1 \cdots n$) phase ($\theta_{i}^{}$) coupled to other oscillators phases in the same way i.e., $\dot\theta_{i}^{}=\omega_{i}^{}+\frac{g}{n}\sum_{j=1}^{n}\sin[\theta_{i}^{}-\theta_{j}^{}]$ doesn't carry any information of dimensionality as it should be clear. Did you mean some variant of form for example, $\dot\theta_{i}^{}=\omega_{i}^{}+\sum_{\text{conditional}(j,i)}^{}g_{ij}^{}\sin[\theta_{i}^{}-\theta_{j}^{}]$ defined on some lattice (which certainly has dimensionality aspect).
Answer: I read an article on it. I will show about it.
Devised in the 1970s to describe synchronization among interacting oscillators, the Kuramoto model has become critical for understanding complex dynamics in systems of interacting entities, such as magnetic dipoles or neurons. Though it has been applied to many disparate fields, the classical version is restricted to interactions that can be described with just two dimensions. By extending the model to three dimensions and more, and by accounting for variation in the tendency of each agent to remain independent, Sarthak Chandra and colleagues at the University of Maryland, College Park, have discovered an unexpected result: The way in which a system achieves coherence—a measure of the degree of synchronization—depends on whether its number of dimensions is even or odd.
In the classical Kuramoto model, the transition to coherence is continuous and begins when the coupling strength between individual components reaches a certain positive threshold. Its 3D generalization, in contrast, shows a sudden, discontinuous transition as soon as the coupling strength rises above zero. When the team extended the model to higher dimensions, they found that all even-dimensional systems show the same behavior as the classical case, while the discontinuous transition occurs for all odd-dimensional systems.
Despite the application of the Kuramoto model to systems as diverse as neural networks, magnetic spins, and consensus-building within societies, its restriction to two dimensions meant that it couldn't describe some interesting phenomena. By extending the model, Chandra and colleagues have made it more relevant to realistic cases of flocking behavior, like that of animals or drones arranging themselves in 3D space. Future developments will include more variables characterizing the relationship between a given individual and its neighbors, such as distance or relative orientation.


Monitoring hardware failure on HP DL servers

Question: Are there any tools other than the HP provided ones for monitoring component failures in these server from RHEL5?
Answer: HP's hardware hooks are themselves proprietry but they do expose their instrumentation via a number of 'open' methods such as SNMP/WMI/WBEM etc. So you don't HAVE to use SIM/SMHP.
Answer: The HP ASM tools & SNMP OIDs are what we mainly use for general component monitoring....
Alternatively, you can also use smartmontools to monitor the disk drives and most of the sensors should show up in lm_sensors
Answer: You should install HP's full complement of tools, hpasm/hprsm packages, etc. They are literally the hardest packages to install I have ever seen. It seems they were written by people with no concern for ease of deployment. They provide a shell script you can run by hand, use this at first until you figure out how to hack that script, write a wrapper, install the RPMs individually, or lean or the vendor to behave reasonably.
You should monitor syslog for the errors from these tools.
You should parse hpasmcli (show server, show dimm) and hpacucli (controller all show, then for each controller slot=X pd all show) output to identify failures. If you rely on the syslog reporting, you will miss failures and have embarrassing disasters.
You should parse hplog output as well, and clear the output after checking it, archiving this output somewhere. Consider this a redundant check to the hpasmcli/hpacucli checking.
You should use hponcfg to make sure the ILO is configured, and connect to it to make sure it is actually responsive.
Make sure you can upgrade firmware, and do so regularly. HP releases critical firmware upgrades, for example that turn a crash from a minor memory error without identifying the bad DIMM into a fault light. HP changed my opinion about upgrading firmware when it is not absolutely required. (Well, it -is- absolutely required, you just have no one telling you so).
Give up on the SNMP stuff. You have a lot of work to do, this is just additional work that will not give you the full functionality you need, so that you will still have to do the other work.
The HP servers are still the best Intel servers with respect to reporting/managing hardware issues. They just have certain extremely annoying issues. Perhaps if every customer complains at least once they will make deployment easier. There's just no excuse for this.
A DL3[68]0 G5 running RHEL5 and constantly monitored HP management tools along with occasional stress tests of disk and memory will be the most reliable Intel solution on the market. Just do your diligence to make sure you get your money's worth. HP provides you the tools, they just don't make them as easy to use as they should.
Only use HP RAM. It's just not worth the trouble otherwise. You don't need vendors pointing fingers at each other when a DIMM has a fault light go on.
Do a datacenter walkthrough for fault lights regularly and use this to correct failures in your monitoring scripts. This is how I learned that syslog is barely useful and you must check hpasmcli/hpacucli regularly.
Comment: Thanks for your reply. The tools provided by HP are indeed painful. Hence my initial question :)

I suppose I'm just going to have to bite the bullet and script alerts and metrics using the provided HP tools.
Comment: I typically leverage the email trap alert feature in the cma.conf file to forward hpasm traps to a monitoring email address. This works great on standalone systems. For larger deployments, I'll use that and an application like OpenNMS for SNMP monitoring.


Can we pray with make up on?

Question: Sometimes we do make up in some occasions or for other purposes, or in front our husband. In this case, can we pray with make up?
Comment: @0aslam0 if possible try to post an answer
Comment: https://islamqa.info/en/72390
Comment: Also related [hanafi] : http://islamqa.org/hanafi/qibla-hanafi/36024
Answer: Judging from online fatawa (below), this is ordinarily acceptable.  Some concerns arose:

the purity of the makeup,
the makeup possibly invalidating wudu, and
the possibility of wearing makeup in front of non-mahram men.

Islam Q&A fatwa Is a woman's prayer wearing make-up considered permissible?:

It should be noted that it is not permissible for a woman to wear makeup in front of non-mahram men, because she is commanded to cover her face in front of them and because wearing makeup is an adornment that leads to fitnah. If she does that and then prays, she will have the reward for her prayer but she will have the burden of sin for tabarruj (wanton display).

See also Praying with nail polish and Types of make-up that affect wudoo and ghusl.
IslamWeb fatwa Praying wearing makeup and nail polish:

A woman can pray with her makeup and nail polish in her house or in any other place where no alien man can see her. But if she needs to make Wudu or bath (Ghusul) then she has to remove only that makeup or nail polish which stops water from reaching her skin. --

See also Praying while wearing make-up, IslamWeb.
Qibla.com fatwa Can I pray with makeup on, sourced from IslamQA.org:

You can pray with make-up on if you are sure that it is pure. Since some make-up products contain impurities, you need to make sure that the one you put on does not contain any impure ingredients.

Qibla.com fatwa I made wudu and applied lipstick, sourced from IslamQA.org:

It is valid to pray with lipstick or other make-up on, if one has applied it after having made wudu, because water would have reached the skin and lips.

MuftiOnline.co.za declared someone's prayer valid after performing wudu with light makeup.
Seekers Path fatwa [Q-ID0113] Women wearing makeup when performing Salah:

Yes, it is allowed to pray your salah whilst wearing makeup, provided the wudu and ghusl was performed correctly.

Islam Helpline Prayer in Makeup and nail polish:

There is absolutely no harm if a believing woman wishes to offer her prayers in her full make-up, provided she is completely covered as is the command of adornment in prayer for women.

Can we pray with make up on?


How can I compress images that have 25mb size and then convert them to pdf?

Question: I have a physical catalog of wallpapers. I took pictures of each and want to convert them into pdf to share over WhatsApp. Each catalog has about 80 images and each one is about 25mb in size. How can I compress it down so that I can fit about 70 or 80 images into a single pdf?
Or is there some website I can use where can I put my catalog of images into a book form and then share the link on WhatsApp?
Comment: Do you have an image editor? A PDF creator/editor?? What you want can be done quite easily if you have the tools.
Answer: A very simple and completely free method would be to use a word processor such as LibreOffice Writer. Once you've created your document, export as PDF. Choose JPEG compression, set the Quality to 70% (the lower the number the more compression will be added), and reduce the resolution. Something like 150dpi should be fine for on-screen viewing, in fact you may get away with even less if required.
Comment: It is unclear from the screencap, but I assume that the 150DPI check box refers to the source/stored image rather than the effective PPI. This matters if 75 images are "larger than the page size" and the remainder are "half the page size" but scaled to fill the page. Any loss in quality may not be apparent for the former, but the latter may suddenly look blurry. **If** the OP sees that happen, then this is probably why.
Answer: Get a layout design program such as InDesign (high cost, but popular) or Affinity Publisher (low cost, tries to be an alternative for InDesign)  or Scribus (freeware)
Make your design. The design file has only links to the image files, it can well handle your images.
Export or print as PDF. You can select the actual resolution and compression of the photos in the resulted PDF. At least InDesign has perfect export presets for PDFs which are intended to be watched on the screen.
The mentioned programs are complex because they must cover complex layouts with detailed typesetting and different color profiles. Prepare to spend a day with tutorials before you get anything useful even for onscreen watching.
Learning to make impressive layouts is another problem. Knowing program tricks isn't the same thing as artistic ability and experience in creative work.
There's also simpler programs which can do the job such as MS Word, Publisher or Powerpoint or their freeware counterparts - Open Office, for example. They cannot be used for detailed print layout work due limited typography capabilities and other limitations in color and layout possibilities, but they can be enough for your purposes. Try them!
Finally: There's several online photo collage making websites. You select the photos, the website makes the collage (and maybe gets your photo- read the terms!). A little different thing is that commercial photo book printers offer their layout design programs for making printed books. Some of them output also PDFs. I guess (never used one) you must pay for it as much as for printed book.


Fire Walkers critical hit

Question: My Fire Walkers burn the ground I walk on, dealing 100$ weapon damage to enemies within a radius. Can the boots do critical hits? If so, is the crit damage based off your normal damage or the damage the boots do (in this case 100% so it would be the same thing)?
Answer: I do not own a pair, but there seems to be a consensus online that they cannot crit:
On Battle.net:

They don't crit or proc LoH :/

On Reddit:

dismiss companion and stand right next to mobs, you will always get the same number. it doesnt crit

You can test it yourself though: equip the boots, and dismiss any other buff/skill/item that damages mobs. Run around and watch the damage, and see if it ever changes.
Answer: I had a pair of Fire Walkers previously on my character (I use Lut Socks now), and I can 100% confirm that the proc on them DOES NOT crit at all.

Fire Walkers critical hit


Neural Networks - Loss and Accuracy correlation

Question: I'm a bit confused by the coexistence of Loss and Accuracy metrics in Neural Networks. Both are supposed to render the "exactness" of the comparison of $y$ and $\hat{y}$, aren't they? So isn't the application of the two redundant in the training epochs? Moreover, why aren't they correlate?
Answer: Log loss has the nice property that it is a differentiable function. Accuracy might be more important and is definitely more interpretable but is not directly usable in the training of the network due to the backpropagation algorithm that requires the loss function to be differentiable. When your preferred loss is not directly optimizable (like the accuracy) you use a loss function that behaves similarly to proxy the true metric. In case of binary classification you would use a sigmoid at the end and a log loss to approximate accuracy. They are highly correlated.
Answer: Yes, they both measure the exactness of y and y_hat and yes they're usually correlated. Sometimes the loss function might not be accuracy but you're still interested in measuring the accuracy even though you're not optimizing it directly. Google's TensorFlow MNIST example minimizes/optimizes cross entropy loss but displays accuracy to the user when reporting results, and this is completely fine.
Sometimes you don't want to optimize accuracy directly. For example, if you have serious class imbalance, your model will maximize accuracy by simply always picking the most common class, but this would not be a useful model. In this case entropy / log-loss would be a better loss function to optimize.
Comment: More importantly, accuracy is a not a differentiable function so you cannot backpropagate through it.
Comment: @Hendrik yes you can, just create a `def your_own_metric(y_true, y_pred)` function and pass it to `model.compile(..., metrics=[your_own_metric])`
Comment: @JanvanderVegt Yes, that's a great point
Comment: I learnt that in Keras I can put a "custom" evaluation metrics (by custom in this case I mean that no built-in implementation in Keras, like AUC or F1-Score) in the compilation function. I presume that in this case this "custom" metrics will be used/displayed instead of Accuracy everywhere where `show_accuracy` parameter is set to True (like at fitting or in evaluation). Is that correct?


Where are these BIONICLE sets?

Question: I'm from Norway and I wonder why BIONICLE sets creature of jungle and stone are nowhere to be found around here.
Answer: I'm not sure why you say "are nowhere to be found around here" - perhaps you mean Brick & Mortar stores? Both these BIONICLE sets are available from the Norwegian shop.lego.com site:

Where are these BIONICLE sets?


Gravatar: How do I know if a user has a real picture

Question: I have gotten the gravatar service working on my site. But I would like to know if the user has uploaded their picture or not. Is there a way to know this?
Answer: When constructing the URL, use the parameter d=404. This will cause Gravatar to return a 404 error rather than an image if the user hasn't set a picture.
If you're using the .Net control linked to from the gravitar site, you'll need to modify the IconSet enumeration (and probably pull the code out of the control, so you can get at the status directly).
Comment: That's a much cleaner answer than all the rest.  Like it - pays to read the documentation it would seem.
Comment: Once you have the 404 how do you turn this into gravatar = false?
Comment: @woodenfox not sure what you mean?  You should probably ask a fresh question.
Comment: @AndrewAylett Hi I have this same issue using java even i was a gravatar user , it;s always return 404 response code.
Answer: What I did:

Generate a gravatar with a non-existing e-mailadress
Save the image
Make a MD5 checksum of the images contents and store it as a constant in your app code

After that I did this for every gravatar request:

Download the gravatar image
MD5 checksum the contents and compare it against the constant
If it matches it's the default image, if it doesn't it is a custom image

I also cached the gravatar image for 24 hours so you don't have to rely on gravatar all the time. Optionally you can put the first 3 points in a function and let it run once in a while to ensure that gravatar still uses the same default image allthough they haven't in at least the last couple of months (propably never).
Comment: MD5 checksum is a MD5 hash of the complete content of the file;
Code snippet for C# here: http://sharpertutorials.com/calculate-md5-checksum-file/
Comment: The chosen answer is way better but this trick is useful in some cases. For example in Javascript on a web page or browser extension if you don't want your browser to log a "404 not found" error in developer tools.
Answer: In PHP:
function hasGravatar($email)
{
    return (md5(file_get_contents(sprintf('http://www.gravatar.com/avatar/%s?default=identicon&size=32', md5($email)))) == '02dcccdb0707f1c5acc9a0369ac24dac') ? false : true;
}

Comment: What do you class as the "default" image? If a user has not explicitly set an image, they get an image based on the identifier passed to Gravatar, so the "default" image returned will be different for every user. Try it with http://www.gravatar.com/avatar/aaa?default=identicon and http://www.gravatar.com/avatar/aab?default=identicon - the images are different. Andrew Aylett's solution works best as it will return a 404 error in every case.
Comment: @Luke101: Don't know, and I'm still giving the first steps in C#. Sorry.
Comment: Why the equality check to 02dcccdb0707f1c5acc9a0369ac24dac?
Comment: @adrianbanks: That's the md5 of the 32px default Gravatar image.
Answer: In C#, based on the PHP code posted earlier (untested - pre-lunch source code follows):
using System;
using System.Text;
using System.Security.Cryptography;
using System.IO;
using System.Net.WebClient;

public string GenerateMD5(string plaintext)
{
    Byte[] _originalBytes;
    Byte[] _encodedBytes;
    MD5 _md5;

    _md5 = new MD5CryptoServiceProvider();
    _originalBytes = ASCIIEncoding.Default.GetBytes(plaintext);
    _encodedBytes = _md5.ComputeHash(_originalBytes);

  return BitConverter.ToString(_encodedBytes).ToLower();
}

public string file_get_contents(string url)
{
    string sContents = string.Empty;

    if (url.ToLower().IndexOf("http:") > -1) {
        System.Net.WebClient wc = new System.Net.WebClient();
        byte[] response = wc.DownloadData(url);
        sContents = System.Text.Encoding.ASCII.GetString(response);
    } else {
        System.IO.StreamReader sr = new System.IO.StreamReader(url);
        sContents = sr.ReadToEnd();
        sr.Close();
    }

    return sContents;
}

public bool hasGravatar(string email)
{
    string _mailMD5 = GenerateMD5(email);
    string _url = String.Format("http://www.gravatar.com/avatar/{0}?default=identicon&size=32", _mailMD5);
    string _fileMD5 = GenerateMD5(file_get_contents(_url));

    return !(_fileMD5 == "02dcccdb0707f1c5acc9a0369ac24dac");
}

Answer: I'm currently doing something similar. I have a table setup for users profiles and in that table I have one column called Avatar. This is where a Gravatar URL will be stored. The following code is what I use to manage this column.
// first gather the email address that is going to be associated with this user as
// their gravatar.
// once you have gathered the email address send it to a private method that
// will return the correct url format.
protected void uxAssocateAvatar_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
    string emailAddress = uxEmailAddress.Text;
    try
    {
        Profile.Avatar = GetGravatarUrl(emailAddress);
        Profile.Save();
        Response.Redirect("Settings.aspx", true);
    }
    catch (Exception ex)
    {
        ProcessException(ex, Page);
    }
}
}

// use this private method to hash the email address,
// and then create the url to the gravatar service.
private string GetGravatarUrl(string dataItem)
{
    string email = dataItem;
    string hash =
        System.Web.Security.FormsAuthentication.
        HashPasswordForStoringInConfigFile(email.Trim(), "MD5");
    hash = hash.Trim().ToLower();
    string gravatarUrl = string.Format(
       "http://www.gravatar.com/avatar.php?gravatar_id={0}&rating=G&size=100",
        hash);
    return gravatarUrl;
}

// on the page where an avatar will be displayed,
// just drop in an asp.net image control with a default image.
<asp:Image ID="uxAvatar" runat="server" ImageUrl="~/images/genericProfile.jpg"
AlternateText="" CssClass="profileAvatar" BorderWidth="1px"/>

// and on page_load or something like that,
// check to see if the profile's avatar property is set
if (Profile.Avatar != null)
{
    uxAvatar.ImageUrl = Profile.Avatar;
}

// by default the profile's avatar property will be null, and when a user decides
// that they no longer want an avatar, the can de-associate it by creating a null
// property which can be checked against
// to see if they have one or don't have one.
protected void uxRemoveAvatar_Click(object sender, EventArgs e)
{
    Profile.Avatar = null;
    Profile.Save();
    Response.Redirect("Settings.aspx", true);
}

This seems to work out pretty well for me. I always have a default avatar showing, and when a user actually wants to have their custom avatar displayed, they associate their Gravatar email (which I hash and never store as email address) which creates a URL which I can just drop in as a imageURL. When the user removes their gravatar link, I null out the database column and the imageURL goes back to my default image.
Good luck, and hope this helps you some.
Answer: private bool HasUserPublicGravatar(string email)
    {
        try
        {
            var gravatarPath = GravatarService.GetGravatarUrlForAddress(email,
            new GravatarUrlParameters { DefaultOption = GravatarDefaultUrlOptions.Error });

            WebRequest wReq = HttpWebRequest.Create(gravatarPath);
            var wRes = wReq.GetResponse();
            return true;
        }
        catch (System.Net.WebException ex)
        {
            if (ex.Message.Contains("404"))
                return false;
            else
                throw new Exception("Couldn't determine if ueser has public avatar");
        }
    }

Answer: function get_gravatar( $email, $s = 80, $d = '404', $r = 'x', $img = false, $atts = array() ) {

$url = 'http://www.gravatar.com/avatar/';
$url .= md5(strtolower(trim($email)));
$url .= "?s=$s&d=$d&r=$r";

if ( $img )
{
$url = ' $val )
$url .= ' ' . $key . '="' . $val . '"';
$url .= ' />';
return $url;

}

$headers = @get_headers($url);

if (!preg_match("|200|", $headers[0]))
{
$has_valid_avatar = 'no';
}
else
{
$has_valid_avatar = 'yes';
}

return $has_valid_avatar;

}


Any opensource equivalent of virtual center?

Question: We got 10 ESXi hosts running. We don't have budget for Virtual center licenses. Is there some free tool that just gives us consolidated view of all VMs with poweroff and poweron options for each VM.We don't need Vmotion, all other stuff.
Thanks
Answer: It's not a GUI, but I know libvirt is able to talk to ESX machines.
Answer: VMware Go allows you to do some fairly limited ESXi centralised management. There are some compromises and none of the advanced features (no cloning, deploying VM's from templates and VMotion\DRS\HA etc are totally out) but it does provide a single console for powering on\off and some other basic functions. The main drawback is that it is a cloud service.
Answer: I believe the current version of Microsoft Virtual Machine Manager will allow you to administer (power on/off) VMware images. Of course it's not free - but you can demo it for 100+ days, during which time something better/cheaper may come along. Runs on Windows Server 2008.
Answer: On the libvirt page, there are a list of applications that leverage libvirt.  Some of them may solve your problem either collectively or individually.
Answer: The facilitites you describe are all accessible via ssh on ESX.
While its technically possible to use libvirt (with additional software on top) this will be a painful process.
If you can't afford the components to make VMWare workable for you, why are you using VMWare? You might consider migrating to Proxmox. I moved my employers onto Proxmox from Simplivity (VMware with added secret sauce) not to save money (which it did) but because of the stability and functionality benefits.
Answer: I know this thread is quite old, but since i had a very similar need (on  both Vmware ESXi and Microsoft Hyper-V) I started developing an open source very basic alternative.
The project is gCenter, an opensource project on GitHub that run on every LAMP server (also on linux on arm).
Github public link : https://github.com/gcaglio/gCenter
Here some of the feature actually implemented.
Vmware ESXI
take vm snapshot
list esxi information (software, hardware, etc)
list vm for each esxi host
check vm cpu and memory statistics/graphs
list datastore for each esxi host
list and take vms snapshots
list datastore content (filesystem tree)
list vswitch/portgroup informations
list network interfaces and porgroup assignation
Micrososft Hyper-V
hyperv-wmi-http-adapter-service windows service to interface WMI
collect hosts informations
collect vms informations
poweron/poweroff vms
taking vms snapshots
listing vms snapshots
check vm cpu and memory statistics/graphs
hope this helps.
Answer: Convirture is probably exactly what you're looking for - the OpenSource version is free, if you get to the point where you feel you have want to spend some money, they have a couple of commercial products Convirture Enterprise & Convirture Enterprise Cloud.
Only problem is that Convirture currently does not support ESX (AFAIK) - only KVM and Xen - maybe you should reconsider your Hypervisor choice and go all open source.
Comment: Doesn't sound like a good fit, since it doesn't support ESX.


Is it possible to hide wallet address with ZK proofs

Question: We are working with zk contracts on partisia blockchain, so out of curiosity I want to hide the senders address while sending a transaction.
Consider a case where we are minting NFTs anonymously, if the user who has to mint the nft has to do it by sending a transaction, their address would still be stored on chain. Contradicting the anonymity.
Could there be any way around?
Answer: I have no idea what is Partisia blockchain, but I assume it's EVM based, since you're on this forum asking about it.
Since it's an EVM, it has quite limited possibilities for privacy. Transactions always have a clear sender, for example.
If you do not want to modify the blockchain protocol itsels (which would be a huge undertaking), you can't hide stuff like transaction sender.
But that doesn't mean that you are fully out of luck. You can utilize some sort of indirect obfuscation, similar to Tornado Cash. So users send something to a common contract which then, after a delay, issues the real commands to mint an NFT. And then the NFTs are given to new fresh addresses controlled by the original senders.
So even without direct ZK privacy you can still use ZK to achieve something similar, even if it means a bit less user friendly approach.


Can I go after my employer for false promises? New Jersey

Question: I work for a wireless retailer and at the time of Black Friday me and my co-workers were told from the 11/22 - 11/25 we would be  receiving commission for the stores sales. For my store it's only me and someone eles but we sold a total of 99 phones so I would get paid for 99 phone sales and the other guy would get paid for 99 sale
But a week before I would get that paycheck my manager told me
They changed their minds and we were just getting commission for our sales i experience this to my higher ups and got nothing so I'm trying to see if I have a case here?
Comment: What documentation do you have for the commission?  Make sure you have a copy outside company control.
Comment: I do have proof of the of the sales from that time frame the 11/22 - 11/25 and for them telling us about the sale I don't it in writing but I do have text from my manager stating me having a problem with the Black Friday sale commission and text from my co-workers about the what was stated during the time we were told about commission for the sale
Answer:
Can I go after my employer for false promises? New Jersey

Yes, to the extent that the employer is withholding commissions that had been agreed upon. The employer cannot unjustifiably change his mind after the fact (the sales). See here the legislative text of the New Jersey Payment of Wages law.
I am not knowledgeable of N.J. law and court rules, but beware that you might have to do what is known as exhaustion of administrative remedies by filing your complaint or grievance with the Commissioner of Labor (or the state Department of Labor) instead of filing a complaint in court.
Additionally, the situation you describe sounds in the torts of unjust enrichment (given the sales you made during that period), and breach of contract. See Vaughan v. Siegel, No. A-4681-16T2, Sup. Ct. of N.J., Appellate Division (Dec. 24, 2018):

A claim for additional wages is a breach of contract claim, which is
  subject to a six-year statute of limitations. Troise v. Extel
  Commc'ns, Inc., 345 N.J.Super. 231, 237 (App. Div. 2001); see also
  N.J.S.A. 2A:14-1.


SQL Server: EDI to XML Data Conversion

Question: I need to do the data conversion from EDI format to XML.
is there any step by step tutorial, links about what are the processes on data conversion?
How to convert from EDI to XML, step by step guide?
I highly appreciate your help.
Thanks
Answer: That's a very complicated question.
First, the short answer: Use a commercial product (an EDI translator/mapper).
For a longer answer, there are several different EDI standards:

UN/EDIFACT
ANSI ASC X12
Several others (see the EDI link above).

There's also the question of whether the EDI is in binary or XML format. Since you're trying to convert it to XML, I'll assume the former. (If it's already in XML format, schemas are available for X12 at least.)
Parsing binary EDI is non-trivial. Dealing with other interchange requirements (such as Functional Acknowledgments), combined with the necessity of having a three-inch-thick standards book on your desk to look up all the segments and elements for one version of one standard implies favoring "buy" over "build."
EDI translators/mappers are not cheap, and there's a learning curve. When your trading partner changes versions or standards, adds documents and segments, and/or requests new documents in return, the cost pays for itself.
I'm not up to date on the current crop of software; search on "EDI translator" for some of them. I believe BizTalk has some support for this as well. Perhaps other posters can recommend one.
Comment: [Jitterbit](http://www.jitterbit.com/Product/index.php) is sort-of like BizTalk and has an open source version.  Unfortunately, the EDI plug-in for it requires the paid version due to licensing.
Answer: Like TrueWill said, it's a complicated question.  Perhaps you can provide a little more detail about what you need to do.  If you have a one-time conversion with just a few documents, you might be able to code your own converter.  If you're in for more than that, I have to agree that you'll want to buy something.  What you buy depends on your needs.
Are you processing these things real-time?  There are some products that have runtime converters you can expose to the web (Mercator, StylusStuido, BizTalk, Webmethods? Not sure about that one)).
If you're dealing with EDI from multiple sources, you'll have to deal with different line lenghts, encodings, separators, versions of the standard, ways they use the standard document, acknowledgement requirements, and mistakes that the people sending you data will make that they claim they're not making.
Some of the best tutorials I've found are done by Stylus Stuido.  They're specific to their product, but they do a good job of explaining things that you can apply to other products if you're using them.  http://www.stylusstudio.com/learn_xml.html.  Their forums are pretty good too.

SQL Server: EDI to XML Data Conversion


Newton's rings experiment

Question: I have performed experiments in my college laboratory on Newton's rings to find radius the of curvature of the convex lens used. I always get a dark center. Is it possible to get a bright center? If yes, how?
Comment: Bright fringe appears to be possible, as can be seen in this image https://en.m.wikipedia.org/wiki/Newton%27s_rings#/media/File%3A20cm_Air_1.jpg
Answer: One can do this but it is difficult and you would need a great deal of patience and optical experimentation skill.
The reason that the centre is almost always dark is that the classic Newton's rings experiment simply involves putting the convex lens in contact with the reference optical flat. The lens touches the flat at the centre; therefore near the centre the two reflexions from the surface of the convex lens and from the flat are almost in phase. They are also opposite in sign, since one is from light going from glass to air (convex lens into the space), the other is from light going from air to glass.
What you would need to do for a non-dark centre, and indeed what you should do if you do not want to marr the convex lens's surface by the test, is to hold the two surfaces a half wavelength apart (at the centre). To do this, you would need to mount the flat or lens in a translation stage and bring the two surfaces together very carefully until the ring pattern can be seen. If you can do this successfully, you should be able to adjust for a bright centre.
Answer: By altering the lens flat plate distance it. Is certainly possible to get a bright ring area in the centre.  Given the increasing that distance by a quarter (or three quarters etc) of the wavelength of light will produce  bright ring means that you need a way of moving the lens very small distances.
Without such a device you might find a bit of dust between the lens and the flat plate and some trial and error (eg pressing the lens down) does the trick?
Another way of thinking about the central dark area is as follows.
Whenever there is a boundary some light is reflected.
Where the glass lens touches the glass plate underneath the lens there is not discontinuity in medium and so (almost) no reflection takes place, hence the dark centre.
Observation from the other side does produce a bright centre because (almost) all the light is transmitted.
The contrast for the Newton's rings seen by transmission is much worse than for those seen by reflection because for the transmitted light beam intensity is so much greater than the reflected beam.  The interference is due to the overlap of light which suffers no reflection and light which suffers two reflections and so complete cancellation cannot happen.
In the conventional set up the interference is between light which has only suffered one reflection and so the cancellation (dark ring) can be almost complete.
Comment: +1 Excellent to mention less contrast as well.
Comment: @Farcher I didn't understand why to move by quarter of wavelength ? Won't odd multiples of $\lambda /2 $ would work ? Am I thinking wrong somewhere ? I read about newton's rings on wikipedia and there I found the condition for bright fringe , so I was getting bit confused
Comment: Every quarter of a wavelength increase the path difference by half a wavelength. If the is a dark "ring" at the centre moving the lens up a quarter of a wavelength will produce a bright rind at the centre. Another quarter of a wavelength produces a dark ring etc.

Newton's rings experiment


Chemical potential for nucleons

Question: Do you know if the concept of chemical potential can be properly defined for nucleons in the nuclei? I mean, if I can picture the nuclei like an interacting gas of nucleons, then may  I think of a chemical potential for nucleons, similarly to the case of  an electron liquid. Of course the nature of the interactions is different for the two cases. My idea is related to the liquid drop model of nuclei.
Comment: Wouldn't a (useful) chemical potential imply that the number of nucleons isn't constant?
Comment: I think the answer is "yes", chemical potential can be defined for nucleons in the nuclei, see "For nuclear
matter at low density and high temperature, the
chemical potentials scale with density. The formation of
nuclei breaks the scaling behavior, i.e., the bound nucleons have much smaller chemical potentials." in http://arxiv.org/pdf/1101.3715.pdf, but hopefully someone can give a more proper answer.
Comment: like equation 2 here? http://www.helsinki.fi/~hkurkisu/cosmology/Cosmo7.pdf
Comment: Please check the question again, as I have try to make it more clear hopefully. Notice that I have studied the Big Bang nucleosynthesis some years ago, and as far as I knew, the chemical potentials for protons and neutrons were calculated considering them free (unbound).
Comment: @user60565 Isn't the chemical potential the same as binding energy per nucleon at low temperature (meaning not in the millions of degrees), basically around -8.5MeV for the most stable nuclei?
Comment: @DavePhD, the link in your first comment shows a 404 error. Do you know if the document is available elsewhere?
Comment: @Urb try starting at the bottom of page 70 here: https://www.mv.helsinki.fi/home/hkurkisu/Cosm_I.pdf (70 according to the author's numbering).
Answer: Yes it has been defined in a coherent way and used many times. You are following a correct reasoning: once you treat a nucleus as an ensemble of nucleons is natural to associate the chemical potential as the energy involved in adding/removing a nucleon from the nucleus. This is generally the case for excitation energies higher than 1 MeV/A when the shell structure is lost A.V. Ignatiuk, Phys. Lett. B 76 (1978) 543.
You will find the use of this concept very often in nuclear astrophysics models of stars where an average description of nuclear behaviour is both relevant useful. The description of the competing processes of absorbing nucleons and releasing them and beta decay is usually described in terms of the behaviour of chemical potential for nucleons in these conditions (ArXiv1,ArXiv2)
Comment: Thank you very much for reply to me. What does you mean saying "when the shell structure is lost"? Thanks again
Comment: Due to its quantum nature, the lowest state of nuclei corresponds to nucleons occupying well defined states of specific energies, like electrons in an atom. That is the shell structure, which is very different to the case where all nucleons are in excited states: the energy involved in adding (removing) a nucleon depends on the energy state it will occupy (occupied) and can sometimes be a prohibited process. But when the shell structure is lost, all nucleons have approximately the same energy and it makes more sense to speak of $\mu$ as really an average energy per nucleon exchanged.

Chemical potential for nucleons


Analytic uniformization

Question: Suppose I am given a subset of $2^\omega\times\omega^\omega$ of some bounded Borel rank. Can I get an analytic uniformization of this set?
Comment: A function with analytic graph is actually a Borel function. To see this, note that $f^{-1}(B)=\pi\big((X\times B)\cap\textrm{Graph} f\big)$, is analytic when $B$ is Borel. But for the same reason, $f^{-1}(B^C)$ is analytic. Since $f^{-1}(B)^C=f^{-1}(B^C)$, this shows that the preimage of a Borel set is both analytic and coanalytic, hence Borel.
Comment: Does analytic uniformization means that graph is an analytical set, or that the map is analytically measurable?
Comment: I think it means that the graph is an analytical set.
Answer: There is an arithmetical set $A\subseteq 2^{<\omega}\times \omega^{<\omega}$ so that for any $x\in 2^{\omega}$, $A(x)=\{\sigma\mid \exists n(x|n,\sigma)\in A\}$ is an $x$-recursive tree which has an infinite path but no infinite path hyperarithmetic in $x$.
Now let $B$ be an arithmetical set so that $(x,y)\in B$ if and only if $y$ is an infinite path through $A(x)$. $B$ has the following property:
(1). For any $x$, there is some $y$ so that $(x,
y)\in B$;
(2) No analytic function uniformizing $B$. Suppose not, then there is a real $z$ and $\Sigma^1_1(z)$-function $f$ uniformizing $B$. Let $x\geq_h z$, then $f(x)\leq_h x\oplus z\leq_h x$, a contradiction.
Comment: I assume that the first formula should read $A\subseteq 2^{<\omega}\times\omega^{<\omega}$... Also, does the existence of $A$ follow from some theorem or should it be obvious (sorry, I am not very fluent in descriptive set theory let alone effective descriptive ST).
Comment: You are right. I corrected the typo. The existence of $A$ follows from a well known fact that there is  a $\Sigma^1_1$ set which does not contain a hyperarithmetic real.

Analytic uniformization


supremum is the only positive root of $z^n=a^m$

Question: I'm trying to define $a^x$ with $x$ rational. Let $r=\frac{m}{n}$ with $m,n \in \mathbb{Z}$, and let $a>1$ be a real number. We define $S_{r}(a)= \left \{ x \in \mathbb{R} | 0\leq x^n\leq a^m \right \} $ and $a^r=\sup S_{r}(a)$. I need to show that $z=a^r$ is the only positive root of the equation $z^n=a^m$ .
Answer: Let $E:=\{x\in\Bbb R:0\le x^n\le a^m\}$ be a subset of $\Bbb R$, and let $a^{m/n}:=\sup E$.
Basically we need to prove $$z=a^{m/n}\quad\text{if and only if}\quad z^n=a^m.$$
$(\Rightarrow)$ First we prove the direct. Suppose for sake of contradiction that we have $z=a^{m/n}$ and $z^n\ne a^m$. We have two cases, $z^n<a^m$ or $z^n>a^m$, and we show that both lead a contradiction.
First suppose $z^n<a^m$. You can use three formulae to prove that there exists a $0<\epsilon<1$ such that $(z^n+\epsilon)^m<a^m$, this means that $z^n+\epsilon$ lies in $E$; but this contradicts the fact that $z^n$ is a upper bound of $E$.
The formulae are (replace $x:=z^n$):

First (Binomial formula): $$\sum_{k=0}^m\binom{m}{k}x^{m-k}\epsilon^k.$$ Then use the expansion to obtain $(x+\epsilon)^m\le x^m+x^{m-1}\epsilon+\dotsb<a^m$.
Second: $$(x+\epsilon)^m\le x^m+\epsilon((x+1)^m-x^m).$$
Then you can find $\epsilon$ such that $(x+\epsilon)^m<x$, just take a $\epsilon$ such that $$0<\epsilon<\min\left\{\frac{x-x^m}{(x+1)^m-x^m},1\right\},$$
which surely exists. Therefore such $x$ cannot be the supremum of the set $E$.
Third: $$(x+\epsilon)^m\le x^m+k\epsilon$$
for some $k\in\Bbb R$. Then you obtain $(x+\epsilon)^m\le x^m+k\epsilon<a^m$, as desired.

All formulae are proved by induction on $m$.
The other case, $z^n>a^m$, is similar; but we need to work with $(z^n-\epsilon)^m>a^m$.
From these two contradictions we see that $z^n=a^m$, as desired.
$(\Leftarrow)$ To prove the converse use the definition of $a^{m/n}$.

EXTRA. Now, I think your definition seems a little complicated. Maybe you can work with the following (it is similar to definition):
Suppose we have defined the exponentiation for rationals and we have proved the laws of exponentiation.

Defintion 1 (Exponentiating a real by a natural number). Let $x$ be a real number. To raise $x$ to the power $0$, we define $x^0:=1$. Now suppose recursively that $x^n$ has been defined for some natural number $n$, then we define $x^{n+1}:=x^n\times x$.
Definition 2 (Exponentiating a real by an integer). Let $x$ be a non-zero real number. Then for any negative integer $-n$, we define $x^{-n}:=1/x^n$.
Defintion 3. Let $x>0$ be a positive real, and let $n\ge1$ be a positive integer. We define $x^{1/n}$, also known as the $n^{th}$ root of $x$, by the formula $$x^{1/n}:=\sup\{y\in\Bbb R:y\ge0\quad\text{and}\quad y^n\le x\}.$$
Lemma 4 (Existence of $n^{th}$ roots). Let $x>0$ be a positive real, and let $n\ge1$ be a positive integer. Then the set $E:=\{y\in\Bbb R:y\ge0\quad\text{and}\quad y^n\le x\}$ is non-empty and is also bounded above. In particular, $x^{1/n}$ is a real number.
Definition 5. Let $x>0$ be a positive real number, and let $q$ be a rational number. To define $x^q$, we write $q=a/b$ for some integer $a$ and positive integer $b$, and define $$x^q:=\left(x^{1/b}\right)^a.$$

It looks like your definition, but I think it is more simple to work. Note that the Definition 3 only uses real numbers and natural numbers, and in Definition 5  we applied the laws of exponentiation of rational numbers. Thus, one can to prove the main properties of $x^{a/b}$; for instance, $x^{q+r}=x^qx^r$, $x^{-q}=1/x^q$, etc.