Wednesday, October 23, 2013

Mavericks, Java, Android Studio, GIT

I installed Mavericks today on my MacBook Pro. The install went fine but it stop me cold for developing on my Android project. Sweet Apple revenge? Not really, they just don't install the developer tools you need by default. I wish the update would look at what you had and update to match but it does not. I did an update of the OS, not a clean install.

Some are getting prompted to install the Apple version of Java 6. I did not get prompted to do so the first time I tried to start up Android Studio. It just did nothing, no bouncing icon and no error message. Highly annoying and not user friendly.

Apple link to Java 6 that works on Mavericks http://support.apple.com/kb/DL1572

With that installed I was able to fire up Android Studio but it could not find GIT. I shut it down.

I was waiting on the install of Xcode to finish. Once that was done I fired up Xcode and it decided to grab the developer command line tools. Now GIT is installed and ready to go.

I appear to be back up and running as far as my Android and iOS development goes.

Outlook is acting weird. It decided to sort of dock itself and moving it just popped back into place when I tried to move it. I then tried Window -> Minimize and restore but that did not help so I did Window -> Zoom and then Outlook did some odd animation witch under a house shrinking up into the corner. I did command Q to quit and restart. It came up with half an email message scrolled off the screen. Doing View -> Navigation Pane seemed to get it back in order for now. It is painting weird in that you can only see half the "Today"header of the email headers.

Macports is not working. First it could not find GNUTAR so I did the following:

sudo ln -s /usr/bin/tar /usr/bin/gnutar

Which let it update and start the update of apps but now it has new issues. They plan and releasing an update soon so I am going to wait on that.

What I really want fixed is the crappy multiple monitor support of Mountain Lion. I really hope Mavericks makes that better. So far it has been a real time killer to get things up and running as a developer though.

I really miss Xtrafinder too. I know Apple added tabs but the other huge feature to me is the ability to sort directories to the top of the listing always. I understand if you don't like that but give us a freaking setting Apple! I don't want to scroll all over to find a stupid directory intermixed with my files. I am sure there are plans to update that too.

Thursday, October 10, 2013

Hey technology stop bothering me!

I love technology, it is how I earn a living but there are times when the magic turns into an annoyance. Let's take Amazon for example. I don't order a lot from them but I do order a couple of times a year and it has kept me out of the mall at christmas. There are times I am just researching something that I buy local, like our new microwave, and there are times I am looking up products for someone else.

To Amazon this means old Kevin is about to buy product X. We need to hound him about it until he buys it from us. To some folks this might look like magic. How did Amazon know I was thinking about getting a new camera? They just sent me a list of sales, that is awesome. Yes, I bought a zoom lens from Amazon for my camera. That is the only camera related thing I wanted to buy but to them I need to be an impulse buyer and get more and more crap. I want a setting to shut that off.

At least camera equipment fits in the all age range. One year my youngest son was into Go Diego Go so I ordered a few items related to that for christmas. I still get emails from Amazon about Go Diego Go. That ship has long sailed for him. No longer age appropriate. Don't know if they have an age out flag or not.

I have also researched things for other people while there were at my house. Things I am not interesting in ordering for myself. This included looking prices up for the Kindle. Yes, I am an Android programmer but I would stick with a stock Android tablet. The Kindle was the right thing for this person though so I was simply helping out. Now I get Kindle based information in my email.

Companies can only guess at what you want. There is no magic here. I have been able to kill some of the email from Amazon. They stopped sending me stuff about shoes because I could disable that category. I am pretty sure this happened from me ordering house slippers one year. The categories they manage are too broad. I don't want to shut off all electronics to stop Kindle emails.

I guess I could stop all the emails. Silly me thinks one day I will get some super sale email that is the deal of the century and who wants to miss that? Right now they go straight to the trash. Well, not straight there, I usually peek at the contents of the email and trace back to what I might have researched for them to bother me this time. Yes, I am analyzing Amazons analysis of me. Let's just file that under vicious circle for now.

