Posted on 1 Comment

How much money can you make as an app developer?

I’ll just go through a couple of the numbers that I have when I first started out making apps. I started out making apps just for myself because I needed various things other apps couldn’t do. It was more a curiousity, if thing. Curiousity will take you very far in development as well. I found my very first client on a freelance website, and he wanted an android app to record a voiceover track. For that I charged him 200 pounds, which was for the first version. Following that, he said he would like to have this on Apple, and he would like to publish it on the app store with various enhancements and Facebook sharing. To do that he paid me 2,700 pounds. Later on he asked for a few more customizations, and so that added up to another 1,800 pounds, and in total it was about 4,500 pounds for that app. Now, that first app took me a month to make, and that was with me as a relatively new beginner to the app development world. Following that, he requested the app on Android and I charged him again 4,500 pounds to put it on Android, and that took me 2 weeks. So, you can see the potential really to make money is there. You can make a lot of money developing apps. I will tell you don’t keep your eye on the money at first, keep an eye on becoming a good programmer. I put LEARN in capitals because that’s what you need to do for the first 6 months. So, you need to be in this for the long haul, and once you’ve been through the long haul, money like this will be absolutely nothing because once you know how everything works, business can come to you. You want business customers because they will request a demonstration app which you can charge and average of 10-20 thousand pounds, and that will take you a month at most. Once they have that they’ll then be confident to invest in you. Depending on the app, I mean the sky is the limit, and we will be looking at 100k to 500k. So, throughout this course. I want you to follow it carefully. If you don’t understand something, ask. Also, I want you to go on YouTube, and on Google, and search for various things that you see popping up. So, with that said, I look forward to seeing you in the next section and we will get on with setting up our brand new project in Xamarin Studio.

Posted on 1 Comment

Xamarin Setup

The very very first thing we need to do is install Xcode, by Apple. Xcode is the traditional way of creating Apple apps. To use Xcode, you have to learn a language called Swift, but we’re using C# and what Xamarin does is it goes to Xcode with its C# code and says could you translate this for me? It’s not the completely correct way of describing it, but it will do for now. So go ahead and download Xcode and install it, and install all of the things it asks you to install. I’ll just point out one thing down here if you are a novice programmer. If we look at this customer review, he goes: “I mean seriously, why would you cast a swift array to an NS array?” If you are new to programming, you’ll come across this a lot. The correct way to do things, the opinionated way to do things, and I will tell you right now, there is no right way, there is no wrong way. Well, ocassionally there is a wrong way. But there’s no right way there are many ways to do things in programming, and that way, it’s more of an art form. So, once you have learned the basics then you can really do it the way your brain works. Okay, so if you come across someone else’s opinion, they say you should do it like this, or like that, don’t be afraid to fight back with what you think. Once you’ve installed Xcode your next step is to go and get Xamarin, and to do that you simply go to Xamarin.com, you click download, you fill out the form, and you download for OSX, and of course you could also get it for Windows. But, if you want to build your app for iOS, you need to be connected to another Mac. This is why I’m doing the whole course on OSX. So, we don’t have to worry about that, but just know you can do that. So, once you’ve downloaded Xamarin open up your installer, and it’s going to present you with a whole bunch of options to install Xamarin. Now, there are very a few sections of Xamarin that we need to consider installing, and it’s about to tell us what we need. You can have Xamarin.Android, Xamarin.iOS and Xamarin.Mac So, I have all of these installed, even .Android, I don’t know why it’s telling me I need a new one. Perhaps it’s an update. Once you’ve gone through and installed that, and you’ve continued, it will give you a screen that asks for prerequisites, like the Java development kit, the Google SDK, and various other bits and pieces. So, go ahead and install all of those, and once you’re done, please join me for the next lesson. I’m going to give you a quick overview of my personal experience with charging for apps, and that will be my experience where I have gone out and contracted with clients to make apps for. I’m sure that’s information that a lot of people would actually like to know.

Posted on 3 Comments

Xamarin Hardware Requirements

