Freitag Software
The Joy of Writing Software has moved to software.dafreitag.com !
  • Home

Starting a New Project

12/9/2016

0 Comments

 
After finishing a project, I like to decompress and relax a bit. I try to enjoy the product of my creative labor. Sometimes my downtime takes months, sometimes only a few days. 

The problem is that starting a new project is like taking a deep breath and diving underwater. I know I'll be gone from the world for a little while and in my own little creative world. It's exciting, but it's also scary. 

When I'm getting ready to start a new project I have to gather myself and mentally and emotionally prepare for the trip. I have to be willing to focus and engage and commit to a creative act. I have to squash my demons who keep saying that nobody cares if I do this or not. I have to create enough enthusiasm to get past the tough creative times after the initial excitement of the project dies down. 

I have to weave a spell around myself to care enough to devote my time and my life to this pursuit. It isn't easy sometimes, but it is getting easier. As I get older, it's easier to spend my time doing activities that I enjoy that others don't understand. As I get older I am content to spend my time in enjoyable creative and intellectual pursuits. 

Besides enjoying the time I get to spend with my wife and friends, I can't think of a better way to spend the days of my life. 
0 Comments

Finishing a Project

11/30/2016

0 Comments

 
After finishing a project, after coming up for air, I frequently have a little let down. Even if the result is fantastic and I am very proud of my effort, being done is a little disappointing. While I was working on the project I was in the zone, experiencing flow, and completely absorbed. It was fun. 

Back when I played tournament chess I remember walking down the hotel hallway after winning my first chess tournament and thinking, "Really? That's it?" It just seemed so anticlimatic. I studied for hours and days and months, followed by playing 5 long games over a weekend, and I lost less than anyone else. That's it? Was the effort and sacrifice worth it? It didn't feel like it. 

I didn't think of it as a sacrifice at the time. I enjoyed playing and studying chess. I enjoyed meeting up with my friends at tournaments. I enjoyed winning and hated losing. And I was relatively successful. But the opportunity cost of the time spent studying chess instead of going out with friends in high school was a sacrifice. But perhaps a sacrifice I would make again anyway. I did have fun. 

So, now when I finish a creative project like programming or writing or an artistic pursuit, I still have a little of the, "Really? Is that it?" in the back of my mind. The difference now is that I am more content to have spent my time doing something that is challenging, new, and enjoyable. Even if that is it and few people will care if I did it or not. 
0 Comments

An Independent Scholar 

9/12/2016

0 Comments

 
I enjoy programming. It's creative, it's fun, it's a way to experience flow while sitting in a comfortable chair in an air conditioned environment. 

Being a programmer, I've always enjoyed learning new techniques and concepts related to software development and technology. But I've always had a job that required me to think about subjects that related to the job. I couldn't do my own thing. 

But, now that I'm a old fart, I can do as I please. I've always been interested in AI, machine learning, the singularity, and science fiction in general. I know, surprising, huh? Well now I have time to indulge my interests. 

The college I work for wants me to go back to school and get a masters in Computer Science to continue to teach programming classes, but FT. I'm not going to spend more years learning what others want me to learn. I'm on my own now - I'm an independent scholar. 

As you know from this website, I've been writing apps for Android and learning about that platform. Its been fun. Now I'm focusing on a larger projects that enable me to code various approaches to machine learning. The world and the internet are my oyster and I intend to dine well. I look forward to years of exploration and fun! 

0 Comments

Programming Languages

8/27/2016

0 Comments

 
A lot of people have religious fervor over which programming language is the 'best'. I never joined that debate - it seems endless, if not pointless. Every language has good and bad points -- if you don't understand that, you aren't experienced enough in the language yet. The best programming language to use is the one that will get the job done within the constraints of the problem.  

A constraint could be a language that your company says you must use - so that's the 'best' language to use. A constraint could be an inability to hire someone with experience with a language you want to use. A constraint could be a tight deadline that precludes you learning a new language that might be more useful than the language you already know. And, of course, there are always technical constraints between various pieces of software that excludes or encourages the use of a language. 