Wednesday, October 9, 2013

Initial thoughts on iRadio - not overly impressed

I have a Mac at work that I use for both iOS and Android development. I installed the latest iTunes to go along with the latest Xcode and it popped up a reminder about iRadio so I figured I would give it a shot. I have used Pandora in the past and have ripped a good number of my personal CD collection to various formats to listen to on my PC / phone / etc.

As an old school hair metal band lover, which greatly explains my tin ear, I chose Kiss as a radio station. It played the first song from them then played the exact same song again and tried to play it again. I finally got it to skip forward to a new song. So far this has been a one time glitch.

I have used iTunes to listen to a shuffled version of ripped collection at work. It appears iRadio has the same issue that iTunes does which is terrible shuffle logic. Same song can appear twice in a row or with only a few songs between it. You may hear a couple of songs off the same album in a row. Ugly.

I use MediaMonkey on my PC at home and don't have this issue with shuffling. It appears to remember what it played and what album it came off of giving me what I consider a proper shuffle. Apple just does not appear to care as this has been an issue with them forever. They went random song selection without other context around it.

So far every song but one I have heard I also have in my music collection. Which is good in one way, I like them, but bad in that I am not getting exposed to anything else. When I used Pandora it found bands I was unaware of - Iced Earth being one of them - and I bought CDs from that band. I find Pandora's discovery system to be superior. This may be catalog related, I don't know what Apple has to choose from and I am well aware new hair metal is hard to come by.

I was happy to see you are allowed to pick explicit lyrics. I really want to hear the original version of the song, not a censored version. So far only one song has played with obvious explicit lyrics from the land of Ted Nugent.

Ads are short and don't appear too often but I have only heard 4 different ones. I have been told about Neil Diamond and the Nissan Versa way too many times already.

iRadio played "She's only 17" from Winger and had no clue what it was. No album art, no song title or artist. It just showed "Kiss Radio". Heck of a way to sell songs. It has done it twice with that song, there were only two songs in between the plays, stupid shuffle logic.

It got stuck trying to stream a song. I had to hit next song and it played an ad then the next song. So far most of the time I skip forward it decides it is time to play an ad before giving me a new song selection.

You can't go backwards. If you really liked a song and wanted to hear it again you are screwed. You can pause, play and skip. Can't even rewind the song you are on. This is a not an optimal user experience to me.

Underwhelmed at this point. Sound quality is good. No skips or stutters while the music is playing. The internet connection I am on is speedy so that is to be expected. Some glitches but none of them are total show stoppers, just annoyances. Apple has some work to do here.

Friday, September 27, 2013

Finally I get to do a tablet only app

We have a dashboard style web page used by our clients. I recently converted the charting side of that from flot to HighCharts. HighCharts gives much nicer looking charts by a long shot and the price was reasonable. All of that work was in JavaScript which I must say I don't miss and am very happy to get back into the mobile side of things.

JavaScript is just barely acceptable on an iPad or Android Tablet. Yes, I tweaked various UI aspects to make them more touch friendly but if we want to be able to look a client in the eye and tell them we have a dashboard that works on their tablet we need to go true native mobile.

All the code I have done in the past has been universal phone and tablet. For this type of dashboard we are going to start tablet only. We really want to design to use the space available. Of course 1024x768 (older iPad and iPad mini current maximum) is not a ton of space but it is what a number of folks run on even older desktop PCs if they only have a 15" LCD.

At this point I am sketching out ideas and have started a framework on the Android side. I am going to start there as this seems a perfect fit for fragments within an activity. Previously I have used fragments to learn about them and knowing it is the proper way to approach the future. Now I will get to exploit so much more of their power. I have not had the need to swap in one fragment for another or to add new ones to an activity, I have only defined them in the XML and let them operate as is.

Since this will target 3.0 and above on large devices I don't even have to worry about the compatibility library. Nice to get to be able to fully use the newer API features.

