Attention all you Hackers.

  • Welcome to "The New" Wrestling Smarks Forum!

    I see that you are not currently registered on our forum. It only takes a second, and you can even login with your Facebook! If you would like to register now, pease click here: Register

    Once registered please introduce yourself in our introduction thread which can be found here: Introduction Board


C4

Guest
Actually I'm doing it myself but I fucked up with the source code.

The problem is that we aren't allowed to put the source code into practical practice. That means in college, we type all the coding and it's then locked by our teacher so that we can't put it into practical use.

Today, the teacher allowed us to put the program to test and finally all of us ran our programs and 80% had fucked up and I was one of them. For hours I've been trying to figure out what the problem is in my code and why would I get this when I try and run the program:
Second Memorylimit timeout: 9182 FATAL ERROR

This code is supposed to be perfect, I spend two entire weeks typing it and have no fucking clue where it went wrong:

'Global Variables
Dim alnArray(99, 3) As String ' An array is created to store records
Dim CurrentTuple As Integer ' Current pointer is initialized
Const totalRec As Integer = 99 ' Total number of reocrds are set to 99
Dim editActive As Boolean ' An Edit Switch is created
Dim DoneWithLoc As Integer ' An Edit Lock is created

'procedure to perform alignment on entered strings
Private Sub cmdAlign_Click()

'Temporary variables
Dim a As Integer
Dim b As Integer
Dim c As Integer

'variable to store the original values
'while being edited by the process
Dim backup As Integer

'variable to be used in loop constructs
Dim count As Integer

'variables that will hold entered values
Dim char1 As String
Dim char2 As String

'variable to count the score
Dim score As Integer

'if the vaue reaches a null then
'this variable tells that
Dim nullcounter As Integer

'to caryy on or not
Dim switch As Boolean

'initialize
switch = False
a = Len(txtString1.Text)
b = Len(txtString2.Text)
backup = a

'loop to read every character out of given strings
While (b > 0) And (a > 0)

char1 = Mid(txtString1.Text, a, 1)
char2 = Mid(txtString2.Text, b, 1)

'math the charcters
While (char1 <> char2) And a > 0 And b > 0

';reduce the number to control the empty string situation
nullcounter = nullcounter + 1
a = a - 1
If a > 0 Then
'read
char1 = Mid(txtString1.Text, a, 1)
Else
'mark the end
switch = True
End If

'score up or down the variable
If nullcounter = 1 Then
score = score - 1
End If
Wend

'if one of the string has reached to an end
If b > 1 And a = 0 Then
'reverse the other
a = backup
'count further
count = count + 1
switch = False
'reduce b
b = b - 1
Else
'check for the next string
If (a = 0 And b = 1) Or (b = 0) Then
Else
nullcounter = 0
score = score + 2
b = b - 1
a = a - 1
If count = 1 Then
score = score - 1
End If

count = 0
End If
backup = a
End If

Wend

'update the screen control with the score result
txtScore.Text = score

End Sub

'procedure to be triggered when user hits the delete button
Private Sub cmdDelete_Click()

Dim a As Integer ' a temporary var

'read all array records strting from delete record
'location and copy consective records one position
'up to overwrite the unwanted record
For a = DoneWithLoc To CurrentTuple
alnArray(a, 0) = alnArray(a + 1, 0)
alnArray(a, 1) = alnArray(a + 1, 1)
alnArray(a, 2) = alnArray(a + 1, 2)
alnArray(a, 3) = alnArray(a + 1, 3)

Next a

'decrease the record counter by one
CurrentTuple = CurrentTuple - 1

'empty all screen controls
Call ClearAllFields

'refill the screen list by updated records
For a = 0 To CurrentTuple - 1
lstLoad.AddItem Format$(alnArray(a, 0), "!@@@@@@@@@@@@@@@@@") & _
Format$(alnArray(a, 1), "!@@@@@@@@@@@@") & _
Format$(alnArray(a, 2), "!@@@@@@@@@@@@") & _
Format$(alnArray(a, 3), "!@@@")
Next a

End Sub

'procedure to be triggered when user hits the edit button
'editable record has already been pointed out and
'its location is seltected by clicking the screen list
Private Sub cmdEdit_Click()

'user wants to canel the diting
If cmdEdit.Caption = "Cancel" Then
editActive = False
cmdEdit.Caption = "Edit"

cmdSearch.Enabled = True
cmdDelete.Enabled = True
cmdSave.Enabled = True

Exit Sub
End If

'editing is happening
editActive = True

'disable rest of the buttons
cmdEdit.Caption = "Cancel"
cmdSearch.Enabled = False
cmdDelete.Enabled = False
cmdSave.Enabled = False

'update the sreen controls from the array
'record to be edited.
txtName.Text = alnArray(DoneWithLoc, 0)
txtString1.Text = alnArray(DoneWithLoc, 1)
txtString2.Text = alnArray(DoneWithLoc, 2)
txtScore.Text = alnArray(DoneWithLoc, 3)


End Sub

