TheSwamp
Code Red => .NET => Topic started by: Keith™ on January 10, 2011, 10:35:47 AM
-
I have to laugh about this ...
My first programming class (required by the degree track) is VB.Net using the 2008 engine
Anyway, the first project is building a form with a half dozen buttons to display text on a label, different text for each button ...
Personally, the coding style is crap .. they want long descriptors for the objects using Pascal style formatting UGH!!!!
The exercise is technically correct, but it could be so much more efficient, at least code wise. For example, instead of having 5 buttons, each with their own event handler, why not simply use one handler with a switch statement to fill in the text.
Anyway, it is done ... waiting for the instructor to "check" it ...
-
??
Must have missed the thread where you talked about going back to school.
So ... you're back in school pursuing a degree? Computer Science? Are you studying at a physical school or doing the distance learning thing?
-
??
Must have missed the thread where you talked about going back to school.
So ... you're back in school pursuing a degree? Computer Science? Are you studying at a physical school or doing the distance learning thing?
In order ...
I am back in school getting a degree so that I can qualify to get a job doing what I have been doing for the last 20 years. I have applied for hundreds of jobs and I have had a total of 4 ... maybe 5 interviews. The qualifications for every job is a degree in Computer Science .. well la-tee-da ... I guess experience doesn't count ...
The school is a physical school but the classes (at least this semester) are all distance learning ... I still have to attend the campus for all tests and certain other items as deemed by the various instructors.
-
Good luck with school Keith. It feels like I will never be done right now.
-
Wow ... How many semesters?
I have 5+ months on my job hunt and zero luck... dang, but going back to school can't afford it... and to oldie... :)
All the best for you.!
In order ...
I am back in school getting a degree so that I can qualify to get a job doing what I have been doing for the last 20 years. I have applied for hundreds of jobs and I have had a total of 4 ... maybe 5 interviews. The qualifications for every job is a degree in Computer Science .. well la-tee-da ... I guess experience doesn't count ...
The school is a physical school but the classes (at least this semester) are all distance learning ... I still have to attend the campus for all tests and certain other items as deemed by the various instructors.
-
In order ...
I am back in school getting a degree so that I can qualify to get a job doing what I have been doing for the last 20 years. I have applied for hundreds of jobs and I have had a total of 4 ... maybe 5 interviews. The qualifications for every job is a degree in Computer Science .. well la-tee-da ... I guess experience doesn't count ...
The school is a physical school but the classes (at least this semester) are all distance learning ... I still have to attend the campus for all tests and certain other items as deemed by the various instructors.
Well you certainly don't need any luck <you'll smoke that program> so I'll just say "best wishes for a great experience".
I've been enjoying being unemployed for the last 3 months. Started taking some online python courses (http://www.oreillyschool.com/?79723) a couple days ago, primarily because I want the paper saying I know this sh!t, and I would like a gig that involves python exploitation in addition to the usual engineering automation I've done over the last couple decades. My belief is that intention (formally pursuing python programming) will change my future -- has every time in the past.
-
Well, I took my first quiz just now and I am pissed ... I missed one
I know damn well the answers to each question, but the questions were written in such a way that I had to interpret them in a manner that made sense based on the multiple choice answers available.
The bad thing is that the system doesn't let me see which one I missed. How stupid is that?
Incidently, here is a bit of text from the book used in the class (emphasis mine):
Good programming practice requires remarks in every procedure and in the Declarations section of a file.
Now while I agree that well written programming is commented in order to make it clear what is happening and to let the subsequent programmer know what is going on, some things are so trivial that commenting isn't required or desirable, in fact, when the code is trivial, it is desirable to NOT comment it.
I'm off to email the instructor requesting the information on the one question.
-
It is good programming practice to write code that is clearly self describing, supported with comments when and where applicable -- but superfluous documentation fluff should be discouraged.
fixed
-
:lmao: yeah, but I am pretty sure the ego of the author(s) wouldn't allow for my (our) arguing otherwise
-
yep, pick your battles :kewl:
-
Hey Keith,
How do you like the distant learning class?
Is it the type you get a book and assignments or the type where you watch recorded or live classes?
I switched from EE to Computer Science and need to decide for next semester where to finish up.
One college only offers some of the classes during the day and the other option is a further drive but offers the distant learning route.
The one that is distant learning was set up by a mac-humping, java-loving(programming language not coffee), windows-hating, spritzer drinking type. If that makes sense.
Very mac biased.
I hated those True/False questions where the answers is "depends". I had my fair share last semester.
-
man, you don't want to see some of my CS141 programming assignments.
well, maybe you do (i had fun with this one)
one was write a roman numeral calculator (command prompt) that would accept as a whole line "X + I" and return the answer in roman numerals, and had to follow all the proper roman numeral conventions. In ADA (bleh)
-
Jeff, I have taken these types of classes before, but this is a bit different and takes some getting used to. The problem isn't the classes or the way the material is presented, but rather the fact that the faculty obviously doesn't know how to use the system the college has installed.
For example ...
On Sunday evening I was emailed a syllabus for a database class. It came in my regular email .. not once, but three times, then when I logged into the system, I am required to "read the syllabus online" .. I mean seriously, I already got it in email three times ... then it says to log into the SAM server and start going through the exercises in conjunction with chapter 1 in the book. Ok fine ... WTF is the SAM system? Where is the link? So i send an email to the system admin asking where the link to the SAM system is ... they don't know what the SAM system is ... after an email to the instructor, I get another three emails on Monday telling me about the SAM system ... ok fine ... so I log into the system (not the SAM system) to get the information I need to enter into the SAM server when I log in ... and I am required to read it again ... OK fine ... I guess this is gonna be an everyday thing ... I log into the SAM system get setup and everything is fine ... I select the first assignment, the date it says it is available is NOW ... I work through the exercises .. really simple stuff ... deleting records, compacting databases, creating tables etc ... so I finish and go to select the quiz ... it also says available NOW ... so I select it to go through the quiz (I know I am gonna ace this thing) and there are two buttons on the popup ... "Save" and "Submit" ... when you select "Save" it is supposed to save the current state of the quiz so you can come back to it later and finish it. Well, I didn't get to start on it because I had an appointment to go to so I selected "Save" ... got back from my appointment and selected the quiz and it said "You have already completed this quiz" .. I was like WTF .. checked the score .. friggin zero ... email the instructor ... response is "That quiz isn't available until next week" seriously? why could I do it earlier and why does it say I got a zero?
Now the VB instructor tells the class they have to install Visual Basic 2008 and submit all homework in that version. I asked if they wanted it in the Express version or Standard. I was told to get it from another instructor ... I emailed that instructor for which version I needed and I was told to supply him with a DVD-9 ... WTF? seriously a DVD-9 what the hell is that? Do you mean a dual layer DVD? That is just over 8gb? Then he tells me that is what is required for the VB 2010 edition. So I told him I already have the 2010 edition, but the syllabus says to use the VB 2008 edition, to which I am told "We have a special licensing deal with Microsoft so you have to get it from us" Ok, what version? again VB 2008 ... I ask again Express or Standard? No response ... the book says to use the Express version, so that is what I am going with. It will still open with the standard version.
I am seriously questioning the ineptitude and ignorance of the instructors for this class.
Overall, once I sent a dozen emails to the tech department telling them that they had lots of dead links on the site and pointing out where they are, plus posting in the forum for other students about how to get the VB Express 2008 version from MS without having to go buy an assload of dual layer DVDs (which it doesn't require anyway) things seem to have calmed down a bit.
So to answer your other question .. the training is an interactive watch/try/apply tool written in flash (requires Adobe Flash) and the quizes are similarly written in Adobe Flash. The chapter assessments are handled through simple Javascript and HTML forms sent back to the server for posting (could easily be hacked), but it is effective for the quality of most students. Everything is backed up by a textbook and downloadable examples. Overall not too bad, except for the crap you have to install to be able to do the work.
UCP, I'll bet it would be fun to see some of them
-
Thanks for info Keith,
Here are the 2 colleges and links to CS degree any suggestions?
UWF Fort Walton (http://uwf.edu/catalog/deg.cfm#1)
FSU Panama City (http://www.pc.fsu.edu/Academics/Undergraduate)
-
LOL .. yeah, if I had to choose I'd go with FSU. I know the education you get from UWF will effectively be the same as from FSU, but the prestige that comes from FSU will probably get you farther after the fact. I also don't know anything about the UWF distance learning program, but the FSU one I investigated quite a bit and considered going there ... if only my funding would pay for it ;-)
-
For some, it seems that programming with visual basic is for donkeys. But it is not. The question is not the programming language, is a question of talent (coder's brain).
-
For some, it seems that programming with visual basic is for donkeys. But it is not. The question is not the programming language, is a question of talent (coder's brain).
I agree, it doesn't matter if you use VB or C# to do your coding it all gets reduced to CLI and behaves similarly.
-
With that email ending .edu you know you get all this(full-version) software for free
https://www.dreamspark.com/default.aspx
-
the standards I have to go by
Coding Standards
1. Use meaningful names that give the reader a clue as to the purpose of the thing being
named.
2. Use comments at the start of the program to identify the purpose of the program, the
author and the date written.
3. Use comments at the start of each procedure to describe the purpose of the procedure and
the purpose of each parameter to the procedure.
4. Use comments at the start of each section of the program to explain what that part of the
program does.
5. Use consistent indentation:(insert page and a half of examples)
-
With that email ending .edu you know you get all this(full-version) software for free
https://www.dreamspark.com/default.aspx
Cool, although some of them are free even if you don't have the .edu email address.
-
finally (geez) hit recursion in my programming class.
and I happened to be wearing my recursion t-shirt....
(like this one)
http://recursivetees.spreadshirt.com/recursion-definition-A4324133
-
It seems most code houses try to go with self documenting code, and are lite on the comments.
I'm very surprised that the use of VB, since it is the most platform dependant language. In a world where you're more likely to make a buck writing apps for smart phones, colleges are teaching VB? :-o
-
It seems most code houses try to go with self documenting code, and are lite on the comments.
I'm very surprised that the use of VB, since it is the most platform dependant language. In a world where you're more likely to make a buck writing apps for smart phones, colleges are teaching VB? :-o
Not only are they teaching VB, but they are using 2008 Express, even though 2010 Express is available, and VB is a required class ... in fact they won't let you take any higher level classes (C++ is considered a higher level class) until you do the VB class.
-
That is the class I am in now. You have to take the intro C++ class first because it is a preq. to all classes
-
So, my instructor changed the first assignment from the hands on exercise in the book to the basic "Hello World" application.
The instructions are now:
Create the Hello World! application and have at least three buttons two of which display "Hello World!" in a different language. One language must be English.
So, I chose 5 languages -
English, Spanish, French, German, and Klingon
I'm waiting to see how she reacts ;-)
-
That is the class I am in now. You have to take the intro C++ class first because it is a preq. to all classes
I hade to take "Beginning UNIX: Linux" two semesters ago. "C Language" last semester. I just started "C++ Programming Language" last week.
-
..."Beginning UNIX: Linux" two semesters ago....
With CSharp:
An open source, cross-platform, implementation of C# (It also has a compiler for vb.net) and the CLR that is binary compatible with Microsoft.NET
http://www.mono-project.com
Commercial add-in for visual Studio that enables developers to write .NET applications for non-Windows platforms. It allows developers to build, debug and deploy .NET applications on Linux (I tested it and seems to work well on red hat and suse).
http://mono-tools.com/
-
So, I had a project to turn in ... Excel ... develop a spreadsheet using supplied information and follow the instructions as written.
Item 8.
8. Use the buttons in the Number group on the Home tab on the Ribbon to apply the Accounting Number format to the range B4:G4 and the range B8:G8. Use the buttons in the Number group on the Home tab on the Ribbon to apply the Comma Style to the range B5:G7.
Ok, this is easy ... so I submitted my worksheet and I got -9 on the part requesting to apply the Comma Style. Well, there isn't a true comma style AFAIK, but there is a button on the Number group that has a comma on it and the tooltip says:
Comma Style
Display the value of the cell with a thousands separator.
This will change the format of the cell to Accounting without a currency symbol.
I have emailed the instructor telling him how stupid this is .. if they wanted Number format with a thousands separator, that is what the damn instructions should have said.
-
I got a fun one coming up... just gotta wait for it to be assigned (the for me to do it), and I'll post it here as a challenge.
(involves recursion!!!)
-
I got a fun one coming up... just gotta wait for it to be assigned (the for me to do it), and I'll post it here as a challenge.
(involves recursion!!!)
I ain't doin' ya homewerk buddy
-
I got a fun one coming up... just gotta wait for it to be assigned (the for me to do it), and I'll post it here as a challenge.
(involves recursion!!!)
I ain't doin' ya homewerk buddy
that's why I was going to wait until I was done.
-
:-P :-P
-
just trust me dude... it'll be a lot more entertaining then hello world in a couple of languages
-
just trust me dude... it'll be a lot more entertaining then hello world in a couple of languages
Hey now ... I was at least a bit creative and used Klingon (I hope the instructor has a sense of humor)
-
just trust me dude... it'll be a lot more entertaining then hello world in a couple of languages
Hey now ... I was at least a bit creative and used Klingon (I hope the instructor has a sense of humor)
I was going to post that probably some nerd wrote a computer language in klingon, but decided to google it and was right.
Klingon computer programming language
Var'aq is a programming language for those that speak Klingon. Here's "Hello world" in var'aq:
~ nuqneH { ~ 'u' ~ nuqneH disp disp } name
nuqneH
Roughly translated, it means "What do you want, universe?"
http://kottke.org/03/01/klingon-computer-programming-language
http://www.trektoday.com/news/070800_05.shtml
-
The links are broken moved
http://esolangs.org/wiki/Var'aq
http://www.reocities.com/connorbd/varaq/varaqspec.html
http://www.reocities.com/connorbd/varaq/index.html
-
just trust me dude... it'll be a lot more entertaining then hello world in a couple of languages
Hey now ... I was at least a bit creative and used Klingon (I hope the instructor has a sense of humor)
I don't care that no one ever see's it, inserting fun is well... just fun.
FUNCTION Tales_From_The_Cryption_Keeper
Put("Sorry Jack Ryan, you don't have high enough clearance for that");
-
just trust me dude... it'll be a lot more entertaining then hello world in a couple of languages
Hey now ... I was at least a bit creative and used Klingon (I hope the instructor has a sense of humor)
I was going to post that probably some nerd wrote a computer language in klingon, but decided to google it and was right.
Klingon computer programming language
Var'aq is a programming language for those that speak Klingon. Here's "Hello world" in var'aq:
~ nuqneH { ~ 'u' ~ nuqneH disp disp } name
nuqneH
Roughly translated, it means "What do you want, universe?"
http://kottke.org/03/01/klingon-computer-programming-language
http://www.trektoday.com/news/070800_05.shtml
Well, your source is close ... the actual text would be
nuqneH qo'
nuqneH: what do you want? Greetings (excl.)
qo': world, realm (n)
But then I also took the liberty of changing the other text on the form as well ... for example, instead of "Exit" I put
Qaw' ngoqDe'
Qaw': destroy (v)
ngoqDe': code - encoded message (n)
So, basically telling the user to "destroy encoded message"
It isn't exactly 100%, but any person capable of understanding Klingon would understand the phrase.
Another little thing I added was to change the window title to the language of choice. The instructor said to put our name in the title along with the Hello World phrase. In English it would be "Hello World - By Keith™" but in Klingon it is as so:
nuqneH qo' - ghajwI' Keith™
nuqneH: what do you want? Greetings (excl.)
qo': world, realm (n)
ghajwI': one/thing which is/does/ have, possess (v)
Roughly translated to: Hello World - Owner Keith™
It was quite fun ;-) I think maybe I'll do more Klingon stuff in the future ... as long as this doesn't backfire on me ;-)
-
just trust me dude... it'll be a lot more entertaining then hello world in a couple of languages
just turned in my recursive soduko solver...
-
So, my instructor gave me 100/100 on the first two assignments - hello world and some other bizarre application that displays different text depending on which radiobutton and checkbox you pick. For my last four projects, I have taken considerable liberty with my programming. I've introduced things that aren't in the scope of the class ... things like GDI printing, structs, enums and <gasp> even data driven error control.
I find it to be laziness when programmers users rely on Try/Catch blocks to prevent invalid data from being entered.
The textbook says to use a Try/Catch block to prevent a user from entering text in a numeric textbox. I prefer to simply find out if the text is numeric before I try to act on it ...
Why would I use
Try
ThisVar = Cint(TextBox1.Text)
Catch ex As Exception
MsgBox(e.Message)
End Try
When this will give a better result and allow you to filter stuff as you go.
If IsNumeric(TextBox1.Text) Then
ThisVar = Cint(TextBox1.Text)
Else
MsgBox("TextBox1 can contain only numbers")
End If
Maybe it is just me, but I hate like hell seeing those errors line up in the immediate window ..
Heck, I even use Option Strict and treat all warnings as errors ... in the end, the code is much more stable.
Oh well, such is life.
-
Well Keith, have to agree with the book on this one. Since CInt throws an error, it makes sense to use the try catch block. It's by design. Also, the approach you suggest doubles the work load if the value is numeric, by first checking, then converting. If the input data needs validation between a range, then try/catch/finally is the proper solution.
-
Your code contains a bug. Enter "2,147,483,648" into the TextBox, and you should get an OverflowException.
It may also be a bug because the value of the TextBox isn't under your sole control, and may change between the If and the CInt. I'm not sure if that's true in this case, but this (for example) would definitely be a bug:
if (File.Exists(f))
File.Open(f)
-drg
-
Well Keith, have to agree with the book on this one. Since CInt throws an error, it makes sense to use the try catch block. It's by design. Also, the approach you suggest doubles the work load if the value is numeric, by first checking, then converting. If the input data needs validation between a range, then try/catch/finally is the proper solution.
We will have to agree to disagree here ... the workload is doubled on the programmer perhaps in writing code, but the processor workload is negligibly impacted by the extra call to IsNumeric.
Using that logic, it would be ok to use a loop and then a "On Error Resume Next" simply because .. well, it must not be what we wanted so lets just ignore it.
Your code contains a bug. Enter "2,147,483,648" into the TextBox, and you should get an OverflowException.
It may also be a bug because the value of the TextBox isn't under your sole control, and may change between the If and the CInt. I'm not sure if that's true in this case, but this (for example) would definitely be a bug:
if (File.Exists(f))
File.Open(f)
-drg
It doesn't when the box is limited to 5 characters ... its all about design. Understand what can be entered and then you can understand the minimum code needed to handle it.
Incidently the text actually insists that all numbers are parsed using the Parse method of the expected type ... whether that is Decimal, Integer, Double or Long ..
-
I would use tryparse, see http://msdn.microsoft.com/en-us/library/f02979c7.aspx
-
Well Keith, have to agree with the book on this one. Since CInt throws an error, it makes sense to use the try catch block. It's by design. Also, the approach you suggest doubles the work load if the value is numeric, by first checking, then converting. If the input data needs validation between a range, then try/catch/finally is the proper solution.
We will have to agree to disagree here ... the workload is doubled on the programmer perhaps in writing code, but the processor workload is negligibly impacted by the extra call to IsNumeric.
More along the lines of don't have redundant code. In the provided example, try/catch is the proper way to convert the input to an int. Why fight the language and API?
-
if (File.Exists(f))
File.Open(f)
Would you recommend this instead?
static StreamReader TryOpen (string name)
{
if (File.Exists (name))
return new StreamReader (name, Encoding.ASCII);
return null;
}
There's a lot more to worry about, considering that only reads/writes of primitive types T where sizeof<T> <= sizeof<nativeint> are guaranteed to be atomic.
-
More along the lines of don't have redundant code. In the provided example, try/catch is the proper way to convert the input to an int. Why fight the language and API?
I see your point about not having redundant code, I just don't accept that IsNumeric(TextBox1.Text) is any less a valid way to catch user input error than a Try/Catch block.
I just did a simple test to see the difference in execution between a Try/Catch block and an If/Then block using IsNumeric and the results pretty well dispel any notion that one is introducing redundancy, at least in the execution of the code ...
My timing test reveals that in debug mode the execution time is always longer in a Try/Catch block than an If/Then, however, in a release build, the number of ticks for the Try/Catch block is only sometimes longer, but when it is, it is significantly longer. The If/Then is always equal to or less than the time ... at least in this test. YMMV
-
Would you recommend this instead?
Sorry, I wasn't trying to exemplify "the Right Thing" in terms of how to open a file in a particular framework. I was trying to point out that {pseudocode}
if file.exists(f)
file.open(f)
is a bug anywhere because the file may disappear between the .exists() and .open() calls -- it's not in the programmer's control. And that I wasn't sure whether a textbox's value was [similarly] vulnerable to changes outside the programmer's control between the IsNumeric() and CInt() calls.
In the file case,
try
file.open(f)
catch IOError
Is the only proper thing to do -- no pre-checking for existence, permissions, lock state, etc. -- they're all liable to change at _just_ the wrong time.
-drg
-
I didn't mean to suggest that using a Try/Catch block was wrong, but rather than using it as an end-all bug catcher, the programmer should spend a little time thinking through the requirements of the code, the effects of user input and possible scenarios.
Certainly no programmer is capable of recognizing ALL potential pitfalls and as the previous post points out, there are some things that are simply not within control of the code, but my assertion is that when known possible conditions exist, they should be provided for by code.
-
I typically have used a textbox's Validating Event Handler with tryparse
-
IMHO, using try catch to validate a textbox is a bit heavy handed, but not unreasonable. I certainly would use try/catch/finally when doing file io operations, as one may need to perform cleanup when the exceptional happens. but this is comparing apples and oranges.
The correct approach if you're doing more than one textbox for numeric's would be to subclass textbox as shown here http://msdn.microsoft.com/en-us/library/ms229644.aspx
-
Or override OnVaildating event
From here http://www.theswamp.org/index.php?topic=36832.msg418314#msg418314
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.ComponentModel;
using System.Drawing;
namespace WindowsFormsControlLibrary1
{
public class IntegerRedTextBox : TextBox
{
public IntegerRedTextBox()
{
OriginalColor = this.BackColor;
}
public Color ChangeColor { get; set; }
private Color OriginalColor { get; set; }
private bool ChangeBackColor()
{
char[] chars = this.Text.ToCharArray();
foreach (char c in chars)
{
if (!Char.IsNumber(c))
{
this.BackColor = ChangeColor;
return true;
}
}
this.BackColor = OriginalColor;
return false;
}
protected override void OnValidating(CancelEventArgs e)
{
base.OnValidating(e);
e.Cancel = ChangeBackColor();
}
}
}
-
I am seriously questioning the ineptitude and ignorance of the instructors for this class.
I've just read this thread and I must say, the hair at the back of my neck is standing up and my toes are curled into position in a way that I wonder how long it'll take to uncurl! I'm not surprised, though, I hear things like this quite often. Education isn't what it used to be!
I must say you're quite courageous to enter into a CS "education" (edutainment?) when you're already far ahead of the pack that the curriculum is aimed at. I've seen it over the past 20 years with some other folks and it usually ends up being somewhat frustrating to jump through hoops that you could've designed yourself. The whole "we require a degree" sounds like a brainless robo-parrot policy and indicates that too many companies are no longer interested in real experience and skill but rather want worthless pieces of paper that in the real world mean nothing. Being a rebel at heart I spent much of the 90's hiring and contracting folks that only had proven experience and actively ignored anyone with "papers". If more companies did that and knew how to properly assess and judge someone's abilities they'd be so much better off.
The one thing that keeps coming to mind here is a question, though. Have you ever considered going into business for yourself? It may be easier to contract for those many companies than it is to get a job there and while there are certain risks that always come up when being self employed there's also a lot of benefits. Just a thought...
Cheers,
Stefan.
-
The one thing that keeps coming to mind here is a question, though. Have you ever considered going into business for yourself? It may be easier to contract for those many companies than it is to get a job there and while there are certain risks that always come up when being self employed there's also a lot of benefits. Just a thought...
Actually I have, but if I do in fact become self-employed, I will lose whatever unemployment I have, regardless of the amount of income I generate. In fact, I had to fight with them to get it re-instated after I reported having made $100 doing odd jobs. I was told that I couldn't get unemployment if I earned wages from a self-employment source.
I have a conference call on Wednesday with a marketing research firm out of Olathe, Kansas. I have done freelance work for them in the past and we have been in negotiations for a while over getting an open end contract. If that works out, I'll be travelling to Kansas in March and making recommendations for setting up a data collection center. Fun stuff -NOT - but it WILL be a paycheck.
Plus, there is the chance that I'll have to go to Honolulu in the fall - now that would be terrible, wouldn't it.