Friday, February 28, 2014

Photos of the Month - February 2014

Many people might not know this about me, but I have developed a very strong interest in photography over the past few years.  Since coming to college, I've realized how much I want to have memories of everything I do, and so I take a lot of pictures.  Actually, that's become an understatement, because it's more than a lot.  It's something I've had a few people get upset about, partially due to some bad photos, partially due to the bulk.  In fact, I routinely have to go through them, or risk not posting the photos due to the sheer numbers.

This past year there were tons of photos that I never uploaded simply because of the time it usually took me to go through them.  I didn't (and still don't) have a nice camera, so I ended up using my phone, which means I had to manually go through each one.  With my recent Android phone, I can now do so much faster since they are automatically synchronized everywhere (privately of course, with the option to share).

Monday, February 17, 2014

Why to Avoid Dynamic Tabs on Android and iPhone Development

Recently I began finishing my first Android application.  They app itself is pretty simple in my mind, but actually creating the application has proven much more difficult than I thought it would originally.  This difficulty is mostly due to things like creating and managing databases for storage, utilizing fragments instead of activities for new screens, and creating user-interfaces that are quick and responsive without requiring multi-threading.

Clicking "Button 1" should insert a new tab
between tab 2 and tab 4
The bulk of my problems have been caused with creating the user-interfaces.  A recent problem I ran into was displaying large amounts of information on a single screen.  My original approach was a tab-based system, where users could add new data sections, which would then appear as a new tab.  These tabs could then be scrolled through, and each one would contain a different sub-section of the application.

The big requirement for this however was the need for dynamic tabs.  That is to say, I needed to be able to easily insert a tab between two other tabs.  This proved impossible with the default TabHost object, as there is no insert method available with it.  I opted then to simply remove the last tab, add on my new one, and then re-add the deleted tab.

It was at this point however that I realized that this was a surprisingly weird feature to leave out in the ADK though.  In fact, my thought was that this must be a bug in the ADK, as this seems like something that everyone would want.  Taking the problem to Google showed a few forum posts about this as well, though it didn't seem like anyone had a good solution.  In fact, I still don't have a good solution other than this, and the steps involved get even more complicated.  You can't just "delete" a tab, you actually have to remove both the tab itself, as well as the content that the tab shows, then add the new tabs.

This is much more complicated than it needs to be though.  Why not have an "insertTab" method for the TabHost?  Why would such a seemingly important method be left out?  While I can't confirm the accuracy of this, I believe I actually found the reason, and it's the exact reason why I opted out of using tabs for this purpose (well, sort of, more on that later).

Let's start with an example of bad tab usage:  imagine you are looking at someone's internet browser.  Imagine this person is me, and when you look at the amount of tabs in their chrome browser, you see this:

Kind of painful to look at that many tabs isn't it?  That's the point I want to bring up: dynamic tabs in an application are very dangerous and bad for the user.  It makes sense that dynamic tabs are not supported, as it would very quickly become a cluttered interface as the user added more tabs to the screen.  If you force your user to create a new tab to view content, looking through that much data can be annoying.  Even if the tabs scroll, that can still be overwhelming when trying to view the page.

There is also another problem that occurs, especially in older devices: memory limits.  If you start adding more tabs, you'll find that your memory usage skyrockets.  This is nothing out of the ordinary though, and is a problem that can be easily combated by simply limiting the maximum number of tabs, but it's still a problem nonetheless, and is prevented by not allowing dynamic tabs.

There are probably a variety of other issues that come up with dynamic tabs, so this brings in the question of whether dynamic tabs should even be used.  In my case, I realized that tabs would not be the most efficient way to achieve what I wanted, so I scrapped them and took on another solution.  The solution I took was instead to use a spinner, and updated the content based on what is selected, as well as breaking up where the data is displayed.  By using a spinner, you allow the user to display more at once but with less clutter due to how spinners are designed, and by breaking up the data, you help guarantee that the user can never overwhelm themselves on accident.

There are of course other solutions that can be done other than spinners and breaking up the data, those are just the ones that I chose.  If you've encountered a similar issue, what was your solution?

Monday, February 10, 2014

High Level Tools Versus Low Level Coding

As someone who is constantly trying to hone my technical abilities, I look around at what tools other people use when developing all the time.  I've noticed a very big trend right now with using tools such as Unity or UDK for game development for example, or tools like the Titanium Mobile Development Kit for creating a simple mobile application.  This even extends to a lower level though when coding, such as using GLFW when creating a window in an OpenGL program, or using a 3D library for Javascript instead of just WebGL.

Why these tools are chosen instead makes sense though, as developing a lot of these on your own would take a ton of time away from just making your application.  Just creating a window to use with OpenGL is incredibly time consuming, so why not just use an external API to do it for you?  Especially since these tools will allow you to go cross-platform automatically when done correctly.

