One of my recent projects required that I round the price I was calculating to the nearest half dollar. This started out at a pain. Rounding to the floor, or to the ceiling, or normal rounding is quite easy. But I have never had to round to the nearest half dollar. (or quarter dollar) After a little bit of time thinking about it, I came up with a solution. (more…)
Archive for the ‘Programming’ Category
Rounding to the nearest half dollor (or quarter dollar)
Wednesday, June 18th, 2008C# Image Server Client (Using XML for the application protocol)
Thursday, June 5th, 2008Our assignment in class this week was to create a network based client that would connect to the teachers Image Server and make requests via XML for information such as getting a category list, getting and image list, and ultimately, getting the image itself. There were a few different things that needed to be handled to make this work properly. Granted, this isn’t the best code in the word, since the summer semester is so short, but it does work. For it to run properly, you have to be connected to the VPN at UVU. (more…)
C# Database Connection Example Program
Thursday, May 29th, 2008We were given a programming assignment in my network programming class that is defined as below. This is my solution to the assignment. I know it isn’t the best code in the world, but it works and will hopefully help someone else who is in need of knowing how to connect to a MSQL database using C#.
Write a program that will connect to the Image Database, list the categories from the category table then when the user selects a category in the list, show the name of all images in that category in another list box. To access the database, you will need to be logged into CSEVPN. (more…)
Multicast Network Chat in C#
Wednesday, May 21st, 2008In my network programming class CS3670 at UVU (UVSC) we had an assignment to write a multicast chat program that would allow everyone in the class talk in the same chat window. This was used to show that we were able to use the multicast addresses and to also demonstrate our use of the UDP client libraries. Here is my solution: (more…)
C# (C Sharp) Console and Input Program
Tuesday, May 20th, 2008Well, I’ve started a network development class at UVU (UVSC) and I have to quickly learn C Sharp to be able to get my assignments and labs done. Here is my version of the first lab (which is a simple hello world style lab) (more…)
Microsoft AlphaImageLoader crashing IE 6
Tuesday, May 20th, 2008I’ve been developing a website for a local group that supports the arts (www.scera.org). The client called my place of work and mentioned that some of their users were having difficulties with IE 6 locking up. After spending several hours on the issue, I discovered that Microsoft has a bug, that causes the filter to no work properly when the images are preloaded. So to fix this issue I had to do the following: (more…)
EVEN-EVEN Simulation
Tuesday, January 22nd, 2008Simulate the EVEN-EVEN automaton found in the book in code. Don’t just “solve the problem”—implement the machine (i.e., there should be evidence of the states and transitions in your code). Input at least the strings below. The output should echo the string in quotes and indicate whether it is in the language EVEN-EVEN or not.
a, abab, aabbab, baab, <the empty string>
(more…)
CakePHP: Gift from Heaven, or from Hell?
Tuesday, January 15th, 2008My development activies have called on my skill and talent to quickly and efficiently learn new things. So it is with CakePHP, at work we have several projects that need to be completed quickly with out much hassle, after looking at several different options, we decided to use the CakePHP libraries. I quickly discovered that CakePHP has some awesome features that allow me to quickly and easily built website from scratch.
Makefiles made easy
Thursday, December 6th, 2007Makefiles are quite simple and easy to use once you have learned the basics. I always felt that they were daunting due to the sheer size of most open source project make files. So I decided to start small, and work my way up. So, to help you get started with them I will start with the basics. (more…)
Changing auto_increment on MySQL
Thursday, December 6th, 2007From time to time, when programming with MySQL, I have needed to change the auto_increment value to something other than the default (Typically it starts counting with 1 and goes up from there). To change this, simply use the following command:
mysql> ALTER tablename AUTO_INCREMENT=new_number
There you go, it is that easy to change the auto increment value for MySQL.
NOTE: I have discovered that MySQL will not allow you to set the auto_increment value to a number smaller that what is currently set. The data must be truncated and then set to get it to work properly.
