find flux,using Cartesian and spherical coordinates Find the flux of the vector field $\overrightarrow{F}=-y \hat{i}+ x \hat{j}$ of the surface that consists of the first octant of the sphere $x^2+y^2+z^2=a^2(x,y,z \geq 0).$
Using the Cartesian coordinates,I did the following:
$$ \hat{n}=\frac{\nabla{G}}{|\nabla{G}|}=\frac{x\hat{i}+y\hat{j}+z\hat{k}}{a} $$
$$\int_C{\overrightarrow{F} \cdot \hat{n}}ds=\int_C{(-y\hat{i}+x\hat{j})\frac{x\hat{i}+y\hat{j}+z\hat{k}}{a}}ds=\int_C{\frac{-xy+xy}{a}}ds=\int_C{0}ds=0 $$
Using the spherical coordinates,I did the following:
$$x =a \cos{\theta} \sin{\phi}$$
$$y=a \sin{\theta} \sin{\phi}$$
$$z=a \cos{\phi} $$
$$0 \leq \theta \leq \frac{\pi}{2}$$
$$ 0 \leq \phi \leq \frac{\pi}{2} $$
$$ \hat{n}=\frac{\nabla{G}}{| \nabla{G}|}=...=\cos{\theta} \sin{\phi} \hat{i}+\sin{\theta} \sin{\phi} \hat{j}+\cos{\phi} \hat{k}$$
$$\overrightarrow{F}= -a \sin{\theta} \sin{\phi} \hat{i}+a \cos{\theta} \sin{\phi} \hat{j}$$
$$ ds=r^2 \sin{\phi}d \theta d \phi $$
$$\overrightarrow{F} \cdot \hat{n}=0 $$
So Flux=$ \int_0^{\frac{\pi}{2}} \int_0^{\frac{\pi}{2}}{0 r^2 \sin{\phi} } d \theta d \phi=0 $
Are both ways right or have I done something wrong?
EDIT: And something else.... Is $ds$ equal to: $\frac{|\nabla{f}|}{|\nabla{f} \cdot \hat{k}|}$ ?

Both of your methods are correct, and the flux through the sphere being $0$ is actually what we would expect, as your field is purely rotational and therefore the field vectors all point along the surface of the sphere. We can see this by observing:
$$\nabla \cdot \vec{F}=\frac{\partial(-y)}{\partial x}+\frac{\partial x}{\partial y}=0$$
And:
$$\nabla \times \vec{F}=\begin{vmatrix}\boldsymbol{\hat{\imath}} & \boldsymbol{\hat{\jmath}} & \boldsymbol{\hat{k}} \\ \frac{\partial}{\partial x} & \frac{\partial}{\partial y} & \frac{\partial}{\partial z} \\ -y & x & 0\end{vmatrix}=2\boldsymbol{\hat{k}}$$
And so we can see that the field behaves purely rotationally, if we look at the vector plot of your vector field, this becomes more clear:
                                 
