Saturday, December 5, 2009

Useful Resources

Useful web resources:

I did want to add that there are so many resources that you can find out about things over the internet. It's more than just playing video games (although they can be just as educational for a computer programmer). We can actually learn so much about the world and how it is focused, and through our interactions with people, we understand why there is such a need for technology and invent more ways to improve our lives in the process.

List of helpful websites on various topics.
2d arrays: http://www.fredosaurus.com/notes-cpp/arrayptr/22twodim.html (remember that tic tac toe game that I told you about in previous posts?)
Iterative programming (this is just basically the process of figuring out something bit by bit): http://en.wikipedia.org/wiki/Iteration
Exception handling in csharp: http://www.c-sharpcorner.com/UploadFile/rajeshvs/ExceptionHandlinginCSharp11282005051444AM/ExceptionHandlinginCSharp.aspx
10 Programming Languages to Learn: http://www.eweek.com/c/a/IT-Management/10-Programming-Languages-You-Should-Learn-Right-Now/
Programming Dictionary (words you need to know when doing programming): http://www.webopedia.com/Programming/

Tuesday, November 17, 2009

Artificial Intelligence

I hope you have enjoyed the varying posts of my random thoughts on mobile application development and programming. Based on the number of views, it seems as though some of these topics have been reviewed several times. I'm happy for the feedback, and thanks to everyone that has helped in this blog. My last thing to ponder about programming is dealing with artificial intelligence: how do computers communicate with each other, and do they truly have sentience, as we know it? There have been plenty of people who have simulated what they thought of as thought patterns for human brains. I can also recall watching one of my favorite shows, Star Trek Next Generation, and there is an Android, called Data. Do you think that these things can actually exist? Some people say no, because a machine can't have emotions or experience pain. But isn't physical pain just a response to a stimulus? Nerves that let us know that something has come into direct contact with our body? That's just what a neural network is in a computer system, a set of electronic impulses let the computer know that there is some event happening. Interesting huh?

Tuesday, November 10, 2009

Programmers Burnout?

Is there anything that you can do when you are completely burnt out when trying to do progamming? I know that some people like to do something totally different, like work out in the gym or cook something delicious. I prefer the latter. I love to eat, and I love trying to cook some dishes that I never have before. One thing to remember is to make sure that you don't forget all about your programming. Sounds odd, doesn't it? When you are trying to figure out a problem, the thing that works for me is to not completely forget about it, but rather try to come up with something in a new way. The point for me is to just get rid of the frustration, and then come back to it in about 4 hours, and not a minute before. What method works for you?

Monday, November 2, 2009

Mastermind-Understanding Logic

There is an important thing to remember in programming whenever creating a game, a device enhancement, a database, or whatever. You have to remember logic! I'll use the example of mastermind. Here are the rules to the game

Mastermind Rules
Object of the Game
The computer picks a sequence of 4 pegs, each one being one of any of six colors.
The object of the game is to guess the exact positions of the colors in the computer's sequence in as few guesses as possible. After each guess, the computer gives you a score of exact and partial matches.
Use Logic…Not Regular Expressions


Rules
1. The sequence can contain pegs of colors: red, yellow, green, blue, white, black
2. A color can be used any number of times in the sequence.
3. All four pegs of the secret sequence will contain a color - no blanks/empties are allowed.
4. Each guess must consist of 4 peg colors - no blanks.
5. You have 8 guesses to find the secret sequence.


Just say you wanted to write a program for this game, instead of worrying about what the graphics and forms look like, work on the logic of the game first. The gui can always be programmed later.

Go to this page for more hints on how to do your algorithm:
The link is http://www.uthinksmart.com/mastermind.htm

Wednesday, October 28, 2009

Gadgets