So now we have to setup our hardware, which for this series of tutorials is ideally going to be a Mac. This can be any kind of Mac. A MacPro, a MacBook any of the older Macs as long as they run at least Yosemite, which is most of them at this point. I am currently using MacBook Pro, but as you can see they are pretty expensive. I couldn’t afford a MacBookPro until I got my first paycheck for one of my first apps, which was about 1,5000 pounds, and I bought a 13-inch MacBookPro with that. I can understand that perhaps you don’t want to make that investment right now, so an alternative is to buy a used MacBook, one of the older ones will be fine for what we are doing. Alternatively, you can go to websites like tonymacx86.com and these websites tell you how to put together New Entry 32 hardware so you can run OSX on a custom built PC. On tonymacx86 there are several articles that will assist you with building a custom Mac, and it gives you a list of ingredients, a recipe if you will, of all the necessary hardware components. Now, if you’re not comfortable with that, that’s fine. You can go to their laptop guides, and you can buy an off-the-shelf laptop and there are lots of helpful people on these forums that will tell you how to install OSX. So we can use ASUS, Lenovo, there’s all different kinds. Personally, I started with an HP EliteBook. I would recommend, if you’re going to configure what is called a Hackintosh, this is definitely where you should start. I’d recommend the model 8470p or something along the 8400 line. You can also have an 8440p. If you go back to the tonymac website and you look in the forum, there are a lot of recommendations. These EliteBooks have had an installer made by tonymac that lets you install OSX without too much fuss. So, I’d recommend that. The reason we need to run everything on a Mac is because iOS apps for iPhones and iPads will only be compiled on a Mac, and we need to use specific Mac software. Okay, with that said, once you’ve got your hardware setup, please go on to the next lesson where we will setup Xamarin, and all of the required software.

Posted on 1 Comment

Xamarin Course Overview

Let’s cover the things that you are actually going to learn in this course. It’s going to be very hands-on. So, I will not provide finalized files as much as possible because I need
you to write the code yourself, and that is the best way to learn. Simply copying will not produce good code. Now, the first thing we’re going to learn about is basic C# code, and this is the language used in Xamarin. C# is a language invented by Microsoft to go along with the .NET framework, and it’s a very elegant language, and in my opinion it is one of the better languages you can start by learning. It’s very modern and it takes all of the best parts of the other languages and puts them together in one place. In Xamarin, you can use another
language called F# and I believe you can use Visual Basic, but don’t quote me on that. I wouldn’t go down that route if I were you, I would stick with C# because most of the examples on the internet are in that language. Secondly, I assume, you know absolutely nothing about programming. So, I will leave nothing out. At times, this may seem laborious, and if you already know about programming you might roll your eyes and think, “Dude, I already know that.” But, it is more important to include everything at the risk of boredom rather than not include it, because at the end of this course I don’t want to leave you with lingering questions about why things are and how they work. Then we’re going to learn the basic structure of an iOS App. Since all Apple apps tend to follow a specific design pattern, and it’s very much the same with android apps, they follow a specific pattern. So if you think about both platforms, if you have ever scrolled through a list of things, both of the platforms implement a list. In iOS it is called a Table View and in Android it’s called a List View, and these are just a list of things and you can define whatever that thing is, but each operating system in both Apple and Android take care of all the heavy lifting for you in the background. Next, we’re gonna look at how to write as much shared code as possible for our apps. So, if we come back up here, I should put in one more thing, and this is going to be a database layer and then a data access layer. And then, we go down to the basic structure of iOS and Android apps. And now, these two sections are shared code and these two sections can be used by both iOS and android without modifying them at all, and that is fantastic because you will save about a third of your time because you’ve already written the base logic code for each app. And it doesn’t end there, because Xamarin will allow you to write Windows phone apps, and it will allow you to write Windows Desktop applications, as well as Mac applications. So, it’s absolutely great for that. Right, second to last, I’m going to show you how to use SQlite databases on your devices. Now, most mobile devices come with this as a standard. To access SQlite databases, if you know about anything about databases, you’ll know we need to know a database query language. But, for this course we don’t need to go into that because we’re going to use a very popular library called SQlite.net which is free on most platforms, in fact all platforms, I think. This concept of a database you’re going to use time and time again with any apps you create. Absolutely any app you create! If you want to save data, this is how you’ll do it. Finally, we’re going to look at some of the common pitfalls in mobile app development. The primary of which, will be things like memory leaks. So, if I have say an image, this image requires memory. If I load another image, then that’s going to add some more memory in use. As you know, mobile devices don’t have a lot of memory, so you can reach a point where memory will be full. At those points your app will usually crash, and the app doesn’t work anymore. So, I’m going to give you a few pointers in both platforms on how to avoid this common pitfall. So, join me in lecture 3 when we’ll begin setting up our Mac or PC.

Posted on

Introduction to Xamarin App Development

Hi! My name is Joseph and welcome to this tutorial on how to create a note taking app in Xamarin. Now, I’ve been through a few tutorials myself online and generally, they just tell you how to create the individual bits and pieces within an app and within the GUI of apps. This course will be different because here we’re going to make a final product. If you follow this course, completely, at the end, if you sign up for a developer account at Apple or Android, you’d actually be able to publish your very own app. So, the best way to learn of course is to create something real and what we’re going to do in this course is create a clone of a popular note taking app called Evernote, which I have up here on my Itunes store. Evernote is fairly complicated at this point, you can take notes, take photos, annotate things, and share them with friends. We’re just going to do a simplified version of it just to get you into the app making ecosystem. So, I want us to allow us to take notes, delete notes, mark notes as completed etc.

