… or something like that.
Wow! It’s been a long time since I updated here. I AM alive.. I’ve just been very busy with a lot of stuff for the last month.
Since I last updated I have been doing a lot of work at my new job plus finishing up the summer semester at the community college, yeah, I’ve been busy.
When not working or studying, I can generally be found somewhere around town with some friends and a Frisbee. Try it, guaranteed fun time had by all. :-)
—
I’ve tried to take some pictures of the (damaged) Powerbook, but because of the shiny/reflective titanium surface, lighting that doesn’t go totally whack when you take a picture is hard to get. I will keep trying, but my first attempts haven’t gone so well.
—
Mrs A: Read your comment on my mom’s site, I’ll email you directly as soon as I’ve completed this. :-)
—
Ok, to segue back into school-related stuff. (Non-geeks can tune out now, if you wish.) I’ve had to/had the opportunity to (depends on how you look at it, I suppose.) write some (I think) pretty cool code recently.
I took a class this summer on Visual Basic .NET, there were 8 assignments total for the semester, plus mid-term and final. The first 6 assignments were pretty simple, just read the corresponding chapter(s) in the book and do some basic coding, not mindless, still mentally stimulating, but not too challenging. Well, the last two assignments changed that, completely. He introduced code requirements that were totally outside anything in the course material thus far, I was left floundering trying to guess how to perform some necessary functions to complete the code.
Thankfully, he(my instructor) called a meeting on campus and explained some concepts needed for the two assignments, this helped a lot, and I coded up both of them in an afternoon.
I think I’m going to insert some screenshots of the programs and explain what they do, I don’t know how interesting this will be to any of you, but here goes:
The first, DollarAmount, takes a word that the user inputs and calculates the dollar amount of that word, the dollar amount is calculated by taking A=1, B=2, C=3… Z=26 and adding the value of the letters together.
(Pardon the poor screenshot quality, silly JPEGs.)

Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click ' setup the necessary variables...Dim strWord As String = txtWord.Text ' send the value of our TextBox to a stringDim intCounter As Integer = 1 ' initiate a counter for our loop countDim intValue As Integer ' initiate a variable to hold the 'value' of the user's word' the real 'meat' of the code, does the actual work...For intCounter = 1 To Len(strWord) ' loop for each letter in the word..intValue += Asc(UCase(Mid(strWord, intCounter, 1))) - 64
' add up intValueNext ' loop...lblAmount.Text = intValue
' set the text of our output label to the value of the wordEnd Sub ' btCalc_Click
(Pardon the poor indentation, the code I turned in was correct, this blog-post editor isn’t very good.)
(Anyone here know why when that loop repeats, it automatically increments intCounter +1? I can’t figure out why VB .NET does… *shrug* Microsoft is weird.)
The concept behind this application seemed impossible, at first. Well, not impossible, but like I would have to write dozens or hundreds of lines of code, with many, many nested If statements. Not fun. However, a nifty trick about ASCII text was brought to my attention. That ‘nifty trick’ is this… a capital ‘a’ is given the value 65 on the ASCII table, capital ‘b’ is 66, and so forth, on to capital ‘z’ is 90, so, what happens if you subtract 64 everytime? A=1, B=2… Z=26. :-D
So, in one line of code, I could write a function that would get the ASCII value of the uppercase version of the given letter, subtract 64, and *bing* I was in business.
Sorry if I didn’t make all of this very clear, I’m just randomly spouting what’s on my mind. (Yeah, bad idea, I know, sorry!)
—
The second application: FileIO – works with input and output to/from files.
I’m not going to post up the code for this one, but I will include some screenshots and explain how it functions. This assignment built on the DollarAmount application with some added functionality and a different focus, as you shall see.
Load up the application and click ‘Click Me’, (I write for function, not aesthetics, sorry.) this File Open dialog presents itself:
(Click for larger view.)
Click on ‘Open’ and the application parses the file and throws back all kinds of entertaining output:
On the right side we have a box that lists all “Dollar Words” the value of these words has been determined to be ‘one dollar’ (By using the formula demonstrated in the code in DollarAmount)
This application also ouputs how many words it read, how many ‘dollar words’ were found, the average value of all the words, the longest word found (Yes, it’s running OUT of that textbox..), the value of said longest word, and the text and value of the shortest word found. (This last function is obviously kind of broken, because any single letter is going to be a very short word. This is not a bug however, the code is working as designed, if someone passed a file without short words, it would still list the shortest word amongst them.)
At any rate, I got an ‘A’ in the class. :-)
—
Ok, I think that may be about it for this (long overdue) update. Have a good night all.
12 Comments:
Whoe! =D That's awesome! You're brilliant. lol.
I need that!!!!!!!!!!
You still need to correct its punctuation....(incorrect comma usage) ;)
Gee, I thought that's what my mom was for at the church office?! :-p
That must be fun to play around with...either that, or just a big hassle!
I tried using that crap before... I didn't have much luck. :(
-Zak
All I've got to say is the next time you get something like this, please let me know so that I don't get freaked out when I see you talking, but there is nobody there!! I thought maybe you had actually gone over the edge this time!
--Mom
WOAH! cool. whats up man?
Wow...
technology...
craziness it is...
Lol... I would have thought the same thing your mum did... haha
<3 jordan
:-O woooowwww......
::giggles::
+hanan+
:-D
I appreciate your standing behind me, brother. There are few who do.
Pray. And pray hard.
PLEASE update? =( I think I could speak for everyone in saying that we all want you to do so! ;-)
acctually, it was a quote.
Post a Comment
<< Home