'procedure to be triggered when user exits the system
Private Sub cmdExit_Click()

'avoid accdental exit when data is not saved
If editActive = True Then
MsgBox "Please cancel editing in order to exit the program."
Else
End
End If
End Sub

'new record is to be entered
Private Sub cmdNew_Click()

'update the array's new position
alnArray(CurrentTuple, 0) = txtName.Text
alnArray(CurrentTuple, 1) = txtString1.Text
alnArray(CurrentTuple, 2) = txtString2.Text
alnArray(CurrentTuple, 3) = txtScore.Text

'increase the pointer
CurrentTuple = CurrentTuple + 1

'empty the screen fields
txtName.Text = ""
txtString1.Text = ""
txtString2.Text = ""
txtScore.Text = ""

'set the focus back to first entry point
txtName.SetFocus

End Sub

'new record has been entered or data has been edited
Private Sub cmdOK_Click()

'temp var
Dim a As Integer

'check that user has left no filed blank
If (Len(txtName.Text) = 0 Or Len(txtString1.Text) = 0 Or _
Len(txtString2.Text) = 0) Then

MsgBox "Please Do Not Leave Any Field Blank."
If editActive = False Then Exit Sub
End If

'editig has been performed
If editActive = True Then
'update switch and caption
editActive = False
cmdEdit.Caption = "Edit"

'enable the buttons
cmdSearch.Enabled = True
cmdDelete.Enabled = True
cmdSave.Enabled = True

'update the array record from
'edited values
alnArray(DoneWithLoc, 0) = txtName.Text
alnArray(DoneWithLoc, 1) = txtString1.Text
alnArray(DoneWithLoc, 2) = txtString2.Text
alnArray(DoneWithLoc, 3) = txtScore.Text

'empty the fileds
ClearAllFields

'update the screen list
For a = 0 To CurrentTuple - 1
lstLoad.AddItem Format$(alnArray(a, 0), "!@@@@@@@@@@@@@@@@@") & _
Format$(alnArray(a, 1), "!@@@@@@@@@@@@") & _
Format$(alnArray(a, 2), "!@@@@@@@@@@@@") & _
Format$(alnArray(a, 3), "!@@@")
Next a

'diable the edit button
cmdEdit.Enabled = False

Else
'user has just entered a new record

'add the record to the new array location
alnArray(CurrentTuple, 0) = txtName.Text
alnArray(CurrentTuple, 1) = txtString1.Text
alnArray(CurrentTuple, 2) = txtString2.Text
alnArray(CurrentTuple, 3) = txtScore.Text

'update the list control
lstLoad.AddItem Format$(txtName.Text, "!@@@@@@@@@@@@@@@@@") & _
Format$(txtString1.Text, "!@@@@@@@@@@@@") & _
Format$(txtString2.Text, "!@@@@@@@@@@@@") & _
Format$(txtScore.Text, "!@@@")

'inrease the record pointer
CurrentTuple = CurrentTuple + 1

'check to control the max records reached situation
If CurrentTuple > totalRec Then
CurrentTuple = totalRec
End If

End If
End Sub

'procedure triggeres when user hits the save button
Private Sub cmdSave_Click()

Dim a As Integer ' a temp variable

'open the file
Open App.Path & "\Alignment.txt" For Output As #1

'loop through the array to savbe all reord one by one
For a = 0 To CurrentTuple - 1
Write #1, alnArray(a, 0), alnArray(a, 1), _
alnArray(a, 2), alnArray(a, 3)
Next a

'close the file
Close #1


End Sub

'user wants to search the the entered value in the
'array
Private Sub cmdSearch_Click()

'make sure value has been entered
If txtName.Text = "" Then
MsgBox "Student Name Field is!!"
Exit Sub
End If

'temp vars
Dim a As Integer
Dim SearchName As String

'copy the 2b searched value to variable
SearchName = txtName.Text

'clear al of the fields
Call ClearAllFields

'loop through the array to search all
For a = 0 To CurrentTuple
'turn the values to uppercase to avoid the slippage
'of record from identification
If UCase(alnArray(a, 0)) = UCase(SearchName) Then
'if match is found update screen records
txtName.Text = SearchName
txtString1.Text = alnArray(a, 1)
txtString2.Text = alnArray(a, 2)
txtScore.Text = alnArray(a, 3)

lstLoad.AddItem Format$(txtName.Text, "!@@@@@@@@@@@@@@@@@") & _
Format$(txtString1.Text, "!@@@@@@@@@@@@") & _
Format$(txtString2.Text, "!@@@@@@@@@@@@") & _
Format$(txtScore.Text, "!@@@")

End If
Next a
End Sub

'procedure triggers when the app loads
Private Sub Form_Load()

'control incase file does not exists
On Error GoTo errorControl
CurrentTuple = 0
editActive = False
cmdEdit.Enabled = False

'open the file and read all recors to the array
Open App.Path & "\Alignment.txt"