Posted on

Learn MATLAB Episode #31: Multivariate Gaussian

In this class we’re going to talk about the multivariate Gaussian. So, in all our past lectures we’ve looked at the one-dimensional case, so one-dimensional distributions both discrete and continuous. When we talk about the multivariate Gaussian distribution we’re talking about two or more dimensions, and of course MATLAB is perfect for this because it works with all matrices and vectors. So now what happens when you extend the Gaussian like this? So the first thing is that the mean becomes a vector, and again this doesn’t really change the definition of the mean. You still add up all the values of X and divide by n to get your sample mean. So as an example let’s say we have a random matrix with 100 values and with 10 dimensions. Alright, so, if we do mean(X) we get a 1 by 10 matrix, and each component is the 100 values in that column summed up together and divided by 100. The thing that is kind of more different than the one dimensional case is the variance. So we see this Sigma symbol here and what this stands for is the covariance matrix. So, with the variance it told us how far X was spread out from the mean, the covariance does that too but only on the diagonals. So, on the off diagonals it tells us how correlated one dimension is with the other, and so you can see here the definition of the covariance matrix is the covariance of the if dimension with the jf dimension, and that would be the ij of element of the covariance matrix. We don’t really need to worry about how to calculate it because we are in the end going to end up using the matlab function cov. So let’s check that covariance is 10 by 10, so our dimensionality is 10. What’s interesting about the PDF of the Gaussian in the multi-dimensional case is that we never use the covariance directly. We use the inverse right here in the exponent and the determinant, and again since we already wrote a function to calculate Gaussians before I’m not going to ask you to do it again. There’s already a function called mvnpdf in matlab that will do this for you. So I’ve got an example here that I want to show you. We set our mean and our covariance… Don’t worry about this code too much since it is not the focus of this lecture, we’re simply setting the x-axis, so the X1 and X2 values. Note that the dimensionality of X is 2, so mu is two-dimensional and Sigma is two by two. So here we calculate PDF value using mvnpdf, and we’re going to do a surface plot of F versus X1 and X2. So now some points worth talking about is this distribution is more spread out on the X2 axis than the X1 axis, and that’s because you see here this distribution has a variance of 1 on the X2 axis, but a variance of point .25 on the X 1 axis, and since the off diagonals are not zero what we get is a Gaussian that is not perpendicular to the X1 and X2 axes.

Posted on

Learn MATLAB Episode #30: 2 Sample Tests

In this lecture we’re going to continue our talk about hypothesis testing of Gaussian distributed data. So to elaborate on how hypothesis tests work we’re going to talk about the hypotheses a little bit more. So there are two hypotheses when we’re doing a statistical test. There’s a null hypothesis which we call h-naught, and it usually represents the control data or random data that results purely from chance. The second hypothesis is the alternative hypothesis. So this is the thing we’re trying to prove, generally. For example, if we’re doing an experiment where we’re testing a drug, the drug actually working would be the alternative hypothesis. And so the alternative hypothesis is the hypothesis that sample observations are influenced by some non-random cause. So now suppose we have some random data, so let’s say R1 equals randn. Let’s say it as a hundred points, a mean of zero, and a variance of one. Now let’s say we have a another data set which is maybe 20 points, but this one’s going to have a different mean. So let’s say it’s mean is one, and let’s increase its variance a little bit. Okay, so, we have two distributions that are Gaussian distributed. The first one has 0 mean and one variance, and the second one has a mean of one but a standard deviation of two. So, how do we compare these two distributions? There is a test called the ttest, or the two-sided t-test, or the two-sample t-test which does what we want, and it again returns a hypothesis and a p-value. So we can try this see ttest2(R1,R2). Ok, so, we reject the null hypothesis in this case with a very, very small p-value. Remember it only has to be less than five percent for us to reject the null hypothesis. So let’s try some things. Let’s have less data points for R1. Okay, and let’s do our ttest again. So notice how we still reject the null hypothesis but our p value has increased, so it’s less significant than before. Alright, so, now let’s do the same thing for R2, let’s say this now only has 10 points. Let’s do the ttest again. Alright, so, this is still significant. Let’s increase the variance. Alright, so, I had to increase the variance a lot to get an insignificant p value, so that’s one thing about when you’re comparing two gaussian distributions you can’t really say one is bigger than the other if they’re spread out a lot. So let’s put the variance back for R2, but let’s say the mean is now less far away from R1’s mean. Let’s do our ttest again, and so this also gives us an insignificant p value. So that’s another fact about the ttest is you also can’t tell if two distributions are different if they are very close together. If they’re very far apart, so the mean is, let’s say we do the ttest again, we now get a very small p-value.