Yet I constantly wonder about whether these tools are good or not though.  I believe using these tools takes a way a huge part of learning to code, because you suddenly don't have to worry about what's happening behind the scenes.  You start trusting that these tools are doing the best they can at whatever you are expecting them to do.  Is this a bad thing though?  On the one hand, it allows for developers to focus more on developing their applications, and less dealing with bugs in code. On the other hand, if a bug comes up in the tools, they may have no idea how to fix it or get around it properly.

These ideas bring in another concept too though: are you learning how to code, or are you learning the tools you use?  Going one step further, should this count as coding, or should it count as something else?  If you use an entire drag-and-drop IDE, should that be considered coding or does there need to be a new category for this specifically?  I think a lot of these questions honestly come down to opinions and what exactly you are making with these tools.  How much are you using from others, how much are you making yourself, and if you run into a problem, can you solve it, are some of the important factors that I think should be considered.

I don't consider myself in any place to judge on whether it's more important to learn more about using tools or how tools work, but I do think it's something that should be brought up.  Me personally, I like to learn how the tools work, and then apply those uses when I use tools.  This leads me to do a lot of unnecessary work, but I feel confident about what I am learning as a result.  Does this mean that you can only feel confident this way?  Of course not.  This is just my personal preference.  That being said, what are your preferences?  Do you prefer just diving into making your application, or do you like learning what the code behind the scenes is for your tools?

Wednesday, February 5, 2014

The Real Problem With Ken Ham vs Bill Nye

Recently I got the chance to watch the debate between Ken Ham and Bill Nye on whether creationism is a valid form of science to teach students in public schools.  Ken Ham believes that creationism is valid, whereas Bill Nye thinks it will be harmful to future generations of children.  Watching the debate was incredibly painful however, mainly due to Ken Ham.  It was not, however, due to his beliefs.  I respect everyone's views, even when I don't agree with them.  I don't agree with parts of Bill's views either, but I also respect them, and will not be rude to him about them.

I'm sure that this is the case for many people.  We all have friends whose beliefs in religions and sciences all differ from us; it is part of what makes everyone different.  While parts of my family are Christian and highly devoted, I am not.  I know many people who are set in their ways of atheism, but I am not.  That's my take on things; you are fine to partake in any religion you'd like near me, just don't try to make it affect me.  That's a huge part of what this debate has been: should you be able to force your views upon others, what is an acceptable "view" to force upon others, and what is not.  Ultimately though, that is not what bothered me about last night's debate.  What bothered me was how incredibly rude Ken Ham was towards Bill Nye about his views.

Take a minute and watch this video to the side (If the embedded time doesn't work, skip to 1:51:25 for a perfect example of all this).  Do you see what Bill is doing? He is listening to Ken and actually taking in what he says.  Bill does occasionally look away, but only to write down notes about what Ken says.  When the first rebuttals start, Bill talks about what Ken had said, rather than trying to bring up new points, thus ignoring what Ken said previously.  He's actually debating, and constantly states that he has an open mind.

That is where Ken ultimately came to bother me.  Every time Bill Nye starts talking, Ken looks away and even walks away (See 1:59:40).  He is very obviously not even listening to a thing that is said.  When asked directly if something could change his views, he bluntly states that there is nothing that could.  That to me is a huge problem.  Ken is not listening to facts, he is not listening to others, and he is not trying to be a scientist.  He is simply trying to shove his views to others, regardless of what others say.

This is where the danger is.  This is exactly why I do not like a single thing that Ken said.  He's not trying to help the children of our future, he's trying to make his museum (where the debate took place) get more visitors.  It's not about what's actually good for anyone, he's not interested in listening how his views could help people or hurt people.  He is solely interested in getting more visitors to his "Amusement Park" and making more money.  It has nothing to do with what is actually best.

Bill however, with all of the odds against him, with absolutely no hope of winning this debate, went out  and tried to address the issue based on what he believes will help, and was willing to listen.  That is something that I think is much more important.  If you choose to stand by Ken, like I have seen many people do, I will not stop you.  In fact, I will respect you still.  I might not like that you do so, but I will still listen to you, I will still help you when I can, and I will do my best not to let you down later, just as Bill Nye did during this entire debate.

Saturday, February 1, 2014

One PC, Three Kinects

Recently I managed to get a hold of three Microsoft Kinects.  A few of my family members had one (including myself) and ended up not needing them since they never used them.  Being the "techy" I am, the first thing I did was attempt to integrate them into my recent Oculus Rift projects.  While the code seems to be correct, there was an issue from a hardware perspective that I was hoping to not run into.  Alas, I have, and thus am writing this blog post about what exactly is going on.  It's an interesting little hardware problem that I'm hopeful Kinect 2.0 will solve a bit more, and that'd I decided to do a quick write-up about.