My oldest son has decided to use Facebook to marketing his art work. He sent out a message to find out how many people would want a $10 portrait for the Christmas holidays. This is like right out of the Lean Startup MVP and he could care less about that book - somehow that was intuitive to him as the right thing to do - how interesting. From his Facebook responses he now has one $100 cow painting and a $200 unicorn painting commissioned. He has one more he must do for an undisclosed amount where he was told to do a painting and he would get well paid for it. The unicorn is going to travel to California so his social network has paid off quickly. My absolute favorite is the harpist and you have to see these in person to really appreciate them.
Does good design really make a difference? Implementing software often has no relation to life outside work, where chaos seems to be the rule rather than the exception. You may not be able to control life, but let's not practice chaos when developing software.
Tuesday, December 24, 2013
Saturday, December 21, 2013
From concept to reality in 6 weeks - part 27
The hardest part of the day today is figuring out what music to listen to. Not really, now I have to watch my time wisely as I have run out of billable time on this project but I need to do more manual testing on the device being sued at the conference to make sure it is working in every way without any problems. It will not take tons of time but it has to be done whether I get paid for it or not.
The first thing I had to do this morning was recap the whole project in executive summary form to give to the customer in our final meeting on Monday. I actually enjoy doing that as it reminds me how much I accomplished the last month but I constantly have to remind myself of the target audience. Not too much technical detail but enough that a valid summary can be given from the details. Kanbanery has some nice reporting features that helped me some, but it also helped me since I constantly use it to record what is needed to be done and I move the tasks when I am done. Any customer interaction is recorded as comments, which this time also helped me with a couple of summary items.
As I was testing the final changes, it suddenly came to me that what I really need to do is create a perfect test file that has an example of every single value so I can double check on more time that everything is perfect. Now that I can load data from files that is just so easy to do. Time to get serious about my test fixtures. It must have been the time pressure of this whole project that we made not think clearly.
In order to get the list of all airports in North Carolina and Virginia, I tried several sources on web and then just found the airport lists on Wikipedia and used them. The list of IATA NC airport codes and VA airport codes was used to locate all of the commercial primary airports. I then used Flight Stats to look up the complete information exception altitude which I had to use Mrs. Google on each of the airports. Most of the time the airport code would work in the search, as in "RDU altitude" and if not then I would just search for the city and use the altitude I saw in any search results match so I did not have to click on any link in the search results. If all else fails then I go to U.S. Climate Data site which always has what I need. Then I got into a roll by using a search string of "zip code near ... airport" within maps.google.com and then entered the closest city name, state name and zip code into the Maps Easy web site to get the latitude and longitude. I then traversed the USA from Bangor, Maine to Los Angeles, California by picking major cities along the way. I then picked half way points between these 15 cities by approximating the halt way GPS coordinate. This simple GPS path of 31 points helped me find a couple more problems in the code, so it was all worth it even though it took me several hours to do it.
After a full day of work with numerous breaks, but still a full day, I am finally DONE.
The first thing I had to do this morning was recap the whole project in executive summary form to give to the customer in our final meeting on Monday. I actually enjoy doing that as it reminds me how much I accomplished the last month but I constantly have to remind myself of the target audience. Not too much technical detail but enough that a valid summary can be given from the details. Kanbanery has some nice reporting features that helped me some, but it also helped me since I constantly use it to record what is needed to be done and I move the tasks when I am done. Any customer interaction is recorded as comments, which this time also helped me with a couple of summary items.
As I was testing the final changes, it suddenly came to me that what I really need to do is create a perfect test file that has an example of every single value so I can double check on more time that everything is perfect. Now that I can load data from files that is just so easy to do. Time to get serious about my test fixtures. It must have been the time pressure of this whole project that we made not think clearly.
In order to get the list of all airports in North Carolina and Virginia, I tried several sources on web and then just found the airport lists on Wikipedia and used them. The list of IATA NC airport codes and VA airport codes was used to locate all of the commercial primary airports. I then used Flight Stats to look up the complete information exception altitude which I had to use Mrs. Google on each of the airports. Most of the time the airport code would work in the search, as in "RDU altitude" and if not then I would just search for the city and use the altitude I saw in any search results match so I did not have to click on any link in the search results. If all else fails then I go to U.S. Climate Data site which always has what I need. Then I got into a roll by using a search string of "zip code near ... airport" within maps.google.com and then entered the closest city name, state name and zip code into the Maps Easy web site to get the latitude and longitude. I then traversed the USA from Bangor, Maine to Los Angeles, California by picking major cities along the way. I then picked half way points between these 15 cities by approximating the halt way GPS coordinate. This simple GPS path of 31 points helped me find a couple more problems in the code, so it was all worth it even though it took me several hours to do it.
After a full day of work with numerous breaks, but still a full day, I am finally DONE.
Friday, December 20, 2013
From concept to reality in 6 weeks - part 26
So here we are at the final day of work on what needs to be working for the conference. I ended the afternoon yesterday listening to Robin Trower and it was so pleasant that I am going to resume where I left off on Spotify this morning instead of trying to discover new music. The goal for today is to look at a couple of performance problems loading the data from the secure server and fixing the remaining two problems. It sounds easy but finding performance problems can sometimes be a big challenge. Of course the #1 task is to test, test and do more testing as it has to be super stable with no new issues introduced today when with anything I fix. As I work on this app, I constantly keep in mind that this is going to be shown to thousands of people and would I be happy to be there in person showing it?
After more than a month of working on this app, it still never ceases to amaze me when I find yet another super useful MSDN documentation page. This morning I was considering adding a hyperlink to my UI and so I used Ms. Google to search for "windows store xaml controls" and found this useful list of controls with thumbnails of what they look like with code used to create them. Then they have a list of all of the controls by function. Those pages are just so useful to someone starting out. Wait, that was me a month ago. I guess I am a little slow. It kinds of reminds me of the Adobe Flex Showcase. Some days I think there is definitely nothing new under the sun as the employees at Microsoft just learned from other tools what works well and then borrow the ideas and improved on them. I don't know which came first Adobe Flex MXML or Windows XAML but Apple Storyboards are the exact same idea and I know they came later than MXML or XAML.
When I was looking thru the controls list, I see they support tooltips. I still find this really odd on a touch device. I know from using Windows 8 that touch and hold results in a difference action from touching but that is not obvious since that gesture does not exist on Apple devices. Maybe it should be it does not.
Before going to too crazy, I wanted to go back to my existing Kanbanery stories and add references to the MSDN documentation on how I would solve the problems, just in case someone else picks up those tasks in the future. Even if it is me, then many weeks from now I am not going to remember what in the world I was doing.
The list of available components is pretty large and it was easy getting distracting looking at all of the examples to see what I could have used but did not for the UI I created, but I found what I need as it is called a HyperlinkButton. I think I am finally getting the hang of this. I then wanted to style the hyperlink as the default color just does not work with my themed colors. I could not find the styles off the main HyperlinkButton class documentation, but I found it right away in Ms. Google as I searched for "hyperlinkbutton styles xaml c#". I define the two brushes and then I run the app expecting easy success. I get the strangest error message I have not seen before:
It is time to do all kinds of manual testing to make sure the latest app is super stable. That is more important to me than adding any new features at this late in the game. I need a really stable app to deliver on Monday morning at my 9am meeting and I cannot work during the weekend, so bug free is very important.
At the same time I have to find out where the time is being spent processing data from the server as the time spent processing is pretty amazing when load the same data from local files. I must say that over the many years I have been doing this I have not found great benefit in using a performance analyzer as they are not to understand and take time to figure out what is being presented in the output report. I used to run analyzers all of the time in OpenGL development as they helped me. So, I decided to give it a try in VSE. They certainly make it so easy to run as I just select "Performance and Diagnostics" from the DEBUG menu. Download 6 hours worth of data and then stop the app and up comes the report. I really like the presentation as I can click on the column chart or select a region and the details below update to show the "Hot Elements" where most of the time was spent. The first time I selected "XAML UI Responsiveness" but the second time I selected "CPU Sampling". The later one was easy to explain as most of the CPU is spent in the mapping engine. Although those reports looked really good and had great interactivity, they did not help me with my problem at hand at all. And since I like to torture myself, I ran the amusing "Energy Consumption" report as well. The nice donut chart said it all "The session consumed approximately 139.09 mW-h of battery charge in 1.03 min. This rate of usage will drain a fully charged standard battery in approximately 5.23 hrs." - nice. The nice thing about this report is that I see "Wi-Fi Network" in the table with his blue bars of data that represent each of my downloads. I double click on them and I see another set of "Data Transfer" blocks and tool tips that tell me about each one as far as how much data transferred in each request and uploaded data which must be the request and acknowledgement responses. If I use my touch screen then I just tap on one of the blue blocks and the tool tip displays. Very nice - it does help me see one thing - the network is not the problem and the size of data is not a problem either. At least that helps me some. I look back at the donut chart and see that 59% of time was spent in CPU, 40% of the time was spent rendering data to the display and 2% was spent on network traffic. I went back into the "CPU Sampling" report and start poking around to see if any glaring problems came out. Although interesting and good looking, I need to add console log statements in my code and figure out what the delay is between getting the server data and starting the next download as that is my real problem.
In order to find the problem in my code I searched for way to get elapsed time and found the StopWatch class and added a Start/Increment/End calls and reran the app. Loading the data form the server took a total of around 44 seconds but reading the same data from files took a little over 1 second. To read 24 hours worth of data (around 65,000 data points with 18 values per point) took 20 seconds. Then I got brave and went back to loading 24 hours of data from the server and that took 4 minutes. I sent an email to the customer with this information. Now blinding fast but not horrible and the times are predictable and do not really vary much at all.
It took way longer than I expected to get the last issues resolved, but finally I am done and the only thing left to do is to have one final meeting and do the official hand off to the customer, but that is for another day.
After more than a month of working on this app, it still never ceases to amaze me when I find yet another super useful MSDN documentation page. This morning I was considering adding a hyperlink to my UI and so I used Ms. Google to search for "windows store xaml controls" and found this useful list of controls with thumbnails of what they look like with code used to create them. Then they have a list of all of the controls by function. Those pages are just so useful to someone starting out. Wait, that was me a month ago. I guess I am a little slow. It kinds of reminds me of the Adobe Flex Showcase. Some days I think there is definitely nothing new under the sun as the employees at Microsoft just learned from other tools what works well and then borrow the ideas and improved on them. I don't know which came first Adobe Flex MXML or Windows XAML but Apple Storyboards are the exact same idea and I know they came later than MXML or XAML.
When I was looking thru the controls list, I see they support tooltips. I still find this really odd on a touch device. I know from using Windows 8 that touch and hold results in a difference action from touching but that is not obvious since that gesture does not exist on Apple devices. Maybe it should be it does not.
Before going to too crazy, I wanted to go back to my existing Kanbanery stories and add references to the MSDN documentation on how I would solve the problems, just in case someone else picks up those tasks in the future. Even if it is me, then many weeks from now I am not going to remember what in the world I was doing.
The list of available components is pretty large and it was easy getting distracting looking at all of the examples to see what I could have used but did not for the UI I created, but I found what I need as it is called a HyperlinkButton. I think I am finally getting the hang of this. I then wanted to style the hyperlink as the default color just does not work with my themed colors. I could not find the styles off the main HyperlinkButton class documentation, but I found it right away in Ms. Google as I searched for "hyperlinkbutton styles xaml c#". I define the two brushes and then I run the app expecting easy success. I get the strangest error message I have not seen before:
WinRT information: Failed to create a "Windows.UI.Xaml.Media.Brush" from the text ''. [Line: 185 Position: 46]I looked in my resources XAML file and then at Git to see what I changed as that just did not make sense. I see the problem immediately as I started adding Foreground color to my Hyperlink button and had Foreground="". Sure enough I look at my MainPage.xaml file and on line 185 I found that half baked code. I compile the code and re-run it and it looks exactly as I intended it to. A little bit more code and I am done with that task.
It is time to do all kinds of manual testing to make sure the latest app is super stable. That is more important to me than adding any new features at this late in the game. I need a really stable app to deliver on Monday morning at my 9am meeting and I cannot work during the weekend, so bug free is very important.
At the same time I have to find out where the time is being spent processing data from the server as the time spent processing is pretty amazing when load the same data from local files. I must say that over the many years I have been doing this I have not found great benefit in using a performance analyzer as they are not to understand and take time to figure out what is being presented in the output report. I used to run analyzers all of the time in OpenGL development as they helped me. So, I decided to give it a try in VSE. They certainly make it so easy to run as I just select "Performance and Diagnostics" from the DEBUG menu. Download 6 hours worth of data and then stop the app and up comes the report. I really like the presentation as I can click on the column chart or select a region and the details below update to show the "Hot Elements" where most of the time was spent. The first time I selected "XAML UI Responsiveness" but the second time I selected "CPU Sampling". The later one was easy to explain as most of the CPU is spent in the mapping engine. Although those reports looked really good and had great interactivity, they did not help me with my problem at hand at all. And since I like to torture myself, I ran the amusing "Energy Consumption" report as well. The nice donut chart said it all "The session consumed approximately 139.09 mW-h of battery charge in 1.03 min. This rate of usage will drain a fully charged standard battery in approximately 5.23 hrs." - nice. The nice thing about this report is that I see "Wi-Fi Network" in the table with his blue bars of data that represent each of my downloads. I double click on them and I see another set of "Data Transfer" blocks and tool tips that tell me about each one as far as how much data transferred in each request and uploaded data which must be the request and acknowledgement responses. If I use my touch screen then I just tap on one of the blue blocks and the tool tip displays. Very nice - it does help me see one thing - the network is not the problem and the size of data is not a problem either. At least that helps me some. I look back at the donut chart and see that 59% of time was spent in CPU, 40% of the time was spent rendering data to the display and 2% was spent on network traffic. I went back into the "CPU Sampling" report and start poking around to see if any glaring problems came out. Although interesting and good looking, I need to add console log statements in my code and figure out what the delay is between getting the server data and starting the next download as that is my real problem.
In order to find the problem in my code I searched for way to get elapsed time and found the StopWatch class and added a Start/Increment/End calls and reran the app. Loading the data form the server took a total of around 44 seconds but reading the same data from files took a little over 1 second. To read 24 hours worth of data (around 65,000 data points with 18 values per point) took 20 seconds. Then I got brave and went back to loading 24 hours of data from the server and that took 4 minutes. I sent an email to the customer with this information. Now blinding fast but not horrible and the times are predictable and do not really vary much at all.
It took way longer than I expected to get the last issues resolved, but finally I am done and the only thing left to do is to have one final meeting and do the official hand off to the customer, but that is for another day.
Thursday, December 19, 2013
From concept to reality in 6 weeks - part 25
Just when I thought I was done and could relax, I woke up today knowing I have to finish in a couple more days. I have today and tomorrow and then a weekend to be done. The good news is just as I expected the fix from my new found friend was waiting for me when I woke up. He had found the problem of the crash in his mapping engine code and had fixed it.
Now all I have to do it using his new DLLs and work my way thru all of the small issues I need to finish off. This morning I tried to poke around in Spotify to figure out what kind of music I felt like listening to and finally I arrived at Kirk Fletcher. He is the guitarist for The Fabulous Thunderbirds, so it is going to be a bluesy day today. That should help me a lot.
This morning I learned a new trick by calling "System.Diagnostics.Debug.Assert(false)" in my LINQ try/catch blocks I can see the stack trace when errors occur in the debug console. I have really de-generated in the past month as look at that crazy language I am speaking. I need to hurry up and finish this stuff to get back to what I really need to do and love doing and that it UX directed tasks. Enough of this programming stuff as it is not helping me!
I have several problems I must fix, so back to working on each one of these until I fix them all. Unless of course I need to go to sleep tonight and then I will leave some for tomorrow.
As I was marching down thru the issues, I actually found one in my own testing. When I was in hurry up mode, I could not figure out how to customize the Telerik Date/Time control to remove the header as I wanted my own text outside the control. I finally took some time and learned how to do that and it was pretty easy once I understood a bit more about component development in Windows 8 XAML from the Telerik documentation on the Date/Time control.
The next big lesson is that when creating a Grid you need to define the RowDefinitions and the ColumnDefinitions if you want the Grid to fill the remaining space. I am not sure why I thought that was the default but this is like the 5th time I have tried using a Grid and got frustrated when it did not work. I went back and the documentation exists but it is hard to find anything useful in there. I had to go back to the Quick Start Guide for Layouts as it was in there under the Auto and Star sizing. What a crazy name so that should prove another special keyword was needed instead of using a "*". On the other hand I really like the "2*" syntax to make a column two times wider than another - that is nice.
Now it is definitely to do a little complaining about VSE. I am sure there is a way to customize everything but the default action to increase/decrease the font size in the current editor is driving me crazy. The VSE default is for a two finger pinch to decrease the font size and the two finger extend increases the font size. That is not a gesture I deal with my my Mac so something I do changes the font size all of the time. It took me a while to figure it out - like a month!
The big lesson for the day is to always use a Grid since it is easier to adjust it that to use a StackPanel and then switch to a Grid. OK - always is a bit harsh but I don't know how many times in the last month I have started with a StackPanel because it was easy and then later on to switch it to a Grid. The real rule is if you have more than one row then create Grid.RowDefinitions and if you have more than one column then create Grid.ColumnDefinitions. Then all is well. Another very good rule is never try to nest StackPanel in a Grid or a Grid in a StackPanel as that just does not work without a lot of effort. This line in the documentation says it all:
Now all I have to do it using his new DLLs and work my way thru all of the small issues I need to finish off. This morning I tried to poke around in Spotify to figure out what kind of music I felt like listening to and finally I arrived at Kirk Fletcher. He is the guitarist for The Fabulous Thunderbirds, so it is going to be a bluesy day today. That should help me a lot.
This morning I learned a new trick by calling "System.Diagnostics.Debug.Assert(false)" in my LINQ try/catch blocks I can see the stack trace when errors occur in the debug console. I have really de-generated in the past month as look at that crazy language I am speaking. I need to hurry up and finish this stuff to get back to what I really need to do and love doing and that it UX directed tasks. Enough of this programming stuff as it is not helping me!
I have several problems I must fix, so back to working on each one of these until I fix them all. Unless of course I need to go to sleep tonight and then I will leave some for tomorrow.
As I was marching down thru the issues, I actually found one in my own testing. When I was in hurry up mode, I could not figure out how to customize the Telerik Date/Time control to remove the header as I wanted my own text outside the control. I finally took some time and learned how to do that and it was pretty easy once I understood a bit more about component development in Windows 8 XAML from the Telerik documentation on the Date/Time control.
The next big lesson is that when creating a Grid you need to define the RowDefinitions and the ColumnDefinitions if you want the Grid to fill the remaining space. I am not sure why I thought that was the default but this is like the 5th time I have tried using a Grid and got frustrated when it did not work. I went back and the documentation exists but it is hard to find anything useful in there. I had to go back to the Quick Start Guide for Layouts as it was in there under the Auto and Star sizing. What a crazy name so that should prove another special keyword was needed instead of using a "*". On the other hand I really like the "2*" syntax to make a column two times wider than another - that is nice.
Now it is definitely to do a little complaining about VSE. I am sure there is a way to customize everything but the default action to increase/decrease the font size in the current editor is driving me crazy. The VSE default is for a two finger pinch to decrease the font size and the two finger extend increases the font size. That is not a gesture I deal with my my Mac so something I do changes the font size all of the time. It took me a while to figure it out - like a month!
The big lesson for the day is to always use a Grid since it is easier to adjust it that to use a StackPanel and then switch to a Grid. OK - always is a bit harsh but I don't know how many times in the last month I have started with a StackPanel because it was easy and then later on to switch it to a Grid. The real rule is if you have more than one row then create Grid.RowDefinitions and if you have more than one column then create Grid.ColumnDefinitions. Then all is well. Another very good rule is never try to nest StackPanel in a Grid or a Grid in a StackPanel as that just does not work without a lot of effort. This line in the documentation says it all:
By default, a Grid contains one row and one column.The final task of the day is to learn how to style the Telerik date/time controls as the default blue background color is clashing with my default colors. Should be easy to fix since Telerik really has superb documentation on their control styles. Then of course I wanted to change the standard XAML slider colors as the purple is just a bit strange with the theme colors I am using. That took a bit more work to find the documentation and then it just show how great the Telerik documentation is as there are not illustrated screenshots that show the SolidColorBrush colors and where they apply to the XAML slider. I finally figured it out but it was a bit of hit and miss programming. Since this took too much effort I don't want to forget this technique:
To end the day I how to figure out how to combine two different dates into a single date. One had the date and the other had the time. Not an ideal situation but it was not all that difficult to merge the two into a single date. Enough for today as tomorrow will be my final day of work on this project it appears at the moment.
From concept to reality in 6 weeks - part 24
I tried to get a few hours of sleep. I went to bed at 10:30pm exhausted and needing sleep. I have a big demo of what is working today at 9am so I wake up at 4:30am worried about the app still not working. Thankfully the mapping engine lead had worked thru the night, which sounds harsh but those are his normal working hours. This day is paid off. After a wake up shower I checked my email and sure enough there was 3 emails from him waiting for me. He had just got to bed when I was starting. He did not fix my problem but had several suggestions. After eating a quick breakfast and taking a deep breath I was ready to go at 5:30am. I had 3 hours to get it all working again so in I dig.
I had misunderstood how to use the mapping engine on Windows as it is very different from iOS in loading resources and managing threads. I needed to load all of the images up front and then create a map layer and only update the markers on the layer when it needed to be updated dynamically. It was time to start some major rewriting.
At 8:10am I finally got all of the map layers to display the markers correctly. Just when I thought I needed to hurry up and face a traffic jam on the freeway, I forgot that I have no access to the internet at my customer's office so I had to make an installable build and then email it to myself and then download it on the demo machine. That took me 30 minutes so I was in the car racing to the office 30 miles away. I turned on the radio and found out that there was a wreck half way there. The only problem by that time I heard about the wreck is that I had no other way to get there. As I entered the stand still traffic, I called my customer to let me know I would be late. I reached the office 15 minutes late.
The demo went really well and I entered tasks that were required to be fixed for the conference, where my app would be shown in the first week of January, as they came up in our discussion. There was a brief talk about running out of money but my main task was to find out what would make him happy for the final product I needed to have delivered to him. I definitely captured all of that important information. About half way thru the morning discussion a guest arrived who was the fellow in charge of the server API I was using to load the data. We discussed a couple of issues I was having and we decided to put a back up plan in the app to load 24 hours of data from local files on the computer in case the WiFi at the conference did not work, which is fully expected to have issues as it does every year! Good thing I added all of that code to read from files when I was stuck in a Starbucks with no working WiFi.
I visited another client only a mile away on the same road and the person I was supposed to meet was not there so I moved on. I decided to call my old work buds and have lunch with them since I was going right by their office and I needed a serious break anyway. Then of course I had to make my rounds and talk to everyone I knew that I saw in my old work building. Old is not really an appropriate word as there is nothing old about the building - maybe previous palatial mansion would be a better word. It was a great and well needed break from constant eating, breathing and sleeping Windows Store app code.
As I left my previous employers digs, I decided to drive to the Starbucks that had Google Business Class WiFi and call the mapping engine lead to see if he could meet me and help me work thru the critical issues. I was there less than an hour when he showed up.
For the next 4 hours we worked thru issues, crashes and general Microsoft debugging stuff I never wanted to know about. I had to read up a bit on using await and async in Windows Store apps. This is really a feature in VSE that is supposed to make asynchronous programming very easy. I must admit it is very easy but I needed to get a better understand since I was definitely seeing random crashes and thread problems. Some of the tools we used on his machine as these tools were so low level that they scared me and I did not want them on my machine. The first scary tool was called WinDbg and the reason it was scary is that you run the command and it changes registry settings and if you don't forget to change them back or remember how then your executable program will launch and then immediately enter into the debugger. Just the user interface alone was scary enough to just forget I ever saw it. The next scary tool was Application Verifier which seemed really super helpful but there again it changed registry settings. Anything that needs to change the registry is not going to happen on my machine. The mapping engine lead showed me how to enable checks to run automatically and how the reference app he wrote would fail all of the time. That is not what I wanted to know but I did see this tool's usefulness.
After 4 hours, I had even more tasks as I was basically testing the app the whole afternoon long as I was trying the duplicate the crashes I had been seeing. I found a couple of problems in my code that I immediately fixed. As I was fixing them we would discuss how I was doing things and he would suggest improvements. I recorded those in new tasks. This was the most important thing I could be doing as I need to make sure the app did not crash at all and was bullet proof for the conference. Finally after about 3 ½ hours in I got a crash. We had tried all kinds of things to get useful information on my machine when a crash occurred. We added a divide by zero in the code and could not find a way to get what we wanted. We looked at the system event log, VSE settings to allow debug symbols, basically nothing worked. Finally we found a setting in VSE File menu to saw the output as a debug dump file. My Windows laptop for some odd reason fails to read a USB thumb drive sometimes, so I had to reboot the machine and then it worked. I copied the 215mb dump file on the drive and gave it to him and he loaded it on his Mac pretending to be a Windows 8.1 machine. He has all of the Microsoft tools on his machine so was able to find out where the problem is, so I left Starbucks as I had to pick up my son at 7pm, but I knew he would find the problem for me.
I had misunderstood how to use the mapping engine on Windows as it is very different from iOS in loading resources and managing threads. I needed to load all of the images up front and then create a map layer and only update the markers on the layer when it needed to be updated dynamically. It was time to start some major rewriting.
At 8:10am I finally got all of the map layers to display the markers correctly. Just when I thought I needed to hurry up and face a traffic jam on the freeway, I forgot that I have no access to the internet at my customer's office so I had to make an installable build and then email it to myself and then download it on the demo machine. That took me 30 minutes so I was in the car racing to the office 30 miles away. I turned on the radio and found out that there was a wreck half way there. The only problem by that time I heard about the wreck is that I had no other way to get there. As I entered the stand still traffic, I called my customer to let me know I would be late. I reached the office 15 minutes late.
The demo went really well and I entered tasks that were required to be fixed for the conference, where my app would be shown in the first week of January, as they came up in our discussion. There was a brief talk about running out of money but my main task was to find out what would make him happy for the final product I needed to have delivered to him. I definitely captured all of that important information. About half way thru the morning discussion a guest arrived who was the fellow in charge of the server API I was using to load the data. We discussed a couple of issues I was having and we decided to put a back up plan in the app to load 24 hours of data from local files on the computer in case the WiFi at the conference did not work, which is fully expected to have issues as it does every year! Good thing I added all of that code to read from files when I was stuck in a Starbucks with no working WiFi.
I visited another client only a mile away on the same road and the person I was supposed to meet was not there so I moved on. I decided to call my old work buds and have lunch with them since I was going right by their office and I needed a serious break anyway. Then of course I had to make my rounds and talk to everyone I knew that I saw in my old work building. Old is not really an appropriate word as there is nothing old about the building - maybe previous palatial mansion would be a better word. It was a great and well needed break from constant eating, breathing and sleeping Windows Store app code.
As I left my previous employers digs, I decided to drive to the Starbucks that had Google Business Class WiFi and call the mapping engine lead to see if he could meet me and help me work thru the critical issues. I was there less than an hour when he showed up.
For the next 4 hours we worked thru issues, crashes and general Microsoft debugging stuff I never wanted to know about. I had to read up a bit on using await and async in Windows Store apps. This is really a feature in VSE that is supposed to make asynchronous programming very easy. I must admit it is very easy but I needed to get a better understand since I was definitely seeing random crashes and thread problems. Some of the tools we used on his machine as these tools were so low level that they scared me and I did not want them on my machine. The first scary tool was called WinDbg and the reason it was scary is that you run the command and it changes registry settings and if you don't forget to change them back or remember how then your executable program will launch and then immediately enter into the debugger. Just the user interface alone was scary enough to just forget I ever saw it. The next scary tool was Application Verifier which seemed really super helpful but there again it changed registry settings. Anything that needs to change the registry is not going to happen on my machine. The mapping engine lead showed me how to enable checks to run automatically and how the reference app he wrote would fail all of the time. That is not what I wanted to know but I did see this tool's usefulness.
After 4 hours, I had even more tasks as I was basically testing the app the whole afternoon long as I was trying the duplicate the crashes I had been seeing. I found a couple of problems in my code that I immediately fixed. As I was fixing them we would discuss how I was doing things and he would suggest improvements. I recorded those in new tasks. This was the most important thing I could be doing as I need to make sure the app did not crash at all and was bullet proof for the conference. Finally after about 3 ½ hours in I got a crash. We had tried all kinds of things to get useful information on my machine when a crash occurred. We added a divide by zero in the code and could not find a way to get what we wanted. We looked at the system event log, VSE settings to allow debug symbols, basically nothing worked. Finally we found a setting in VSE File menu to saw the output as a debug dump file. My Windows laptop for some odd reason fails to read a USB thumb drive sometimes, so I had to reboot the machine and then it worked. I copied the 215mb dump file on the drive and gave it to him and he loaded it on his Mac pretending to be a Windows 8.1 machine. He has all of the Microsoft tools on his machine so was able to find out where the problem is, so I left Starbucks as I had to pick up my son at 7pm, but I knew he would find the problem for me.
From concept to reality in 6 weeks - part 23
Here we are at probably the last full day of work on the Windows Store app. It is not really sad for me as I really need a break as I have been putting in way too many hours. I look forward to scaling down the number of hours per day and relaxing over the Christmas break with the family. I am starting off the day listening to Good Old War on Spotify as I need some enjoyable music to start the day off right. I really like their song "Amazing Eyes".
I added the nightly mapping engine build to my app and double checked a couple of things and then checked the DLLs into GitHub. I added some debug statements to verify I am getting all of the correct callbacks for the filtering as that is my final missing piece of functionality. If I can get that working today then I will be a happy camper. I expect that to happen as I know what needs to be done. Since my wife is still sick I have to take my son to a doctor appointment and I may meet the mapping engine lead developer in the afternoon so I need to watch my time closely to make sure I don't run out of time as I definitely do not need another super long work day.
My first attempt worked so I am feeling good about today. I am going to update the status messages first so I can see the affects of the filtering without doing actually doing the filtering. Once I understand that part, then I should be done as the rest is easy. I was really tempted to rename so properties in the event being passed to me but then I decided against it and just use it as is. A side note about refactoring code before I go crazy and finish my last task. When working on Adobe Flex for several years, I complained about how refactoring is more than just renaming something. Now VSE has done the same thing to me all over again. Except they added the ability to extract a method also. Apple Xcode is not much better so I cannot brag about them either. I just find it pretty sad that many ages ago when I worked in Java that the Eclipse IDE had all refactoring support and yet I have to see another IDE that had that capability since then. I have use that a couple of times in I am over that and moving on...
I must say that Good Old War was a perfect band choice for today.
It never fails, when the heat is on something horrible happens. For me today the app just stopped working and all day long I have been trying to figure out why. I am still struggling with how that happened. No words to describe how long today was.
I added the nightly mapping engine build to my app and double checked a couple of things and then checked the DLLs into GitHub. I added some debug statements to verify I am getting all of the correct callbacks for the filtering as that is my final missing piece of functionality. If I can get that working today then I will be a happy camper. I expect that to happen as I know what needs to be done. Since my wife is still sick I have to take my son to a doctor appointment and I may meet the mapping engine lead developer in the afternoon so I need to watch my time closely to make sure I don't run out of time as I definitely do not need another super long work day.
My first attempt worked so I am feeling good about today. I am going to update the status messages first so I can see the affects of the filtering without doing actually doing the filtering. Once I understand that part, then I should be done as the rest is easy. I was really tempted to rename so properties in the event being passed to me but then I decided against it and just use it as is. A side note about refactoring code before I go crazy and finish my last task. When working on Adobe Flex for several years, I complained about how refactoring is more than just renaming something. Now VSE has done the same thing to me all over again. Except they added the ability to extract a method also. Apple Xcode is not much better so I cannot brag about them either. I just find it pretty sad that many ages ago when I worked in Java that the Eclipse IDE had all refactoring support and yet I have to see another IDE that had that capability since then. I have use that a couple of times in I am over that and moving on...
I must say that Good Old War was a perfect band choice for today.
It never fails, when the heat is on something horrible happens. For me today the app just stopped working and all day long I have been trying to figure out why. I am still struggling with how that happened. No words to describe how long today was.
Monday, December 16, 2013
From concept to reality in 6 weeks - part 22
We have to pick up every a couple of notches today. To start off the day on the wrong foot, my Windows laptop had updates that had to be applied which meant a reboot. The only good thing about that is that it forces me to reboot my Windows laptop which I forget to do after using a Mac for so many years you just forget about it like one should. Why would I ever want to reboot my computer daily or weekly?
On the other hand my wife is sick and is got worse over the weekend, which almost never happens. I keep telling myself that I cannot sick as I now have to finish the rest of the work in two days. I will leave one extra day to change anything the customer wants changing. The good news is that I never expected to have any break over Christmas so now I get one! I definitely need a break to recover as this has been fun but I cannot sustain this for much longer without downtime.
Now to work. I have a new update to the mapping engine this morning that I need to try. I downloaded the ZIP file and updated all of the files in my project. I cleaned the solution and then did a rebuild solution. I then ran the app to make sure everything was still working as it should. The first problem of the day, which I knew there would some issues when I try to hurry up. The server failed with a 500 error. I knew that I was going to run into road blocks today and tomorrow as I try to rush to the finish line.
When I rewrote all of the asynchronous server downloading code yesterday I forgot to put in the debug statements for the URLs being accessed so that would have helped the above 500 error. I need to put those back in and then try again. I also need to add back in the Cancel button on the progress as after the 500 error, the app got stuck. I could actually take care of that case as well. First the debug statements to figure out the real problem and then I will look into handling errors and the cancel button. After I add the log statements, now I no longer see the 500 server error. I don't know how to feel about that. A bug you cannot reproduce is not giving me a warm fuzzy feeling this early in the morning or any time of the day for that matter. I am going to work on the Cancel button to get that to work as a fall back, just in case it happens again. I am going to the number of dat ago download to 24, so it will be easy to tell if the cancel actually works. I then will check to make sure I can start another download as it has to clear everything on the map and start over. Cancel and restarting download from scratch is working - now that is a good start to the day as all of the that finished in only one hour. One thing is absolutely for sure and that as I rewrite code it is definitely getting better with each passing day. Time to check in the code and move on. Wait, I am going to the save the JSON files for 24 hours as a backup in case I do not have an internet connection so I can still do work.
The next big task is finishing the user interface for the download dialog where the user can choose how much data to download from the server to the app. Now that I know all of the underlying code works and is testing, adding the UI and doing something when the user clicks on the Download button will be so easy. At least that is what I am thinking right now anyway!
Every time I use a Grid layout I have to remember the difference between "Auto" and "*". It makes sense when you learn it but it just is not intuitively obvious to me as it just does not fit my mental modal. There must have been some special keyword Microsoft could have created to mean auto-fill all remaining space instead of using a "*". Now what I am over that, I must learn how to use a slider and configure it like I want it to look. First I read up on the standard guidelines for sliders as I don't want to create something that looks and works really oddly on Windows. I take that back first thing is to find the right music for my mood. I have been listening to Jazz this morning but it is just not doing it for me. I switch over to Spotify and try to discover something new from it's suggestions since I have been listening to Spotify for so long. OK, I am switching to blues as that is just about right.
Yet another very long, so I need to recap what I did since my last comment and what I learned. I first tried to use the Perpetuum free controls as I wanted to see if their calendar and date/time controls were good. The bottom line is not what I wanted at all, so I remove the DLLs from the project and removed all references. No need code that does not help me, so it is all gone. Next I looked up how to use the standard Windows Store Metro sliders as I need to show minimum and maximum values, which I had to do myself using a TextBlock, Slider and TextBlock inside horizontal StackPanel. Pretty easy to add tick marks as the Slider just did the right thing by adding minimum and maximum values. That was easy as it should be. I looked up the standard guidelines on using sliders just to make sure I was not doing anything off guidelines.
Then I wanted to learn more about customizing components using styles and templates so I read yet another MSDN web page on that topic. What I have yet to figure out was how to see the existing visual templates in VDE. I found references to it but I just got too impatient trying to find it in VSE. I did find this great explanation on how to create Metro styles. I wish I had more time to explore that in great detail but I am in a hurry today.
Since I got rid of Perpetuum, I need to get up to speed on how to use the Telerik Date/Time component and they have really great documentation so it made my life very easy. Specifically I just skip to the Selector properties as everything just made sense with little documentation reading. It took me a couple of hours to get the dialog looking special like I wanted it to, but the end result made me happy and worth the effort involved.
I spent several hours working with the mapping engine lead developer to make sure I understood all of the issues and a couple of them were indeed misunderstandings on my part where I had to fix my code. By the end of the very long day, I am good on all of the issues and will met him tomorrow to finish off the rest.
To end the day I had to look up the latitude/longitude extents of the continental USA and also including Alaska. With these bounds I can tell the mapping engine how to show that part of the geographic map initially. I found a couple of interesting blog posts on this subject. The most useful one was a link to OpenStreetMaps with the extents showing on a map so I could verify I had them set right. I double checked them on another blog post. I was using the geographic center of the USA of (39.8282, -98.5795) and trying to change the zoom level but that was too odd. Now I am using visible extents of (24.52, -124.77) to (49.38, 66.95) and that did the trick.
To end the data I re-wrote code to read 24 hours of data from local disk as a debugging aid so I did not have to wait for the server to return the data. At least this verified that the problem is not in my code as 44,000 observations were loaded into the mapping engine very quickly. If I have time tomorrow I will have to look into that some more to find where all of the time is spent as maybe I am doing something wrong in gathering the data from the server.
Right now I am very tired and need to call it another day. Tomorrow will be the last full day of development unless the customer coughs up more money for me to do more work. I am feeling the need for rest...
On the other hand my wife is sick and is got worse over the weekend, which almost never happens. I keep telling myself that I cannot sick as I now have to finish the rest of the work in two days. I will leave one extra day to change anything the customer wants changing. The good news is that I never expected to have any break over Christmas so now I get one! I definitely need a break to recover as this has been fun but I cannot sustain this for much longer without downtime.
Now to work. I have a new update to the mapping engine this morning that I need to try. I downloaded the ZIP file and updated all of the files in my project. I cleaned the solution and then did a rebuild solution. I then ran the app to make sure everything was still working as it should. The first problem of the day, which I knew there would some issues when I try to hurry up. The server failed with a 500 error. I knew that I was going to run into road blocks today and tomorrow as I try to rush to the finish line.
When I rewrote all of the asynchronous server downloading code yesterday I forgot to put in the debug statements for the URLs being accessed so that would have helped the above 500 error. I need to put those back in and then try again. I also need to add back in the Cancel button on the progress as after the 500 error, the app got stuck. I could actually take care of that case as well. First the debug statements to figure out the real problem and then I will look into handling errors and the cancel button. After I add the log statements, now I no longer see the 500 server error. I don't know how to feel about that. A bug you cannot reproduce is not giving me a warm fuzzy feeling this early in the morning or any time of the day for that matter. I am going to work on the Cancel button to get that to work as a fall back, just in case it happens again. I am going to the number of dat ago download to 24, so it will be easy to tell if the cancel actually works. I then will check to make sure I can start another download as it has to clear everything on the map and start over. Cancel and restarting download from scratch is working - now that is a good start to the day as all of the that finished in only one hour. One thing is absolutely for sure and that as I rewrite code it is definitely getting better with each passing day. Time to check in the code and move on. Wait, I am going to the save the JSON files for 24 hours as a backup in case I do not have an internet connection so I can still do work.
The next big task is finishing the user interface for the download dialog where the user can choose how much data to download from the server to the app. Now that I know all of the underlying code works and is testing, adding the UI and doing something when the user clicks on the Download button will be so easy. At least that is what I am thinking right now anyway!
Every time I use a Grid layout I have to remember the difference between "Auto" and "*". It makes sense when you learn it but it just is not intuitively obvious to me as it just does not fit my mental modal. There must have been some special keyword Microsoft could have created to mean auto-fill all remaining space instead of using a "*". Now what I am over that, I must learn how to use a slider and configure it like I want it to look. First I read up on the standard guidelines for sliders as I don't want to create something that looks and works really oddly on Windows. I take that back first thing is to find the right music for my mood. I have been listening to Jazz this morning but it is just not doing it for me. I switch over to Spotify and try to discover something new from it's suggestions since I have been listening to Spotify for so long. OK, I am switching to blues as that is just about right.
Yet another very long, so I need to recap what I did since my last comment and what I learned. I first tried to use the Perpetuum free controls as I wanted to see if their calendar and date/time controls were good. The bottom line is not what I wanted at all, so I remove the DLLs from the project and removed all references. No need code that does not help me, so it is all gone. Next I looked up how to use the standard Windows Store Metro sliders as I need to show minimum and maximum values, which I had to do myself using a TextBlock, Slider and TextBlock inside horizontal StackPanel. Pretty easy to add tick marks as the Slider just did the right thing by adding minimum and maximum values. That was easy as it should be. I looked up the standard guidelines on using sliders just to make sure I was not doing anything off guidelines.
Then I wanted to learn more about customizing components using styles and templates so I read yet another MSDN web page on that topic. What I have yet to figure out was how to see the existing visual templates in VDE. I found references to it but I just got too impatient trying to find it in VSE. I did find this great explanation on how to create Metro styles. I wish I had more time to explore that in great detail but I am in a hurry today.
Since I got rid of Perpetuum, I need to get up to speed on how to use the Telerik Date/Time component and they have really great documentation so it made my life very easy. Specifically I just skip to the Selector properties as everything just made sense with little documentation reading. It took me a couple of hours to get the dialog looking special like I wanted it to, but the end result made me happy and worth the effort involved.
I spent several hours working with the mapping engine lead developer to make sure I understood all of the issues and a couple of them were indeed misunderstandings on my part where I had to fix my code. By the end of the very long day, I am good on all of the issues and will met him tomorrow to finish off the rest.
To end the day I had to look up the latitude/longitude extents of the continental USA and also including Alaska. With these bounds I can tell the mapping engine how to show that part of the geographic map initially. I found a couple of interesting blog posts on this subject. The most useful one was a link to OpenStreetMaps with the extents showing on a map so I could verify I had them set right. I double checked them on another blog post. I was using the geographic center of the USA of (39.8282, -98.5795) and trying to change the zoom level but that was too odd. Now I am using visible extents of (24.52, -124.77) to (49.38, 66.95) and that did the trick.
To end the data I re-wrote code to read 24 hours of data from local disk as a debugging aid so I did not have to wait for the server to return the data. At least this verified that the problem is not in my code as 44,000 observations were loaded into the mapping engine very quickly. If I have time tomorrow I will have to look into that some more to find where all of the time is spent as maybe I am doing something wrong in gathering the data from the server.
Right now I am very tired and need to call it another day. Tomorrow will be the last full day of development unless the customer coughs up more money for me to do more work. I am feeling the need for rest...
Sunday, December 15, 2013
From concept to reality in 6 weeks - part 21
Yesterday I took the day off and read a book "The Mountain of Light" by Indu Sundarsan which is a different view on the same story that my favorite author William Dalrymple wrote about called "Return of a King". It was very relaxing to take a whole day to read this 300+ page book.
I definitely did not intend to work today, but when I found out that due to budget constraints I would need to finish this week. Running out of money is one of things common things in life that we just have to deal with. In a perfect world, I could just go on forever writing stuff that the customer wants but someone has to pay for the work being done and in this case, as in all of the cases I have work on, there is limited amount of funds.
My goal today was to allow multiple server requests to retrieve data for at least 24 hours and have it show up on a map. Seems like a reasonable thing to do since I have to have that working by Wednesday.
First I was curious about a couple of things I have seen in sample code. What is the difference between strings surrounded by double quotes and those with a "@" preceding the double quotes? That was easy to find the answer as it was the first match from Ms. Google as it is called Regular vs. Verbatim strings. The next question is about regular expression string matching. I found a page outside of MSDN that was a helpful start on C# regular expressions. I found good documentation that showed me that it is exactly as I expected. The regular expression quick reference was what I needed.
As I started coding I quickly did something evil again as I kept getting a run-time null exception. Man those are so hard to track down. I went back to see if there was a way to capture every exception and tried both "catch (Exception e)" and an "catch" without any exception. There was something I was missing as one of my asynchronous calls must have gotten me in trouble as I could not track it down. I did learn to that there is an easy way to show the class name in debug statements by using "this.GetType().Name" as that was definitely helpful. One other thing I was a bit concerned about was extending an array as more data became available, but I learned that was no problem as a List can be changed on the fly by either increasing the Capacity or just adding more elements one at a time.
I decided it was time to completely rewrite the complex code I wrote that gets data from a server. The Background Transfer code I wrote was way too complex to debug and was causing too many issues. I went back to the drawing board to learn how to use the HttpClient in a Windows Store app. My code was just so much clearer in the end and actually worked to transfer 24 hours worth of data in 1 hour increments. I was so happy I had to send screenshots to the customer even at the late hour it is.
This post clearly does not cover everything I did as it took me all day long to rewrite my code, so the number of words in this post clearly does not express how much I got done today!
I definitely did not intend to work today, but when I found out that due to budget constraints I would need to finish this week. Running out of money is one of things common things in life that we just have to deal with. In a perfect world, I could just go on forever writing stuff that the customer wants but someone has to pay for the work being done and in this case, as in all of the cases I have work on, there is limited amount of funds.
My goal today was to allow multiple server requests to retrieve data for at least 24 hours and have it show up on a map. Seems like a reasonable thing to do since I have to have that working by Wednesday.
First I was curious about a couple of things I have seen in sample code. What is the difference between strings surrounded by double quotes and those with a "@" preceding the double quotes? That was easy to find the answer as it was the first match from Ms. Google as it is called Regular vs. Verbatim strings. The next question is about regular expression string matching. I found a page outside of MSDN that was a helpful start on C# regular expressions. I found good documentation that showed me that it is exactly as I expected. The regular expression quick reference was what I needed.
As I started coding I quickly did something evil again as I kept getting a run-time null exception. Man those are so hard to track down. I went back to see if there was a way to capture every exception and tried both "catch (Exception e)" and an "catch" without any exception. There was something I was missing as one of my asynchronous calls must have gotten me in trouble as I could not track it down. I did learn to that there is an easy way to show the class name in debug statements by using "this.GetType().Name" as that was definitely helpful. One other thing I was a bit concerned about was extending an array as more data became available, but I learned that was no problem as a List can be changed on the fly by either increasing the Capacity or just adding more elements one at a time.
I decided it was time to completely rewrite the complex code I wrote that gets data from a server. The Background Transfer code I wrote was way too complex to debug and was causing too many issues. I went back to the drawing board to learn how to use the HttpClient in a Windows Store app. My code was just so much clearer in the end and actually worked to transfer 24 hours worth of data in 1 hour increments. I was so happy I had to send screenshots to the customer even at the late hour it is.
This post clearly does not cover everything I did as it took me all day long to rewrite my code, so the number of words in this post clearly does not express how much I got done today!
Saturday, December 14, 2013
From concept to reality in 6 weeks - part 20
So here we are at day 20 with only 3 calendar weeks left. Kind of hard to believe that 4 weeks ago today I started on this project. I am definitely over the hump now. The app is actually very stable and makes a good demo just as it is today. But of course I cannot stop today as I need to keep going. I have a couple of things to change this morning related to the latest nightly build from the mapping engine guys. As always the lead mapping engine developer was awake as I started my early day at 5:30am and he wanted to check I had everything before he went to bed. It is a privilege to work with people like him as he does such great quality work. Every day he sends me not only the build but an example app that shows how to use the new features. I will definitely miss working with him daily as it is a breath of fresh air to work with him. It reminds me of the time I worked at SGI as that defunct company was full of the brightest people on the planet. That just proves that because you have transforming technology and the greatest developers anyway, it does not guarantee success. Now every computer and mobile device has an OpenGL supported. Enough of waving eloquently, on to the Windows Store app.
Today was an interesting switch for me. I need to add the latest mapping engine binaries to my project to verify it was working and add some new code to show the selected point on a map. That was pretty easy, but then I got tired of the standard Windows Store MessageDialog as it is a big white bar across my screen. Plus it is modal which means I cannot do anything else while it is up. What I really want is a custom popup dialog that I can tap all over the map and update the contents of the popup as I tap around. If the user close the popup and then taps on the map then I want to re-show the popup dialog. How hard can that be? Apparently I had a good reason is using the MessageDialog as it was the easiest thing to do. Now I get to use this as a test to learn about notifications and bindings.
I need to switch to some more subtle music to get thru this next section so I start listening to Robben Ford & The Blue Line on Spotify.
The first thing I had to figure out was how to style the popup. I want a white background with a blue Close button in the bottom right hand corner. That should be easy. Turns out it is easy to get the layout as I can use the Visual C# Blend editor to help me with the design but then for reusable styles I have to create static resources in a XAML file which means editing XML. I guess I have too many years of doing HTML and CSS as I expect this to be easy. On the web I set a background color, a foreground or text color and then I change the colors for pseudo elements like hover states. Easy as it should be. The first thing I try in the Blend editor is to code complete on the properties to see if I can get the hover styles to work in Blend. It turns out that is a bad NO. I can easily set the background and foreground colors to make it close. I want to explore the existing styles that are available in Windows Store apps as I like the way the MessageDialog text is styled by default. Wait, I wonder if I can just style the existing MessageDialog? It turns out that is the big NO also. There are MSDN social blogs available where I keep looking but it just is not possible. I keep hoping to find something but the more I look the more frustrated I am becoming, so I just give up and realize I must create a custom dialog. Microsoft does not even publish the styles so without knowing the keys to the Microsoft kingdom you cannot enter that gate. I start to look into styles within Blend as I have seen code like this before:
I need to connect my model classes to change the popup dialog contents and to be notified when it closes to do some cleanup. I am expecting this to be complicated. I like the notification manager in iOS but I am no way expect the same in Windows Store apps. The first thing I need to get a handle on is bindings. I have also see them in many examples over the last few weeks, so I need to make sure I understand how they work. I found yet another quick start guide on how bindings work that was useful. I then found the explanation of property notifications which all made sense. So you have a model that sends notifications when a property changes and the view is observing the model and receives the notifications. That all makes sense. Let me try to explore creating custom controls and then hook all of that up using notifications. I found an example on how to create a custom control which was helpful. I move all of the custom popup code to a new user control class. I then try to use my custom dialog in my main page and I get the strangest error:
I just need to call it a day as this was my longest day so far and the long days are going to have to end soon as I am getting run down physically and my whole family is falling sick so I don't want to succumb to that sickness mess.
Today was an interesting switch for me. I need to add the latest mapping engine binaries to my project to verify it was working and add some new code to show the selected point on a map. That was pretty easy, but then I got tired of the standard Windows Store MessageDialog as it is a big white bar across my screen. Plus it is modal which means I cannot do anything else while it is up. What I really want is a custom popup dialog that I can tap all over the map and update the contents of the popup as I tap around. If the user close the popup and then taps on the map then I want to re-show the popup dialog. How hard can that be? Apparently I had a good reason is using the MessageDialog as it was the easiest thing to do. Now I get to use this as a test to learn about notifications and bindings.
I need to switch to some more subtle music to get thru this next section so I start listening to Robben Ford & The Blue Line on Spotify.
The first thing I had to figure out was how to style the popup. I want a white background with a blue Close button in the bottom right hand corner. That should be easy. Turns out it is easy to get the layout as I can use the Visual C# Blend editor to help me with the design but then for reusable styles I have to create static resources in a XAML file which means editing XML. I guess I have too many years of doing HTML and CSS as I expect this to be easy. On the web I set a background color, a foreground or text color and then I change the colors for pseudo elements like hover states. Easy as it should be. The first thing I try in the Blend editor is to code complete on the properties to see if I can get the hover styles to work in Blend. It turns out that is a bad NO. I can easily set the background and foreground colors to make it close. I want to explore the existing styles that are available in Windows Store apps as I like the way the MessageDialog text is styled by default. Wait, I wonder if I can just style the existing MessageDialog? It turns out that is the big NO also. There are MSDN social blogs available where I keep looking but it just is not possible. I keep hoping to find something but the more I look the more frustrated I am becoming, so I just give up and realize I must create a custom dialog. Microsoft does not even publish the styles so without knowing the keys to the Microsoft kingdom you cannot enter that gate. I start to look into styles within Blend as I have seen code like this before:
Style="{ThemeResource BodyTextBlockStyle}"So what do these styles actually look like? Do I have to set them and then run the app to see what it looks like? That is pretty sad, so I go looking for my answer on line and find this interesting site that shows some of the undocumented Metro styles. That helps a little bit but let me see if I can find button styles as I need to find the hover like styles in Metro UI and I find this social blog answer to my stylish problems. Now that is just about as complicated and unobvious as I could imagine. The only good news is that it actually works. The real answer is that you need to start with the existing default styles and modify them as you have to have the correct XML hierarchy or else nothing will work. I did find an article that described how to do this programmatically but I am just not going to go there. This is way more complicated that I need so why would I go all out and really torture myself? Just to be clear Microsoft does document the styles so for a button everything you need to know can be found if you know what to look for as they are called themed resources. This is an example of the complete documentation for TextBox styles and templates. I experiment with transparency which in Windows Store apps is an Opacity property to see if I should make the background for the dialog slight opaque and the answer is no as it does not look good. So I move on. All in all I found success on styling my custom popup and I did learn how to do it correctly but I never expected to wake up this morning and have to go thru all of that mess. Now onto notifications...
I need to connect my model classes to change the popup dialog contents and to be notified when it closes to do some cleanup. I am expecting this to be complicated. I like the notification manager in iOS but I am no way expect the same in Windows Store apps. The first thing I need to get a handle on is bindings. I have also see them in many examples over the last few weeks, so I need to make sure I understand how they work. I found yet another quick start guide on how bindings work that was useful. I then found the explanation of property notifications which all made sense. So you have a model that sends notifications when a property changes and the view is observing the model and receives the notifications. That all makes sense. Let me try to explore creating custom controls and then hook all of that up using notifications. I found an example on how to create a custom control which was helpful. I move all of the custom popup code to a new user control class. I then try to use my custom dialog in my main page and I get the strangest error:
Inconsistent accessibility: return type '...' is less accessible than methodWhat on earth does that mean. I go to the internet for help as it sort of makes sense but I don't know how to solve it. I found an explanation on stack overflow but it just feels odd to make my control public so I can use it in my main class. I quickly contact a co-worker to help me thru this but after a couple more hours of frustration on my lack of understanding, I give in a revert to working without property notifications as I understand the principle but in practice I am not man enough to get it working. I think I am just overly tired and under too much time pressure to think clearly. The last trick to get the easy way to work is that I have to learn how to pass a function as an argument to a method as my callback on when my dialog closes and I found a good explanation on my friend Mr. StackOverflow.
I just need to call it a day as this was my longest day so far and the long days are going to have to end soon as I am getting run down physically and my whole family is falling sick so I don't want to succumb to that sickness mess.
Thursday, December 12, 2013
From concept to reality in 6 weeks - part 19
Well today is a new day. The days of coding are getting longer and the amount of daylight is getting shorter with each passing day as the day with the least amount of daylight is coming soon. It is so cold out to me that it is not very appealing to be outside anyway!
Today I have a new mapping engine that I need to add to my project and then see how many things have been fixed. We were having issues with touch events working but today that has been fixed. That is a great start to a new day. I also added a debug statement handler for the mapping engine so when running in debug I could tell if I caused any errors by incorrect setup on my part. The mapping engine team of two needed that functionality anyway to help debug crashes I was seeing so hopefully it will help us both.
I had yet another victory using LINQ and the more I use it the more I like it. This time I needed an "orderby" and "group" to find unique values. Oh my gosh that was so simple and makes sense at the same time. Now if I just had that in other languages that I use. This list of LINQ grouping examples definitely helped me a lot. Then I wanted to pass the group to a method to do more calculations and I found that I can create a List instead of having to deal with IGrouping by using ToList(). Wow that is so nice.
Next up is a little bit of math and thanks to the iPad app code I learned about this great site that explains in exact details how to determine a bearing. That certainly was easy, except for one thing I need to get the floating point modulus, which does not exist in the Windows Store Math library. Wait, it turns out that the "%" operator already handles that and so there is no need for a special Math library function like in Objective-C - that is the way it should work. I think I am finally getting the hang of this C# stuff. Of course it matters who you hang out with. Spending many hours yesterday with ex-Microsofties helps me know which language is better!
Pretty happy day so far as I finished the last layer on the map so now just need to look into a couple of small bugs and move onto the next tasks of filtering the data being displayed on the map. That is after I get the app working on another Windows 8.1 machine to make sure all of the mapping engine bugs have been fixed that preventing me from getting that far yesterday.
Today I am trying new music by following related to links in Spotify and found Doyle Bramhall again and I am enjoying like while struggling with builds. And then something magical happens as I have the app running on the other tablet. Maybe I should just quit while I am way ahead and it is not even noon yet.
I took a short break to celebrate but helping my daughter with my old Mac laptop as it was acting strangely. It is a 2009 model and still works pretty well for homework and cruising on the internet so it has done a great deal of work over the years. I originally bought it to work on writing my book as I wanted to use Pages and carry it around with me at work and when I went to the library. Overall is looks pretty good and recently my daughter decorated it with a turquoise outer shell and has a thin rubber key cover as well. All it took was a reboot and then holding down Command+S and I checked the hard drive to make sure there were no problems. All was well in the old Mac land.
Now I am back to work as I need to get filtering working. Wait, I cannot start yet as my Windows laptop has a bunch of updates that require a restart. I might as well do that before I get back into the depths of filtering. Just when I thought the work would begin on filtering I re-ran the app and noticed a point off the west coast of Africa, which can only mean one thing. There was a slight problem in that I always need to check to make sure every GPS point I receive is valid. Not that a point off the west Africa is not valid, it just is not valid in my case. I had to do some searching to see if there was anything special I had to do in C# to test a float is close to zero. Turns out the solution would work in pretty much any language.
Had to take a break and do a show-n-tell at work so others could see all of the amazing stuff that is working in the 18+ days so far.
Now I get to learn about notifications, bindings and the event model used in Windows Store apps. There is a couple of articles I need to read to become familiar with it.
At the moment I have to figure out how to take a screenshot on a Windows tablet without a keyboard. This is special hardware I am on so hopefully a generic solution will work. I searched Ms. Google for "windows 8 tablet screenshot" and found an article that described exactly what I need. Thankfully clicking on the Windows button on the front of the tablet and the Volume down button did the trick. It is kind of like the Home button and the Power button on my iPad. The only problem is I have to look to find which button is the Volume down button as the up and down buttons feel just the same. The Power button is right above the Volume up so that is probably not a good button to click on randomly. There is another button below the Power button that I don't even know what it is. I click it and behold it is the Autorotate button, which feels different from the others as it is smaller. The small unreadable label did not help me figure out that one.
I think it is time to call it a day and think about the notifications tomorrow morning when I am fresh from a good night's sleep. I am a morning person and need such tasks that require concentration for the wee morning hours.
Today I have a new mapping engine that I need to add to my project and then see how many things have been fixed. We were having issues with touch events working but today that has been fixed. That is a great start to a new day. I also added a debug statement handler for the mapping engine so when running in debug I could tell if I caused any errors by incorrect setup on my part. The mapping engine team of two needed that functionality anyway to help debug crashes I was seeing so hopefully it will help us both.
I had yet another victory using LINQ and the more I use it the more I like it. This time I needed an "orderby" and "group" to find unique values. Oh my gosh that was so simple and makes sense at the same time. Now if I just had that in other languages that I use. This list of LINQ grouping examples definitely helped me a lot. Then I wanted to pass the group to a method to do more calculations and I found that I can create a List instead of having to deal with IGrouping by using ToList(). Wow that is so nice.
Next up is a little bit of math and thanks to the iPad app code I learned about this great site that explains in exact details how to determine a bearing. That certainly was easy, except for one thing I need to get the floating point modulus, which does not exist in the Windows Store Math library. Wait, it turns out that the "%" operator already handles that and so there is no need for a special Math library function like in Objective-C - that is the way it should work. I think I am finally getting the hang of this C# stuff. Of course it matters who you hang out with. Spending many hours yesterday with ex-Microsofties helps me know which language is better!
Pretty happy day so far as I finished the last layer on the map so now just need to look into a couple of small bugs and move onto the next tasks of filtering the data being displayed on the map. That is after I get the app working on another Windows 8.1 machine to make sure all of the mapping engine bugs have been fixed that preventing me from getting that far yesterday.
Today I am trying new music by following related to links in Spotify and found Doyle Bramhall again and I am enjoying like while struggling with builds. And then something magical happens as I have the app running on the other tablet. Maybe I should just quit while I am way ahead and it is not even noon yet.
I took a short break to celebrate but helping my daughter with my old Mac laptop as it was acting strangely. It is a 2009 model and still works pretty well for homework and cruising on the internet so it has done a great deal of work over the years. I originally bought it to work on writing my book as I wanted to use Pages and carry it around with me at work and when I went to the library. Overall is looks pretty good and recently my daughter decorated it with a turquoise outer shell and has a thin rubber key cover as well. All it took was a reboot and then holding down Command+S and I checked the hard drive to make sure there were no problems. All was well in the old Mac land.
Now I am back to work as I need to get filtering working. Wait, I cannot start yet as my Windows laptop has a bunch of updates that require a restart. I might as well do that before I get back into the depths of filtering. Just when I thought the work would begin on filtering I re-ran the app and noticed a point off the west coast of Africa, which can only mean one thing. There was a slight problem in that I always need to check to make sure every GPS point I receive is valid. Not that a point off the west Africa is not valid, it just is not valid in my case. I had to do some searching to see if there was anything special I had to do in C# to test a float is close to zero. Turns out the solution would work in pretty much any language.
Had to take a break and do a show-n-tell at work so others could see all of the amazing stuff that is working in the 18+ days so far.
Now I get to learn about notifications, bindings and the event model used in Windows Store apps. There is a couple of articles I need to read to become familiar with it.
At the moment I have to figure out how to take a screenshot on a Windows tablet without a keyboard. This is special hardware I am on so hopefully a generic solution will work. I searched Ms. Google for "windows 8 tablet screenshot" and found an article that described exactly what I need. Thankfully clicking on the Windows button on the front of the tablet and the Volume down button did the trick. It is kind of like the Home button and the Power button on my iPad. The only problem is I have to look to find which button is the Volume down button as the up and down buttons feel just the same. The Power button is right above the Volume up so that is probably not a good button to click on randomly. There is another button below the Power button that I don't even know what it is. I click it and behold it is the Autorotate button, which feels different from the others as it is smaller. The small unreadable label did not help me figure out that one.
I think it is time to call it a day and think about the notifications tomorrow morning when I am fresh from a good night's sleep. I am a morning person and need such tasks that require concentration for the wee morning hours.
From concept to reality in 6 weeks - part 18
In two more days it will be one more week gone and that will leave me with only 3 weeks to go. No pressure! After a very long day yesterday, I definitely needed a night to rest and just not think about the Windows Store app. I woke up this morning ready for a new day. It was super frosty outside and I was just glad I did not have to go outside. Definitely zero interesting in running when it is this cold out.
The first thing is to solve the problems I had with one of the layers not displaying the correct colors. I had to go into the code that was defining the values and put in a "System.Diagnostics.Debug.WriteLine" to see what the values were. After seeing the output it was obvious what happened as I had two problems. The first was I saw a bunch of "-Infinity" values. I handled the case with missing values in my data loader but forgot I need to ignore those values when displaying data. The second problem was that all of the values were fractional and yet I stored color values in the range from 1-10. A quick scale factor solved that problem.
Then a couple more fixes and one last test proved that something had gone seriously wrong. I am now getting a run-time exception as the mapping engine does not like something I am passing to it. I try to use the Git client to see what I changed that was not good. I did not find it so it is time to debug until I find the problem.
I had a GoToMeeting with the customer, who was a no show, but I needed to document some of the potential UI needed for the next piece, so I added screenshots of the iPad app into Kanbanery along with some text explaining what I need to do. One of my favorite characters is the checkmark which is needed for the text description of the next few tasks, where I needed to show checkboxes [✓].
Now I have to hurry up and find this run-time error somewhere in my code. First I need to check on updating the UI from a background thread since I want to make sure that is not my problem. Microsoft has some nice documentation on asynchronous programming that explained many useful things. I don't see anything I am doing wrong so time to dig in a debug until I find and fix the problem. Some times you just have to relax, take a deep breath and then dive in.
I have to say that finding run time exceptions is just nasty in any language. I finally found and fixed the problem as I was calling an asynchronous method and when it returned I had assumed it fully completed - what a terribly bad idea that was. I looked back at the Git source history to see all of the changes I made this morning and then noticed the "async" change. I got into the debugger and checked the values after the method returned and found nothing was setup correctly. Bingo, found that nasty bug and now I get to move onto the making another build to test on another machine that mine.
Since I have only create one successful release build, I had to go remind myself how to do that by reading the documentation. The big secret is to select Store > Create App Packages... and then select "No" that I don't want to put the app in the store. My executable is now 10MB in size and that is after I removed BingMaps which made no difference at all in the size of the executable. Hopefully someone other than me will be able to get that to work correctly in Windows 8.
Turns out that it worked sort of. I was able to load the executable on a USB thumb drive and install it on another Windows 8.1 tablet but the way VSE creates a package installer is a bit odd. You have to be the administrator of the computer in order to use PowerShell. I found a Microsoft article that described the ticket to PowerShell working as you have to set the execution policy as in a PowerShell window:
Most of the remaining part of the day is trying to get work done in a very crowded Starbucks. I was meeting the mapping engine developers there. Typically they told me it was empty, but when I arrived there was not a single seat available at 2pm. I was constantly getting a dropped WiFi connection, which I assume was due to so many people trying to get WiFi and since I did not use it constantly I was being dropped. I finally gave up and just used the WiFi from my iPhone as it was the only reliable WiFi. Then it started having issues.
It was time to figure out how to get the app working by reading the files I downloaded from the server as that was my intent all along but did not take the time to get that working. For some reason the super crowds in the Starbucks must have caused my brain to stop working as I had to read about File IO again. The quick start guide to reading and writing files in a Windows Store app to the rescue. Everything hinges on a StorageFolder and a StorageFile. Finally after an hour I had the JSON being read from the last files I downloaded that worked. Not bad but it should have been a couple of minutes since I had already dealt with it, but so much time and code had passed thru my mind since then I guess.
The rest of my day was learning all of the new mapping engine APIs that I needed to call and making notes in Kanbanery so I did not forget how to do them when tomorrow morning arrives early. I also had to deploy many times and try to get the app running on a couple of other Windows 8.1 machines to verify the whole deployment would work easily.
Since I have only create one successful release build, I had to go remind myself how to do that by reading the documentation. The big secret is to select Store > Create App Packages... and then select "No" that I don't want to put the app in the store. My executable is now 10MB in size and that is after I removed BingMaps which made no difference at all in the size of the executable. Hopefully someone other than me will be able to get that to work correctly in Windows 8.
Turns out that it worked sort of. I was able to load the executable on a USB thumb drive and install it on another Windows 8.1 tablet but the way VSE creates a package installer is a bit odd. You have to be the administrator of the computer in order to use PowerShell. I found a Microsoft article that described the ticket to PowerShell working as you have to set the execution policy as in a PowerShell window:
This allows the command to be run to install the executable in the Metro desktop by running:Set-ExecutionPolicy RemoteSigned
./Add-AppDevPackage.ps1Of course most fonts make it very hard to know whether that is a numeric one or lowercase "L" as the last character in the file extension, but that is another usability problem for another day.
Most of the remaining part of the day is trying to get work done in a very crowded Starbucks. I was meeting the mapping engine developers there. Typically they told me it was empty, but when I arrived there was not a single seat available at 2pm. I was constantly getting a dropped WiFi connection, which I assume was due to so many people trying to get WiFi and since I did not use it constantly I was being dropped. I finally gave up and just used the WiFi from my iPhone as it was the only reliable WiFi. Then it started having issues.
It was time to figure out how to get the app working by reading the files I downloaded from the server as that was my intent all along but did not take the time to get that working. For some reason the super crowds in the Starbucks must have caused my brain to stop working as I had to read about File IO again. The quick start guide to reading and writing files in a Windows Store app to the rescue. Everything hinges on a StorageFolder and a StorageFile. Finally after an hour I had the JSON being read from the last files I downloaded that worked. Not bad but it should have been a couple of minutes since I had already dealt with it, but so much time and code had passed thru my mind since then I guess.
The rest of my day was learning all of the new mapping engine APIs that I needed to call and making notes in Kanbanery so I did not forget how to do them when tomorrow morning arrives early. I also had to deploy many times and try to get the app running on a couple of other Windows 8.1 machines to verify the whole deployment would work easily.
Tuesday, December 10, 2013
From concept to reality in 6 weeks - part 17
Today we start yet another day but for me it is all down hill from here on out. Today's big challenge is to make another build and see if my customer can install it without it prompting for my developer account. I also need to explorer ways of installing a Windows Store app outside the store to make sure the Microsoft documented way is the only way to get it to work. I also need to get layer filtering to work with the latest mapping engine build. On this very raining cold day I am expected to get a lot done. In general I need to hurry up as I have a week until the next full moon day and we all know what happens on those days. Before jumping into it, I have been re-listening to the music of Roy Buchanan while working this week. Yet another unknown talented guitar player who met his early demise. It just seems like the most creating people always have the biggest problems and Roy Buchanan killed himself in jail many years ago after yet another drunken state. So sad for me to read this again.
I started the morning by double checking all of the anchor points for the images I created yesterday to make sure it was exactly the same for each one. That was a bit time consuming. I then had to create white versions of each icon as that is what the mapping engine requires to color the values by height. It was time again to learn a bit about ImageMagick and how to do this in an automated fashion. This required using a trick where you pass an opaque color and the fill color. I preferred to ignore all pixels except the transparent color to do the fill that way:
I wish there was more to write about today but it was just a tons of coding and debugging. Nothing new or exciting to write about. All in all a good day as I got most of what I wanted done. I did not get time to look into how to deploy the app outside the Windows Store as that will have to wait until tomorrow.
I started the morning by double checking all of the anchor points for the images I created yesterday to make sure it was exactly the same for each one. That was a bit time consuming. I then had to create white versions of each icon as that is what the mapping engine requires to color the values by height. It was time again to learn a bit about ImageMagick and how to do this in an automated fashion. This required using a trick where you pass an opaque color and the fill color. I preferred to ignore all pixels except the transparent color to do the fill that way:
I learned this trick by going to one of the great tutorials that explains how to use ImageMagick for this purpose called Color Basics.convert +opaque transparent -fill 'rgba(255,255,255,255)' A.png A_white.png
I wish there was more to write about today but it was just a tons of coding and debugging. Nothing new or exciting to write about. All in all a good day as I got most of what I wanted done. I did not get time to look into how to deploy the app outside the Windows Store as that will have to wait until tomorrow.
Monday, December 9, 2013
From concept to reality in 6 weeks - part 16
Today is thankfully a new day as I just want to completely forget everything that happened this weekend as it was all just a bad dream, or at least that is what I want to tell myself. It was all personal problems with my family that is just getting worse with every passing day. That is the challenge of balancing family and work life. No client of mine pays me to moan and groan about my personal and family issues. They are paying me for super first class high quality results. Part of experience of getting old is to be able to separate family and work and put 100% effort into work every when things are going terribly at home. I really learned this two jobs ago when my best friend was dying of cancer in front of me daily at work. He definitely rose above his circumstances and did his absolute best even when feeling horrible from chemotherapy or radiation. He was a trooper until the end and I have to remember those 3 years for the rest of my life.
Now it is time to refocus on the task at hand as I am half way thru the project. Elapsed time wise I have 4 calendar weeks left to go. I realize that does not mean I have 20 days as I want to spend time with my family during Christmas and New Year's Day. Today my task is to finish off the final layer and resolve the layer icon issues so they all look correct by color and size. Before I start on that I need to check the label changes I made and learn about latitude for the millionth time it seems. I quickly go to Wikipedia so I can see a visual picture in my head so maybe just maybe I will remember this time that longitudes or meridians go thru the poles and latitudes are parallel to the equator. I change my debug statements to show the extend of the markers for N/S latitudes and E/W longitudes. I then need to fix my labels to show altitudes as whole numbers as I see decimal points being displayed, so I switch back over to the C# number formatting documentation asI have been there before. The secret was to use "N0" to show a number with no values after the decimal point. Two problems resolved just like that.
Now to solve the markers. I have decided to automate this whole process by using ImageMagick convert program since I don't want to edit the SVG files and generate PNGs each manually as that is too time consuming. I had to regenerate the triangle in Inkscape so I had to look that up as it is not obvious how to do that. The first thing is how to set the transparent pixel which is done with -transparent option. The second thing is how to account for the case when the background color is not an exact single color and that is fixed by using the -fuzz option. Then I need a way to change the default foreground pixel color as it needs to change for each marker depending on elevation and that is done with the -fill option. Now I just need to figure out the colors that match each of the icons and I am done. ImageMagick definitely helps me here as it supports many color syntax values. I have RGBA values stored in C# so I am going to use those values in my Bash script that will auto-image-magickally do every thing for me. As an aside, this has to be one of the worst names in all of UNIX, the shebang marker at the top of the UNIX shell script which I add to my script. I always run it with the time command so I know how long it takes to run:
The whole rest of the day was fixing, changing, editing and resizing icons to make sure they look really good as they are essential to the app. Gimp and Inkscape were my constant companions all day long. It took way too long to fix all of the images it had to be done either programatically or manually. I am just glad that it all looks good and I can call it a day.
Now it is time to refocus on the task at hand as I am half way thru the project. Elapsed time wise I have 4 calendar weeks left to go. I realize that does not mean I have 20 days as I want to spend time with my family during Christmas and New Year's Day. Today my task is to finish off the final layer and resolve the layer icon issues so they all look correct by color and size. Before I start on that I need to check the label changes I made and learn about latitude for the millionth time it seems. I quickly go to Wikipedia so I can see a visual picture in my head so maybe just maybe I will remember this time that longitudes or meridians go thru the poles and latitudes are parallel to the equator. I change my debug statements to show the extend of the markers for N/S latitudes and E/W longitudes. I then need to fix my labels to show altitudes as whole numbers as I see decimal points being displayed, so I switch back over to the C# number formatting documentation asI have been there before. The secret was to use "N0" to show a number with no values after the decimal point. Two problems resolved just like that.
Now to solve the markers. I have decided to automate this whole process by using ImageMagick convert program since I don't want to edit the SVG files and generate PNGs each manually as that is too time consuming. I had to regenerate the triangle in Inkscape so I had to look that up as it is not obvious how to do that. The first thing is how to set the transparent pixel which is done with -transparent option. The second thing is how to account for the case when the background color is not an exact single color and that is fixed by using the -fuzz option. Then I need a way to change the default foreground pixel color as it needs to change for each marker depending on elevation and that is done with the -fill option. Now I just need to figure out the colors that match each of the icons and I am done. ImageMagick definitely helps me here as it supports many color syntax values. I have RGBA values stored in C# so I am going to use those values in my Bash script that will auto-image-magickally do every thing for me. As an aside, this has to be one of the worst names in all of UNIX, the shebang marker at the top of the UNIX shell script which I add to my script. I always run it with the time command so I know how long it takes to run:
This is what my script looks like in general:$ time ./convert.shreal 0m1.388suser 0m0.443ssys 0m0.278s
The last thing I had to do in my script was copy each output PNG file into the Windows Store project Assets folder so I can easily add them into the VSE project on my Windows laptop. I am still not happy with the icons as I need to find a way to use vector icons as generating the PNG files just don't look good at all. The functionality is working, but it looks bad, so I need to address that somehow.convert -fill 'rgba(181,13,33,235)' -fuzz 20% -transparent white A.svg A.png
The whole rest of the day was fixing, changing, editing and resizing icons to make sure they look really good as they are essential to the app. Gimp and Inkscape were my constant companions all day long. It took way too long to fix all of the images it had to be done either programatically or manually. I am just glad that it all looks good and I can call it a day.
Saturday, December 7, 2013
From concept to reality in 6 weeks - part 15+
With my customer visit yesterday I did not have time to record my thoughts all day long. This means I get to try to remember every thing that happened yesterday and this morning. I woke up early this morning so that should be pretty easy to recall.
The first task I completely failed on yesterday was switching from Kanbanery to Trello for the Kanban project management board. It is just so hard to switch tools like that in the middle of a project. I would need to export all of the tasks from Kanbanery and import then into Trello. That is just not going to happen easily as I have almost 50 tasks in 4 different columns. Something is going to get lost and I don't have time to fix stuff like that.
Part of this story is going to be easy as I can look at the Git log and see what I did yesterday! The big news for yesterday is that I got a new build for the mapping engine and was able to get it all working and showing 3 out of the 4 layers. I definitely like it when things just work. I tried a couple of times to get the images working and then just gave up and colorized the ones I needed to a fixed color. I looked at the iPad app Objective-C code to find the colors and the layer settings since we are using the same mapping engine. That exercise just reminded me how verbose and challenging Objective-C is to write an enterprise application. The code just hurts my head and is painful to read and to follow the flow of what is going on. On the other hand C# is very much like Java or ActionScript where you need to understand the framework, threads and events and you are done.
A couple of new challenges occurred yesterday. The first one was I had to learn how to split strings but that was very easy by reading the documentation. Then I needed to figure out how to create a new LINQ query with multiple where clauses. Back to the documentation and within minutes I yet again fell in love with LINQ. As I was adding this new LINQ statement, I was chatting with the mapping engine developer and he told me he worked on LINQ while at Microsoft. I quickly told him, he was now in the circle of trust as my favorite Microsoft developer. I have only met a handful of Microsofties but I have never lived in that part of the country either. Doesn't matter as still anyone involved with LINQ is near the top of useful people.
Another lesson while changing to use the new mapping engine API, was to learn how to read a file from the file system using Windows.ApplicationModel.Package.Current.InstalledLocation. That is interesting since working on web sites for so long you just forget that you can actually read and write files!
Everything considered, yesterday was a huge success so it was a very happy day. I was able to take a break and play tennis also since it was a nice spring day in the middle of December.
The hardest thing all day this morning was fixing images. I still do not have them working as I would like but I quickly made PNG files so I could verify my layers were displaying properly for the data values. I find that the easiest thing to do is use Gimp or Inkscape on my Mac, check the files in and then go to Windows and use Git to retrieve the files and then add them to my project. So much easier than waiting for SkyDrive which is not the speediest tool in the shed.
The first task I completely failed on yesterday was switching from Kanbanery to Trello for the Kanban project management board. It is just so hard to switch tools like that in the middle of a project. I would need to export all of the tasks from Kanbanery and import then into Trello. That is just not going to happen easily as I have almost 50 tasks in 4 different columns. Something is going to get lost and I don't have time to fix stuff like that.
Part of this story is going to be easy as I can look at the Git log and see what I did yesterday! The big news for yesterday is that I got a new build for the mapping engine and was able to get it all working and showing 3 out of the 4 layers. I definitely like it when things just work. I tried a couple of times to get the images working and then just gave up and colorized the ones I needed to a fixed color. I looked at the iPad app Objective-C code to find the colors and the layer settings since we are using the same mapping engine. That exercise just reminded me how verbose and challenging Objective-C is to write an enterprise application. The code just hurts my head and is painful to read and to follow the flow of what is going on. On the other hand C# is very much like Java or ActionScript where you need to understand the framework, threads and events and you are done.
A couple of new challenges occurred yesterday. The first one was I had to learn how to split strings but that was very easy by reading the documentation. Then I needed to figure out how to create a new LINQ query with multiple where clauses. Back to the documentation and within minutes I yet again fell in love with LINQ. As I was adding this new LINQ statement, I was chatting with the mapping engine developer and he told me he worked on LINQ while at Microsoft. I quickly told him, he was now in the circle of trust as my favorite Microsoft developer. I have only met a handful of Microsofties but I have never lived in that part of the country either. Doesn't matter as still anyone involved with LINQ is near the top of useful people.
Another lesson while changing to use the new mapping engine API, was to learn how to read a file from the file system using Windows.ApplicationModel.Package.Current.InstalledLocation. That is interesting since working on web sites for so long you just forget that you can actually read and write files!
Everything considered, yesterday was a huge success so it was a very happy day. I was able to take a break and play tennis also since it was a nice spring day in the middle of December.
The hardest thing all day this morning was fixing images. I still do not have them working as I would like but I quickly made PNG files so I could verify my layers were displaying properly for the data values. I find that the easiest thing to do is use Gimp or Inkscape on my Mac, check the files in and then go to Windows and use Git to retrieve the files and then add them to my project. So much easier than waiting for SkyDrive which is not the speediest tool in the shed.
Thursday, December 5, 2013
From concept to reality in 6 weeks - part 14
Whoever came up with the idea that 13 is an unlucky number? What does luck have to do with anything? I just don't believe in luck has to do with anything. I used to avoid even saying the word. All I know is that yesterday was the 13th day on this Windows 8 app and it was my most productive day so far!
Today is the big day when I switch from using Bing Maps to a different 3rd party mapping engine. I received new DLLs yesterday for the mapping engine but ran out of time to try it out in my app. I did try it out late last night to make sure the sample project I was given definitely works. This morning when I woke up early I found a newer version waiting for me, including a new vector map that is much better than the one we used in the iPad app. There is a lot more working today than yesterday and I was told that I would receive new builds each morning. The lead developer basically works all night long and I work all day long, so we have 24 hour coverage on this app.
I looked at the mapping engine example code and know exactly what I need to do. The one big exception is I must figure out how to add dynamic images which I create from a my icomoon custom font that contains the map marker symbols. I ran out of time yesterday to get that working on Bing Maps. The code I wrote will work in both cases, so that is where I will begin this morning.
But first now that I have two different maps, it is time to learn how to use C# interfaces. I want a single interface implemented in two different ways. I would also like to store some static properties in the interface that are constants I need in all implementations. To the documentation I go and I find a good explanation of how interfaces work in C#. I also find that C# supports properties in interfaces so that is all I need to begin. Turns out that you cannot have properties in an interface after all. Not exactly what I meant by static properties across all implementations so that is not going to work for me.
Now I am back on the task of figuring out how to create a dynamic image bitmap. The problem is that this is very easy in Windows desktop apps as I have done this before many years ago and I find articles explaining how to do create dynamic images but it does not work in Windows Store apps. I also cannot use the Bitmap class directly as it is not supported either. Bummer. Basically I cannot use anything in System.Windows.Media.Imaging as Windows Store app can only use Windows.UI.Xaml.Media.Imaging. The good news is that I learned that lesson already, so now all I need to do it figure out how to do what I want. In the correct package I see something promising called WriteableBitmap class. It appears that this is a very common question and the only solution I have found so far is to use DirectX, which just seems so wrong. I am giving up and creating images that I can then transform to whatever color I want as I just have not found any solution to my problem.
The big decision today was to go ahead and purchase the Hobbyist license of Telerik XAML Windows 8 controls since I can use that for the range slider without writing one from scratch.
I was able to get some of the data displaying on the mapping engine. I have been struggling all day trying to get images to display correctly on the map and now I am getting a very odd runtime exception that I do not know where it is coming from. That all will have to wait until tomorrow as it is time to go running for the 4th day in a row as I seriously need a break right now.
Today is the big day when I switch from using Bing Maps to a different 3rd party mapping engine. I received new DLLs yesterday for the mapping engine but ran out of time to try it out in my app. I did try it out late last night to make sure the sample project I was given definitely works. This morning when I woke up early I found a newer version waiting for me, including a new vector map that is much better than the one we used in the iPad app. There is a lot more working today than yesterday and I was told that I would receive new builds each morning. The lead developer basically works all night long and I work all day long, so we have 24 hour coverage on this app.
I looked at the mapping engine example code and know exactly what I need to do. The one big exception is I must figure out how to add dynamic images which I create from a my icomoon custom font that contains the map marker symbols. I ran out of time yesterday to get that working on Bing Maps. The code I wrote will work in both cases, so that is where I will begin this morning.
But first now that I have two different maps, it is time to learn how to use C# interfaces. I want a single interface implemented in two different ways. I would also like to store some static properties in the interface that are constants I need in all implementations. To the documentation I go and I find a good explanation of how interfaces work in C#. I also find that C# supports properties in interfaces so that is all I need to begin. Turns out that you cannot have properties in an interface after all. Not exactly what I meant by static properties across all implementations so that is not going to work for me.
Now I am back on the task of figuring out how to create a dynamic image bitmap. The problem is that this is very easy in Windows desktop apps as I have done this before many years ago and I find articles explaining how to do create dynamic images but it does not work in Windows Store apps. I also cannot use the Bitmap class directly as it is not supported either. Bummer. Basically I cannot use anything in System.Windows.Media.Imaging as Windows Store app can only use Windows.UI.Xaml.Media.Imaging. The good news is that I learned that lesson already, so now all I need to do it figure out how to do what I want. In the correct package I see something promising called WriteableBitmap class. It appears that this is a very common question and the only solution I have found so far is to use DirectX, which just seems so wrong. I am giving up and creating images that I can then transform to whatever color I want as I just have not found any solution to my problem.
The big decision today was to go ahead and purchase the Hobbyist license of Telerik XAML Windows 8 controls since I can use that for the range slider without writing one from scratch.
I was able to get some of the data displaying on the mapping engine. I have been struggling all day trying to get images to display correctly on the map and now I am getting a very odd runtime exception that I do not know where it is coming from. That all will have to wait until tomorrow as it is time to go running for the 4th day in a row as I seriously need a break right now.
Wednesday, December 4, 2013
From concept to reality in 6 weeks - part 13
Today is a brand new day and several things are planned for the day. I need to create some new SVG symbols for my map markers and then added them to my custom font. I then need to get the rest of the data to display on the map with dynamic colors per each marker. I then need to load the latest build for the mapping engine and see if I can get the markers to display on it. I then need to look into buying a 3rd party set of controls from Telerik since they have a dual range slider that may just work out of the box. I downloaded the RadControls demo trial on my Windows laptop and it looks like it will work. I also like their date picker as it looks good and is very similar to the Apple iOS7 date selector.
First thing up is to get the rest of the map markers displaying in different colors. It was easy to put the markers on another layer on the Bing Map. It was a bit of work to get the push pins to be different colors depending on the elevation. I have not gotten custom images on the map yet as that will be my first chore for tomorrow morning. I have my font ready to go but ran out of time to use it. I really want to use the FontIcon class but really wonder if the Bing Map will allow it as a child of a map layer. I may have to use one of the Windows.Graphics.Imaging classes instead and learn how to draw into a bitmap from a font symbol, now that does not really sound like fun.
I also had to learn about formatting doubles since I needed to show some details when a map marker was tapped, but I wanted to show numbers in a reasonable format like "12,345" with the thousands separator. I had to look in two places as the Double.ToString method was a great start and then I found this beauty that lists all of the Standard Numeric Format options. That gave me everything I ever wanted to know about formatting in Windows apps.
Next up is learning how to use LINQ to build dynamic queries in-line as I wanted to show some statistics on the data that was loaded. Before I could use them I had to convert my old school Array code to use a List Generic. Then I directed by a co-worker to the LINQ cheat sheet that just made my day. I was then able to find the count of a couple of properties and the date range of the data that was loaded very easily in just a couple of simple and readable statements.
I did not write down much today but I was so excited when I had all of the data showing up on a Bing Map that I forgot to record what I was doing. The above links definitely describe all of the fun I had today.
Tuesday, December 3, 2013
From concept to reality in 6 weeks - part 12
I had to take a break yesterday afternoon to catch up on my physical exercise and then had to help my daughter with her senior class project on Hamlet. I know there are many people who love Shakespeare, but I am not one of them as it is absolute torture to read his stuff. It is not the content because that is absolutely amazing but it is a language issue. It might appear to be English but it is not what I speak or read. The only way I could help her was to use the Sparknotes version that shows the original old English on the left and the what they heck it means in today's real English. This is kind of what I have been dealing with so far in the first 12 days as Windows 8 might appear to be a computer platform but it has changed so much that I need Sparknotes to help me out and the equivalent would be the Microsoft Developer Network (MSDN) documentation.
Today I had to send an email to the mapping engine man on a couple of issues I found around Victoria Island at the Canada - USA border above Washington State. Now I am back to finishing off the JSON processing and today I am going to get the some data showing up on a Bing Map as I am not going to sleep until I do!
I think I am finally getting the hang of this. I can find the C# class or XAML documentation I need. Most of the time I can write the C# code I need to handle strings or doubles or JSON without looking up what I need. One thing I have not tried is to locate the documentation within VSE itself as I normally use Safari on my Mac. I also use my Mac in case I find something interest so I can save it in this blog easily. Yesterday I had to go back to my blog posts three times looking for information that I knew I had encountered previously but could not recall where I found it. It may take extra time to blog but it helping me as I am a Windows 8 team of one.
I am getting the hang of this - I have all of the JSON being parsed and it is only 9 am. Sounds like it is going to be geographic mapping for the rest of the day. These were very useful in setting default empty values for doubles and dates to differentiate between empty and valid values. It took me 2 more hours to validating that I was processing all of the data correctly. The way I finished this that was to read the JSON data asynchronously, processing the data and store into DAO objects and then implement a ToString method that takes the DAO objects and output JSON. The beauty of this method is that I have the whole round trip tested manually at least. Now I am 100% confident that adding the data to a Bing Map will work as everything is GPS coordinates. It is time to re-login into the Bing Maps Portal to learn about the API...
At 1pm in the afternoon I saw my push pins on a Bing Map. There are several keys to success. The first thing is figuring out what classes exist in a Windows Store app. If the class is not listed on under the Windows API reference for Windows Store apps, then forget about it as it will not exist or work. The default markers were light blue with a double thick border with text that was nor readable in the markers. The real ticket was learning how to create Bing MapLayer and then place a bunch of Bing Map Pushpins on the layer. The real beauty of the documentation is that is shows how to add a tap event to the push pin to show more information which is exactly what I need to do. Now I know exactly how to put all of the data on a map as I will create a second layer tomorrow for the rest of the data.
I am going to call it a day and attempt to exercise for two days in a row.
Today I had to send an email to the mapping engine man on a couple of issues I found around Victoria Island at the Canada - USA border above Washington State. Now I am back to finishing off the JSON processing and today I am going to get the some data showing up on a Bing Map as I am not going to sleep until I do!
I think I am finally getting the hang of this. I can find the C# class or XAML documentation I need. Most of the time I can write the C# code I need to handle strings or doubles or JSON without looking up what I need. One thing I have not tried is to locate the documentation within VSE itself as I normally use Safari on my Mac. I also use my Mac in case I find something interest so I can save it in this blog easily. Yesterday I had to go back to my blog posts three times looking for information that I knew I had encountered previously but could not recall where I found it. It may take extra time to blog but it helping me as I am a Windows 8 team of one.
I am getting the hang of this - I have all of the JSON being parsed and it is only 9 am. Sounds like it is going to be geographic mapping for the rest of the day. These were very useful in setting default empty values for doubles and dates to differentiate between empty and valid values. It took me 2 more hours to validating that I was processing all of the data correctly. The way I finished this that was to read the JSON data asynchronously, processing the data and store into DAO objects and then implement a ToString method that takes the DAO objects and output JSON. The beauty of this method is that I have the whole round trip tested manually at least. Now I am 100% confident that adding the data to a Bing Map will work as everything is GPS coordinates. It is time to re-login into the Bing Maps Portal to learn about the API...
At 1pm in the afternoon I saw my push pins on a Bing Map. There are several keys to success. The first thing is figuring out what classes exist in a Windows Store app. If the class is not listed on under the Windows API reference for Windows Store apps, then forget about it as it will not exist or work. The default markers were light blue with a double thick border with text that was nor readable in the markers. The real ticket was learning how to create Bing MapLayer and then place a bunch of Bing Map Pushpins on the layer. The real beauty of the documentation is that is shows how to add a tap event to the push pin to show more information which is exactly what I need to do. Now I know exactly how to put all of the data on a map as I will create a second layer tomorrow for the rest of the data.
I am going to call it a day and attempt to exercise for two days in a row.
Subscribe to:
Posts (Atom)