I have a phone, called the Motorola i290. I simply love it, and it was only $30! There are so many people who are into phones and all other types of mobile devices. I guess as a computer programmer who looks at code all day, the last thing that I want to do when I get home is to play with all of my gadgets that I have bought. There are so many people who do love the devices, and they talk about all of the apps that they can download, and all the things that they can do. Well how about this: I don't need an iphone play games. That's why I have a computer or a gamecube (and yes, I know it's old, but I still love my XMEN fighting game). I like to only buy items that can end up making me money or help me improve on some other things in my life. If it happens to be a fun little device, that is just icing on the cake. I'll try to talk about one of my fun gadgets in another post.

Thursday, October 22, 2009

Iphones, Perls, Oh my!

There so much to remember when programming mobile devices. When you write a game or application for the mobile devices, it is very good to try to remember all of the rules and quirks. For instance, you need to remember the screen size of the mobile device that you are programming. You have to remember the speed in which the device can access the internet. You have to remember so many more things, such as can it access things wirelessly, if the phone has a touchpad, a stylus, or if it has touchscreen capability. You also have to use the drivers that are supplied with the devices, and rememer which device you are programming for. The interface for an Apple Iphone is completely different from a Blackberry Pearl.

Tuesday, October 13, 2009

Itegrating Mobile Device Software

What do you need to do when you are trying to integrate software that you have written for mobile devices? There are some tutorials that suggest that you can just connect a cable to the device and just download the program that you have written. Others suggest that you upload the program to a server, and then use the mobile device to download the program over the internet. It would be nice if there was one definitive tutorial or userguide, but there are so many different types of mobile devices, and it is just hard to just get the data from the mobile device in the first place. I bet a lot of people don't even know how to display their own cellphone number right on it's screen (that includes me).

Wednesday, October 7, 2009

Subversion: Use it or Lose it

I hate the fact that version control software exists. Now they are absolutely great for allowing you to revert back to the last stable state of your program. But what if you did something significant, and you were almost at the point where you could fix it? Sometimes we never know that we can fix the problem, or we may be at a crossroads and we have to decide between trying to fix the bugs, or just starting over. So how do you know which to do? Well I would say use the 5 minute rule. If you see errors and you have seen them before, and you have fixed these problems before, I would say do not revert back to the old version. But if it takes you 15 minutes to fix one error and you have at least 4 errors, I would just say revert back to the previous stable version.

Tuesday, September 29, 2009

Behavior Software Modeling

I have always wondered, how do we succesfully model what happens in the real world? For instance, if you have a mathematical formula that calculates how long it will take someone to get from their home to the grocery store, how would you try to get the software to accurately display this? Short answer: There are many ways.

1st way: You could have some preset values in a list, and depending on which person you are selecting to go to the grocery store, you can just have the value already programmed into the formulas. For instance, Judy drives really slow, so if the grocery store is 30 miles away, and she drives at 30 miles per hour, it will take her 1 hour to get to the grocery store. If Karen goes to the store, she loves to speed, so if she drives at 90 miles an hour, she would get to the grocery store in 20 minutes, which is 1/3rd of the time it would take Judy to get to the store.

2nd way: You could plug this into a mathematical modeling system that take into account all of the variables that you feed into it. For instance in the mathematical software platform called Mathematica, you could feed in multiple values and try to get the computer to figure it out for you. For instance you say that 1. Judy drives 30 miles per hour; 2. She stopped to get gas for 8 minutes; 3. She went to McDonalds after going to the grocery store, so she was in line for 11 minutes; 4. The traffic was traveling at 5 miles per hour for 6 minutes after she left McDonalds, because there was a car accident.

There are many more ways, but you get the idea.

Thursday, September 17, 2009

IDE Advantages and Disadvantages

IDE Advantages

A couple of people have asked me 'what is an IDE?' so I'll give you a quick answer. IDE stands for Integrated Development Environment. This is a computer program, such as Visual Studio, or Eclipse, or Netbeans, or Borland, etc. that allows you to write a computer program in notepad form. The main advantage to using an IDE, instead of typing your program into notepad is that the IDE usually checks your code for errors as you type.

The biggest advantage that I have found:
1. You can run your code, line by line, and you can find out exactly where your errors are. On top of that, you can also view the status of other variables dynamically as you step through the code.
Look at this snippet of code(I am using Perl, not C#):

1 SisterAge=17;
2 BrotherAge;
3 print "Your brother's age is " . BrotherAge;
4 BrotherAge=15;
5
6

Line 3 has an error, because it is trying to access a value that hasn't been assigned yet. I know this is a simple example, but imagine if you have written about 1000 lines, and then you'll see how useful it is. It is so easy to miss a simple mistake, and you'll be pulling your hair out trying to find it!

There are other reasons why using an IDE is great:
2. You can use it to develop a GUI, because the most common controls, such as buttons, checkboxes, etc. already exist. You can just click and drag them to the screen.
3. The IDE can automatically fix your errors or suggest the proper fixes.
4. The IDE will automatically add the proper packages that you need to import (in Eclipse)
5. You can perfom multiple undos to correct your mistakes you just made.
6. You can get updates and notifications of common fixes in email or through your RSS within your IDE.
7. Some IDEs even have a team of people that can help you with your programming, and they can connect to your computer with remote assistance. It's sort of like a warranty that is provided with your purchase of an IDE (of course school provided software or free software doesn't count).

You can't count out that there are some drawbacks to using an IDE
1. They take up a lot of space on your computer
2. They can be a hassle to update and/or install packages
3. You have to learn each one well, and sometimes there is a steep learning curve.

However, the advantages outweigh the disadvantages, but I would say, PLEASE don't try to go out and learn them all. Just stick to one or two and learn them well. Here is a previous post about IDEs http://josephamospowell.blogspot.com/2009/08/visual-studio-vs-eclipse.html

Tuesday, September 8, 2009

People don't read blogs!

It is presumptuous to think that people sit around at home all day and read blogs on things that they don't care that much about. I know it's true for me. If I wanted to know about the new Halo game, I would go to someone's blog and find out what they thought of it.

There's just one catch... some of the blogs are too long! Just like reading a headline about a certain celebrity that we're obsessed with, or about some odd news around the world, we like our information quick and fast. We do not want to sit around and worry about all the details, we just want the juicy ones.

So if there is any piece of advice I would like to offer anyone who loves writing blogs: Keep it short!

Monday, September 7, 2009

2D arrays

About 2D arrays  

There is a game that is called Tic Tac Toe. It is a great game to understand how 2D arrays work. If you don't know what an array is, I would suggest searching for it online and doing some background work, or looking at my previous post about a 1D array. Basically a 2d array is just a group of items that are arranged in rows and columns. An example of an application that uses 2d arrays is Microsoft Excel. You have items that are in a row and column. Another example is Tic Tac Toe. That is a 3 X 3 array. That means that there are three rows and three columns. The thing to remember is that rows are first and columns are second. So in a 3 X 3 array, just say you have buttons (see picture). To set the name of the top right item, type:
button[0][2]="green arrow";






Another example is the starburst candy, which is a continuation from the last post (can't you see I love candy?)




Always remember to start counting at Zero, not 1.
If you have any questions, just email me at joseph@uthinksmart.com


Thursday, September 3, 2009

What Is An Array?

An array is a container that holds a group of data of the same type. An easy way to understand this is to think about food… I love using food examples to explain computer science concepts, because I LOVE EATING!! But anyway, think about Starburst candy. It has a wrapper, which you can think of as the container, and all of the individually colored candies inside represents the contents. A standard array is just one row long. Look at the picture of the starburst candy. We have to remember that we start counting from zero, and we need to make sure that we name each individual item. For instance in the example, the 6th element is represented by starburst[5] so all you have to do is assign the color of the starburst by using the number contained within brackets. This is pretty self explanatory. An important thing to remember is that we cannot try to print something that is not there, for instance, if you try to do this: print "the color of the 12th piece of candy is " + starburst[11]; Just for the record, the last example was written in the Perl programming language.










Above is an example of a 1D array.

The thing to remember is that arrays and other concepts exist in virtually all languages, all you have to figure out is the syntax.

I will talk about 2D arrays soon.

Wednesday, September 2, 2009

Emulator and exe files

One thing that I discovered while developing the Visual Studio mobile applications is that the emulator runs distinctly different from the .exe files. One perfect example is when doing the checks for the screen size. When you are using the Pocket PC or any of the Other Smart Device emulators, the screen works perfectly. Moreover, when you try to specify a grid size that is too big for the screen, you will get an error message alerting you that you cannot use that grid size and to select a smaller grid. I added this "screen integrity" check into the program to accommodate for different sized screens. In contrast, the exe program that is produced from the debug process does not link explicitly to any emulators and uses the .net platform to display a basic window. It does not do a screen check at all, and it will allow you to specify a grid that is much larger than the original. In this case, I just had to limit the amount of rows and columns within the GUI itself to prevent someone for specifying a huge amount of rows and columns.

Sunday, August 30, 2009

Understanding inheritance




I have always not really liked the idea of using inheritance. The reason why is because there is so much abstraction going on. Let me use a general example outside of programming. Just say you have a door, and it can do many things, it can open, close, lock, and unlock. Instead of going out to the forest and cutting down a tree and building the door, I could go to a manufacturer or hardware store and buy a door. Then I can modify it to do one extra thing, display the street numbers.


Now going back to programming, we could use somebody else's code that already made a class called Door. When we inherit the door, we don't have to make the open() close() lock() and unlock() methods, because somebody already did it for us. All we need to do is add a few lines like this:

public partial class myInheritedDoor : Door

{

// add your methods here

}


It took a little time for me to understand inheritance, but I did discover it is useful because it helps you save time. I would also suggest going to google.com or yahoo.com and type in "c sharp inheritance examples". Better yet to make your life easier, type in "c sharp basic inheritance examples"

Saturday, August 29, 2009

Iterative Teaching

There are all kinds of code that is readily available over the internet. All you have to do is search for it. But a common problem that I have (especially while trying to learn Java), is that a lot of code is pretty much snippets. I don't know about anyone else, but I cannot use snippets of code, and it is hard to understand unless I can see the whole code. After all, a lot of us are beginners, when it comes to learning new programs, and we don't know how to import packages, and libraries, especially if we can't see the whole code.

But there is help. I would suggest doing a search for classes that are offered in learning the syntax of a language, or some programming course for beginners. Even If I know how to do something, I'm sure the instructor will get to a part that I have had difficulty with before.

Also, If you teach from the beginning, that means that nobody is left behind. So just like there is iterative programming, there should be iterative teaching.

Monday, August 24, 2009

Compatability

I always wonder how difficult it would be to integrate older code into newer devices. People call this ability as "backward compatability" so they can integrate what's called legacy devices. For instance, a legacy device would be a car phone. We know that the car phone no longer exists, and has been replaced with cell phones. However, cell phones have had some code that have made it's way into some of the newer code. For instance, when you turn on a cell phone, there is code to make the back screen light up. This code was originally in the carphone!

Mobile Apps and Older Versions

I was working on trying to develop a simple application, and had a question: What if someone used a previous version of some software, such as Visual Studio 2000, or Borland Compiler (which is not a popular IDE for C languages anymore). If this happened, I wonder what compatability issues could surface.

There are so many different versions of linux (debian, linux kernel, fedora, ubuntu, centOs, etc) and other operating systems. I know that all of them have their share of issues, no matter if they are open source or not. The problem is, how do we catalog these errors and find ways to fix the problems?

Saturday, August 22, 2009

Visual Studio vs. Eclipse

There are so many programs to use when programming. You can use Microsoft Visual Studio (I'm currently using Microsoft Visual Studio 2005, and am now upgrading to Microsoft Visual Studio 2008...) But I don't want to! I hate changes! I know that when you are in this business, we have to keep track of the new developments, because after all, we are software engineers. We are the people whow are making new database programs, and new games, etc. And we definitely don't want to be behind the curve.

I am learning Eclipse, mainly because I have to learn how to develop using Java. Microsoft Visual J++ is not very popular, and it was Microsoft's answer to Java. The problem that I have is that since Eclipse is open source, there are so many different people who write different packages, etc. to the IDE, and a lot of them are non-standard. So it's very difficult to find support online.

I'll keep you posted on what I've learned in Eclipse, but I've got to say, I love Visual Studio. I would even use Notepad ++ to do java editing. The only problem is that Notepad ++ cannot help you do GUI, and it does not check your code for syntax errors. Ugh, I need to shape up, stop complaining, and learn Eclipse.

Tuesday, August 18, 2009

How to Subscribe to my Posts

The easiest way to subscribe to my posts are to go to google.com and choose the 'reader' option that is at the top of your page. You have to have a gmail account, and once you sign up for the account, it should be shown. You can also use other readers, and all you have to do is copy and paste this url into the reader: http://josephamospowell.blogspot.com/feeds/posts/default?alt=rss

If you have any questions, add a comment on this page. You can also find all sorts of help on the google homepage. Just go to google.com and type in 'Google Reader'

First Mobile Application

Ok, I am trying to develop the first mobile application. The only problem is that I have the Visual Studio 2005, and It has the options of Smartphone 2003, Pocket PC 2003, and Windows CE 5.0, but I didn't see the 'Smartdevice' option that is listed using the new version of Microsoft Visual Studio 2008.

I also have had to get used to the fact that some of the options are harder to work with, and that we are working with a very limited screen space... So that meana there is no trying to develop complete applications, and I have to keep track of if someone is using a thumb or a stylus (i've always hated that word, it sounds like glasses or some fancy word.. just say pointed pen!).

Oh well, we'll see how this development goes over time.