I am using achartengine for the pie, line and bar charts on the Android side and core-plot on the iOS side of things. The current smaller app just displays a pie chart so I will need to learn my way around the others.

Not sure what approach I will take on the iOS side of things. There is nothing like fragments there so I will get to deal with UI views and manual placement of things. This is why I plan to get it up and running on Android first so I can knock out the initial design without fighting layout issues. I should be able to figure out a number of UI patterns such tab controls, menu options, widget manipulation buttons etc. and run them by beta testers before I begin the iOS conversion.

Thursday, September 5, 2013

AAAARRGGGG iOS layouts stink!

I hate iOS layout management. Yes, everyone loved it when you knew the iPhone had this one resolution and you could perfectly layout everything. All phones were held in portrait only mode. Even the auto code generator blocked landscape by default. We knew what you had and how you would use it so just shut up. All Apple devs told Android devs they were hosed with their stupid layout managers without true WYSIWYG editing. Na-na-na-na-boo-boo.

This meant if you wanted to support landscape you added code to move things around and resize them during orientation changes. You could still use IB to see that pristine portrait view. Then came the iPad which was used in landscape a lot. Just do IB in that mode.

Well IB sucks. Adding storyboards just allowed it to suck in some new ways. Sure you can tie you portrait screens together and you can do separate iPad and iPhone screens but you have to manually tie all the controls back to your source code with crazy Ctrl + Click drag and drop if you can get the right source file to appear in a squished down window below the stupid layout that is way too damn big for iPad screens that wants to constantly scroll and resize every freaking time you click on it!

You are an idiot - use auto layout. If you don't then you are hosed. But Apple did not backport that, you had to wait until most users were on iOS 6. Google backports, Apple does not. Apple is a jerk in this area. iOS 6 seems like a safe enough target at this point.

Auto layout has a new set of issues. IB really blows here. It has to have everything in perfect order even though when you are creating the layout you can't get it in perfect order until the layout is fully loaded with all the controls. They IB rewrites the damn file over and over. You lose the battle every single time wasting a huge amount of effort.

So screw IB, it has been screwing you. Besides if you want a team working on things they can't all have the storyboard open because version controls DIFF is nearly impossible. It is a SNAFU. Time to write it all in code and skip everything related to IB.

You have a couple of choices. Use the auto layout weird ASCII stuff, which is just ugly to read, or use NSLayoutConstraints manually. I think I am going NSLayoutConstraints. If I am getting no WYSIWYG support I might as well take full controls. That ASCII stuff is too bizarre. Honestly this all feels like I am moving back into the land of GridBagLayout in Java.

GridBagLayout was the end all do all layout manager for Java back in the day. Yes, I did some crazy layouts with it that worked and even allowed you to resize the panel and flow properly. The code was ugly and not maintainable. You could not look at it and tell what the hell was going to display on screen and you could not add a new control between other controls without totally screwing everything up. I worked with developers that used GridBagLayout for everything even though a simpler BorderLayout would have worked. Use the right tool for the job people.

Look Apple there were a ton of other good examples of how to do things. MigLayout for example if you only want one layout manager. The Android XML way of doing things if you don't might multiple layout managers that deal with each other. At least with Android you can layout portrait and landscape and just put them in different directories. There is a WYSIWYG viewer too. I use it to preview the code changes I make in XML and so far have been able to build every layout I have wanted. The Android side is not perfect but is better than what I have seen from Apple.

Nope, Apple just puts all of that on you. Now I get to manually code all this crap and other devs will be able to see what it looks like when they run the code.

I just wanted to convert a current screen from a table view to a normal view. The original developer misused a table view for the screen and I need to clean it up and give a better look. IB does not like it when you try to change view types. Time to punt. Yes, I am using Xcode 5.x and I know it is supposed to have better auto layout support but it is still a mess.

Having spoken to my other iOS developer friends they have all stated it is time to move as far away from IB as possible. It has done nothing but screw them over. They think I am a fool for attempting to stick with IB as long as I have. I really just wanted to get the current project off the books but that is not going to happen. I can try and blow away the current table with a normal view then reattach the segues to the new view and leave it at that but that seems a new waste of effort.