So, I'm pragmatic regarding programming languages. What works works. Let's deliver something and move on the next cool thing to code. 
0 Comments

JavaFX

8/27/2016

0 Comments

 
Back in the day I wrote some small dialogs and simple user interfaces with Swing, but I never became proficient with it. I just never had the need to do so - especially since I became a supervisor, manager, and director at the software company I was working for. 

So, now that I've gotten back into coding in Java from the Android side of things, and now that I'm teaching Programming and Problem Solving I and II at Pima Community College which uses Java as the teaching language, I have more reason to dive deeper into Java. 

To my surprise, JavaFX seems to be reasonably easy to learn and use. Check out my BattleShip game I created to try out some JavaFX concepts. It's rather simple, but not too bad for a first effort. 

The problem with creating software for others to use is that the fun coding part of it is only a small part of the entire process. I like designing and writing and testing code, but I don't care for creating the graphical elements, the sound, or the user interface. Each of those areas is a full time career in themselves. So I'm focusing on the coding and the user interface you see will be simple and usually text-based just so I can keep moving and learning and enjoying myself. 
0 Comments

Artificial Intelligence

5/14/2016

0 Comments

 
​I've always been interested in artificial intelligence and emergent behaviors. So, instead of just reading about the subject, I've decided to start coding. My plan is to read, learn, and create a Android app demonstrating whatever I've been learning. No hurry. This could be a 20 year project. 

My app Rock, Paper, Scissors, Lizard, Spook has an AI that uses pattern recognition and basic probability. If the human player has a simple pattern, the AI will recognize it and play accordingly. 

My app The Oracle uses randomness to keep the user more entertained. Not really AI, but it shows how a little randomness in a very simple toy can be entertaining. 

I've written a Battleship game that uses more sophisticated AI with rule based AI and probability maps. If the computer hits a ship, it knows to continue shooting around that hit. If the computer is looking for a ship, it will calculate the location that will most likely contain a ship. The AI is good enough to beat a human playing the best they can if the chips fall in the right way - just as human vs. human players win. Now I just have to write an app for it! 
0 Comments

Going beyond Casual Games

1/18/2016

0 Comments

 
Now that I've created a few games for the Android, and a few for my classes, I'm getting tired of creating small games that I can code in a few days to a week. The good news is that now I can quickly code a variety of games; the bad news is that interesting ideas and solid code is only a small part of delivering a quality game experience to the player. 

So now I'm thinking about larger projects that I can work for a longer period of time on -- something more challenging and interesting than arcade-style games. If I come up with anything, you'll see it here first! 
0 Comments

Teaching Programming I and II

12/27/2015

0 Comments

 
As the saying goes, if you want to learn something better, try to teach it to others. I knew how to code in Java before teaching this class, but after teaching both Programming I and II this semester, I'm a much better programmer now. 

It was extremely motivating to face a room full of students looking to me for answers to keep me learning and studying. It was a blast, actually. 

It was satisfying to see the metaphorical lightbulb go on over people's heads when they 'got it' and understood a concept we were covering. And it was frustrating when a student would not even try to put in the effort to understand the concept. 

I'll be teaching Programming I this semester so I hope to be able to use what I learned about teaching programming to improve the experience for everyone. 

(and maybe even get a little coding done myself!)

0 Comments

Slight Detour

5/4/2015

0 Comments

 
My Android programming has taken a back seat lately since my coding energy has been directed towards teaching a class at my local community college (CIS 100 Introduction to Computers). I've enjoyed being on campus again and connecting with the students. 

As the saying goes, if you really want to learn a subject, teach it to others. I've tried various ways for the students to remember the material, and have settled on the repetition of: Open book quiz at home, closed book quiz in class, play a fun team game in class, and finally the chapter quiz. I've been happy with the class's retention of the terms and concepts we've been covering. 