Posted on 4 Comments

Learn MATLAB Episode #29: Hypothesis Testing

In this lecture we’re going to talk more about the Gaussian distribution. So the first thing we’ll ask is we’ve generated data so far from uniform distributions, how can we generate data for random normal distributions? So there’s a function in matlab called randn that will do this. So if you type in randn it should give you different function signatures. So let’s say we want to generate a thousand random normal values. Okay, and so this can represent any number of random random values. So if you download data from Kaggle or some other data set where you want to do machine learning or statistics on, you want to know the distribution of your input. In this case, we want to know if the distribution is normal or not. So one thing we could do to check that is just to plot it, plot the histogram. Alright, so, you can see that it looks relatively normal. We can use more bins to get a finer granularity. So we still see this same type of distribution even with 50 bins, and of course if we increase n our curve looks closer and closer to the Gaussian curve that we saw from the last lecture. Now of course in the real world your data is not going to look this nice and clean since your distribution may or may not be Gaussian distributed. The question now is how do you test if your data is Gaussian distributed or not? So we’re going to talk a little bit about hypothesis testing, but not too much since it’s a pretty long and difficult subject. So the basic idea with hypothesis testing is you have two different hypotheses. So in this lecture we’re not going to talk about the mechanics behind statistical testing, we’re going to kind of work backwards and jump right into statistical tests that you can use in matlab right away. So the first is a Jarque-Bera test. In matlab it’s the function jbtest. So you can use it to return a hypothesis and a p-value. The hypothesis will be whether or not your data is randomly distributed, and it returns a p-value to tell you the strength of that hypothesis. So let’s try this on our data that we just generated. Alright, so, one thing that we need to talk about is how to interpret the return values of the Jarque-Bera test. So, when we talk about hypothesis testing you’ll see that there is a null hypothesis and an alternative hypothesis. The Jarque-Bera test will return one if we reject the null hypothesis, and the null hypothesis is that our data is normally distributed. So if we pass it in R, we get the hypothesis is the null hypothesis and a p-value of .5 which means we do not reject the null hypothesis that our data is normally distributed. There is another test called the Kolmogorov-Smirnov test which essentially does the same thing. So the null hypothesis again is that the data comes from a normal distribution, and the result h will be 1 if you reject the null hypothesis, so let’s try that. Same thing with kstest, right, and so this also rejects or does not reject the null hypothesis that the data is normally distributed. So now let’s do something interesting, let’s generate some random data that we know is not normally distributed. So, we’ll do this data from a uniform distribution. So now I want to do jbtest on uniform data right. So we get h equals 1 which means we do reject the null hypothesis, and our p-value is one one-thousandth, and usually a p value is determined significant when it’s less than five percent. So, what this is basically saying is that our uniform generated data is not Gaussian distributed which we know already is true. We can do the same test with Kolmogorov-Smirnov, and so this also rejects the null hypothesis with a much smaller p-value. Alright, and so this is how you can test if your data is normally distributed or not.

Posted on

Learn MATLAB Episode #28: Gaussian (Normal) Distribution