I am going to have to learn auto layout. It is the new Apple way of doing things. It is the only hope if Apple decides to ever come out with a new resolution, which I really think they should. People are expecting HDTV on their devices. 1024x768 on the iPad mini is not cutting it anymore.

Maybe someone will come out with an excellent layout manager for iOS that will solve a number of these issues. At this time I don't care about WYSIWYG at the start. Something that is easy to code and maintain is what I want. I enjoyed working with MigLayout. I converted over 300 Java desktop screens from old NetBeans format to MigLayout at a previous company. I find the Android layout managers more difficult that MigLayout but still serviceable. The new Android Studio does a really nice job showing me a preview of my screens as I edit the XML. The layouts work and scale on various device sizes.

Done with my rant. Off to code NSLayoutConstraints.

Wednesday, August 28, 2013

UITextField Change made by Apple

The following worked prior to Xcode 5 + iOS 6:


@property (weak, nonatomic) IBOutlet UITextField *source;

if (![self.source.text isEqualToString:@""])

It now needs to be

if (self.source.text != nil && ![self.source.text isEqualToString:@""]) {

Previously if the user never touched the text field you got back an empty string. Now you get back a nil string instead. 

Just found this while testing code I am updating for iOS 7 while running on a device under iOS 6.

Shown for simplicity. In the actual code I am using a utility method to trim the string and check for a length of 0. The stupid trim method for iOS is a super long line and can be found all over the web as everyone must write it over and over as Apple does not include it in the base NSString object.

Tuesday, August 27, 2013

Finally have new ActionBarActivity working with Android Studio

Yes I am a sucker for punishment. The new Android Studio 0.2.6 came out today and I found this out my usual way - saw it on Reddit. Since I just battled this beast yesterday I thought I would give it yet another shot.

Post install it still could not build my project but was mad about even more things. I decided to delete the entire project off disk and start fresh especially since it kept being mad about gradle build settings and make settings that I would change and save and it would forget I had done that.

I deleted the project. Started AS, told it to create a new project with old project name, single activity. While it did this it appeared to download some additional gradle files. Probably updating from 1.6 to 1.7 but I am not sure. It did not do that when opening my old project.

Shut down AS. Copied the java source code, resource files and manifest over from the working Eclipse project. I did not want to risk changes to a working project. Started up AS and it found all the files automatically. I love that about Java, just put the files in the proper directly and have at them.

Copy in the build.gradle from this web site http://www.recursiverobot.com/post/59267986367/setting-up-the-new-actionbarcompat-in-android-studio then add the dependencies to the two bonus libraries I am using - achartengine and GSON. Run the rebuild all and everything worked like a champ. No errors. I was able to deploy it to my Note II and it ran perfectly.

Obviously multiple things happened here. AS was upgraded and it needed to upgrade various support tools which it did not do until I forced it via creation of a new project. That is pretty annoying. Once that was in place it is finally working.

I am glad they fixed the issue dealing with Google support libraries. The actual editing you do to the build.gradle is simpler than the project import work I had to do in Eclipse. You can read those steps here http://developer.android.com/tools/support-library/setup.html

Do I think this project will keep working? Who knows, seems on the AS side of things they make changes that require you to start with a fresh project or you are hosed. Gradle is in flux too. I like the editor and layout preview features of AS so I may use it for the next parts of this project. I really want to come up with functional tablet layouts beyond what you can do on the phone. I have everything split into fragments so this should be possible. I also want to use more than just the pie chart from achartengine and have more than one chart on screen in tablet mode.

This ties back into the JavaScript work I was doing in another area of our product. While that works in the browser on tablets it is slow and cumbersome. I should be able to do something similar in native code with large gains in speed and usability.

Using Genymotion to test against various device sizes. Nice and fast and recommended when you are not testing on an actual device. Very happy they added device rotation support.