Setting Up SQL, PHP, and Sending/Loading Locations

After displaying a map the next thing to do was to let the user send their location and be able to store it. For this I used 000webhost a hosting site that provided me with a MySQL server and PHP scripting to manage it. Using the System.Net.Http Plugin in Xamarin I wrote code that would post the latitude, longitude, and place name in JSON to a php file located on my site. The file would then convert the JSON into variables, stick them into a sql call, and execute the sql against the MySQL database to store them inside the Location table. To do this I needed a way to get the users location on iOS and Android. This functionality was provided by the Xam.Plugin.Geolocator Plugin. Also I needed a way to show a popup asking for the name of the location. For this I used Acr.UserDialogs Plugin. So after putting everything together the user would be able to tap an add button which would poll Geolocator for their location, then type in the name of their location and tap Ok, which would send and store the data in the MySQL server.

Next I needed to be able to get the locations from the server and display them on the map as pins. The process works almost the same way but backwards. You pull the data from the sql database using php encode it in JSON and send it back. The only difference would be decoding the JSON on the other side. Using the plugin Newtonsoft.Json you could decode the JSON string, but what makes the plgin convenient is that you can decode the JSON straight into an Object that will hold the data. For example I created the Object LatLonPair that would hold latitude, logitude and name variables. So using Newtonsoft you could decode a json string into an array of LatLonPairs that hold all your data. From their displaying on the map is easy. just iterate over the array and place the pins on the map.

From the blog Location App Blog by Anonymous and used with permission of the author. All other rights reserved by the author.

Setting Up SQL, PHP, and Sending/Loading Locations

After displaying a map the next thing to do was to let the user send their location and be able to store it. For this I used 000webhost a hosting site that provided me with a MySQL server and PHP scripting to manage it. Using the System.Net.Http Plugin in Xamarin I wrote code that would post the latitude, longitude, and place name in JSON to a php file located on my site. The file would then convert the JSON into variables, stick them into a sql call, and execute the sql against the MySQL database to store them inside the Location table. To do this I needed a way to get the users location on iOS and Android. This functionality was provided by the Xam.Plugin.Geolocator Plugin. Also I needed a way to show a popup asking for the name of the location. For this I used Acr.UserDialogs Plugin. So after putting everything together the user would be able to tap an add button which would poll Geolocator for their location, then type in the name of their location and tap Ok, which would send and store the data in the MySQL server.

Next I needed to be able to get the locations from the server and display them on the map as pins. The process works almost the same way but backwards. You pull the data from the sql database using php encode it in JSON and send it back. The only difference would be decoding the JSON on the other side. Using the plugin Newtonsoft.Json you could decode the JSON string, but what makes the plgin convenient is that you can decode the JSON straight into an Object that will hold the data. For example I created the Object LatLonPair that would hold latitude, logitude and name variables. So using Newtonsoft you could decode a json string into an array of LatLonPairs that hold all your data. From their displaying on the map is easy. just iterate over the array and place the pins on the map.

From the blog Location App Blog by Anonymous and used with permission of the author. All other rights reserved by the author.

Setting Up SQL, PHP, and Sending/Loading Locations

After displaying a map the next thing to do was to let the user send their location and be able to store it. For this I used 000webhost a hosting site that provided me with a MySQL server and PHP scripting to manage it. Using the System.Net.Http Plugin in Xamarin I wrote code that would post the latitude, longitude, and place name in JSON to a php file located on my site. The file would then convert the JSON into variables, stick them into a sql call, and execute the sql against the MySQL database to store them inside the Location table. To do this I needed a way to get the users location on iOS and Android. This functionality was provided by the Xam.Plugin.Geolocator Plugin. Also I needed a way to show a popup asking for the name of the location. For this I used Acr.UserDialogs Plugin. So after putting everything together the user would be able to tap an add button which would poll Geolocator for their location, then type in the name of their location and tap Ok, which would send and store the data in the MySQL server.

Next I needed to be able to get the locations from the server and display them on the map as pins. The process works almost the same way but backwards. You pull the data from the sql database using php encode it in JSON and send it back. The only difference would be decoding the JSON on the other side. Using the plugin Newtonsoft.Json you could decode the JSON string, but what makes the plgin convenient is that you can decode the JSON straight into an Object that will hold the data. For example I created the Object LatLonPair that would hold latitude, logitude and name variables. So using Newtonsoft you could decode a json string into an array of LatLonPairs that hold all your data. From their displaying on the map is easy. just iterate over the array and place the pins on the map.

From the blog Location App Blog by Anonymous and used with permission of the author. All other rights reserved by the author.

Getting a Map

