PHP DOMElement is Immutable. = 'No Modification Allowed Error'

Question: I cannot understand why this fails. Does a DOMElement need to be part of a Document?
$domEl = new DOMElement("Item");
$domEl->setAttribute('Something','bla');

Throws exception
> Uncaught exception 'DOMException' with message 'No Modification Allowed Error';

I would have thought I could just create a DOMElement and it would be mutable.
Comment: I found that DOMElement must be part of some DOMDocument to work properly.
Answer: From http://php.net/manual/en/domelement.construct.php

Creates a new DOMElement object. This object is read only. It may be appended to a document, but additional nodes may not be appended to this node until the node is associated with a document. To create a writeable node, use DOMDocument::createElement or DOMDocument::createElementNS.
Comment: I would really like to know why.  I was trying to use DOMElements to test making tags to be printed out (i.e. I didn't want to go to the trouble of making an entire DOMDocument) and ran into this error.  I would really like to know the thought process behind this "feature".
Comment: I know it's old thema, but would anyone care to comment why it is done so in PHP?
Answer: I needed to pass one instance of \DOMElement to a function in order to add children elements, so I ended up with a code like this:
class FooBar
{
    public function buildXml() : string
    {
        $doc = new \DOMDocument();
        $doc->formatOutput = true;

        $parentElement = $doc->createElement('parentElement');
        $this->appendFields($parentElement);

        $doc->appendChild($parentElement);

        return $doc->saveXML();
    }

    protected function appendFields(\DOMElement $parentElement) : void
    {
        // This will throw "No Modification Allowed Error"
        // $el = new \DOMElement('childElement');
        // $el->appendChild(new \DOMCDATASection('someValue'));

        // but these will work
        $el = $parentElement->appendChild(new \DOMElement('childElement1'));
        $el->appendChild(new \DOMCdataSection('someValue1'));

        $el2 = $parentElement->appendChild(new \DOMElement('childElement2'));
        $el2->setAttribute('foo', 'bar');
        $el2->appendChild(new \DOMCdataSection('someValue2'));
    }
}


ubuntu laptop to win7 laptop music transfer

Question: What is the easiest way to connect my ubuntu laptop to a win7 laptop to pull music and pics off the win7 laptop?
I installed Ubuntu on my new computer as the primary os and I want to pull my music, pics and some docs off my old one in the easiest way possible.
Comment: How big is this music directory? Do you have a flash drive? Do you have a network that both computers can connect through?
Comment: @Subcomfreak my 1st question would be... are the 2 in the same network?
Comment: I have about 1500 songs, and a few hundred pictures, about 150 pics.  I couldn't figure out how to connect the ubuntu computer to the network.  I thought I'd use a firewire but I just installed ubuntu for the first time and I'm new to this arena.
Answer: You can connect both computers in hotspot or a command LAN.
Then, you need to share folder with your files from windows computer.
Then, from Ubuntu

Open File Manager (nautilus) i.e Open your home folder.

From Menu > Go > Network in Nautilus, or from left sidepane, click on Browse Network.

You can find your Windows share in a folder named Windows Network.

Open your shared folder, enter windows username and password if asked.

Now, you can copy your files as you wish.
Comment: Ok.  I couldn't figure out the ubuntu side.  I got a call just now so I gotta go but, I will try this as soon as I can and get back to you guys.  Thanks for the help.
Comment: @donna Refer to the edited answer. Hope it will help.
Answer: I guess the link had the same issue and see whats the solution he thought of using
http://askubuntu.com/questions/152326/how-do-i-share-my-files-from-windows-7-to-ubuntu

Comment: My search didn't turn up that link.  I'll check it out as soon as I can.  Gotta go to work right now.  Thank you for the link.


Combinatorics question from IMO 2012

Question: This is the 3rd problem of the International Mathematical Olympiad 2012.

The liar's guessing game is a game played between two players $A$ and $B$. The rules of the game depend on two positive integers $k$
   and $n$ which are known to both players.
  At the start of the game the player $A$
   chooses integers $x$ and $N$
   with $1\leq x\leq N$. Player $A$ keeps $x$ secretly, and truthfully tells $N$ to the player $B$. The player $B$ now tries to obtain information about $x$ by asking player $A$ questions as follows: each question consists of $B$ specifying an arbitrary set $S$
   of positive integers (possibly one specified in some previous question), and asking $A$ whether $x$
   belongs to $S$
   Player $B$
   may ask as many questions as he wishes. After each question, player $A$ must immediately answer it with yes or no, but is allowed to lie as many times as she wants; the only restriction is that, among any $k+1$ consecutive answers, at least one answer must be truthful.
After $B$ has asked as many questions as he wants, he must specify a set $X$ of at most $n$ positive integers. If $x\in X$, then $B$ wins; otherwise, he loses. Prove that:
(a) If $\geq2k$
   then $B$ has a winning strategy.
(b) There exists a positive integer $_0$
   such that for every $\geq_0$
   there exists an integer $\geq1.99$
   for which  cannot guarante a win.

How to solve this question without using complex methods?.
Comment: Can you solve it already using "complex methods" then? ;-)
Comment: Learn $\LaTeX$.
Answer: All but the youngest IMO problems have solutions on imomath.com. I've reproduced verbatim from here:

The game can be reformulated in an equivalent one: The player $A$
  chooses an element $x$ from the set $S$ (with $|S|=N$) and the player
  $B$ asks the sequence of questions. The $j$-th question consists of
  $B$ choosing a set $D_j\subseteq S$ and player $A$ selecting a set
  $P_j\in\left\{ Q_j,Q_j^C\right\}$. The player $A$ has to make sure
  that for every $j\geq 1$ the following relation holds: $x\in P_j\cup
> P_{j+1}\cup\cdots \cup P_{j+k}$.
The player $B$ wins if after a finite number of steps he can choose a
  set $X$ with $|X|\leq n$ such that $x\in X$.
(a) It suffices to prove that if $N\geq 2^k+1$ then the player $B$ can
  determine a set $S^{\prime}\subseteq S$ with $|S^{\prime}|\leq N-1$
  such that $x\in S^{\prime}$.
Assume that $N\geq 2^n+1$.
In the first move $B$ selects any set $D_1\subseteq S$ such that
  $|D_1|\geq 2^{k-1}$ and $|D_1^C|\geq 2^{k-1}$. After receiving the set
  $P_1$ from $A$, $B$ makes the second move. The player $B$ selects a
  set $D_2\subseteq S$ such that $|D_2\cap P_1^C|\geq 2^{k-2}$ and
  $|D_2^C\cap P_1^C|\geq 2^{k-2}$. The player $B$ continues this way: in
  the move $j$ he/she chooses a set $D_j$ such that $|D_j\cap P_j^C|\geq
> 2^{k-j}$ and $|D_j^C\cap P_j^C|\geq 2^{k-j}$.
In this way the player $B$ has obtained the sets $P_1$, $P_2$,
  $\dots$, $P_k$ such that $\left(P_1\cup \cdots \cup P_k\right)^C\geq
> 1$. Then $B$ chooses the set $D_{k+1}$ to be a singleton containing
  any element outside of $P_1\cup\cdots \cup P_k$. There are two cases
  now:

The player $A$ selects $P_{k+1}=D_{k+1}^C$. Then $B$ can take    $S^{\prime}=S\setminus D_{k+1}$ and the statement is proved.
The player $A$ selects $P_{k+1}=D_{k+1}$. Now the player $B$ repeats    the previous procedure on the set $S_1=S\setminus D_{k+1}$
  to obtain    the sequence of sets $P_{k+2}$, $P_{k+3}$, $\dots$,
  $P_{2k+1}$. The    following inequality holds: $$\left|S_1\setminus
> \left(P_{k+2}\cdots    P_{2k+1}\right)\right|\geq 1,$$
     since $|S_1|\geq 2^k$. However, now we have $$\left|\left(P_{k+1}\cup P_{k+2}\cup\cdots\cup
> P_{2k+1}\right)^C\right|\geq 1,$$ and we may take
$S^{\prime}=P_{k+1}\cup \cdots \cup P_{2k+1}$.

(b) Let $p$ and $q$ be two positive integers such that $1.99< p< q<
> 2$. Let us choose $k_0$ such that $$\left(\frac{p}{q}\right)^{k_0}\leq
> 2\cdot
> \left(1-\frac{q}2\right)\quad\quad\quad\mbox{and}\quad\quad\quad
> p^k-1.99^k> 1.$$
We will prove that for every $k\geq k_0$ if $|S|\in\left(1.99^k,
> p^k\right)$ then
there is a strategy for the player $A$ to select sets $P_1$, $P_2$,
  $\dots$ (based on sets $D_1$, $D_2$, $\dots$ provided by $B$) such
  that for each $j$ the following relation holds: $P_j\cup
> P_{j+1}\cup\cdots\cup P_{j+k}=S.$
Assuming that $S=\{1,2,\dots, N\}$, the player $A$ will maintain the
  following sequence of $N$-tuples:
  $(\mathbf{x})_{j=0}^{\infty}=\left(x_1^j, x_2^j, \dots, x_N^j\right)$.
  Initially we set $x_1^0=x_2^0=\cdots =x_N^0=1$. After the set $P_j$ is
  selected then we define $\mathbf x^{j+1}$ based on $\mathbf x^j$ as
  follows:
$$x_i^{j+1}=\left\{\begin{array}{rl} 1,&\mbox{ if } i\in P_j \\ q\cdot
> x_i^j, &\mbox{ if } i\not\in P_j.\end{array}\right.$$
The player $A$ can keep $B$ from winning if $x_i^j\leq q^k$ for each
  pair $(i,j)$. For a sequence $\mathbf x$, let us define $T(\mathbf
> x)=\sum_{i=1}^N x_i$. It suffices for player $A$ to make sure that
  $T\left(\mathbf x^j\right)\leq q^{k}$ for each $j$.
Notice that $T\left(\mathbf x^0\right)=N\leq p^k < q^k$.
We will now prove that given $\mathbf x^j$ such that $T\left(\mathbf
> x^j\right)\leq q^k$, and a set $D_{j+1}$ the player $A$ can choose
  $P_{j+1}\in\left\{D_{j+1},D_{j+1}^C\right\}$ such that $T\left(\mathbf
> x^{j+1}\right)\leq q^k$.
Let $\mathbf y$ be the sequence that would be obtained if
  $P_{j+1}=D_{j+1}$, and let $\mathbf z$ be the sequence that would be
  obtained if $P_{j+1}=D_{j+1}^C$. Then we have
$$T\left(\mathbf y\right)=\sum_{i\in D_{j+1}^C}
> qx_i^j+\left|D_{j+1}\right|$$
$$T\left(\mathbf z\right)=\sum_{i\in D_{j+1}}
> qx_i^j+\left|D_{j+1}^C\right|.$$
Summing up the previous two equalities gives:
$$T\left(\mathbf y\right)+T\left(\mathbf z\right)= q\cdot
> T\left(\mathbf x^j\right)+ N\leq q^{k+1}+ p^k, \mbox{ hence}$$
$$\min\left\{T\left(\mathbf y\right),T\left(\mathbf
> z\right)\right\}\leq \frac{q}2\cdot q^k+\frac{p^k}2\leq q^k,$$
because of our choice of $k_0$.

I welcome any copyright-motivated edits to this answer before I have time to make my own.

Combinatorics question from IMO 2012


Can I disable censorship in the German version of Fallout 3?

Question: Recently, I purchased Fallout 3 on Steam, at a very reduced price. I was not paying attention, though, and I got a German copy.
Playing the game in German is fine, as I speak it, but Mature content is disabled. Is there any way to enable it?
Comment: @TimmyJim, based on google searches for this, it looks like blood and gore is completely removed. Bloody Mess -> Bloodless Backflips
Comment: Because I don't live in Germany, I'm having difficulty understanding what mature content is disabled exactly. The blood and strong language?
Answer: I am not entirely sure this will work since I have been reading mixed messages about it. But there is an ini tweak you might be able to make in order to enable the blood and gore in the german version.
From Tweek Guides

bDisableAllGore=1 - If set to =1, this variable will disable all gore in the game. This includes removing all blood decals and splatter marks, and all forms of dismemberment. Note: This setting does not exist by default in the .ini file, it must be manually created exactly as shown above and placed under the [General] section of the Fallout.ini file (e.g. insert it under the last sLanguage=ENGLISH line). If on the other hand you want more control over the level gore, try a mod such as this Gore Tweak Mod (Fallout.ini).

Source: http://www.tweakguides.com/Fallout3_8.html
Comment: Give me an update when you try it. The German version of FO3 seems to be quite an odd version of it.
Comment: You should use `bDisableAllGore=0` right?
Comment: Yeah 0 would say that you do not want to disable it. It might not work though the German version is really odd.


How to add custom libraries and binaries in AWS Lambda?

Question: I have deployed my app with python36 runtime long ago, and now AWS Deprecated this runtime.
So while migrating from python36 to python38 or python39, I observed that AWS removed many in-built libraries in Amazon Linux 2 which is used for Python38 or python39.
Here we need to add binaries if we're using them in our App.
how to add custom binaries to the lambda package? Suggest ways to do it, if you know.
References:

AWS Lambda Deprecation Schedules
Comment: Can you be more specific about what you need?
Comment: I need to make binaries like file, tar etc available to my app in lambda.
Answer: Starting with python3.8, AWS Lambda removed many Binaries like tar, find file, cat, which etc.
So if you're using any of these binaries in our package, we can add them using layers.
Method 1:
Add libraries in layers in the custom directory, and let lambda know the directory by setting LD_LIBRARY_PATH and PATH environment Variables.
Let's say you've added your binaries in custom_bins directory then you've to set PATH as /var/lang/bin:/usr/local/bin:/usr/bin/:/bin:/opt/bin:/opt/custom_bins
and if you've added your custom libraries in custom_libs directory then you've to set LD_LIBRARY_PATH as /var/lang/lib:/lib64:/usr/lib64:/var/runtime:/var/runtime/lib:/var/task:/var/task/lib:/opt/lib:/opt/custom_libs
Method 2:
By Default, Lambda will detect libraries in the /opt/lib path and binaries in /opt/bin, as we know layers will be available in /opt  directory, we can create a layer with /lib and /bin directories containing appropriate libraries & binaries.
Layer Structure:
custom_libs/
├── bin
│   ├── curl
│   └── bin_2
│   └── bin_3
└── lib
    ├── libbz2.so.1
    ├── lib_2
    ├── lib_3
    └── magic

Here, we need not set any environment variables as we uploaded our libraries & binaries in the path detected by lambda by default.

Note: If your binaries require a magic file then you can add a magic file and specify a magic file path using the MAGIC environment variable.


$G$ group of order $36$, $H\le G$ of order $9$. Show that either $H\unlhd G$ or there is $K\le H$ of order $3$, $K\unlhd G$.

Question:
Suppose $G$ is a group of order $36$ with a subgroup $H$ of order $9$.
Show that either $H$ is normal in $G$ or there is a subgroup $K$ contained in $H$ of order $3$ that is normal in $G$.

This is the question and here is what I have managed:
Since $G$ has order $36=2^2\times3^2$ then any subgroup of order $9$ is a Sylow $3$ subgroup. Let $n_3$ denote the total number of Sylow $3$ subgroups of $G$. Then Sylow tells us that $n_3 \equiv 1\pmod 3$ and $n_3\mid 4$ hence we can conclude $n_3=1$ or $n_3=4$. In the case $n_3=1$ then the subgroup is unique and since Sylow subgroups are conjugate then we have that it is a normal subgroup, so this is the first part of the question.
So it remains to show that if $n_3=4$ then there are normal subgroups of $G$ of order $3$ contained in each of the $4$ Sylow $3$ subgroups. I don't know how to prove this.
Any advice?
Answer: $H$ is a $3$-Sylow. If it is not unique, then the intersection of all its conjugates has order $3$ or $1$. But such a subgroup is the normal core of $H$ in $G$, which is also the kernel of the $G$-action by left multiplication on the left quotient set $G/H$, of size $[G:H]=4$. So, if you prove that it can't be trivial, you are done. And this is the case, as otherwise you'd have an embedding $G\hookrightarrow S_4$, which is impossible because $|G|>|S_4|$.


Login screen corruption

Question: This is what I get in the login screen, it disappears only when I move the mouse and it only happens in the login screen.

This is Ubuntu 12. 04 running over an Intel desktop board DG31PR and I'm using the onboard video.
Any help will be appreciated.
Comment: Do a check on you VGA cable.
Comment: >.< facepalm here, actually it looked well connected when i checked but regardless of that i adjusted it even more and that resolved the problem, thank you!
Answer: Ok this is embarrassing, it was just a slightly loose cable as suggested by Mitch, but anyway this could help someone with the same problem to realize that maybe it is not a driver/system/configuration problem.

Login screen corruption


Get Gps Location Using Android

Question: I want to get latitude and Longitude from the following Android code.
location = locationManager.getLastKnownLocation(provider);

Here i am getting error location is null.
Here is the code:
package com.p;
import android.app.Activity;
import android.os.Bundle;
import android.os.Bundle;

import android.content.Context;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.widget.TextView;
 import android.widget.Toast;
 public class GooglemapActivity extends Activity implements LocationListener {
  private TextView latituteField;
        private TextView longitudeField;
   private LocationManager locationManager;
    private String provider;

 /** Called when the activity is first created. */

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    latituteField = (TextView) findViewById(R.id.TextView02);
    longitudeField = (TextView) findViewById(R.id.TextView04);

    // Get the location manager
    locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    // Define the criteria how to select the locatioin provider -> use
    // default
    Criteria criteria = new Criteria();
    provider = locationManager.getBestProvider(criteria, false);
    Location location = locationManager.getLastKnownLocation(provider);

    // Initialize the location fields
    if (location != null) {
        System.out.println("Provider " + provider + " has been selected.");
        int lat = (int) (location.getLatitude());
        int lng = (int) (location.getLongitude());
        latituteField.setText(String.valueOf(lat));
        longitudeField.setText(String.valueOf(lng));
    } else {
        latituteField.setText("Provider not available");
        longitudeField.setText("Provider not available");
    }
}

/* Request updates at startup */
@Override
protected void onResume() {
    super.onResume();
    locationManager.requestLocationUpdates(provider, 400, 1, this);
}

/* Remove the locationlistener updates when Activity is paused */
@Override
protected void onPause() {
    super.onPause();
    locationManager.removeUpdates(this);
}

public void onLocationChanged(Location location) {
    int lat = (int) (location.getLatitude());
    int lng = (int) (location.getLongitude());
    latituteField.setText(String.valueOf(lat));
    longitudeField.setText(String.valueOf(lng));
}

public void onStatusChanged(String provider, int status, Bundle extras) {
    // TODO Auto-generated method stub

}

public void onProviderEnabled(String provider) {
    Toast.makeText(this, "Enabled new provider " + provider,
            Toast.LENGTH_SHORT).show();

}

public void onProviderDisabled(String provider) {
    Toast.makeText(this, "Disabled provider " + provider,
            Toast.LENGTH_SHORT).show();
}
}

I have added the following permisions:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

But I am getting the following error:

Provider not available
Comment: The following library takes care of all the criteria, caching and other background work: https://github.com/delight-im/Android-SimpleLocation
Answer: If the last known location is null, it's because the phone has no last known location. If there is no location cached, you need to request an updated location, either via network, or GPS. Note that this process can take time, so must be done asynchronously.
You need to read this document:
http://developer.android.com/guide/topics/location/obtaining-user-location.html
I also recommend reading this:
http://android-developers.blogspot.co.uk/2011/06/deep-dive-into-location.html
Answer: You haven't define a valid Criteria. Define that as follows
    Criteria criteria = new Criteria();
    criteria.setAccuracy(Criteria.ACCURACY_FINE);
    criteria.setAltitudeRequired(false);//true if required
    criteria.setBearingRequired(false);//true if required
    criteria.setCostAllowed(true);
    criteria.setPowerRequirement(Criteria.POWER_LOW);
    provider = locationManager.getBestProvider(criteria, true);//search for enabled provider

Answer: Think you need to specify from which provider you want to receive updates.
You have two options:

GPS_PROVIDER
NETWORK_PROVIDER

You're probably missing something like this:
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);

Comment: i have added following code  locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this); but still getting marktext Disable provider
Comment: Also try to get the coordinates on the LocationListener interface methods. Since once you create the activity, it takes a while to get a grip of the provider and provided coordinates. You might wanna go through this : http://developer.android.com/guide/topics/location/obtaining-user-location.html
Comment: Try printing out on StatusChanged & onLocationChanged
Comment: @tim I have used NETWORK_PROVIDER but still getting error Disable provider
Answer:
have you switched on GPS in Settings -> Location ?
why do you use (int) (location.getLatitude()) -- latitude/longitude is a float
Answer: I think you may want to add the following permission as well, since I am pretty sure that the FINE relies on the COARSE...
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

Get Gps Location Using Android


Hints for moving to using SVN or GIT to manage our code on the server?

Question: Our current situation:

1 Apache server (hosted)
30 gb of data, hundreds of folders/projects
files are 99% html/php/js/css, with a bunch of pdf/ppt/docs etc.
Several developers, working from different locations, using own computers
Some devs have only access to certain directories (using different ftp accounts)
All updates are made with FTP directly, saving over old files
The hosting company makes basic daily/weekly backups, but access to those files requires their help

Now we know this isn't near an optimal solution. Every now and then somebody accidentally deletes working files with wrong ones etc etc.
What should we do to this:

All files are automatically backed up, so mistakes can be recovered easily and securely
Devs shouldn't have to change their workflow much, we really, really like the auto-save-to-FTP functionality of Dreamweaver & WinSCP
We get the new, better way of working to affect also the current files

?
Answer: Argh!! I had to say it. :)
Your workflow assumes that mostly developers work on only certain well-defined parts of the project, right? Else, I think your current setup just won't work.
Then the first course of action could be to create separate source repositories for these separate 'projects'. I use the term project loosely to mean functionality (e.g. search), part of the website (e.g. About Us) or however else you divide up the work.
I wouldn't go with SVN. No new project should if you're starting from a clean slate. With git, I'd start with the following:

Create a list of sub projects based upon folder structure (no overlapping files/folders)
Commit them to separate git repositories
Create a master git project and import all these git repositories as submodules into the right path
Give repository-specific write permissions to the developers as before
However, all them them should be able to read all repositories
A single git clone of the master repository followed by the submodule init command will initialise the repository for each developer
Comment: Yeah, argh is said here pretty often too.

It seems the next thing I'm doing is googling Git for dummies. Just a quick question - with the setup you're suggesting, how does the basic developing work?

Now we just save the file to the FTP server, refresh the browser and it's there. I really, really like the simplicity.
Comment: You would have an explicit 'git commit' step after making changes. There are UI tools that handle commit and push to remote automatically e.g. SmartGit. And I'll recommend ProGit (progit.org). Free ebook, also available in dead-tree version.
Answer: I haven't used GIT. I use SVN heavily. From what you describe, you definitely need a version control system. You can achieve almost all (except may be auto save) from a version control system, plus you will thank it for saving a lot of mess you might be going under with your current system.
So, lets jump to your queries:
All files are automatically backed up, so mistakes can be recovered easily
and securely

Files in a revision system are indexed per commit (commit==save), so you can see complete history of a file. In build features like diff, help you to find exact changes made from one revision to other. You can recover accidentally deleted files. You would like (and appreciate) to learn repository structure and how it helps to ease release, spot fixes by branching the code. So, SVN covers ground here.
Creating user and setting authorization and authentication is matter of editing a text file with user-name, password, and it's realm(s).
Devs shouldn't have to change their workflow much, we really, really like the
auto-save-to-FTP functionality of Dreamweaver & WinSCP

There are a lot of plugins available for SVN for various IDE. I haven't worked in Dreamviewer but it seems working with SVN in Dreamweaver is seamless. I guess it might change your work-flow a bit, but it's a good change. In any case, you can always have things like Tortoise SVN to provide you with a great UI to work with.
We get the new, better way of working to affect also the current files

It's very easy to import files to SVN. Once you get basic SVN server running, all you need to just run svn import my/project/folder svn://svn.server.location/reponame/projectname/trunk for each project or something similar. And you get going.
What I suggest is to look into

Advantage of using a VCS
Confused between git and SVN?
SVN Book (free resource)
A very nice article on adobe.com on 'using Subversion with Dreamweaver'

PS: By the way, my answer is true to any modern VCS. Whatever you choose to go with will be better than what you currently have.


Remap to a subdir

Question: I have an appplication which is ment to be outside public document root...but the hosting provider doesn't allow that...
How can I remap it?
structure:
/
/public_html/app
/public_html/new_public_html