In this lecture we’re going to talk about a special continuous distribution called the normal distribution, or the Gaussian distribution. It probably looks very familiar to you since it is what most people refer to as the bell curve, and you’ve probably seen this in school where bell curves are used to shift marks up or down based on how well students perform. So this formula you see here is the PDF of the Gaussian distribution, notice how they also use the little f notation on Wikipedia. The interesting thing about the Gaussian distribution, so we talked about last time that the mean and the variance are two special numbers that help us describe what a continuous distribution looks like. With the Gaussian distribution the mean and the variance completely describe the shape of the distribution. So, the mean tells us where the center peak is of the bell curve, and the variance tells us how much that bell curve is spread out. So you can see this yellow curve is very spread out and the blue curve is spread out not that much. So let’s talk a little bit about this formula. First, there is a normalizing constant. It’s 1 over the square root of 2pi times Sigma which is the variance. Actually, Sigma stands for the standard deviation. Usually it’s written as 1 over the square root of 2 pi sigma squared where Sigma squared goes inside the square root, so Sigma squared is the variance and Sigma is a standard deviation. Second part of the PDF is this exponential. So we take the negative of X minus the mean which we denote by mu, square that, divide it by 2 Sigma squared or two times the variance, and then we exponentiate that. n=Note that since we square the thing where X is this PDF is symmetric, so if you go a distance from mean to the left, or that same distance to the right, you will get the same value for the PDF. So let’s do an exercise where we plot the values of a gaussian curve from say -100 to 100. So we’ll create a new function and call it my Gaussian. It will take in two parameters mu and sigma squared, and I will output an array. So n will be the number of different values between min_x and max_x. So we’re going to start our little x value at min x. And then we want to know how much to increment X on each iteration of the loop, so we’ll call that dx, and we’ll say it’s max_x minus min_x divided by n. So at the end of the loop we’re going to add dx to X. We’re going to call this f. Okay, so, we’re going to return the array of X values, also. So, X(i) is going to equal to x, and f(i) is going to equal, return x and f, so 1 over the square root of 2 pi sigma_sq, times exponential of negative x minus the mean squared, divided by 2 times sigma squared. So let’s do this for mu equals 0, Sigma squared equals 1, let’s say -10 to 10, and then have a thousand values between them. Okay, so, now we can plot x and f, alright so we get this bell curve. So the peak is at zero because that’s the mean, and then it’s spread out and from about -2 to 2, so the drop-off or how fast f of X goes to 0 is pretty quick. You can see the maximum value is about 0.4. Let’s try that again with a smaller variance, and some smaller values also for min_x and max_x. So let’s do 0.1 for sigma squared, let’s plot it again. Alright, so, the drop off of is even quicker now where we get to about 0 at -1 and 1, and notice the peak value is above 1.2. So since the PDF values above 1 are allowed.

Posted on

Learn MATLAB Episode #27: Mean and Variance

In this lecture we’re going to talk about mean and variance. So how do we measure the distribution of continuous variables? We know that with discrete variables we can just check how often your random variable takes on a certain value and divide it by the total number of values to give you an approximation, or an estimation, to that value’s probability, but we can’t exactly do that with continuous variables. We can’t really count them and put them in the buckets like discrete variables. So we need to measure certain characteristics of the distributions that might tell us the shape of their distribution curve. So two common measures that you probably have already heard of are the mean and the variance, so first let’s talk about the mean. So the mean is like the average. It means you add up all the different values and you divide it by the total number of values, and that kind of tells you what the middle value would be. So what I want you to do is to load back up our random integer CSV. And so you know how to calculate the sum of all values, and we want to divide this by the total number of values. So the mean of r, so let’s just plot r again to remind ourselves what values that it can take, so -5 to 5, and so we get an average value of 0.35. So why is this value so small, because we generated values from -5 to 5. With a uniform distribution we could say that the distribution is balanced whether the value is less than 0 or greater than zero, so a lot of the numbers end up canceling each other out when you sum them, and therefore our mean value is about zero. Notice that we can never actually get the value .35 from our distribution right because our distribution gave us uniformly distributed numbers between -5 and 5, but only with discrete values. So you could get negative five, negative 4, negative 3, negative 2, negative 1, or 1 all the way up to 5, but you would never get the value .35. So it might seem odd that we also call the mean value the expected value even though we would never expect to get that actual value. We only expect that to be the average value of the values that we do draw from this random distribution, and of course there is an easier way to calculate the mean in MATLAB and it’s just the function mean. Right, so, we get the same value. Now let’s talk about the second measure of distribution variance. So we already talked about the mean which is kind of like the middle value, so we could say that it measures the centeredness of the distribution, so where the middle is, where the center is. Variance does a different thing, it measures the spread. So, one thing tells us where the random variable goes and that’s the mean, and then the variance tells us how much it’s spread out from that middle value. So the definition of the variance is it’s the expected value of the random variable minus its mean, and then we square that whole thing, and of course that doesn’t help us much since it doesn’t tell us how to calculate or estimate the variance, but it’s very similar to how we do the mean. So, let’s set the mean of r to be mean(R) like that. We can then calculate the variance of R by taking R minus the mean of R, and so we want to do the dot product between these two which is effectively squaring all the individual values and then multiplying by the corresponding value like that. So it’s treating R as a vector, and then finding the dot product with itself after subtracting the mean. In other words, it’s like subtracting the mean and then taking the squared distance, or the squared length, and of course we divide by the length of R. So we get 10.6475. Of course MATLAB has it’s own variance function, so we didn’t really need to do all this work, and it’s just var. So we get a pretty similar value. One thing that comes up in statistics which is a little bit outside of the scope of our discussion is that if we divide instead of by n we divide by n minus 1, that gives us what we call an unbiased estimate of the variance, and so this gives us the exact value of matlab’s version of R.