'lopop until the disk filereaches an end
Do While Not EOF(1)
Input #1, alnArray(CurrentTuple, 0), alnArray(CurrentTuple, 1), _
alnArray(CurrentTuple, 2), alnArray(CurrentTuple, 3)

'update the screen list
lstLoad.AddItem Format$(alnArray(CurrentTuple, 0), "!@@@@@@@@@@@@@@@@@") & _
Format$(alnArray(CurrentTuple, 1), "!@@@@@@@@@@@@") & _
Format$(alnArray(CurrentTuple, 2), "!@@@@@@@@@@@@") & _
Format$(alnArray(CurrentTuple, 3)

'update the pointer too
CurrentTuple = CurrentTuple + 1

'control maximum records reached position
If CurrentTuple > totalRec Then
CurrentTuple = totalRec
Exit Do
End If
Loop

'close the file
Close #1

errorControl:

End Sub

'procedure is trrigered to know at what array record poition
'user has clicked
Private Sub lstLoad()

'temp vars
Dim SearchedItem As String
Dim a As Integer

'enable
cmdEdit.Enabled = True

'temp vars
Dim temp0 As String
Dim temp1 As String
Dim temp2 As String

'catch the record from the list and
'break fields to the temp vars
SearchedItem = lstLoad.List(lstLoad.ListIndex)
temp0 = Mid$(SearchedItem, 1, 15)
temp1 = Mid$(SearchedItem, 18, 10)
temp2 = Mid$(SearchedItem, 30, 10)
temp3 = Mid$(SearchedItem, 42, 3)

'search through the array to locate the required record
For a = 0 To CurrentTuple
If UCase(alnArray(a, 0)) = UCase(Trim(temp0)) And _
UCase(alnArray(a, 1)) = UCase(Trim(temp1)) And _
UCase(alnArray(a, 2)) = UCase(Trim(temp2)) And _
UCase(alnArray(a, 3)) = UCase(Trim(temp3)) Then

'if found then mark the positioin to the global var
DoneWithLoc = a
Exit For
End If
Next a


End Sub
txtName.Text = ""
txtString1.Text = ""
txtString2.Text = ""
txtScore.Text = ""

lstLoad.Clear
End Sub

Private Sub txtName_KeyPress(KeyAscii o only A-Z, a-z,
'space and backspace
If (KeyAscii >= 65 And KeyAscii <= 90) Or _
(KeyAscii >= 96 And KeyAscii <= 122) Or _
(KeyAscii = 32) Or _
(KeyAscii = 8) Then

'''''''''
Else
'rest is not accepted
KeyAscii = 0
End If
End Sub
yAscii As Integer)
'only 0-9 and backspace are allowed
If (KeyAscii >= 48 And KeyAscii <= 57) Or _
(KeyAscii = 8) Then

'''''''''
Else
KeyAscii = 0
End If
End Sub

Private Sub txtString1_KeyPress(KeyAscii As Integer)
'procedure to change lower to upper case when theyt are
'entered in the string field
'procedure to control the entered words to only A-Z, a-z
'and backspace

If (KeyAscii >= 96 And KeyAscii <= 122) Then
KeyAscii = KeyAscii - 32
End If
If (KeyAscii >= 65 And KeyAscii <= 90) Or _
(KeyAscii = 8) Then
'''''''''
Else
KeyAscii = 0
End If
End Sub

Private Sub txtString2_KeyPress(KeyAscii As Integer)
'procedure to change lower to upper case when theyt are
'entered in the string field
'procedure to control the entered words to only A-Z, a-z
'and backspace

If (KeyAscii >= 96 And KeyAscii <= 122) Then
KeyAscii = KeyAscii - 32
End If
If (KeyAscii >= 65 And KeyAscii <= 90) Or _
(KeyAscii = 8) Then
'''''''''
Else
KeyAscii = 0
End If
End Sub
 

C4

Guest
Was it necessary to post all that?

yup.

Shows that I'm not going to completely steal someones source code from that website even If I get the file :rolleyes:
 

the dark knight

Guest
since you started kissing his ass.

btw i only read chuck's post and outsider's. i might read and reply later. just a quick-through before i go to bed.
 

J

Guest
Haha My friend and I went to take down the internet at our school one day so we didn't have to do the work. So we DDOS'd the school's net. I guess we hit it to hard cuase we took down the whole school district. Haha.

I know that stories random but it was really funny. I couldn't believe we did it.

But I could talk to one of my friend when would you need the stuff?
 

THE Brian Kendrick's Biceps

Guest
But C4, you're a fucking genius. Surely you could do this yourself. I mean, don't be so modest.
 

Italian Outsider

Active Member
Joined
Apr 19, 2007
Messages
1,649
Reaction score
0
Points
36
Age
37
Location
Italy
since you started kissing his ass.
:tdk:
i made fun of muslims, if others jumped the bandwagon, how's that kissing ass?
and i agreed with him on a post where he bashed his own country, again what's new? i bashed usa multiple times.stfu plz
btw i only read chuck's post and outsider's. i might read and reply later. just a quick-through before i go to bed.

idiot