This summer I'm teaching CIS 129 Programming and Problem Solving I online. And in the fall semester I'll be teaching both CIS 129 and CIS 131 (P
rogramming and Problem Solving I and II) in traditional classrooms. Sometimes it's good to go back to the basics. Reviewing and teaching basic programming concepts will only make my own coding better. 
0 Comments

What to do next? 

1/11/2015

0 Comments

 
Now that I've finished Gemini Falcon: Asteroid Miner, what should I create next? The world is my oyster -- as the saying goes. I want to do something where I can program an interesting AI (artificial intelligence) for the game. And of course it needs to look awesome! 

I have all kinds of ideas, but which one is best? I'll be working on this for awhile, perhaps for all of 2015, so it needs to be worth my time. Of course I would love to develop a fully realized game universe with all the bells and whistles, but, being a single app developer, that is not realistic. Several of the games I've thought about would require months of just developing artwork and then several months of developing animations -- and that's before writing any code at all. 

So I think I need to avoid realistic game environments and focus on abstracting the game elements so I can focus on the game mechanics I want to code. No realistic art -- just shapes, colors, movement, and cool code under the covers. 
0 Comments

Details nobody will ever notice

12/30/2014

0 Comments

 
I enjoy programming because I can see results immediately, or at least relatively quickly. I code, I test, and it either works or it does not. Cool. 

But a lot of code also contains functionality that most users will never see, and yet that code is important to include to round out the application. For example, in Gemini Falcon: Asteroid Miner, if the player elects to fly missions without doing any upgrades, the program will start to speed up the ship in tiny increments until it is almost as fast as it could be after the first upgrade. Otherwise it would be impossible to complete all 60 missions. And, as a surprise, after 55 missions of no upgrades, the impulse engines are actually faster than the regular engines! At that point it will be better to run out of fuel -- which I made certain to happen by eliminating the fuel clouds in the later levels. Of course the player will be nervous about running out of fuel since it has been critical to find fuel clouds until then. 

Another detail, when a player has trouble completing a mission, the player may notice the number of coins required to fix the Gemini Falcon goes down, as does the time required to repair the ship. But the player may not notice the mission becomes a little easier each time they crash also. I did that to encourage the crash-happy player to continue playing and not to become discouraged. 
0 Comments

Some Gotchas

11/24/2014

0 Comments

 
Here are few things I've encountered recently that I had to spend some time figuring out. 

In-App Purchases: 
  • I created a test value for my in-app purchase id, no-ads-test, and then I purchased it. So far so good. But when I created the real in-app id and deactivated the test id, my app received an error saying that it could not find prices for a purchased product. So I activated the test id again, and all was well. The result is that in the Google Play Developer console I have a bunch of active test ids that are only active so I can buy new in-app products in the production version. It's just irritating not being able to clean it up. 
  • When I created an alpha or beta version of Gemini Falcon, I added several people including myself to the Google Play Console / Settings / Gmail accounts with testing access. Again, so far so good. My testers could purchase in-app products without actually being charged for them. But when I created a production version of the app, the testers still could not buy in-app products. I had to remove their email addresses out of the Google Play Console / Settings / Gmail accounts with testing access area. 
Not Power of Two
  • When I was creating and modifying Gemini Falcon's artwork I reduced the size of some files and added to others, but I didn't keep them a power of two (512x512, 512x1024, etc). This worked fine on my Samsung phone, but it didn't work at all on my friend's Nexus phones. 


This is what it looked like on a Nexus phone ------> 
Picture
0 Comments

Lots of Details

11/15/2014

0 Comments

 
Writing and publishing an Android App is an interesting process with lots of little details. I started doing this because I enjoyed coding and seeing how the code turns out. I love an elegant solution that is clear and easily understood. But I soon discovered that writing code is a small part of creating and sharing an Android App.

