|
i am sooo sorry i never knew how things are done here,this is my first time of askin a question,i am not in the habi....I AM SO SORRY. i am actually workin on a desktop application..
and nobody will understand my code but i want to implement it in this area
its over 5000 lines of code, i thot nobody will be interested in that sh*t..
I AM VERY SORRY IF I HAVE OFFENDED ANYONE WITH MY APPROACH..
I WILL BE VERY GLAD TO REMAIN HERE...
if (readval1.Read())
{
//assign these values into current sem sum variables
int TUT3, TUP3, COUT3;
decimal WS3, GPA3;
TUT3 = System.Convert.ToInt16(readval1.GetValue(3).ToString());
TUP3 = System.Convert.ToInt16(readval1.GetValue(4).ToString());
WS3 = System.Convert.ToDecimal(readval1.GetValue(5).ToString());
GPA3 = System.Convert.ToDecimal(readval1.GetValue(6).ToString());
COUT3 = System.Convert.ToInt16(readval1.GetValue(7).ToString());
MessageBox.Show("TUT = " + TUT3.ToString() + "TUP = " + TUP3.ToString() + "WS = " + WS3.ToString() + "GPA = " + GPA3.ToString() + "Outstanding = " + COUT3.ToString());
//add the values of previous sem to current semester
decimal CUT3, CUP3, AOUT3;
decimal CWS3, CGPA3;
CUT3 = (TUT3 + PTUT2);
CUP3 = (TUP3 + PTUP2);
CWS3 = (WS3 + PCWS2);
CGPA3 = Math.Round((CWS3 / CUT3), 2);
AOUT3 = System.Convert.ToInt32((CUT3 - CUP3));
MessageBox.Show("CUT =" + CUT3 + " CUP = " + CUP3 + " CWS =" + CWS3 + " CGPA =" + CGPA3 + " OUT =" + AOUT3);
//update All Semester Summary
string updalltab = "UPDATE AllSemesterSummary SET Levels = '200', Semester = '2', CumulativeUnitTaken = '" + CUT3 + "', CumulativeUnitPassed = '" + CUP3 + "', CumulativeWeightedScore = '" + CWS3 + "', CumulativeGradePointAverage = '" + CGPA3 + "', OutstandingUnits = '" + AOUT3 + "' WHERE MatricNumber = '" + matnumber + "' ";
Oluwayomi Ige
MCP MCAD.
|
|
|
|
|
Please ignore the duplicate post
Best Regards
-----------------
Abhijit Jana
"Success is Journey it's not a destination"
|
|
|
|
|
This is about as bad as code gets, plus you have not actually asked a question - you've just posted your crap repeatidly.
Stick to 419's!
|
|
|
|
|
Jamie is correct. This is some really nasty code and you haven't asked a question about it.
Oluwayomi wrote: and nobody will understand my code
So, you're saying that you're writing code like this in an effort to build "job security" for yourself?? Thank God, 'cause I wouldn't want to be the poor bastard coming in behind you to support this code.
|
|
|
|
|
i am sooo sorry i never knew how things are done here,this is my first time of askin a question,i am not in the habi....I AM SO SORRY. i am actually workin on a desktop application..
and nobody will understand my code but i want to implement it in this area
its over 5000 lines of code, i thot nobody will be interested in that sh*t..
I AM VERY SORRY IF I HAVE OFFENDED ANYONE WITH MY APPROACH..
I WILL BE VERY GLAD TO REMAIN HERE...
if (readval1.Read())
{
//assign these values into current sem sum variables
int TUT3, TUP3, COUT3;
decimal WS3, GPA3;
TUT3 = System.Convert.ToInt16(readval1.GetValue(3).ToString());
TUP3 = System.Convert.ToInt16(readval1.GetValue(4).ToString());
WS3 = System.Convert.ToDecimal(readval1.GetValue(5).ToString());
GPA3 = System.Convert.ToDecimal(readval1.GetValue(6).ToString());
COUT3 = System.Convert.ToInt16(readval1.GetValue(7).ToString());
MessageBox.Show("TUT = " + TUT3.ToString() + "TUP = " + TUP3.ToString() + "WS = " + WS3.ToString() + "GPA = " + GPA3.ToString() + "Outstanding = " + COUT3.ToString());
//add the values of previous sem to current semester
decimal CUT3, CUP3, AOUT3;
decimal CWS3, CGPA3;
CUT3 = (TUT3 + PTUT2);
CUP3 = (TUP3 + PTUP2);
CWS3 = (WS3 + PCWS2);
CGPA3 = Math.Round((CWS3 / CUT3), 2);
AOUT3 = System.Convert.ToInt32((CUT3 - CUP3));
MessageBox.Show("CUT =" + CUT3 + " CUP = " + CUP3 + " CWS =" + CWS3 + " CGPA =" + CGPA3 + " OUT =" + AOUT3);
//update All Semester Summary
string updalltab = "UPDATE AllSemesterSummary SET Levels = '200', Semester = '2', CumulativeUnitTaken = '" + CUT3 + "', CumulativeUnitPassed = '" + CUP3 + "', CumulativeWeightedScore = '" + CWS3 + "', CumulativeGradePointAverage = '" + CGPA3 + "', OutstandingUnits = '" + AOUT3 + "' WHERE MatricNumber = '" + matnumber + "' ";
Oluwayomi Ige
MCP MCAD.
|
|
|
|
|
Oluwayomi wrote: I AM VERY SORRY IF I HAVE OFFENDED ANYONE WITH MY APPROACH..
I WILL BE VERY GLAD TO REMAIN HERE...
You didn't, and I apologise if you thought it was personal. There are some rules when posting in forums, and things can get a bit heated (read sarcastic) if these rules aren't adhered to. The first rule is that we don't do work for others. We'll help if they are stuck on a particular problem, but we won't write solutions. Secondly, we need decent descriptions of the problem - only then can we help. Third, we need to know that you've tried to solve the problem for yourself.
Tick all those boxes and you'll find your time on the boards a much more pleasant one.
|
|
|
|
|
Oluwayomi wrote: (To whom it may concern)SEE THIS ITS IMPORTANT
Try to put some useful information in the subject line, so that it says anything about the question. That subject line contains no useful information at all.
Oluwayomi wrote: I AM VERY SORRY IF I HAVE OFFENDED ANYONE WITH MY APPROACH..
I WILL BE VERY GLAD TO REMAIN HERE...
You are very welcome to stay here, if you just STOP SCREAMING!
Oluwayomi wrote: nobody will understand my code
Perhaps if you said anything at all about what the code is supposed to do...?
Oluwayomi wrote: int TUT3, TUP3, COUT3;
Don't be afraid to use variable names that are somewhat longer. If you can see from the variable name what the variable is supposed to be used for, it's easier to understand the code, and easier to find errors.
Oluwayomi wrote: UT3 = System.Convert.ToInt16(readval1.GetValue(3).ToString());
An int is not an Int16 , it's an Int32 .
Why are you getting the value as a string, then convert it to a number? Do you store everything as text in the database?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
|
Best Regards
-----------------
Abhijit Jana
"Success is Journey it's not a destination"
|
|
|
|
|
Thanks Pete O'Hanlon,ve to get back to work...
Oluwayomi Ige
MCP MCAD.
|
|
|
|
|
My cats breath smells like cat food!
|
|
|
|
|
Men...because im certified doesnt mean i knw the whole world...it might interest you to know that i have written my code..just needed ideas...WHY IS THIS A COMMUNITY?...ARE WE SUPPOSE TO HELP OR LAUGH AT? THOT I COULD COUNT ON PEOPLE HERE, I HAVE NEVER ASKED QUESTION HERE BEFORE, MY FIRST TIME IS A TOTAL NIGHTMARE....I AM OUT
Oluwayomi Ige
MCP MCAD.
|
|
|
|
|
Seriously though - you do know that we aren't here to write your code for you don't you? You didn't demonstrate that you had written a single line of code, and come on - this wasn't exactly a tough problem now was it? Hardly one that would tax a rocket scientist like yourself.
|
|
|
|
|
Fact is you posted not a question, but a vague demand. No please, no thank you, and the "problem" was poorly defined. Although anyway you look at the "problem", seriously, you don't know how to "triple" something? Be that performing elementary maths or repeating something three times.
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
Oluwayomi wrote: i have written my code..just needed ideas..
So why not post your code and ask if anyone has a better suggestion? Then people would take your question seriously. I know myself I have sometimes written a piece of code and thought 'there must be a better way' but have had a mental block about how to do it better.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Oluwayomi,
We're all very sorry, come back!
Regards,
Gareth.
|
|
|
|
|
What I'd like to be able to do is make a generic class for hardware status words where every bit in the word corresponds to a boolean named flag. I'd like to have something that would take advantage of the underlying type of the enum as well as some attributes that I'm tagging onto the enum. I thought I'd be able to do that, but I'm not having very much luck at it. I guess the enum is just being used as a template which is what I want. The question is, is it possible to take advantage of some of the enum features in a generic class?
Example target code:
enum AlarmTemplate : byte {
[Description("High Liquid Level")]
HighLevel,
[Description("Low Liquid Level")]
LowLevel
}
Byte theStatus = 0xA5;
StatusWord<<AlarmTemplate>> word = new StatusWord<<AlarmTemplate>>(theStatus);
word.Bit[AlarmTemplate.HighLevel] = false;
Byte temp = word.UnderlyingValue;
I've always made custom classes to support all of these things, and lately I'm getting tired of it. Any ideas?
Scott P
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.”
-Edsger Dijkstra
modified on Thursday, May 8, 2008 11:03 AM
|
|
|
|
|
I don't know if I understood you correctly, but how about something like this
class StatusWord<T, U> where T : struct where U : struct
{
U val;
public StatusWord(U val)
{
this.val = val;
}
public bool this[T t]
{
set { val = val | 0x001; }
}
public U Val
{
get { return val; }
}
}
|
|
|
|
|
The code you show seems more or less OK (other than the doubled < and >), but I don't understand what you want to accomplish.
carbon_golem wrote: where every bit in the word corresponds to a boolean named flag
Will the FlagsAttribute be of use?
|
|
|
|
|
I put the double <<>> to make the CP html generator show at least that it was generic. What I want to do is define named bits in a generic way. The named bits would be of standard lengths, 8, 16, 32, 64. I hoped to use an enum to provide a templating mechanism to do this, but so far no luck, and the solutions I have worked out aren't very type safe. What this is for is representing bit fields in embedded device logs. Here is my latest. A lot of it is shetchy, but...
public class StatusField<t>
where T : struct {
#region Members
private T template;
private ValueType sword;
#endregion
private StatusField(ValueType initialValue) {
template = new T();
if (template is Enum) {
Type t = template.GetType();
if (t.GetCustomAttributes(typeof(FlagsAttribute), false).Length == 0) {
throw new System.InvalidCastException("Requires Enum that defines FlagsAttribute");
}
sword = initialValue;
} else {
throw new System.InvalidCastException("Could not convert generic type");
}
}
public Object UnderlyingValue {
get {
return sword;
}
set {
sword = (ValueType)value;
}
}
public Boolean this[T index] {
get {
if (Enum.IsDefined(typeof(T), index)) {
Object x = Convert.ChangeType(index, typeof(Int64));
Int64 temp1 = (Int64)x;
Object y = Convert.ChangeType(sword, typeof(Int64));
Int64 temp2 = (Int64)y;
return (temp1 & temp2) == temp1;
} else {
throw new IndexOutOfRangeException("Field is not defined");
}
}
set {
if (Enum.IsDefined(typeof(T), index)) {
} else {
throw new IndexOutOfRangeException("Field is not defined");
}
}
}
public static StatusField<t> New(ValueType value) {
return new StatusField<t>(value);
}
}
</t></t></t>
And Usage:
StatusField<alarms> field = StatusField<alarms>.New(Alarms.Battery | Alarms.Motion);
Console.WriteLine(field.UnderlyingValue);
Console.WriteLine(field[Alarms.Battery]);
Console.ReadLine();
</alarms></alarms>
Thanks for the attention!
Scott P
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.”
-Edsger Dijkstra
|
|
|
|
|
I suspect you need the FlagsAttribute, but I'm still unclear on what you are trying to do.
|
|
|
|
|
I would like to add some meta tags to a JPEG after it has been taken, unfortunately it is not possible to add the tags at the time the picture is taken. What I have found (best is here[^]) says it is not possible to add tags, so it is necessary to fool the JPEG by opening a current tag changing the values and than saving. While this work around does do the job it isn't very clean and seems like a problem waiting to happen. Does anyone know of a better way to add EXIF metadata after the picture has been taken?
Please let me know if it would be more appropriate to post this in the graphics form.
this thing looks like it was written by an epileptic ferret
Dave Kreskowiak
|
|
|
|
|
AFAIK there is no solution other than restuffing an existing JPEG file that already has
all the required tags.
|
|
|
|
|
Hi
Can someone help me. I need to convert a excel file into PDF format?
S
|
|
|
|
|