The next thing to get done was to set up displaying a Map on both iOS and Android. Android uses Google Maps and iOS uses Apple Maps. To use Google Maps you need to generate an API key and input it into the Android side of the code. You don’t need to do anything special for Apple Maps. Each Map also needs to ask for permissions depending on what version you are running. To solve this I used the Plugin.Permissions plugin that provides code that takes care  of permissions for both sides of the project. At this point though I ran into problems. In order for Google Maps to run on earlier versions of Android you need to download the relevant support libraries. This is done through the NuGet Package Manager. The manager should act like any package manager for Linux, it should download and install dependencies for you depending on the package you are downloading. Unfortunately at the moment it is a buggy mess. For example if a package has a dependency that can be greater or equal to a certain version NuGet will ignore the greater than sign and spit out an error message saying you are installing something that exceeds the version number. The only way to solve this, that I found, was to write down all the dependencies and manually install them at the correct version one by one. Out of all the time I spent that week working, the largest chunk was taken up by solving this problem.

From the blog Location App Blog by Anonymous and used with permission of the author. All other rights reserved by the author.

Getting a Map

The next thing to get done was to set up displaying a Map on both iOS and Android. Android uses Google Maps and iOS uses Apple Maps. To use Google Maps you need to generate an API key and input it into the Android side of the code. You don’t need to do anything special for Apple Maps. Each Map also needs to ask for permissions depending on what version you are running. To solve this I used the Plugin.Permissions plugin that provides code that takes care  of permissions for both sides of the project. At this point though I ran into problems. In order for Google Maps to run on earlier versions of Android you need to download the relevant support libraries. This is done through the NuGet Package Manager. The manager should act like any package manager for Linux, it should download and install dependencies for you depending on the package you are downloading. Unfortunately at the moment it is a buggy mess. For example if a package has a dependency that can be greater or equal to a certain version NuGet will ignore the greater than sign and spit out an error message saying you are installing something that exceeds the version number. The only way to solve this, that I found, was to write down all the dependencies and manually install them at the correct version one by one. Out of all the time I spent that week working, the largest chunk was taken up by solving this problem.

From the blog Location App Blog by Anonymous and used with permission of the author. All other rights reserved by the author.

Getting a Map

The next thing to get done was to set up displaying a Map on both iOS and Android. Android uses Google Maps and iOS uses Apple Maps. To use Google Maps you need to generate an API key and input it into the Android side of the code. You don’t need to do anything special for Apple Maps. Each Map also needs to ask for permissions depending on what version you are running. To solve this I used the Plugin.Permissions plugin that provides code that takes care  of permissions for both sides of the project. At this point though I ran into problems. In order for Google Maps to run on earlier versions of Android you need to download the relevant support libraries. This is done through the NuGet Package Manager. The manager should act like any package manager for Linux, it should download and install dependencies for you depending on the package you are downloading. Unfortunately at the moment it is a buggy mess. For example if a package has a dependency that can be greater or equal to a certain version NuGet will ignore the greater than sign and spit out an error message saying you are installing something that exceeds the version number. The only way to solve this, that I found, was to write down all the dependencies and manually install them at the correct version one by one. Out of all the time I spent that week working, the largest chunk was taken up by solving this problem.

From the blog Location App Blog by Anonymous and used with permission of the author. All other rights reserved by the author.

The Deep End

This Week I read up on the section called Deep End. This section talks about taking risks and not always taking the safe and easy route. With life it isn’t all about doing the bare minimum and playing it safe. Trying to cruise by in life by doing only what is needed of you. Also doing what you are comfortable with. This section has a story of a person who decided to take that leap of faith by accepting a new job that took him out of his comfort zone. He met with the CTO and CEO of the company he worked at and they wanted him to go to Lagos to work with a contract there and Lagos was rated the 3rd most dangerous city in the world and this would scare away a lot of people however he decided to go. When he started working there it was supposed to be a 3 month job however he stayed for nearly 2 years helping the client. He doesn’t regret taking that trip and because of the trip he has been all-over the west African country and now he is working in London. Because of the risk he took it opened his world by being able to experience different opportunity and meeting new people and go to new places. We can learn a lot from this because in life working on projects for companies we will not be doing things that we like all the time. There are going to be times that we would have to work on projects that take us out of our comfort zone and ask us to learn a new library or a new language and we would have to throw out everything we know and accept the fact that things change. Sooner or later we are going to have to make those hard decisions. But sometimes those hard decisions are just a test of our will to be able to move past those barriers that we have set in front of ourselves and to overcome the obstacles to become better and open new opportunity for ourselves. I think I will take this lesson with me in the future because there are going to be times that I am comfortable working at where I am at but when a new opportunity comes up where it asks me to move ½ way around the world and to work a new team. I will look back on this section and maybe take that opportunity and hopefully it would let me experience something new.

From the blog CS@Worcester – The Road of CS by Henry_Tang_blog and used with permission of the author. All other rights reserved by the author.

Post #33 – Reflection on the “Rubbing Elbows” Pattern