Creating a basic Android App consists of many parts: 
  • Installing, understanding, and using the IDE  (Eclipse or Android Studio) 
  • Understanding how to use the IDE's emulator
  • Understanding the Android environment (phones and tablets to start), including the lifecycle of an App 
  • Coding in Java
  • Understanding and using multi-threading in the Android Java environment 
  • Coding in-app purchasing
  • Coding application data backup through Google's Android backup service 
  • Understanding and using data encryption for app files 
  • Writing and modifying XML
  • Understanding the difference between using Android resources and assets  
  • Being comfortable navigating and using developer.android.com
  • Being effective in debugging your App
  • Being effective in researching issues in stackoverflow and other resources
  • Creating artwork for the app. Games require lots and lots of artwork. My deficiencies in this area soon became very apparent! 
  • Ability to use the Google Play Developer Console to publish alpha, beta, and production releases 
  • A website for your "organization" and perhaps for each App 
  • A privacy statement for each app
  • Finding or creating sounds / music for your App
Once I had the necessary knowledge and skill, the major areas that take up most of the time in writing an App seem to be (based on my limited knowledge and experience!): 
  • Designing the App (and not winging it!) 
  • Writing the Java code 
  • Creating artwork / creating the interface 
  • Adding sounds / music 
  • Publishing the App
Writing my first App was not be a quick and easy process, but I found it to be rewarding. As I learn more I expect the process to become quicker and, indeed, I wrote the Ay Caramba! app in a single week (of course I had already written the content years before and I only had to write a container App to display it to the user). I look forward to knocking out Apps as often as I care too!
0 Comments

Creating App Interfaces

11/13/2014

0 Comments

 
I started writing Android Apps because I enjoy coding and creating and seeing the fruits of my labor. Years ago, when I first started learning Java for fun, I stopped before I immersed myself into creating interfaces for the code I enjoyed writing. It was clear to me that creating the interfaces I could imagine was beyond my abilities and would take years of study and experience. So I reluctantly set Java aside and concentrated on other subjects that interested me.

Enter Android. I discovered that writing user interfaces was fairly easily so I could enjoyably code in Java behind the scenes instead of spending so much time on the interface with the end user. 
0 Comments

Burned Out

10/8/2014

0 Comments

 
Tired. So very tired. 

Not of my programming projects exactly. I'm tired because as I continue to improve my latest app, Gemini Falcon, which is turning out rather well I think, I think of new bells and whistles to add to it. The idea that it will never be done is scary, and the idea that if I stop development now it won't be as perfect as I could make it if spent more time on it is frustrating. 

The only major item left is to decide how to monetize it -- as if I'll make any real jack on it anyway. I could just release it for free; or I could add full screen or banner advertisements, which I hate to encounter when I'm playing a game; I could add in-app billing, which would require a lot more work (sigh); or I could create a limited free demo version and a fully featured version for a small amount of money.  

I don't expect to make any money on this, so why am so concerned about it? In the back of my mind I worry that if I gave it away and millions of people loved it and then I would miss out on a life-changing amount of income. That would be a bummer!  
0 Comments

Creative Angst

7/28/2014

0 Comments

 
When I have an idea for an app, a program, an essay, a story, a play, or some other creative piece of work, I can visualize the final form and I work towards that. I jokingly say that I'm working on tedious details of the project rather than the imaginative creative portion of design -- although during the tedious phase there are always plenty of opportunities to be creative. 

I really enjoy these times and frequently find myself "in the zone" and time flies by. I can easily code for 5 hours without realizing any time has gone by at all. Experiencing flow like this is a lot of fun and working on my creative projects allow me to feel that directly and reliably. 

At some point during the project I eventually hit a place of darkness where I cannot see through the tunnel to the other side or even see if there is another side to see through to. When I'm programming it might be after I've done everything I know how to do and now I have to implement some new functionality that I've never done before and some functionality I have no idea how to implement. Those are dark days when I discover the garage needs cleaning, my bike's chain needs to be oiled (again), and look! There's a Big Bang marathon on television!  

But, after some angst and some downtime, I return to the task at hand and begin to tackle it. On my best days I am enthusiastic, optimistic, and look forward to learning something new. It's a challenge I embrace. On my worst days my head aches and I despair of ever getting it to work like I want it to. 