"public_html" is the web server's document_root. "/" is the dir where I'd normally put my app (outside document_root". Since I'm not allowe to do this I neew to somehow remap it without breaking the other redirects...
So on access the server server files in "public_html" I need to redirect it to "new_public_html" where the public part od my app would be...
The "non public" part of my app would reside in "public_html".
The webserver needs to go directly to the new_public_html but there are other rules in effect:
RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Content routing
RewriteRule ^([^.]+)/?$ /index.php?$1 [L]

Thanks!
Answer: This should work for you:
RewriteRule ^(.*)$ /sub_dir/$1 [L]

Sorry I didn't get it at once, I thought more complicated than it is.
Comment: I don't want to rewrite to non-public dirs... As I said there's a restriction which prevents me to put the app into non-public dirs... so they have to be in public dir... so i need to mirror that hierarchy...so that I don't have to rewrite my app...
Comment: Just to make this clear: RewriteRules allow you to access URLs that are public anyway _within_ the server. So what exactly do you want to achieve? http://server/index.html  -> http://server/sub_dir/index.html ? It would be really helpful if you'd give more information on your concrete problem, not just the symptom. Maybe there's an entirely other+better way.
Comment: server/index.html -> server/sub_dir/index.html - this is what I want to achieve. BTW this is somewhat I have posted in my question...
Comment: I'm sorry, I got confused by the part of public/non-public. Added the solution in an edit.
Answer: This is what I was looking for... in case anyone has a similar problem...
http://www.alberton.info/zend_framework_mod_rewrite_shared_hosting.html

Remap to a subdir


Two Representations of the Prime Counting Function

Question:
The bounty  for the best work out of Greg's answer, especially the
"solving for $\pi^*(x;q,a)$ in terms of all $\Pi^*$ functions (tedious but possible)"
part is over. Since Raymond's contributions might be very helpful to recall the necessary math, upvoting his answers is highly appreciated...
I posted my attempt of a workout here. Comments welcome...

Original question:
I have two representations of $\pi(x)$:

The Prime Counting Function $\pi(x)$ is given
$$
\pi(x) = \operatorname{R}(x^1) - \sum_{\rho}\operatorname{R}(x^{\rho}) \tag{1}
$$
with $    \operatorname{R}(z) = \sum_{n=1}^{\infty} \frac{ \mu (n)}{n} \operatorname{li}(z^{1/n})$ and $\rho$ running over all the zeros of $\zeta$ function.

This formula, while
widely believed to be correct, has not yet been proved.
$$
\pi(x) \approx \int\limits_2^x{\frac{dt}{\ln t}} - \frac{\sqrt x}{\ln x}\left( 1 + 2\sum_{\gamma} \ \ \frac{\sin(\gamma\ln x)}{\gamma}\right) \tag{2},
$$
with $\gamma=\text{Im}({\rho})$ being imaginary part of the roots  of the $\zeta$ function.

Now I have two questions:

Does the truth of $(2)$ depend on Riemann's Hypothesis or is it "just" what Wikipedia says, that The amplitude of the "noisy" part is heuristically about $\sqrt x/\ln x$?
How to show the equivalence between $(1)$ and $(2)$? The integral logarithm is easily found in both representations, but how do the $\rho$-parts fit together? How do I get $\sin$s from $\text{li}(z^{1/n})$s? Does this invoke Gram's series:
$$
    \operatorname{R}(z) = \sum_{n=1}^{\infty} \frac{ \mu (n)}{n} \operatorname{li}(z^{1/n}) = 1 + \sum_{k=1}^\infty \frac{(\ln z)^k}{k! k \zeta(k+1)} ?
$$
We can rewrite $\displaystyle \frac{\sin(\gamma\ln x)}{\gamma}=\frac{x^{i\gamma}-x^{-i\gamma}}{i\gamma}$ and I remember that I've seen a similar expression at Wikipedia:
$$
    \psi_0(x) = x - \sum_\rho \frac{x^\rho}{\rho} - \ln 2\pi - \frac12 \ln(1-x^{-2}) ,
$$
But could this help, if at all? ($\psi_0(x)$ is the normalization of the Chebyshev function, see here)
Comment: +1: interesting question but where did you find the formula $(2)$ ? I would bet that it is only an approximation just from the lower bound $2$ of the first integral ( and... from the $\approx$ sign :-) ) ?
Comment: It is from the linked paper here : http://math.stackexchange.com/q/149755/19341 . Sorry but i post from my tablet. I hate that...
Comment: Just some preliminary numerical results : I compared $(2)$ to the actual $\pi(n)$ function in the interval $(2,100)$ ![pi_100](http://i.stack.imgur.com/kEy7X.gif) : $(2)$ (darker and on the top) has all the features of a function growing 'by steps' and is very similar to the real $\pi(n)$ function but, as seen in $(3,1000)$ ![pi_1000](http://i.stack.imgur.com/sD4s3.gif), it is starting too low and growing too fast (this effect is real : more than $10^4$ zeros were used).
Comment: From your ref. the zeros seem to be the imaginary parts of the zeros of the [Dirichlet beta function](http://en.wikipedia.org/wiki/Dirichlet_beta_function).
I have Montgomery and Vaughan's book (I'll see tomorrow...).
Comment: But do your plots compare to Figure 4 in  [Prime Number Races](http://arxiv.org/pdf/math/0408319v1.pdf). Beta functions are used in the case $\pi_{4n+3}-\pi_{4n+1}$ (p.19)...
Comment: You are right @draks zeta zeros have to be considered here (and this returns the plots of Figure 4). $(2)$ seems pretty near of an actual solution but not entirely as you may see from this [graph](http://i.stack.imgur.com/HlLF4.gif) of $\pi_N(x)-\pi(x)$ using $N=10^5$ zeros of zeta and $x\in (3,1000)$.
Comment: I didn't entirely forgot you and will try a numerical evaluation of your formulas in the coming days.
Comment: @RaymondManzoni Really? I tried with Matlab, but didn't succeed. A verification from your side would be ever so cool. Thanks in advance and good night...
Answer: Before answering to your question in the comment :

" Is it possible to write $\ \#\{\text{primes}\ 4n+3 \le x\}\,-
 \,\#\{\text{primes}\ 4n+1 \le x\}$ (form here) in terms like $\,\operatorname{R}(x^1) - \sum_{\rho}\operatorname{R}(x^{\rho})$ ? "

let's start with a sketch using von Mangoldt's derivation to obtain your equation $(1)$ that will be used for inspiration (for proofs see for example Edwards' chapter 3) :

Riemann's Explicit Formulas
The Euler product formula gives us :
$$\tag{1}\boxed{\displaystyle\zeta(s)=\prod_{p\ \text{prime}}\frac 1{1-p^{-s}}}\quad\text{for}\ \ \Re(s)>1$$
so that
$$\log \zeta(s)=-\sum_{p\ \text{prime}}\log(1-p^{-s})=\sum_p\sum_{k=1}^\infty \frac{p^{-ks}}k$$
minus the derivative will be :
$$\tag{2}f(s):=-\frac{\zeta'(s)}{\zeta(s)}=\sum_p\sum_{k=1}^\infty \frac{\log\,p}{p^{ks}}=\sum_{n=1}^\infty \frac{\Lambda(n)}{n^s}\quad\text{for}\ \ \Re(s)>1$$
with $\Lambda$ the von Mangoldt function defined by $\ \Lambda(n):=\begin{cases}
\log\, p & \text{if}\ n=p^k\ \text{and}\ k>0\\
0 & \text{else}
\end{cases}$
Let's use the definition of the second Chebyshev function : $\displaystyle \psi(x)=\sum_{n\leq x}\Lambda(n)$ and Abel's sum formula applied to $a(n):=\Lambda(n)$ and $\phi(n):=n^{-s}$ :
$$\sum_{n=1}^\infty \frac{\Lambda(n)}{n^s}=s\int_1^\infty \frac {\sum_{n\leq x}\Lambda(n)}{x^{s+1}}\;dx$$
to rewrite $f(s)$ as (the lower bound became $0$ since $\phi(x)=0$ for $x<1$) :
$$\tag{2.1}f(s)=s\int_0^{\infty}\frac{\psi(x)}{x^{s+1}}dx$$
But this is a Mellin transform which may be reverted to get Perron's formula (let's observe that the Dirichlet series $\displaystyle f(s)=\sum_{n=1}^\infty \frac{\Lambda(n)}{n^s}$ is absolutely convergent for $\Re(s)>1$ and suppose $c>1$) :
$$\tag{3}\psi^*(x):=\frac1{2\pi i}\int_{c-i\infty}^{c+i\infty}f(s)\frac{x^s}s\,ds=\sum_{n=1}^\infty \Lambda(n) \frac1{2\pi i}\int_{c-i\infty}^{c+i\infty}\left(\frac xn\right)^s\frac{ds}s$$
This last integral may be evaluated using Fourier's theorem :
$$\ \displaystyle\frac1{2\pi i}\int_{c-i\infty}^{c+i\infty}\frac{y^s}s ds=
\begin{cases}
\ \ 0 & 0<y<1\\
1/2 & \quad y=1\\
\ \ 1 & \quad y>1\\
\end{cases}$$
and we obtain (as wished) that : $\displaystyle \tag{4}\psi^*(x)=\sum_{n\le x}^{*}\Lambda(n)$
with $\psi^*$ the second Chebyshev function except when $x$ is an integer because in this case the last term of the sum has to be divided by $2$. This will be the meaning of the $^*$ symbols in this article : at a first order discontinuity point (i.e. a jump) the result is the mean value of the limit at the left and the right.
Now $\psi^*(x)$ may also be written as :
$$\tag{5}\psi^*(x)=-\frac1{2\pi i}\int_{c-i\infty}^{c+i\infty}\frac{\zeta'(s)}{\zeta(s)}\frac{x^s}s\,ds$$
Here the idea is simply to sum the residues of (all) the poles at the left of the vertical line of integration ($c>1$) at least if $x>1$ (for $0<x<1$ we would have to take the poles at the right and obtain $0$). These poles come from the denominator $s$, the pole of $\zeta$ at $1$ and the zeros with the correspondence : $0\mapsto -\frac{\zeta'(0)}{\zeta(0)},\ 1\mapsto x^1,\ \rho\mapsto -\frac{x^\rho}{\rho}$ for $\rho$ any zero of $\zeta\,$ (from the Weierstrass factorization of the Hadamard product) so that :
$$\tag{6}\boxed{\displaystyle\psi^*(x)=x-\sum_{\rho} \frac {x^{\rho}}{\rho}-\frac{\zeta'(0)}{\zeta(0)}},\quad(x>1)$$
(in this post we won't distinguish the trivial from the non-trivial zeros $\rho$ ; for convergence the non-trivial roots should be grouped by pairs and sorted by increasing $|\Im(\rho)|$)
The Riemann prime-counting function is defined by :
\begin{align}
\tag{7}\Pi^*(x):&=\sum_{p^k\le x}^{*}\frac 1k=\sum_{n\le x}^{*}\frac {\Lambda(n)}{\log\,n}\\
&=\sum_{n\le x}^{*} \Lambda(n)\left(\int_n^x \frac{dt}{t\,\log^2 t}+\frac 1{\log\,x}\right)\\
&=\int_2^x\frac{\psi^*(t)\ dt}{t\,\log^2 t}+\frac{\psi^*(x)}{\log \,x}\\
&\tag{8}=\int_2^x\frac{\psi^{*'}(t)\ dt}{\log\,t}\\
\end{align}
But $\ \displaystyle\operatorname{li}(x)=\int_2^x \frac{dt}{\log\,t}\,$ (Riemann's variant of the logarithmic integral) verifies $\ \displaystyle\operatorname{li}(x^r)'=\frac{r\,x^{r-1}}{\log\ x^r}=\frac{x^{r-1}}{\log\,x}$ so that from $(6)$ :
$$\tag{9}\boxed{\displaystyle\Pi^*(x)=\operatorname{li}(x)-\sum_{\rho} \operatorname{li}(x^{\rho})},\quad(x>1)$$
The prime-counting function is defined by $\ \displaystyle\pi^*(x):=\sum_{p\le x}^{*}1\ $ while $\ \displaystyle\Pi^*(x):=\sum_{p^k\le x}^{*}\frac 1k$ will be :
$$\tag{10}\Pi^*(x)=\sum_{k>0} \frac{\pi^{*}\bigl(x^{1/k}\bigr)}k$$
Applying the Möbius inversion formula $\ \displaystyle\pi^{*}(x):=\sum_{n=1}^{\infty} \frac{\mu(k)}k \Pi^*\bigl(x^{1/k}\bigr)\ $ to $(9)$ we get (with questionable convergence...) :
$$\tag{11}\boxed{\displaystyle\pi^*(x)=R(x)-\sum_{\rho} R(x^{\rho})},\quad(x>1)$$
Where Riemann's $\,\displaystyle R(x):=\sum_{n=1}^{\infty} \frac{\mu(k)}k \operatorname{li}\bigl(x^{1/k}\bigr)\,$ may be written as a Gram series.

Dirichlet's L-functions
We will try to repeat the previous derivations but with $\zeta$ replaced by the Dirichlet L-function
$$L(s,\chi)=\sum_{k=1}^\infty\frac{\chi(k)}{k^s}$$
With $\chi$ a Dirichlet character we get following Euler product :
$$\tag{1'}\boxed{\displaystyle L(s,\chi)=\prod_{p\ \text{prime}}\frac 1{1-\chi(p)p^{-s}}}\quad\text{for}\  \ \Re(s)>1$$
so that ($\chi$ is multiplicative implying $\chi(p)^k=\chi(p^k)$) :
$$\log L(s,\chi)=-\sum_{p\ \text{prime}}\log(1-\chi(p)p^{-s})=\sum_p\sum_{k=1}^\infty \frac{\chi(p^k)p^{-ks}}k$$
minus the derivative relatively to $s$ will be :
$$\tag{2'}f(s,\chi):=-\frac{L'(s,\chi)}{L(s,\chi)}=\sum_p\sum_{k=1}^\infty \frac{\chi(p^k)\log\,p}{p^{ks}}=\sum_{n=1}^\infty \frac{\chi(n)\Lambda(n)}{n^s}\quad\text{for}\ \ \Re(s)>1$$
The Perron formula applied to $f(s,\chi)$ gives :
$$\tag{3'}\psi^*(x,\chi):=\frac1{2\pi i}\int_{c-i\infty}^{c+i\infty}f(s,\chi)\frac{x^s}s\,ds=\sum_{n=1}^\infty \chi(n)\Lambda(n) \frac1{2\pi i}\int_{c-i\infty}^{c+i\infty}\left(\frac xn\right)^s\frac{ds}s$$
$$\tag{4'}\psi^*(x,\chi)=\sum_{n\le x}^{*}\chi(n)\Lambda(n)$$
But $\psi^*(x,\chi)$ may also be written as :
$$\tag{5'}\psi^*(x,\chi)=-\frac1{2\pi i}\int_{c-i\infty}^{c+i\infty}\frac{L'(s,\chi)}{L(s,\chi)}\frac{x^s}s\,ds$$
Again we compute the sum of the residues at (all) the poles to the left of the vertical line of integration (for $c>1$). The contributions from the different poles will be : $0\mapsto -\frac{L'(0,\chi)}{L(0,\chi)},\ \rho\mapsto -\frac{x^\rho}{\rho}$ for $\rho$ any zero of $L(s,\chi)\,$ (from Weierstrass factorization) so that :
$$\tag{6'}\boxed{\displaystyle\psi^*(x,\chi)=-\sum_{\rho} \frac {x^{\rho}}{\rho}-\frac{L'(0,\chi)}{L(0,\chi)}},\quad(x>1)$$
(the sum over $\rho$ combines the trivial and the non-trivial zeros and we will suppose that $\chi$ is a non principal character so that $\,L(s,\chi)\,$ is regular everywhere, for a principal character we should add a $x$ contribution from the pole at $1$)
An analogue to the Riemann prime-counting function will be :
\begin{align}
\tag{7'}\Pi^*(x,\chi):&=\sum_{p^k\le x}^{*}\frac {\chi(p^k)}k=\sum_{n\le x}^{*}\frac {\chi(n)\Lambda(n)}{\log\,n}\\
&=\sum_{n\le x}^{*} \chi(n)\Lambda(n)\left(\int_n^x \frac{dt}{t\,\log^2 t}+\frac 1{\log\,x}\right)\\
&=\int_2^x\frac{\psi^*(t,\chi)\ dt}{t\,\log^2 t}+\frac{\psi^*(x,\chi)}{\log \,x}\\
&\tag{8'}=\int_2^x\frac{\psi^{*'}(t,\chi)\ dt}{\log\,t}\\
\end{align}
From $\ \displaystyle\operatorname{li}(x^r)'=\frac{x^{r-1}}{\log\,x}$ and $(6')$ we get :
$$\tag{9'}\boxed{\displaystyle\Pi^*(x,\chi)=-\sum_{\rho} \operatorname{li}(x^{\rho})},\quad(x>1)$$
(for $\chi$ a principal character there is an additional $\,\operatorname{li}(x)$ term)
The $\chi$-prime-counting function is $\ \displaystyle\pi^*(x,\chi):=\sum_{p\le x}^{*}\chi(p) $ while $\ \displaystyle\Pi^*(x,\chi):=\sum_{p^k\le x}^{*}\frac {\chi(p^k)}k$ so that :
$$\tag{10'}\Pi^*(x,\chi)=\sum_{k>0} \frac{\pi^{*}\bigl(x^{1/k},\chi^k\bigr)}k,\quad(x>1)$$
Broken analogy...
The problem here is that we have $\,\pi^{*}\bigl(x^{1/k},\chi^k\bigr)$ in the sum and not $\,\pi^{*}\bigl(x^{1/k},\chi\bigr)$.
For principal characters (when $\,\chi(p)=0$ or $1$ so that $\,\chi^k(p)=\chi(p)\,$ for $k$ positive) we may apply the Möbius inversion formula to $(9')$ and get :
$$\tag{11'}\displaystyle\pi^*(x,\chi)=[R(x)]-\sum_{\rho} R(x^{\rho})$$
(since $\chi$ is a principal character we must add the $R(x)$ term from the pole at $1$)
but this doesn't work in general and the equality becomes questionable after the first prime $p$ such that $\,\chi^k(p)\not =\chi(p)\,$ as we will see by considering your specific question.
We want $\chi$ to be the Dirichlet character modulo $4$ ($\chi_2$ in the link) defined by $\ \displaystyle\chi(0)=0,\ \chi(1)=1,\ \chi(2)=0,\ \chi(3)=-1\ $ and get :
$$\tag{12'}L(s,\chi)=\sum_{n=0}^\infty\frac {(-1)^n}{(2n+1)^s}=\beta(s)$$
with $\beta$ the Dirichlet beta function we could hope that :
$$\pi^*(x,\chi)=\displaystyle\pi_{4,1}^*(x)-\pi_{4,3}^*(x)\approx -\sum_{\rho} R(x^{\rho})$$
with $\pi_{q,a}(x)=\#\{p:p\ \text{is prime and}\ \,p\le x\,\ \text{and}\ \,p\equiv a\pmod q\}$
But, from $(10')$ and $(9')$, we have in fact :
\begin{align}
\Pi^*(x,\chi)&=\sum_{k>0} \frac{\pi_{4,1}^{*}\bigl(x^{1/k}\bigr)+(-1)^k\,\pi_{4,3}^{*}\bigl(x^{1/k}\bigr)}k=-\sum_{\rho} \operatorname{li}(x^{\rho})\\
&=\sum_{k>0} \frac{\pi_{4,1}^{*}\bigl(x^{1/k}\bigr)-\,\pi_{4,3}^{*}\bigl(x^{1/k}\bigr)}k+2\sum_{j>0} \frac{\pi_{4,3}^{*}\left(\sqrt{x}^{1/j}\right)}{2j}\\
\end{align}
so that the Möbius transformation will return the exact (with $\rho$ any zero of $\beta$) :
$$\tag{13'}\boxed{\displaystyle\pi_{4,1}^{*}(x)-\pi_{4,3}^{*}(x)+\pi_{4,3}^{*}\left(\sqrt{x}\right)=-\sum_{\rho} R(x^{\rho})}$$
To show the effect of the $\,\pi_{4,3}^{*}\left(\sqrt{x}\right)\,$ term let's exhibit an approximation of the expression at the right (taking the $40$ first terms of the sum $R$ and the $300$ first non-trivial zeros of the Dirichlet-beta function) that we compare to the exact (dark) result for $\,\pi^*(x,\chi)=\displaystyle\pi_{4,1}^*(x)-\pi_{4,3}^*(x)\,$ in the interval $\,[5,80]$ :

The initial behavior seems right : $-1$ at $3$ followed by $+1$ at $5$ and $-1$ at $7$ but just after that there is a first 'irregularity' at $9=3^2$ because $\chi(3^2)=1$ while $\chi(3)=-1$. After that the behavior is correct (shifted $+1$ of course) until another irregularity at $49=7^2$ again because $\chi(7^2)=1$. The next one will be at $121=11^2$ and at all the following squares of primes of gender $4n+3$...

ADDITION: Draks telescoping
The situation was blocked at this point until draks, using a suggestion of Greg Martin, proposed in february his powerful telescoping method to obtain (the $\rho_\zeta$ and $\rho_\beta$ are respectively all the zeros of the $\zeta$ and $\beta$ function) :
$$\tag{14'}\pi_{4,3}(x):=\sum_{k=0}^\infty\;2^{-k-1}\left(
R\left(x^{1/2^{k}}\right)-\sum_{\rho_\zeta}
R\left(x^{\rho_\zeta/2^k}\right) +\sum_{\rho_\beta}
R\left(x^{\rho_\beta/2^k}\right) \right)$$
We may obtain this result too (with a minor correction) by rewriting $(11)$ as (for $x>2$) :
$$\pi^*(x)=1+\pi_{4,1}^{*}(x)+\pi_{4,3}^{*}(x)=R(x)-\sum_{\rho_\zeta} R(x^{\rho_\zeta})$$
($1$ was added since all primes except $2$ are equal to $1$ or $3\bmod{4}$)
and using $(13')$ :
$$\pi_{4,1}^{*}(x)-\pi_{4,3}^{*}(x)+\pi_{4,3}^{*}\left(\sqrt{x}\right)=-\sum_{\rho_\beta} R(x^{\rho_\beta})$$
Subtracting these equations gives :
$$2\pi_{4,3}^{*}(x)-\pi_{4,3}^{*}\left(\sqrt{x}\right)=R(x)-1-\sum_{\rho_\zeta} R(x^{\rho_\zeta})+\sum_{\rho_\beta} R(x^{\rho_\beta})$$
while draks' telescoping sum $\ \displaystyle\frac 12\sum_{k=0}^\infty \frac{f\left(x^{1/2^{k}}\right)}{2^k}$ is :
$$\sum_{k=0}^\infty \frac {2\,\pi_{4,3}^{*}(x^{1/2^{k}})-\pi_{4,3}^{*}\bigl(x^{1/2^{k+1}}\bigr)}{2^{k+1}}=\sum_{k=0}^\infty \frac {R\left(x^{1/2^{k}}\right)-1-\sum_{\rho_\zeta} R\left(x^{\rho_\zeta/2^k}\right)+\sum_{\rho_\beta} R\left(x^{\rho_\beta/2^k}\right)}{2^{k+1}}$$
producing draks' formula :
$$\tag{15'}\boxed{\displaystyle\pi_{4,3}^{*}(x)=\sum_{k=0}^\infty \frac {R\left(x^{1/2^{k}}\right)-\sum_{\rho_\zeta} R\left(x^{\rho_\zeta/2^k}\right)+\sum_{\rho_\beta} R\left(x^{\rho_\beta/2^k}\right)}{2^{k+1}}-1}$$
A similar formula may be written for $\pi_{4,1}$ and this answers positively the initial question !
Let's finish with a plot of $\pi_{4,3}^{*}(x)$ from $4$ to $100$ (more details here with the pari/gp scripts used)
Comment: Raymond, first of all: Wow! What an answer. "+1". Thank you so much for everything including the link to Edward's book. My copy is buried somewhere in a box because I moved. It'll take me a while to *verify all that*, but like you, I think that the *reasoning by analogy* is correct. Specially the last equation thrills me. You might have noticed my attempts with ["Summing over General Functions of Primes"](http://math.stackexchange.com/q/115230/19341) ...
Comment: ... or the follow-on question: ["An Expression for $\log\zeta(ns)$ derived from the Limit of the truncated Prime $\zeta$ Function"](http://math.stackexchange.com/q/280984/19341). So I think it's possible to combine these result to get an analytic expression for the truncated Prime $\zeta$ function with a restriction to primes $4n\pm 1$. This is ever so cool and I can't leave this unawarded...
Comment: Thanks @draks... I think that most things are right here except tiny things like the - from the citation, the starting value $n=1$ of the Dirichlet beta function,  and perhaps very important things like the transitions from $(9')$ to $(11')$ : these should be (more than!) double checked (because of things like $\chi(3^2)=1\not =-1$ and of warnings from different authors like Ingham that Riemann's method to obtain $\pi$ may not be as easily generalized as $\psi\cdots$ but works only for some specific Dirichlet characters ($\chi(p)=0,1$ only?)). But this clear path may at least be checked!
Comment: @draks... I corrected the end of my answer.
Comment: aha, looks like we've gottta add $(\mu^2(n)-1)$ to get rid of the squares...interesting, what do you think? And thanks for your thoughts. At least my ${\rm li}(x)$ works...
Comment: @draks... hmmm I don't know (we need to change the sign of the squares but only for the $4n+3$ primes)...
Comment: It looks like the dog, I'm hunting, bites its own tail, since one would need a prime counting function $\pi_{4n+3}$ as argument for the Möbius function, to get the $-\sum_{\rho} R(x^{\rho})$ correction to get the prime counting function $\pi_{4n+3}$. Strange isn't it?$\color{white}{...}$
Comment: What do you think about this one: [Will this work as a $\pi_{4n\pm 1}$ prime counting function?](http://math.stackexchange.com/q/290137/19341)
Answer: Let's start with the nice paper 'Prime Number Races' of Granville and Martin from your comments. It contains the sentence :

"The precise formula he (Riemann) proposed is a bit too technical for
  this article, but we can get a good sense of it from the following
  approximation when x is large. This formula, while widely believed to
  be correct, has not yet been proved."

$$
\tag{1}\boxed{\displaystyle\frac{\int\limits_2^x{\frac{dt}{\ln t}}-\pi(x)}{\sqrt x/\ln x} \approx 1 + 2\sum_{\gamma} \ \ \frac{\sin(\gamma\ln x)}{\gamma}}
$$
I can only conjecture that the formula referenced in their last sentence is your formula $(1)$ (I don't know a proof of convergence of this formula either) derived from Riemann's explicit formula (proved by von Mangoldt) and not the approximate formula I reproduce above equivalent to your $(2)$ . Note that they add that this approximation is valid 'when $x$ is large'.
Let's add that this approximation doesn't include the trivial zeros from your other thread.
Concerning the $\displaystyle \frac{\sin(\gamma\ln x)}{\gamma}$ term it is a good approximation of Riesel's approximation $(2.30)$ from his fine book 'Prime Numbers and Computer Methods for Factorization' :
$$\tag{2}\frac{\cos(\gamma\ln x-\arg \rho)}{|\rho|},\quad\text{with}\ \ \rho=\frac 12+i\gamma$$
since $\ \gamma\gg 1 $ we have indeed $\ |\rho|\approx \gamma\ $ and $\ \arg\,\rho\approx \frac{\pi}2$
(note that $\gamma > 14.13\ $ so that $\ 1<\frac {|\rho|}{\gamma}<1.00063$)
Riesel's method is to approximate the oscillating term (see the next page from Riesel's book) :
$$\tag{3}\operatorname{R}(x^{\rho}) = \sum_{n=1}^{\infty} \frac{ \mu (n)}{n}\operatorname{li}(x^{\rho/n})$$
with the first term :
$$\tag{4}\operatorname{R}(x^{\rho}) \approx\left[\operatorname{li}(x^{\rho})=\operatorname{li}(e^{\rho\;\ln x})=\operatorname{Ei}(\rho\;\ln x)\right]$$
and to use the asymptotic expansion for $\operatorname{Ei}$ :
$$\tag{5}\operatorname{Ei}(z)\sim \frac{e^z}{z}\left(1+\frac {1!}z+\frac{2!}{z^2}+\cdots\right)$$
to get :
$$\operatorname{Ei}\left(\left(\frac 12+i\gamma\right)\;\ln x\right)\approx \frac{x^{1/2+i\gamma}}{(1/2+i\gamma)\;\ln x}$$
so that combining the two 'mirror' zeros :
$$\operatorname{Ei}\left(\left(\frac 12+i\gamma\right)+\;\ln x\right)+\operatorname{Ei}\left(\left(\frac 12-i\gamma\right)+\;\ln x\right)\approx \frac{\sqrt{x}}{\ln x}\left(\frac{e^{i\gamma\ln x}}{1/2+i\gamma}+\frac{e^{-i\gamma\ln x}}{1/2-i\gamma}\right)$$
$$\approx\frac{\sqrt{x}}{\ln x}\frac{e^{i\gamma\ln x-i\arg{\rho}}+e^{-i\gamma\ln x+i\arg{\rho}}}{|\rho|}\quad\text{since}\ \ \rho=\frac 12+i\gamma$$
we get Riesel's approximation :
$$\tag{6}\operatorname{R}(x^{\rho})+\operatorname{R}(x^{\overline{\rho}})\approx\frac{2\;\sqrt{x}\;\cos(\gamma\ln x-\arg{\rho})}{|\rho|\;\ln x}$$
while $\operatorname{R}(x)$ was approximated by (using $(3), (4), (5)$) :
$$\tag{7}\operatorname{R}(x)\approx \operatorname{li}(x)-\frac 12\operatorname{li}\bigl(x^{1/2}\bigr)\quad \text{with}\ \operatorname{li}\bigl(x^{1/2}\bigr)\approx \frac{2\sqrt{x}}{\ln x}$$
this allows too to get better approximations if wished ($\operatorname{R}(x)\approx \operatorname{li}(x)-\frac 12\operatorname{li}\bigl(x^{1/2}\bigr)-\frac 13\operatorname{li}\bigl(x^{1/3}\bigr) $ for example, adding the trivial zeros contribution and so on...)
Now to answer your questions :

We have to suppose the R.H. to be able to write $\rho=\frac 12+i\gamma\ $ for any root $\rho$ so that the simplifications proposed apply (in practice we don't need R.H. since $(2)$ requires precomputed zeros and since all the zeros known satisfy the R.H. ... to this date...)
The implication from $(1)\to (2)$ was provided without using the Gram series

Hoping this clarified things,
Comment: thank you very much. Again :-)
Comment: You are welcome @draks : this gave me the occasion to compute some zeros (say 331) of Dirichlet beta, see a fine approximation for $\pi(n)$ and ways to make it better. Thanks for the journey !
Comment: Wow 331 sounds great. I was just out to find a table where these zeros are listed. Would you mind sharing the zeros of **beta** with me? And to be honest I still have one more question: Is it possible to write $\#\{\text{primes}\ 4n+3 \le x\} - \#\{\text{primes}\ 4n+1
\le x\}$(form [here](http://math.stackexchange.com/q/149755/19341)) in terms like $\operatorname{R}(x^1) - \sum_{\rho}\operatorname{R}(x^{\rho})$ ? I hope I don't bother you too much...
Comment: Thanks a lot. Concerning the last question, I thought about using a simple analogy $(\pi_{4n+3}-\pi_{4n+1})-\text{Li}(x)=\text{R}(x)-\sum_\rho \text{R}(x^\rho)$ with $\rho$ being the values you've kindly provided...?
Comment: @draks: I gave the zeros in your other [thread](http://math.stackexchange.com/questions/149755/textprimes-4n3-le-x-in-terms-of-textlix-and-roots-of-diric/271847#271847) and will erase the values here... Concerning your other question I don't know but will look at it in the coming days (it's late...). I must add that from your formula $(4')$ there is probably a similar (or identical) formula as you suppose !
Comment: I have to correct myself. I think it is $\pi_1 -\pi_3 + {\rm Li}(x)={\rm R}(x)-\sum_\rho{\rm R}(x^\rho)$? I think the LHS would be more close to the RHS if we write it as $\pi_1 -\pi_3 + \sum_k \frac{\mu(k)}k{\rm Li}(x^{1/k})=\pi_1 -\pi_3 +{\rm R}(x)={\rm R}(x)-\sum_\rho{\rm R}(x^\rho)$ and therefore $\pi_3 -\pi_1=\sum_\rho{\rm R}(x^\rho)$. I would be glad to hear/read your opinion?
Comment: @draks... I didn't try it numerically for small values but may give it a try (this) tuesday evening. Of course I am more interested by a derivation (possibly done by Landau around 1905 or 1918 in a more abstract character-like $\psi$ way). I am merely very busy (at work but too about the numerous ideas turning around the huge subject of explicit formulas, L-functions, Multiple Dirichlet Series, periods...) so that convergence is very slow. ;-)
Comment: ...with your roots for $\beta$ provided and my implementation of ${\rm R}(x)$ I can also do it. I'll put my num3rica1 results here, asap. I'm also quite busy these days. Concering the the analytical derivation: Do you think you can just take Riemann's proof from $\zeta(s)$ to $\pi(n)$ and revert the proof steps while starting from $\pi_1(n)-\pi_3(n)$? I'll have to have another look at Harold M. Edward's book...
Comment: @draks: I hope so. The idea is to start with the logarithm of the appropriate Euler product, use a Mellin transform to get (something similar to) Riemann's explicit formula and use the Möbius transformation to get a variant of $(1)$. So that merely remains the redaction ! ;-) (it seems that the $\psi$ form : sum over powers of primes ; was preferred since von Mangoldt ; there could be a reason...)
Comment: Hey Raymond, sorry there was an acceptance problem caused by my tablet. Sorry for inconvenience...
Comment: No problems @draks. In fact you should have 'unaccept' my answer earlier for better visibility of your $+200$ bounty (less people will look at an accepted answer...). Fine continuation,
Comment: If you're interested, I wrote up my ideas in this [chat](http://chat.stackexchange.com/rooms/7548/discussion-between-draks-and-greg-martin). Your opinion is highly welcome...
Answer: You probably know that
$$
\Pi^*(x;q,a) = \sum^*_{\substack{n\le x \\ n\equiv a\pmod q}} \frac{\Lambda(n)}{\log n} = \frac1{\phi(q)} \sum_{\chi\pmod q} \overline{\chi(a)}\Pi^*(x,\chi).
$$
I find that the easiest way to convert from counting prime powers (with weights) to counting only primes is to use the fact that
\begin{align*}
\Pi^*(x;q,a) &= \sum^*_{\substack{p\le x \\ p\equiv a\pmod q}} 1 + \sum^*_{\substack{p^2\le x \\ p^2\equiv a\pmod q}} \tfrac12 + \sum^*_{\substack{p^3\le x \\ p^3\equiv a\pmod q}} \tfrac13 + \cdots \\
&= \pi^*(x;q,a) + \tfrac12 \sum_{\substack{b\pmod q \\ b^2\equiv a\pmod q}} \pi^*(x^{1/2};q,b) + \tfrac13 \sum_{\substack{c\pmod q \\ c^3\equiv a\pmod q}} \pi^*(x^{1/3};q,c) + \cdots
\end{align*}
and solving for $\pi^*(x;q,a)$ in terms of all $\Pi^*$ functions (tedious but possible).
Comment: +1 thanks, doesn't it boil down a little/lot when $a=1$? Could you give me a reference hint or something else to read on that topic?
Comment: I'm not sure it gets much better when $a=1$. Except that all the values $\chi(a)$ (which I forgot to put in in the first place - they're there now) equal $1$ and thus disappear. But $a=1$ will yield the largest possible number of terms in the sums over $b$, $c$, etc. in the last displayed equation line.
Comment: hmm, when I look at the second term in the last line and insert $a=1$, the sum's running over $b=1,3,5,7,\dots$. But $b>3$ doesn't make sense since it's included already before, right? If this is correct and I continue, I get  $x^m\equiv 1 \bmod 4\to \cases{x=1,3 \text{ if $m$ even }\\x=1\;\;\,\, \text{    if $m$ odd}} $. But doesn't summing $\pi(x^{1/m};4,\pm 1)$  equal $\pi(x^{1/m})$? How to continue from here? Could you kindly sketch the way...?
Comment: Right, when I write a sum over $b\pmod q$, I mean a sum over residue classes - so don't separately include both $b=1$ and $b=5$, since they're the same residue class. And in this particular case, when $m$ is even you do in fact count all odd primes in the sum, yes.
Comment: you are awarded the bounty since it was your prime race paper which gave me new hope. I'm currently studying your arXiv stuff. Could you point me to something that would help me once more?
Comment: Thanks @draks...! Regarding additional help, what question is foremost on your mind now?
Comment: How to explicitly formulate $\pi(x;q,a)$ in terms of roots of the $L$-functions, especially for $q=4,a=1$? A hint how to procede from your starting point would be very nice, but you should know that I'm not familiar with these kind of calculations. I'm used to follow them, but not inventing them, but I'm also able to learn...
Comment: One more thing: I accepted your answer by mistake. It was from my tablet. I will re-accept Raymond's. Sorry for inconvenience...
Comment: (no problem) It's a four-step process (some reordering is possible). 1: the explicit formula for $\psi(x,\chi)$ in terms of zeros of $L(s,\chi)$ - essentially (6') from Raymond's answer, although when $\chi$ is the principal character there is an extra term $x$ on the RHS. 2: relating $\psi(x,\chi)$ to $\Pi(x,\chi)$ using partial summation - essentially (7') through (9'), though I feel (9') is missing some terms. 3: combining $\Pi(x,\chi)$ to get $\Pi(x;q,a)$ - that's the first equation in my answer. 4: combinatorially rewriting in terms of $\pi(x;q,a)$ - the rest of my answer.
Comment: Perhaps a more typical ordering is: relate $\psi(x,\chi)$ to $\psi(x;q,a)$ (orthogonality of Dirichlet characters); relate $\psi(x;q,a)$ to $\theta(x;q,a) = \sum_{p\le x,\, p\equiv a\pmod q} \log p$ (no prime powers there) using the combinatorics from my answer; then relate $\theta(x;q,a)$ to $\pi(x;q,a)$ using partial summation. Should lead to the same result though.
Comment: let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/7548/discussion-between-draks-and-greg-martin)
Comment: Hi Greg, Raymond checked the derived [formula for $\pi^*(x;4,3)$](http://math.stackexchange.com/a/409667/19341) and the result looks really nice. If you want, have a [look](http://math.stackexchange.com/a/412511/19341)...
Comment: @GregMartin What is $\chi$ in your answer?
Comment: They are Dirichlet characters.
Comment: @GregMartin I'm sorry, I have mistyped, I meant: What is $\overline{\chi(a)}$?
Comment: $\overline{\chi(a)}$ is the complex conjugate of $\chi(a)$ (or, equivalently in this case since $|\chi(a)|=1$, its reciprocal).


If $\phi: X \rightarrow Y$ is a morphism of varieties, then $\phi(X)$ contains a nonempty open subset of $\overline{\phi(X)}$.

Question: This question has been asked before, but I am stuck on a different part.  If $\phi: X \rightarrow Y$ is a morphism of varieties over an algebraically closed field $k$, I'm trying to understand why $\phi(X)$ contains a nonempty open subset of its closure.  Here a variety is a ringed space of $k$-algebras which has a finite open cover by maximal spectra of reduced finitely generated $k$-algebras.
I understand the proof when $X$ and $Y$ are affine, $X$ is irreducible, and $\phi(X)$ is dense in $Y$. What I'm having trouble understanding is how we can reduce to that case.  In (1.9.5), Springer Linear Algebraic Groups, the proof says we first reduce to the case where $Y$ is affine, then to the case where $X$ is affine, then to the case where $X$ is irreducible.

Reducing to the case where $Y$ is affine:

I'm trying to understand first how we can reduce to the case where $Y$ is affine.  I suppose we should start with finite affine open cover $W_i$ of $Y$, and let $U_i = \phi^{-1}W_i$.  Then $\phi$ restricts to a morphism of varieties $U_i \rightarrow W_i$.  The closure of $\phi(U_i)$ in $W_i$ is $\overline{\phi(U_i)} \cap W_i$.  Suppose for each $i$ with $U_i \neq \emptyset$, we have shown that $\phi(U_i)$ contains a nonempty open subset $V_i$ of $\overline{\phi(U_i)} \cap W_i$.  That intersection itself is open in $\overline{\phi(U_i)}$.  Hence $V_i$ is open in $\overline{\phi(U_i)}$.  I want to say that the union of $V_i$ is open in the union of the $\overline{\phi(U_i)}$, which is $\overline{\phi(X)}$.  But in general if $A_1$ is open in $B_1$, and $A_2$ is open in $B_2$, then $A_1 \cup A_2$ need not be open in $B_1 \cup B_2$.  Even if $B_1$ and $B_2$ are closed in some larger space.
Answer: You need an open affine cover of $\overline{\phi(X)}$, not of $Y$.  So the trick is to assume without loss of generality from the beginning that $\phi(X)$ is dense in $Y$.  Then $\phi(X) \cap W_i$ is dense in $W_i$.  Now let $U_i = \phi^{-1}(W_i)$.  The claim is that $$\overline{\phi(U_i)} \cap W_i = W_i$$ Once this is proved, we are done, because the $V_i$ will then be open in $Y$.  We have $\phi(U_i) = \phi(X) \cap W_i$, so the closure of $\phi(U_i)$ in $W_i$, i.e. $\overline{\phi(U_i)} \cap W_i$, is the closure of $\phi(X) \cap W_i$ in $W_i$.  But $\phi(X) \cap W_i$ is dense in $W_i$, so this closure is $W_i$.


Javascript validation works...and fails

Question: I have the following Javascript code in my web page that SHOULD ensure data validation and then (if the form is valid) submit the data to an AJAX call:

The problem is, the validation works, but it doesn't.  When the form fields are not valid, it hits this block:
if (form.checkValidity() == false) {
    form.classList.add('was-validated');
    alert('Hit invalid user input');
    return false;
}

and the alert is displayed.  The very next line should force the function to exit, stopping execution of any remaining code, but for some reason it doesn't.  Instead, the remainder of the code executes as if the form is valid, and the alert for the AJAX failure pops up.
Why does the 'return false' not actually force the function to exit, and what am I missing here?
Comment: `return false` is a statement of the anonymous function `function (form) {...` which is called for each form element. The anonymous function `function (event) {...` doesn't have a `return` statement. The filter function in `Array.prototype.filter.call(forms, ` has to return either `true` or `false` for each element to work as expected, not `false` or `undefined`. Why do you use filter instead of e.g. `Àrray.prototype.every`?
Comment: OMG...!   You're right.  Post this as an answer and I'll accept it.  I added a variable that gets set to true/false inside the function, and then test the condition to either exit the submit or continue.  Thank you!  Been banging my head on this for a little while (hurts...).  Can't believe I missed that...
Answer: return false is a statement of the anonymous function function (form) {... which is called for each form element. The anonymous function function (event) {... doesn't have a return statement. The filter function in Array.prototype.filter.call(forms, has to return either true or false for each element to work as expected, not false or undefined. You could use e.g. Array.prototype.every and/or Array.prototype.map instead of Array.prototype.filter:

Javascript validation works...and fails


root profile error

Question: I had a problem with my root account on Ubuntu 14.04. when I login by using root account, I received this error:
Error found when loading /root/.profile: stdin: is not a tty
As a result the session will not be configured correctly. You should fix the problem as soon as feasible

Comment: Why login with the root account? `sudo` or `gksudo` etc can do all you need from a regular account
Comment: have you edited any bash file in root folder?
Comment: please refer to here `http://docs.fabfile.org/en/1.4.3/faq.html` and try all three approches to solve the same proglem
Answer: https://bugs.launchpad.net/ubuntu/+source/xen-3.1/+bug/1167281
stdin: is not a tty due to mesg n instead of tty -s && mesg n in .profile
Try the said method to add tty -s && in front of the line mesg n and see if it helps. The difference is, in case your problem is also caused by the mesg n in yout profile.

root profile error


Sorting array by another array's size

Question: var names = ['Bob', 'Joe', 'Phil', 'Max'];
var ages = [8, 23, 15, 17];

I need to sort the names by their age. So something like:
var result = [1, 3, 2, 0];

Comment: You want the result to be an array of indices? And why do you have the data stored in two separate arrays in the first place instead of an array of objects?
Comment: You pose three different questions: (1) your title, (2) your description, and (3) your example.
Comment: @TimothyShields, someone converting an answer from one language which they have never seen to another language is not prerequisite. Perhaps something exists in JavaScript which makes this easier. Or maybe there is an idiomatic way to do it that different than in C++11. Also, C++11 is so new that most compilers have it off by default.
Comment: See here: http://stackoverflow.com/questions/17074324/how-can-i-sort-two-vectors-in-the-same-way-with-criteria-that-uses-only-one-of/17074810#17074810 This answer is for C++11, but the concept is directly applicable.
Comment: @PaulDraper There's a reason it was a comment and not an answer. ;) The idea of (A) creating the list containing 1,2,...n, (B) sorting that list based on your key then (C) using the sorted list of indices to permute your list of items is in fact directly applicable...
Comment: @TimothyShields, quite correct. I misunderstood your comment as implying that the question was a duplicate of another question.
Answer: You question asked to sort names, but your output has indices. I'm not sure which you want.
This sorts names by age (per your question):
var sortedNames = ages.map(function(age, i) {
    return {age:age, i:i};
}).sort(function(a, b) {
    return a.age - b.age;
}).map(function(a) {
    return names[a.i];
});

This sorts the indices (per your example):
var result = ages.map(function(age, i) {
    return i;
}).sort(function(i, j) {
    return ages[i] - ages[j];
});

Answer: I would reccommend changing your data structure to something like this
people = [
    {name: "John", age: 62},
    {name: "Mike", age: 21},
    {name: "Dave", age: 54}
];
people.sort(function(val1, val2) {
    return val2.age - val1.age;
});
people;//[{name:"John", age:62}, {name:"Dave", age:54}, {name:"Mike", age:21}]

Sorting array by another array's size


Saving Inputs to ArrayList

Question: So I am making a project and I want to create a new clinic.
On my UI we insert all the topics that we need to create the clinic and they must be saved as ArrayList and I am struggling with this method.
this is how i am asking for the input, should i change to a scanner?
laboratoryId = Utils.readLineFromConsole("Enter Clinic Id: ");

class to the array
public class ClinicalAnalysisLabStore{

        private ArrayList<ClinicalAnalysisLab> cliniclist;

        public ClinicalAnalysisLabStore(){
                cliniclist = new ArrayList<>();
        }

        public ArrayList<ClinicalAnalysisLab> getCliniclist() {
                return cliniclist;
        }

      cals = new ClinicalAnalysisLabStore();
        ArrayList<ClinicalAnalysisLab> cliniclist = cals.getCliniclist();

for(ClinicalAnalysisLab cals : cliniclist){
                    System.out.print(cals.getLaboratoryId()+"\n");
                    System.out.print(cals.getName()+ "\n");
                    System.out.print(cals.getAddress()+"\n");
                    System.out.print(cals.getPhoneNumber()+"\n");
                    System.out.print(cals.getTinNumber()+"\n");
                    System.out.print(cals.getTestType()+"\n");

                }
                Utils.readLineFromConsole("The Operation was a success!");

this is a short cut from my code where i am trying to print the arraylist but it only prints "The Operation was a success!"
Comment: Where did you add variables to the arraylist?
Comment: public class ClinicalAnalysisLabStore{

private ArrayList cliniclist;

public ClinicalAnalysisLabStore(){

                cliniclist = new ArrayList<>();
        }

        public ArrayList getCliniclist() {

                return cliniclist;
        }

this is the class where i made the array
Comment: Although you made the arraylist, you never added any items to it, so the arraylist is empty.
Comment: so how do i add items to it?
Comment: See my answer posted below
Comment: and so this should be replaced on my 1st or 2nd code?
Comment: It doesn't replace anything. What you're doing is creating a new object. So, put this right below the "laboratoryId" code. Also, attach your code for the "ClinicalAnalysisLab" class
Comment: posted it bellow
Comment: So now the problem that i am facing is that i need to initialize my variables i can't find a way to make set work
Comment: That's right. I edited my post with an example.
Comment: Did the code work?
Comment: but it is not supposed to initialize tha variables so thats my concern right now
Comment: it is but its not getting the input, only the initialize ones and it does not change
Comment: If you don't want to initialize the variables yourselves, all you have to do is get the input multiple times. Repeat this: laboratoryId = Utils.readLineFromConsole("Enter Clinic Id: "); for all the different variables
Comment: and i have that, check my post with RegistClinicalAnalysisLabUI
Comment: Then, what's the problem?
Comment: already was abble to made it, thank you very much!
Comment: No problem. If my answer worked, you can check if below.
Answer: You're ArrayList is empty. So, the code is actually working perfectly.
What you'll need to do is add items to the ArrayList.
To add an item:
laboratoryId = Utils.readLineFromConsole("Enter Clinic Id: ");
ClinicalAnalysisLab obj = new ClinicalAnalysisLab(laboratoryId, *name*, *address*, *phoneNumber*, *tinNumber*) {
clinicList.add(obj);

In this case, you would just create the object based on however you want. So, change the variables "name", "address", "phoneNumber", and "tinNumber" with whatever you want.
One example would be:
laboratoryId = Utils.readLineFromConsole("Enter Clinic Id: ");
ClinicalAnalysisLab obj = new ClinicalAnalysisLab(laboratoryId, "First Lab", "32 Lincoln Rd", "666 666 6666, "102") {
clinicList.add(obj);

Saving Inputs to ArrayList


Type mismatch in dao insert - how to convert list of object to entity

Question: In my Kotlin application I'm using Retrofit to retrieve data from network and room to store these data locally.
In the ViewmMdel I want to get the asteroid objects and store them in local database.
The main problem is the network call returns ArrayList of data class called Asteroid
And the Dao expects an ArrayList of Asteroid Entity.
So basically I have 2 asteroids classes. One represents an entity for room and the other as model for network call.
I have this funcion in ViewModel
private fun getAsteroids() {
    viewModelScope.launch {
        try {
            var result = repository.getAsteroid()
            _asteroidList.value = result.toMutableList()
            appLocalDb.asteroidDao.insertFeed(result)

        } catch (e : Exception) {
            _asteroidList.value = null
        }
    }

}
Here getAsteroids in repository
   override suspend fun getAsteroid(): ArrayList<Asteroid> {
        return apiRepositoryImp.getAsteroids();
    }

insertFeed in Dao
@Dao
interface AsteroidDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insertFeed(vararg asteroid: Asteroid)
}

Here's the error
Required:
com.asteroidradar.repository.db.entity.Asteroid
Found:
kotlin.collections.ArrayList<com.asteroidradar.Asteroid> /* = java.util.ArrayList<com.asteroidradar.Asteroid> */

Answer: You must convert com.asteroidradar.repository.db.entity.Asteroid com.asteroidradar.Asteroid by following code:
 var result = repository.getAsteroid()
 _asteroidList.value = result.toMutableList()
 appLocalDb.asteroidDao.insertFeed(*result.map{ repoAsteroid ->
    com.asteroidradar.Asteroid(
      //Set full properties here
    )
 }.toTypedArray())

See the Kotlin documentation:
Comment: I have tried this before and it's showing another error
Type inference failed. Expected type mismatch:
required:
Array
found:
Array
Comment: Please check com.asteroidradar.repository.db.entity.Asteroid and com.asteroidradar.Asteroid. The app contains 2 Asteroid models, the one in com.asteroidradar.repository.db.entity package and another Asteroid in com.asteroidradar package
Comment: Yes and this is what I wrote in the question. I'm having 2 models as entity and another one for API calls I don't want to mix both. is it not applicable?
Comment: Yes, you must convert com.asteroidradar.Asteroid to com.asteroidradar.repository.db.entity.Asteroid by creating new instance
Comment: I have just updated my answer. Please check it


Does having the mob attack you cause your gathering to fail?

Question: Earlier today, I was gathering an Orrian Sapling which should yield Ancient Wood Logs, the highest tier wood. At the time I was gathering it I was being attacked by 2 risens. I got two ruined logs which typically occur when you use a lower tier logging axe. I immediately stopped gathering. I typically have one mithril and one orichalcum gathering tool of each type. I would switch accordingly when I gathered (to save on costs). I had originally thought I had the wrong logging  axe equipped. So I killed the two risen and went to my inventory to equip my Orichalcum logging axe, only to find that it was already equipped. I used the logging axe again to gather the last piece of Ancient Wood Log which did work.
I know that I have successfully gathering material in the past while being attacked by the mob.
So my question is, does having the mob attack you while you are gathering sometimes cause you to fail at gathering. Or is there a small random chance of you failing to gather a material regardless if you have the correct tier or higher gathering tool?
Answer: Mobs attacking do affect your gathering. I tested this out and had ruined logs when I was being attacked. This was done more than 3 times and each time I was being attacked yielded  the same results.  Not once had I failed when not being attacked. I always use Orchichlum for gathering
Comment: This was a bug that was fixed several months ago and is no longer true.
Answer: Since both existing answers talk about tool quality, which is unrelated to the problem, and the answer that was correct when given is now incorrect, I'll provide an updated answer. There used to be a bug that caused players who were not in combat to switch from their gathering tools to their weapons if an enemy attacked them while they were gathering. This caused the gathering to act as if an insufficient quality tool was used. This bug was fixed around the beginning of 2013.
When the question was asked: Yes, being attacked while gathering could cause it to fail if the player was not already in combat.
Now: No, being attacked while gathering will not cause the gathering to fail.
Answer: Mobs attacking has no effect on gathering. In fact, I have often run to guarded nodes, mined/chopped, and fled, with one or more mob beating on me.
The likeliest explanation is that you had the wrong logging axe equipped, as, as you mention yourself, the node harvested fine when you confirmed your orichalcum logging axe was equipped.
One thing you can't do is change equipment during combat, and this includes the gathering tools. It's possible you tried to change tools and failed because of the enemy attacking you, but did not realize you were unsuccessful.
Edit: I don't know if it's a problem with Orichalcum tools or what, but the above can not be guaranteed when it comes to max-tier nodes (i.e., Orichalcum, Ancient, Omnomberries, etc.)
Comment: @Hackworth Well, not experiment so much as keep track of. You get 3 from your personal story. The first is Iron, the Second is Mithril, and the third is Ori.
Comment: Ok so it just happened again. This time I know for a fact that it wasn't a mistake on my part. I was chopping a Cypress Sapling with a mithril logging axe and I got 2 Elder Wood Logs and 2 Ruined Logs at the same node without stopping the chopping at all. And I was being attacked by 4 risens this time.
Comment: @Jay Don't know what to tell you, then. I've never had an issue with harvesting while being attacked.
Comment: @jay I have a feeling it is a bug with the system with regards to logging specifically. I have got ruined logs from the first few tier trees in the lower zones while using a master logging axe. The master mining picks have no problems even with ores up till mithril.
Comment: @TerryChia Master level tools have varying degrees of quality, they can be equivalent to Iron, Steel, or whatever tool. The actual quality is hidden and you have to experiment to determine which quality that tool really has. So if you fail a harvest with a Master tool, then it was simply of insufficient quality.


osx - Linking error, when building POCO library

Question: I'm trying to build poco library on osx 10.9 with clang++.
I'm running make CXXFLAGS+=-stdlib=libstdc++ CFLAGS+=-stdlib=libstdc++ LDFLAGS+=-stdlib=libstdc++.
It've successfully compiled all .o files:

** Compiling src/UUIDGenerator.cpp (release, shared) clang++  -Iinclude -I/Users/croco/Work/poco-1.6.0-all/CppUnit/include -I/Users/croco/Work/poco-1.6.0-all/CppUnit/WinTestRunner/include -I/Users/croco/Work/poco-1.6.0-all/Foundation/include -I/Users/croco/Work/poco-1.6.0-all/XML/include -I/Users/croco/Work/poco-1.6.0-all/JSON/include -I/Users/croco/Work/poco-1.6.0-all/Util/include -I/Users/croco/Work/poco-1.6.0-all/Net/include -I/Users/croco/Work/poco-1.6.0-all/Crypto/include -I/Users/croco/Work/poco-1.6.0-all/NetSSL_OpenSSL/include -I/Users/croco/Work/poco-1.6.0-all/Data/include -I/Users/croco/Work/poco-1.6.0-all/Data/SQLite/include -I/Users/croco/Work/poco-1.6.0-all/Data/ODBC/include -I/Users/croco/Work/poco-1.6.0-all/Data/MySQL/include -I/Users/croco/Work/poco-1.6.0-all/MongoDB/include -I/Users/croco/Work/poco-1.6.0-all/Zip/include -I/Users/croco/Work/poco-1.6.0-all/PageCompiler/include -I/Users/croco/Work/poco-1.6.0-all/PageCompiler/File2Page/include -stdlib=libstdc++ -DNDEBUG -O2 -fasm-blocks -fPIC -c src/UUIDGenerator.cpp -o
  /Users/croco/Work/poco-1.6.0-all/Foundation/obj/Darwin/x86_64/release_shared/UUIDGenerator.o

But when linking, -stdlib flag doesn't used and i receive some errors like this:

Undefined symbols for architecture x86_64:
  "std::basic_string,
  std::allocator >::data() const", referenced from:
        Poco::UnicodeConverter::convert(std::basic_string, std::allocator > const&,
  std::string&) in UnicodeConverter.o   "std::basic_string, std::allocator >::length() const",
  referenced from:
        Poco::UnicodeConverter::convert(std::basic_string, std::allocator > const&,
  std::string&) in UnicodeConverter.o

What i'm doing wrong?
Answer: Well, my solution is to put -stdlib flag to build/config/Darwin-clang and configure build with required Darwin-clang config.


Probability exercise without combinatorics

Question: Three kids go to by some icecream. There are 10 parfumes.
What is the probability that they pick-up $1, 2$ or $3$ different parfume ?
The answer should be $0.01, 0.27$ and $0.72$ but I can't figure out how to find directly the result for $2$.
Comment: I guess you should state that the kids choose independently and that each flavor is chosen with equal probability.
Answer: It's the probability that:
"the first two kids chose the same and the third differently,  or,
 the first two kids chose differently and the third chose a parfume chosen before"
So, it's
$$\textstyle
P({\text{first two }\atop\text{chose same} })
\cdot P({\text{third chose different given}\atop\text{the first two chose same}} )+P({\text{first two}\atop\text{chose different}})\cdot P({\text{third chose one chosen before }\atop\text { given the first two chose diff.}})
$$
The probability that the first two kids chose the same parfume is $1\over10$. In this case, the probability that the third kid chose differently is $9\over 10$.
The probability that the first two kids chose differently is $9\over 10$.  In this case, the probability that the third kid chooses one of the two parfumes chosen by the first two is $2\over 10$.
So, the probability that exactly 2 parfumes were chosen is
$$
{1\over10}\cdot{9\over 10}+{9\over10}\cdot{2\over 10}= {27\over100}.
$$
Answer: After the first kid got his, if the next kid randomly chooses from the 10, what's the probability that they're the same?  So what's the probability they're different?
Now, given those two possible outcomes and their probabilities, the third kid chooses his randomly from the 10.  If both of the first two were the same, then what's the probability the third kid also chose the same?  Multiply that by the probability that both two were the same to start with.  What's the probability that the third kid chose differently.  Multiply that with the probability the first two were the same.
Now consider the second possible outcome: two different.  What's the probability the third kid choose one of those two?  What's the probability he chooses something different?  Multiply those into the probability of the 2 different outcome.
Now we have 4 outcomes, but 2 of them are identical (2 same, 1 different or (2 different, 1 same).  So we can add those two probabilities together.
Is that what you mean by "directly"?
Comment: Yes. For instance for 1, the first kid can choose among the 10 parfumes, the second and the third have to choose the same. So the probability is 10*1*1/1000 = 0.01. For 3, the formula is 10*9*8/1000 (the first can choose the parfume he wants, the second all the others parfumes except the first one and so on.
Comment: I'm just unable to do it for the number 2
Answer: Call the kids A, B, and C, or something more interesting.  They are lined up in that order at the ice-cream stand.  They can end up with exactly $2$ different flavours in $3$ different ways, which I will abbreviate as XYY, YXY, and YYX, hoping the meaning is clear.
What is the probability of the pattern XYY? Whatever flavour X is picked by A, the probability that B picks a different flavour is $\frac{9}{10}$, and then C has probability $\frac{1}{10}$ of picking the same flavour as B did. Thus the probability of the pattern XYY is $\frac{9}{10}\cdot\frac{1}{10}=\frac{9}{100}$.
What is the probability of the pattern YXY? Whatever flavour Y is picked by A, the probability B picks a different flavour X is $\frac{9}{10}$, and then the probability C picks the same flavour as A did is $\frac{1}{10}$.  We conclude that the probability of the pattern YXY is $\frac{9}{100}$.
In a very similar way, we can show that the probability of the pattern YYX is $\frac{9}{100}$.
Add up. We get $\frac{27}{100}$.
Another way: This one may be forbidden by the title (
"without combinatorics").  Suppose that A, B, C choose at random. Record their choices, in order. There are $(10)(10)(10)$ possible records, all equally likely.
How many of these records have exactly $2$ flavours? The minority flavour can be chosen in $10$ ways. For each of these ways, the majority flavour can be chosen in $9$ ways.  And once these have been chosen, the position of the minority flavour (that is, who got it) can be chosen in $3$ ways, for a total of $(10)(9)(3)$ ways. So our probability is $270/1000$.
Another way: The "indirect way" that you alluded to is very efficient. Simply add together the probabilities of exactly one flavour and exactly $3$ flavours ($0.01+0.72=0.73$) and subtract this from $1$.


Oracle - Records from multiple tables with * parameter

Question: I need to retrieve the records from multiple different views. The views have exactly the same columns. I want to use the * parameter because there are constantly added new views and with UNION ALL there would be always the same code.
Whats working:
SELECT ID, TEXT FROM TABLE1
UNION ALL
SELECT ID, TEXT FROM TABLE2
UNION ALL
SELECT ID, TEXT FROM TABLE3
UNION ALL
SELECT ID, TEXT FROM TABLE4
UNION ALL
SELECT ID, TEXT FROM TABLE5
UNION ALL
SELECT ID, TEXT FROM TABLE6
UNION ALL
SELECT ID, TEXT FROM TABLE7

What I want:
SELECT * FROM TABLE1
UNION ALL
SELECT * FROM TABLE2
UNION ALL
SELECT * FROM TABLE3
UNION ALL
SELECT * FROM TABLE4
UNION ALL
SELECT * FROM TABLE5
UNION ALL
SELECT * FROM TABLE6
UNION ALL
SELECT * FROM TABLE7´

If I do that, I get the following error:
ORA-01790: expression must have same datatype as corresponding expression

UPDATE:
Ok sorry, my fault.
The views weren't exactly the same because one datatype was converted to a number and the other to a varchar.
Problem solved.
Comment: Have you tried anything? Remember that the UNION's different selects must have the same number of columns, with matching data types.
Comment: the tables are exactly the same but with different data
Comment: Then you can do `select *`. But why do you have so many similar tables?
Comment: That are views, not tables. These views are build up with completely different parameters but same columns
Answer: if both tables have exactly same number column and datatype it should work
see below example
with cte1 (st,dt) as
(
select 'New' as st, '30/09/2014 3:48:10 PM' as dt from dual
union all
select 'Open' as st, '30/09/2014 3:48:10 PM' as dt from dual
union all
select 'Open' as st, '20/09/2014 3:48:10 PM' as dt from dual
union all
select 'Qued' as st, '18/06/2015 1:31:30' as dt from dual

)
,
 t2(st,dt) as
 (
 select 'New' as st, '30/09/2014 3:48:10 PM' as dt from dual
union all
select 'Open' as st, '30/09/2014 3:48:10 PM' as dt from dual
union all
select 'Open' as st, '20/09/2014 3:48:10 PM' as dt from dual
union all
select 'Qued' as st, '18/06/2015 1:31:30' as dt from dual
 )
select * from cte1
union all
select * from t2

https://dbfiddle.uk/?rdbms=oracle_11.2&fiddle=430f00a6616515f2cdaefe61990285d0
Comment: i got the following error
`ORA-01790: expression must have same datatype as corresponding expression`
Comment: @ThomasKlammer yes i said my answer column data type should be same
Comment: i copied the views. those are the same
Comment: @ThomasKlammer https://dbfiddle.uk/?rdbms=oracle_11.2&fiddle=430f00a6616515f2cdaefe61990285d0 chek this
Comment: As an aside, `'30/09/2014 3:48:10 PM'` is not a date it is a string. If you want a `DATE` data type then wrap it in the `TO_DATE` function or use literals (either a `DATE` literal and add an `INTERVAL` literal or a `TIMESTAMP` literal and cast back to a `DATE`).
Answer:
The views weren't exactly the same because one datatype was converted to a number and the other to a varchar.

SQL Fiddle
Oracle 11g R2 Schema Setup:
CREATE TABLE TABLE1 (
  id    NUMBER(8,0),
  text  VARCHAR2(400),
  value NUMBER
);

CREATE TABLE TABLE2 (
  id    NUMBER(8,0),
  text  VARCHAR2(200),
  value VARCHAR2(20)
);

INSERT INTO TABLE1 VALUES ( 1, '1', 1 );
INSERT INTO TABLE1 VALUES ( 2, '2', '2' );

Query 1: If the data types do not match then you will get an exception:
SELECT * FROM TABLE1
UNION ALL
SELECT * FROM TABLE2

Results:
ORA-01790: expression must have same datatype as corresponding expression

Query 2:
To solve this, you can use SELECT * FROM ... on the tables with the matching data types and explicitly name columns and apply a conversion on the table(s) that have different data types:
SELECT * FROM TABLE1
UNION ALL
SELECT id, text, TO_NUMBER( value ) FROM TABLE2

Results:
| ID | TEXT | VALUE |
|----|------|-------|
|  1 |    1 |     1 |
|  2 |    2 |     2 |


In RoR, how do I customize a validation error message that is set to numericality greater than zero?

Question: I'm using Rails 4.2.7.  I have this validation rule for my model
class MyObjectTime < ActiveRecord::Base

  validates :time_in_ms, numericality: { greater_than: 0 }

I want to write a custom error message, so in my config/locales/en.yml file I included
en:
  activerecord:
    attributes:
      my_object:
        name: "Name"
      my_object_time:
        time_in_ms: "Time"
    errors:
      models:
        my_object_time:
          attributes:
            time_in_ms:
              not_a_number: "This field must be a number greater than zero."
              blank: "This field must be a number greater than zero."

But when my object fails to validate, this custom error message is not included in my @my_object_time.errors.full_messages array .  Instead what is included is
Must be greater than 0

What is the proper rule to write in my config file so that I can customize this error message?
Comment: Possible duplicate of [Fully custom validation error message with Rails](http://stackoverflow.com/questions/808547/fully-custom-validation-error-message-with-rails)
Answer: You can customize message directly in model.
class MyObjectTime < ActiveRecord::Base

  validates :time_in_ms, numericality: { greater_than: 0 }, message: 'my customized message.'

end

or in your en.yml file you need to add message for greater_than:
en:
  activerecord:
    attributes:
      my_object:
        name: "Name"
      my_object_time:
        time_in_ms: "Time"
    errors:
      models:
        my_object_time:
          attributes:
            time_in_ms:
              not_a_number: "This field must be a number greater than zero."
              blank: "This field must be a number greater than zero."
              greater_than: "my custom message for greater than"


Run specflow tag from within visual studio?

Question: I've got an automation suite using SpecFlow. Some of my test scenarios are tagged with let's say @testme
How can I run all the @testme tags from within visual studio?
Answer: Freely adopted from: http://www.marcusoft.net/2010/12/using-tags-in-specflow-features.html
If the test framework supports it (as NUnit and MsTest do) the tags will be converted to Categories which you can use to run certain parts of your test suite for example.
Turning on the categories is typically done with ordering/grouping your test cases by traits. (Visual Studio 2017 Community: Test Explorer, 2nd icon: Group By: Traits)
Comment: Grouping by traits shows me all my tags. This is what I was looking for. Thanks a bunch!


Bind two generic types

Question: I have a question regarding generics.
I have the following interfaces:
public interface InterfaceA {

    public interface InterfaceB {

        void setA(A a);
    }
}

And the following abstract implementation of InterfaceA:
public abstract class AImplOne implements InterfaceA {

    private final B b;

    public AImplOne(B b) {
        this.b = b;
        b.setA(this); // <-- Unchecked call...
    }
}

Its clear to me, that the call b.setA(this) is unchecked - but I don't like it, so I tried a second abstract implementation:
public abstract class AImplTwo<A extends InterfaceA, B extends InterfaceA.InterfaceB> implements InterfaceA {

    private final B b;

    public AImplTwo(B b) {
        this.b = b;
        b.setA((A)this); // <-- Unchecked cast
    }
}

And again, its clear to me, that the call b.setA((A)this) is an uncheck cast.
But how should this be implemented or redesigned in order to get rid of the unchecked code?
Comment: Using one-letter class names `A` in a question about generics is very very confusing
Comment: @artbristol: Good Point: Renamed `A` to `InterfaceA` and `B` to `InterfaceB`
Comment: As well as using nested classes, `AImpl` should be `AImplOne` or `AImplTwo`, there is a typo in the question name, you don't have a type parameter for `B` (here: `B*>`. That might be a problem, but your sample code is a bit overcomplicated.
Answer: You are actually having a mutual recursive generic definition that you break by using raw types: in
b.setA((A)this); // <- Unchecked cast

this is of type InterfaceA<? extends InterfaceA.InterfaceB<? extends InterfaceA>>, but it should be of type InterfaceA<? extends InterfaceA.InterfaceB<? extends InterfaceA<? extends InterfaceA.InterfaceB<...>>>>. You would have to use instead
public interface InterfaceA<B extends InterfaceA.InterfaceB<?>> {

    public interface InterfaceB<A extends InterfaceA> { //<- cannot make a static reference to the non-static type B

        void setA(A a);
    }
}

but you cannot use B, which is non-static, in the static interface declaration (interface declarations are always static).

For detail, one further try: Using the alternative
public interface InterfaceA<B extends InterfaceA.InterfaceB<?>> {

    public interface InterfaceB<A extends InterfaceA<? extends InterfaceA.InterfaceB<?>>> {

        void setA(A a);
    }
}

abstract class AImplTwo<B extends InterfaceA.InterfaceB, A extends InterfaceA> implements InterfaceA {

    private final B b;

    public AImplTwo(B b) {
        this.b = b;
        b.setA((A)this); // <-- Unchecked cast
    }
}

causes again an unchecked cast, since now the nested type parameter of InterfaceA in interface InterfaceB<A extends InterfaceA<? extends InterfaceA.InterfaceB<?>>> is again an arbitrary subclass of InterfaceA.InterfaceB<?>.

Update, since you've asked for a general design:
I would think of InterfaceB (in fact, interfaces in general) as abstraction from a concrete implementation: You only need the interface InterfaceB, not its implementation details, in your implementation of InterfaceA. Think of InterfaceB as a contract, and you do not care about the implementation. Hence there is no need for binding the implementation of InterfaceA to the implementation of InterfaceB:
public interface InterfaceA {

    public interface InterfaceB {

        void setA(InterfaceA a);
    }
}

Only if, for reasons I can't see, you do want  to have the same type for all instances of InterfaceB that you are using, you need generics. Vice versa for InterfaceA. With the last generics example above, you can at least fix the types for InterfaceA and InterfaceB, and would only have to dynamically assert that A's B and B's A are the same.
Showing that no type checked solution exists in Java is difficult, but maybe it becomes plausible with the following example, which would be a solution if Java allowed the combination of extends and super:
public interface A<TB extends A.B<?>> {

    public interface B<TA extends A<? extends A.B<?>>> {

        void setA(TA a);
    }
}

class AImplTwo<TB extends A.B<TA>, TA extends AImplTwo<TB, TA> super AImplTwo<TB, TA>> implements A<TB> {

    private final TB b;

    public AImplTwo(TB b) {
        this.b = b;
        b.setA((TA)this);
    }
}

...come to think of it, the Pluggable Type System, which adds further typing to Java, allows this combination of extends and super, and might therefore offer a solution to your problem. But I find it too complex for what you get, and would either stick with simply using Interfaces without generics or some unchecked cast.
Comment: Ok, so this can only be done using raw types. But how can this be solved more elegantly? Generally asking, how to make the implementation knowing each other in an abstract sub class?

Bind two generic types


Is the output of a Veblen function larger than its input?

Question: I am looking to prove that:
$$
\forall \gamma < \Gamma_0 . \forall \alpha < \Gamma_0 . \varphi_\alpha(\gamma) \geq \gamma
$$
Where $\varphi$ is the Veblen function and $\Gamma_0$ is the Feferman–Schütte ordinal.  Which is to say that the Veblen functions is at least it's input.
This seems true to me and I can't come up with any counter examples.  I can prove some simple cases.  But I also can't seem to prove it in general.
Comment: In fact it's true for every strictly increasing ordinal function.
Comment: Ah, then the simple proof (induction up to $\Gamma_0$) won't work at successor steps.
Answer: As BrianO brought up, every strictly increasing function $f:\textrm{Ord}\rightarrow\textrm{Ord}$ has this property (*), so every Veblen function  $\varphi_\alpha$ (including $\alpha>\Gamma_0$ as well!) is strictly increasing.
Proof of (*): Assume towards a contradiction that there exists some $\gamma$ with $f(\gamma)<\gamma$. Due to the fact $f$ is strictly increasing, along with $f(\gamma)<\gamma$ this gives us some properties:

For all $\gamma'<\gamma$, $f(\gamma')<\gamma$. (Otherwise $f(\gamma')\ge f(\gamma)$ contradicts $f$'s strictly increasingness)
$f$ is injective. (Otherwise we'd have $\delta<\varepsilon\le\gamma$ such that $f(\delta)=f(\varepsilon)$, contradicting $f$'s strictly increasingness)

Since we have a strictly increasing (i.e. for $\delta,\varepsilon<\gamma$, $\delta<\varepsilon\leftrightarrow f(\delta)<f(\varepsilon)$) injection that maps $\gamma$ to $f(\gamma)$, we have an order-preserving injection from $\gamma$ to $f(\gamma)<\gamma$, which is a contradiction.


Scoping in javascript

Question:

    <title></title>

I am coming from c and java background . Scoping rule is different in java script. I want to know why this program is giving output 1. How this program is working.
Comment: *** The explanation for that code can be found on the same page the sample code came from ** http://www.adequatelygood.com/2010/2/JavaScript-Scoping-and-Hoisting  If there is a specific question *not* covered on that page, go ahead and ask here.
Comment: http://stackoverflow.com/questions/327454/scoping-issue-in-javascript?rq=1
Comment: @JeremyJStarcher, now this is funny ;-)
Answer: JavaScript uses function scope.  Also, functions are "hoisted" to the top of their scope (the closest function).
function b() {
    a = 10;
    return;
    function a() {}
}

This is being interpreted as:
function b() {
    function a() {}  // function was hoisted
    a = 10;
    return;
}

When a function is declared using function a(){} it's like there was a var there; it's making a local variable.  Therefore, the a=10 is the local a, not the global a.
Reference: http://www.adequatelygood.com/2010/2/JavaScript-Scoping-and-Hoisting
Comment: One can also illustrate it as `var a=function(){};` in `b()`.
Answer: There is a combination of two things going on here; the scope of variables, and how functions and variables are declared inside a function.
You are declaring a local function inside the b function named a, so that has the same effect as declaring a local variable inside the function that shadows the variable by the same name in the global scope.
It doesn't matter where you create a local variable/function inside a function, it will still be created before the code in the function starts, so doing this:
function b() {
  a = 10;
  return;
  function a() {}
}

is basically the same as:
function b() {
  var a = function(){};
  a = 10;
  return;
}

When the code in the function assigns the value 10 to the variable a, it actually overwrites the local function and replaces it with the number. As function references in Javascript are first class members, they can be passed around like any other value, and also replaced by any other value.
As the code in the function only changes the local variable a the global variable a is unchanged.
Answer: In javascript scoping unit is a function. In your b function, a is a local function. Therefore, global a variable is unaffected.
Answer: About scoping in Javascript language, you can find here: http://www.adequatelygood.com/2010/2/JavaScript-Scoping-and-Hoisting

Scoping in javascript