<s>[INST] About the conserved charge for the ghost number current in $bc$ conformal field theory (skip disclaimer)
I have a question about the conserved charge for the ghost number current in $bc$ conformal field theory in Polchinski's string theory p62. It is said

For the ghost number current (2.5.14), $j=-:bc:$, the charge is 
  $$ N^g= \frac{1}{2 \pi i} \int_0^{2 \pi} dw j_w  = \sum_{n=1}^{\infty} (  c_{-n} b_n -b_{-n} c_n ) + c_0 b_0 - \frac{1}{2} \,\,\,\, (2.7.22) $$

First, what is $j_w$? Seems it haven't been defined before. Is current (2.5.14) in variable w, i.e. $z=\exp(-iw)$?  Then how to derive Eq. (2.7.22)? I tried to derive it but differs the constant term and lots of (conformal) normal ordering
$$ N^g= \frac{1}{2 \pi i} \int_0^{2 \pi} dw j_w =   \frac{1}{2 \pi i} \oint dz j_z $$
$$ = -\frac{1}{2 \pi i} \oint dz :bc: =\frac{-1}{2 \pi i} \oint dz   \sum_{m=-\infty}^{\infty}  \sum_{n=-\infty}^{\infty} \frac{ : b_m c_n:}{z^{m+n+1}} (\mathrm{omit} \,\,\, \lambda  \,\,\, \mathrm{in} \,\,\, \mathrm{2.7.16})$$
$$  = - \sum_{m=-\infty}^{\infty} \sum_{n=-\infty}^{\infty}  : b_m c_n: \delta_{m+n,0}   = - \sum_{m=-\infty}^{\infty} : b_m c_{-m}: $$
$$ =- :b_0 c_0: - \sum_{m=-\infty}^{-1} : b_m c_{-m}: - \sum_{m=1}^{\infty} : b_m c_{-m}: = -:b_0 c_0: - \sum_{m=1}^{\infty} : b_{-m} c_{m}: - \sum_{m=1}^{\infty} : b_m c_{-m}: $$
$$ =  :c_0b_0: - 1 - \sum_{m=1}^{\infty}: b_{-m} c_{m}: - : c_{-m} b_{m}: -  \sum_{m=1}^{\infty} \{ :b_{m},c_{-m}: \} $$
$$ =  \sum_{n=1}^{\infty} (:c_{-n} b_n: - :b_n c_{-n}:) + :c_0b_0: - \infty$$ 
$$ =  \sum_{n=1}^{\infty} (\circ :c_{-n} b_n: \circ- \circ :b_n c_{-n}: \circ) + \circ :c_0b_0: \circ - \infty$$ 
$\circ \cdots \circ$ indicates creation-annihilation normal ordering
I guess there is huge problem in my derivation, but how to get (2.7.22) correctly?
 [/INST] I believe you are both missing something. As $z$ is related to $w$ by a conformal transformation you need to use (2.5.17) to relate $j_w(w)$ and $j_z(z)$. This is a my derivation:
\begin{align}
N^\mathrm{g} =  \frac{1}{2\pi i } \int_0^{2\pi}dw j(w) 
\end{align}
From (2.5.17) we have
\begin{align}
(\partial_w z) j_z(z) = j_w(w) + \frac{2\lambda-1}{2} \frac{\partial^2_wz}{\partial_w z}
\end{align}
with $z= e^{-iw}$ we have $\partial_w z = -i z$ and $\partial^2_wz = -z$ so that
\begin{align}
-i z j_z(z) = j_w(w) + \frac{2\lambda-1}{2}  \frac{-z}{-iz} \Rightarrow j_w (w) = -i z j(z) +i  \frac{2\lambda-1}{2}  
\end{align}
Using this and $dw= idz/z$ we have
\begin{align}
N^\mathrm{g} =&\,   \frac{1}{2\pi i } \oint \frac{idz}{z} i \left( - z j(z) +  \frac{2\lambda-1}{2}  \right) \nonumber\\
=&\, -\frac{1}{2\pi i} \oint dz \, \left( - j(z) +  \frac{2\lambda-1}{2z}  \right) 
\end{align}
We now have
\begin{align}
N^\mathrm{g} =&\, - \frac{1}{2\pi i} \oint dz\, \left( :bc:(z) +  \frac{2\lambda-1}{2}  \right) = - \frac{1}{2\pi i} \oint dz\, \left( \substack{\circ\\\circ}  b c \substack{\circ\\\circ}(z)  +\frac{1-\lambda}{z}+  \frac{2\lambda-1}{2z}  \right) 
\end{align}
where we used that
\begin{align}
:bc:(z) =&\, \lim_{z'\rightarrow z} :b(z) c(z'): = \lim_{z'\rightarrow z} \substack{\circ\\\circ} b(z) c(z') \substack{\circ\\\circ}+  \lim_{z'\rightarrow z}\frac{(z/z')^{1-\lambda} -1}{z-z'} \nonumber\\
=&\,  \substack{\circ\\\circ}b c \substack{\circ\\\circ} (z)  +\frac{1-\lambda}{z} \end{align}
Let us first quickly do the last two terms of $N^\mathrm{g}$. They give
\begin{align}
-\frac{1}{2\pi i} \oint dz \frac{1}{2z} =-\frac{1}{2}
\end{align}
The first terms gives
\begin{align}
& \, -\frac{1}{2\pi i} \oint \sum_{m=-\infty}^\infty  \sum_{n=-\infty}^\infty \frac{\substack{\circ\\\circ} b_m c_n \substack{\circ\\\circ} }{z^{m+\lambda +n+1-\lambda}} = 
-\frac{1}{2\pi i} \oint \sum_{m=-\infty}^\infty  \sum_{n=-\infty}^\infty \frac{\substack{\circ\\\circ} b_m c_n \substack{\circ\\\circ} }{z^{m+ +n+1} }\nonumber\\
=&\, -\sum_{m=-\infty}^\infty \ \sum_{n=-\infty}^\infty \substack{\circ\\\circ}b_m c_n \substack{\circ\\\circ}\delta_{m+n,0} = -\sum_{m=-\infty}^\infty \substack{\circ\\\circ} b_m c_{-m} \substack{\circ\\\circ}\nonumber\\
=& \, -\sum_{m=-\infty}^{-1} \substack{\circ\\\circ}b_m c_{-m} \substack{\circ\\\circ} -\substack{\circ\\\circ} b_0 c_0 \substack{\circ\\\circ} -\sum_{m=1}^{\infty} \substack{\circ\\\circ} b_m c_{-m} \substack{\circ\\\circ} \nonumber\\
=&  \, -\sum_{m=-\infty}^{-1} b_m c_{-m}  + c_0 b_0   +\sum_{m=1}^{\infty} c_{-m} b_m  =  \sum_{m=1}^{\infty} (c_{-m}b_m- b_{-m} c_{m}  ) + c_0 b_0  
\end{align}
Combining both contributions we find
\begin{align}
N^\mathrm{g} =&\, \sum_{m=1}^{\infty} (c_{-m}b_m- b_{-m} c_{m}  ) + c_0 b_0    - \frac{1}{2}
\end{align}
</s>