This week, I will be writing the posting my final reflection on an apprenticeship pattern – the Rubbing Elbows pattern.  This pattern addresses developers who feel that they are more productive when they work alone.  The problem that arises for these developers is that they feel that their learning is stagnating because they believe that superior techniques are out there and their work environment causing them them to elude you.  I have had some problems working in groups throughout my college career, but I have never felt that my learning is stagnant.  I chose to write a reflection on this pattern because I think it could be useful in the future, if I ever run into this kind of problem.  Oshineye and Hoover provide solid advice on how to improve your learning in unfavorable environments.

The first piece of advice they give is to find ways to work on tasks with another developer, “side-by-side”.  Oshineye and Hoover believe that some things can only be learned while in the company of other developers.   Even if many techniques don’t require you to collaborate to learn, many ‘microtechniques’ do.  They believe that it is also beneficial to rotate programming partners, because you may find that, after some time, your partner has beome a troublesom one.  Your peers are not the only element conducive to a good working environment though; the physical location is actually important, as well.  According to Richard Sennett’s the Craftsman, an ideal work environment is one in which “absorption into tacit knowledge, unspoken and uncodified in words” takes place.  As many of us are aware, those kind of environments are few and far between, so ‘rubbing elbows’ with another developer is the modern day substitute.  Working with others exposes you to work habits that allow you to gradually refine your skill and extend those habits beyond software development.

The action they advise you to take, if you are somebody currently experiencing this problem, is to find somebody who has already expressed an interest in working collaboratively.  Try to coordinate with that person to meet once a week for a while and see how long you remain motivated.  If the business of your life begins to put a strain on your motivation, adapt and find ways to keep pushing forward until the motivation returns.  I found this pattern very helpful and I will utilize it in my future collaborations.

From the blog CS@Worcester – by Ryan Marcelonis and used with permission of the author. All other rights reserved by the author.

Thoughts on “Sustainable Motivations”

The Sustainable Motivations pattern is aimed at apprentices that are having a tough time sticking it out through the more difficult aspects of the craft.  These might not be constrained to the craftwork itself, but could involve management, handling stakeholders (practically it’s own craft, and probably deserving its own book and set of patterns), and just dealing with burnout.  Even if the apprentice hasn’t yet experienced a motivation deficit, they’re likely to encounter one at some point.  They also tell the apprentice to avoid “Golden Locks”, that trap a person in a position because it feels too good to give up, even though it does not contribute to longer-term goals.

Their solution is to commit motivations to writing, spacing some of them out over a few minutes.  They ask the apprentice to determine which of those are externally driven, which internal, and which may not be necessary.  The end result should be a list of five important things that motivate the apprentice, so they can “look at it when times get tough”.

Motivation can be tough for me.  I tend to be energetic at the start of projects or semesters, but struggle to find ways to keep going once the shine wears off.  One of my concerns as making my way in the professional world gets closer and closer to reality is that I won’t be able to sustain motivation.  I’m always worried that a month or two in, I’ll wear down and burn out and not be able to keep going even though I love programming.  As an apprentice software craftsman, finding ways to motivate myself (and the discipline to keep going if and when motivation fails) is probably one of the most important things I can do to set myself up for future success.

I realize while writing this that I don’t actually know for sure what my ambitions are.  I know that I want to spend some time in the software industry, if only to pay off my student loans and ensure that I’m comfortable.  Even if the motivation to do that is the only thing I get out of this pattern, it’s worth it.

From the blog CS@Worcester – orscsblog by orscsblog and used with permission of the author. All other rights reserved by the author.

Thoughts on “Concrete Skills”

This apprenticeship pattern seeks to solve the problem of the apprentice that wants to seek out and join a skilled team to contribute to and learn from (also, it pays the bills).  However, a truly novice software developer may lack the skills needed to contribute, and faces (perhaps fears) rejection.

The writers offer a solution and an action item to assist it.  The solution is to develop and maintain concrete skills, items that can go on a resume, get through HR filters, and convince a hiring manager that it’s worth it to take a shot on the otherwise unproven apprentice.  These include picking up new languages and technologies, and most importantly writing a project in them, especially if it’s something the apprentice can put on a repository site or their own personal site for potential employers to look at.  The action item (short of finishing a half-dozen personal projects) is to look at the CVs of skilled proffessionals, and to figure out which skills they have that the apprentice could learn.  This goes hand-in-hand with keeping one’s own CV up to date and figuring out which parts are likely to catch the attention of hiring managers.

I think that the development of concrete skills is one of the more valuable things that I’ve gotten out of my education, and I wish that I’d had more opportunities to develop some.  I think it’s really important for students to have opportunities to create projects that push not just conceptual learning, but force the development of concrete skills because they’re the best tools for the job.  I have also been lucky to have an employer that’s willing to let me work on software projects for the business which has given me a lot of experience as well.  I would add to this pattern a suggestion to find an external source of pressure to create a project that works and looks professional.

This is, I think, a pattern that seems obvious and is harder to put into practice than it might appear.  It’s easy to commit to doing things by looking over a CV and developing a list of skills, and harder to actually get them done.

From the blog CS@Worcester – orscsblog by orscsblog and used with permission of the author. All other rights reserved by the author.