The important thing for me to remember on my dark days is that I've been there before and all I can do is to keep making progress and trust that I will eventually see the light at the end of the tunnel -- and then it's all tedious details again. Joy! 
0 Comments

Embarrassing  Things I've Done

6/18/2014

0 Comments

 
Here are some embarrassing things I've done related to programming...
  • I was tired and forgot that the For / Next loop in java is a 'while the variable' type of loop and not a 'until the variable' loop. I spent more than an hour debugging this when a nap would have resulted in finding the problem immediately. Sometimes a rested mind is more important than plugging away at a problem that I know should be easy to find.  
  • Not backing up something and losing some work. I seem to have to relearn this every couple of years. 
  • Forgetting to copy a file to the Assets folder and wondering why my change was not working. I took a break for dinner and realized the problem in mid-chew. 
  • Forgetting the format of some simple code statement. That's why I have reference books close by. A waste is a terrible thing to mind. 
  • Trying to show someone the results of hours of coding when they couldn't care less. 
  • Trying to explain to a non-programmer the cool piece of code I've written and how it blah, blah, blah. They don't care. 
  • Telling my wife it's done, finished, complete. And then finding a bug when I'm proudly showing it to her. Arrrrg! 
  • Spent 5 hours re-installing Eclipse, the Android SDK, and a bunch of drivers, and finally discovering that a recent upgrade to my phone tuned off Developer Mode and the USB access between the phone and my computer. This is something to check if it appears Eclipse can't find your phone through the USB connection. 
0 Comments

Placing text and knowing where to accept touch

4/30/2014

0 Comments

 
When creating Major Bob, I had to place text on the screen in specific places and then know when the text was touched so I could do something. To be organized, and to save time, which is the purpose of being organized anyway, I created a spreadsheet to do the calculations for me. (I'm lazy that way.)

Below is the data for the main menu. The 'Play ' menu item was placed at (10, 218) and the other text areas fell into place. I just had to enter the data in the yellow cells. The Rectangle (10, 218, 300, 42) statement indicates where the 'Play' touch area is located. A reminder of what is what is at the bottom of the screen because I'm sure I'll forget all about this by the time I start my next project. 
Picture
0 Comments

Eclipse Tips

3/31/2014

0 Comments

 
  1. When working on a project, close all unrelated projects. 
  2. If things get a little screwy, try closing everything and restarting Eclipse.
  3. If things get a little screwy, use the menu option Project/Clean and see if that helps.
  4. An error in an xml resource will prevent the app from running, and Eclipse may not flag it as an error. Be very careful! 
  5. Put the cursor on a field or function and use Ctrl+Shift+G to search for all references. This is very useful! 
  6. Put the cursor on a function and press F3 to go to that function directly. 
  7. Be very careful in moving projects from workspace to workspace. Back up everything first! 
  8. Don't be afraid to reinstall Eclipse in Windows -- it's just copying files, not a full windows installation. Just back up your workspace and import your projects afterwards.
  9. When there appear to be lots of errors (red underlines) under code that is totally correct, try copying the code, deleting it, and pasting right back where it was. That may clear it up.
0 Comments

Testing

3/31/2014

0 Comments

 
  • Testing using a device hooked up to the computer via USB is much faster than using the emulator. If you are going to use the emulator for testing, make sure you have the proper settings to speed it up as much as possible (use HAX and hardware acceleration if possible).  
0 Comments
<<Previous

    Author

    David Freitag - 
    Someone who enjoys programming and software development. 

    Archives

    December 2016
    November 2016
    September 2016
    August 2016
    May 2016
    January 2016
    December 2015
    May 2015
    January 2015
    December 2014
    November 2014
    October 2014
    July 2014
    June 2014
    April 2014
    March 2014

    Categories

    All

This website documents my continuing education in software development.
I hope it is useful and entertaining for you to read. 
An old programmer learning new tricks... 
(c) 2017 David A. Freitag, all rights reserved.