Sunday, April 22, 2012
Measuring the length of each line of a string
This is what it does: You tell it the string that you want to use, the text control that it is going to use and the number of rows you want to display. The function builds line-by-line the string until no more will fit and returns the new string that will fit within that control.
Private Function fitTextToLength(stringToFit As String, textfield As Object, rows As Short)
' This function is very important for displaying text in the alerts properly.
' stringToFit is the string that is going to be used to populate the control
' textField is the object where teh text will be placed. We will have to consider the size
' of the field for this function.
' rows indicated how many rows is wanted for the field. Multiline fields would be more then 1
' depending on useage requirements
' Split the words
Dim words() As String = stringToFit.Split(" ")
Dim complete As Boolean = False
Dim counter As Short = 0
Dim row As Short = 0
Dim stringLine As String = String.Empty
Dim finalText As String = String.Empty
' Loop until we find a complete string
While Not (complete)
' Build a string to mesaure
' This is built word-by-word until the string is too long for the objects width
' Each word is not added to the string until it is known that it will fit.
Dim myString As String = stringLine & words(counter) & " "
' Measure the string length for comparision
Dim g As Graphics = Graphics.FromHwnd(textfield.Handle)
Dim f As SizeF = g.MeasureString(myString & "...", textfield.Font)
' Determine if the built string fits the width of the object
If f.Width <= textfield.width Then
' Concatenate the string to the main string
stringLine = myString
counter += 1
Else
' Check to see if we have reach the max row
If row = rows Then
' Show that there is more text using "..."
finalText += "..."
' Complete the loop
complete = True
Else
' Increase the row
row += 1
' Concat the final text
finalText += stringLine
' Clear the stringLine for the next line to build
stringLine = String.Empty
End If
End If
' Make sure that we don't go beyond the array
If counter >= words.Length Then
' Concat the build string to the main string
finalText += myString
' Exit the loop
complete = True
End If
End While
' Return the result.
Return finalText
End Function
Friday, March 16, 2012
Progress
Thursday, February 2, 2012
Lack of drive
SGA is having calendar issues and I just don't have the energy to fix it. I feel like I have writers block. I am trying to do other things to get motivated, but honestly I'd rather just sleep all day.
Saturday, January 14, 2012
Starting a project
To start I researched some of the things that I would need in-order to accomplish what I wanted to do. Things like IMAP support and the new features of Windows.
I drew up plans for what the program would do, and the basic outline for the modules. I also planned out an rough guess of what the forms would look like. I spend quite a bit of research trying to find out what interfaces work best for the program I am making so that users will be able to easily use the program.
Something that may seem unrelated is my website, yet it is not. A strong web presence is important since I don't sell my software in stores or anything. Another step in starting my project involved redoing my site and adding a section for Raven. I have decided to do a few things differently then I did with SGA in terms of the website. SGA updates through the update form and can automatically down the files needed on the click of a button. Raven will alert a user to an update and link to the website where the update can be found. This will make the website more of a source for users and will make it possible for me to only maintain one setup version. Each update will have a dedicated page that will have useful information for users so that they can download files easily.
With having the update section of the website started, I was able to begin the Raven project with the updating part of my code. It made sense to add that first because with a project that is underdevelopment, having a way to update to new versions will be important for testing. Rather than using the text file that SGA uses, Raven is using the more robust XML file:
' Load data into variable
Dim update As updateInformation
With update
.major = CShort(document...<version>...<major>.Value)
.minor = CShort(document...<version>...<minor>.Value)
.month = CShort(document...<version>...<month>.Value)
.day = CShort(document...<version>...<day>.Value)
.text = document...<text>.Value
.URL = document...<URL>.Value
.requiredUpdate = CBool(document...<required>.Value)
End With
From there I started designing my forms. It is important to me that all the forms have a uniform look. Coming up with a nice design from the beginning is important so that I don't have to redo all the forms later in development. SGA went through many different versions because the UI was always being improved and the underlying code was always being rewritten for efficiency. I am trying to make Raven better from the start.
So since I stated the actual coding, I figured it would be best to make a documentation file of all the things that I actually finished for my own record. It helps to know what you worked on and what your ideas were, my memory is not good enough where I can just remember everything.
NOTES
Things to do:
Add application variables to remember system settings.
Implement detection for the computer going idle so that alerts show once user returns.
Start alert windows, and client GUI.
------------------------------------------------------------------------
January 8, 2012
Cleaned up code and removed additional form that was the startup form.
Moved account code to the same file into a new module.
Started making send email window.
Some performance enhances.
More testing of present functions.
Added IMAP stop function
Added power mode handler
Added windows shutdown handler
Added display changes handler
------------------------------------------------------------------------
January 7, 2012
Experimented with IMAP IDLE (push) support
Worked on client UI and added meesages to display
------------------------------------------------------------------------
January 5, 2012
Created a account management window UI
------------------------------------------------------------------------
January 4, 2012
Designed message checking system that loads new messages in to each accounts queue and to a new message queue.
Using events to alert the program to completed message checking, messages are passed to the function to initiate alerts and update the ui
various supporting functions were added.
A toolstrip along the bottom showing the progress of message checking and program status added.
Did some testing to get emails to see if program would run correctly.
------------------------------------------------------------------------
January 3, 2012
Updates:
Started working on the startup commands. Switch -exit shutdown the program.
Added some IMAP support
Added classes to cover accounts and messages
Added the start of an alert messaging system
Did research on how IMAP works.
------------------------------------------------------------------------
January 2, 2012
Icons:
http://www.webiconset.com/category/free-icons/
http://mediadesign.deviantart.com/art/HP-Dock-Icon-Set-71481581
http://www.freeiconsweb.com/Free-Downloads.asp?id=1700
Updates:
Fixed debug error that was prevening me from using breakpoints
Added update function the the application startup as a seperate function that can be easily called from anywhere.
Included forced update for alpha and beta versions
created sample xml file on server for updates
Designed update window interface
Added taskbar icon that looks like an envelope
Started settings window design
Made post on dream in code for UI designs on settings.
Added tabless tabs to the settings page to ease design process and make things more efficient.
Add my name and a link to my website.
setup general, display, connection, sounds, technical, security, contacts, and credits tabs.
Started design on a comments window to allow users to easily contact me.
I am working slowly on Raven to make it better. My college classes have resumed and I am back to work after having a holiday break, so development will probably be even slower now. Yet so far, Raven is interfacing with IMAP and able to display messages. It is far from finished, but it is a start.
Monday, January 2, 2012
Progress
Tuesday, December 13, 2011
Website
Sunday, December 11, 2011
Raven design
Wednesday, December 7, 2011
Raven
Technique
Code block
I have not written much in a while. For a long time I have felt worn out and tired down to my bones; I have had no energy to do much of anything. In contrast, there have been times when I couldn’t do anything other than write code; it practically consumed me. It is for that reason that I have been burnt out for so long – I haven’t found the safe medium where I can continue to be creative and have energy to keep a healthy momentum.
The amount of energy it takes to write code is amazing. I don’t think about my project when I have time to dedicate to development exclusively – I go as far as dreaming about it in my sleep; I think about it in the shower and on the drive to the store. While this is happening I am able to get things done quickly and solve problems extremely well. The issue arises when the headaches start and my concentration becomes short. It has been so bad for me that I have dropped some of my classes in college because I could not focus on anything, even the easy stuff. I graduated Magna Cum Laude with my Associates Degree; I should be able to do it again with my Bachelors.
So what is a good way to keep things under control? From what I can tell, playing video games is a great way to avoid burn out. There is an exception: only play games that don’t require too much thinking! I have been playing StarCraft 2, which is known as a thinking man’s game because of all the strategy involved, and it has helped increase my burn out. Playing something like Left 4 Dead or Angry Birds is much better to cleanse the mind. The point here is to entertain yourself and get your brain to stop thinking so much. It needs a break!
I have felt my health declining for a little while now. I notice that when I am programming or playing games that I tend to eat too much and get no exercise. This could be one of the reasons I feel old and achy. Getting out of my comfy chair to do some activity would be a good start. My wife has been giving me vitamins that are supposed to give me more energy.
I can feel the rusty cogs in my head are starting to turn; I am getting ideas for a new project. It will be hard to change the way I do things, but it should be beneficial in the long run to try and balance my time so that I don’t get burned out so fast. Being more active and eating better will help. Working on individual sections at a time and taking break will help. Playing games will give my mind a rest.
Skills
I have been at this stuff for awhile, yet I still don't have any idea what part of programming I am best at. I always keep my interests in finding a need for a piece of software that could be useful, at least to someone. My most successful projects began as programs that I had a need for personally. Programming is not as simple as understanding the logic and syntax, you have to have the ideas and enthusiasm to complete a project all the way until it is finished. The hierarchy in picking a career path does not end once you decide to be a programmer: there are so many aspects within the programming world that you may never experience.
It seems that video game programming is the most well known, as far as I have noticed; it is also a very diverse segment in itself. It is very difficult to create a game by yourself. An individual cannot get things done as quickly as a group. An individual cannot be talented in as many areas as a group. What exactly would you do as a game programmer? It is about more than writing the code; a game requires many different types of programming to be successful:
· Logic programming to control the aspects of the game that are not static. Things like gravity, sprites, and projectiles.
· Network programming to allow for online multiplayer connections.
· Graphics programming to maximize graphical performance and have the best graphics.
· Interfacing programming so that the awesome code that was written can be used easily and fully by the user.
· And several more could easily be included.
So my point? My point is that being a programmer is like being a piece in a puzzle. While you may have the power to create applications on a small scale that doo amazing things, your power can be exponentially greater in a team of individuals with individual talents. You have to be able to work on your own or in a team. There are times when you will need to do both in order to succeed.
Even with the projects that I have worked on, I have had the help and support of other people who share an interest in the project. It is amazing how the internet allows people to come together to create something. Even if someone doesn’t have the experience to write code, they can be instrumental in helping create a great program because they have insight from a different aspect then you might have. Your program could do everything and clean the dishes, but if it is hard to use no one will want to use it.
Sunday, May 15, 2011
Variables
short: Limited to being between -32768 and 32767long: Limited to being between -2147483648 and 2147483647integer: Limited to being between -2147483648 and 2147483647double: Limited to numbers with decimals
This is a string.There are to variable types that can store characters:
Char: Stores one character.String: Stores an array of characters.
Structures: As the name implies, a structure is an object that contains things, much like a house or a building does. While these things are not like those of a house, they are important to the programmer. The structure is a collection of other variables, like shorts and strings. The big difference between the basic variables and a structure is that a structure holds much more information then a basic variable.
Classes: A more advanced structure is called a class. Each class is similar to a structure as they hold many different variables, but in addition a class also can hold subroutines and functions that can be used to ensure that the data stored in the class is correct. This is very handy when it comes to classes that store calculated data by having the calculations occur automatically when a new object is dimensioned.
Dim number as shortDim trueFalse as booleanDim myText as string
Structure customStructureDim name as stringDim age as shortDim phoneNumber as stringEnd StructureDim myStructure as New customStructure
Public Class customClassDim name as stringDim age as shortDim phoneNumber as stringSub New(name as string, age as short, phoneNumber as string)Me.name = nameMe.age = ageMe.phoneNumber = phoneNumberEnd SubEnd ClassDim myClass as New customClass
Wednesday, May 11, 2011
Getting started
Current programming technology encapsulates Object Oriented Programming (OOP) as the main basis for allowing interaction between the user and the computer. Event driven coding has replaced the old line coding in the early days of computers.
When I wrote code using DOS in a language called QBASIC, often times the programs were very limited in scope. Each program did one thing, and did it well. Now with todays technology, applications are required to do many things at the same time, and often are required to duplicate themselves to complete the task given. This is where objects are needed. As a programmer, you must identify all the aspects of what your object is made of. What is the problem that you are trying to solve with your program?