ZH's software thread

Place to talk about all that new hardware and decaying software you have.

Moderator: General Mods

Post Reply
ZH/Franky

Post by ZH/Franky »

Maybe he recieved a random event?
( if you know what online game I'm referring to, that is 8) ).
Nightcrawler
Romhacking God
Posts: 922
Joined: Wed Jul 28, 2004 11:27 pm
Contact:

Post by Nightcrawler »

grinvader wrote:
Nightcrawler wrote:I think our strengths would compliment the others potential weaknesses well. I
would like to read the end of your post, if that's possible.
Don't know what happened there. I had gone on a few more sentences on Nach's knowledge and experience with efficiency, design patterns, and algorithms. Kind of a high level, low level compliment thing. Not to say either of us in incapable of both, just stronger at one end versus the other.
[url=http://transcorp.romhacking.net]TransCorp[/url] - Home of the Dual Orb 2, Cho Mahou Tairyku Wozz, and Emerald Dragon SFC/SNES translations.
[url=http://www.romhacking.net]ROMhacking.net[/url] - The central hub of the ROM hacking community.
grinvader
ZSNES Shake Shake Prinny
Posts: 5632
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Post by grinvader »

Aww, we got the summed up version. Thanks for completing, still. :)
皆黙って俺について来い!!

Code: Select all

<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
adventure_of_link
Locksmith of Hyrule
Posts: 3634
Joined: Sun Aug 08, 2004 7:49 am
Location: 255.255.255.255
Contact:

Post by adventure_of_link »

Franky wrote:Maybe he recieved a random event?
( if you know what online game I'm referring to, that is 8) ).
Lemme guess, lunar wars or perhaps galava? Maybe cybernations?
<Nach> so why don't the two of you get your own room and leave us alone with this stupidity of yours?
NSRT here.
ZH/Franky

Post by ZH/Franky »

adventure_of_link wrote:
Franky wrote:Maybe he recieved a random event?
( if you know what online game I'm referring to, that is 8) ).
Lemme guess, lunar wars or perhaps galava? Maybe cybernations?
No, runescape.

Alright guys, I've completely rewritten ZBinc, using some of the new techniques I've learned recently:

Code: Select all

Option Explicit On
Option Strict On
Module Module1

    Dim usAddress, usNotation, usMax, usBin, usHex, sReturn As String

    Function bVerifyAddress(ByRef sAddress As String) As Boolean
        bVerifyAddress = True
        Try
            Call Convert.ToInt32(sAddress)
        Catch ex As Exception
            bVerifyAddress = False
        End Try
        If bVerifyAddress = True Then
            If (Convert.ToInt32(sAddress) Mod 4) <> 0 Or Convert.ToInt32(sAddress) > 32 Or Convert.ToInt32(sAddress) < 4 Then
                bVerifyAddress = False
            End If
        End If
    End Function

    Function bVerifyMax(ByRef sMax As String, ByRef iAddress As Integer, ByRef sNotation As String) As Boolean
        bVerifyMax = True
        Try
            Call Convert.ToDouble(sMax)
        Catch ex As Exception
            bVerifyMax = False
        End Try
        If bVerifyMax = True Then
            If (Convert.ToDouble(sMax) Mod 1) <> 0 Then
                bVerifyMax = False
            ElseIf sNotation = "signed" Then
                If Convert.ToDouble(sMax) < (-(2 ^ (iAddress - 1))) Or Convert.ToDouble(sMax) > ((2 ^ (iAddress - 1)) - 1) Then
                    bVerifyMax = False
                End If
            ElseIf Convert.ToDouble(sMax) < 0 Or Convert.ToDouble(sMax) > ((2 ^ iAddress) - 1) Then
                bVerifyMax = False
            End If
        End If
    End Function

    Function bVerifyBin(ByRef sBin As String, ByRef iAddress As Integer) As Boolean
        bVerifyBin = True
        If sBin = "" Then
            bVerifyBin = False
        ElseIf sBin.Length > iAddress Then
            For j As Integer = 1 To sBin.Length
                If Mid(sBin, j, 1) = "0" Then
                ElseIf Mid(sBin, j, (sBin.Length - (j - 1))).Length > iAddress Then
                    bVerifyBin = False
                    Exit For
                Else
                    Exit For
                End If
            Next
        End If
        If bVerifyBin = True Then
            For j As Integer = 1 To sBin.Length Step 1
                If Mid(sBin, j, 1) <> "1" And Mid(sBin, j, 1) <> "0" Then
                    bVerifyBin = False
                    Exit For
                End If
            Next
        End If
    End Function

    Function bVerifyHex(ByRef sHex As String, ByRef iAddress As Integer) As Boolean
        Dim sTempBin As String = ""
        bVerifyHex = True
        If sHex = "" Then
            bVerifyHex = False
        ElseIf (sHex.Length * 4) > iAddress Then
            sTempBin = sHexadecimalToBinary(sHex)
            For j As Integer = 1 To sTempBin.Length
                If Mid(sTempBin, j, 1) = "0" Then
                ElseIf Mid(sTempBin, j, (sTempBin.Length - (j - 1))).Length > iAddress Then
                    bVerifyHex = False
                    Exit For
                Else
                    Exit For
                End If
            Next
        End If
        If bVerifyHex = True Then
            For j As Integer = 1 To sHex.Length
                If Not (Mid(sHex, j, 1) Like "[A-F]" Or Mid(sHex, j, 1) Like "#") Then
                    bVerifyHex = False
                    Exit For
                End If
            Next
        End If
    End Function

    Function sDecimalToBinary(ByVal iMax As Double, ByRef sNotation As String, ByRef iAddress As Integer) As String
        sDecimalToBinary = ""
        If sNotation = "signed" And iMax < 0 Then
            iMax += (2 ^ iAddress)
        End If
        Do
            If Not ((iMax Mod 2) = 0) Then
                sDecimalToBinary = "1" + sDecimalToBinary
            Else
                sDecimalToBinary = "0" + sDecimalToBinary
            End If
            iMax = Int(iMax / 2)
        Loop Until iMax = 0
    End Function

    Function sBinaryToHexadecimal(ByRef sBin As String) As String
        sBinaryToHexadecimal = ""
        If Not ((sBin.Length Mod 4) = 0) Then
            Do
                sBin = "0" + sBin
            Loop Until (sBin.Length Mod 4) = 0
        End If
        For j As Integer = 1 To sBin.Length Step 4
            Select Case Mid(sBin, j, 4)
                Case "0000"
                    sBinaryToHexadecimal += "0"
                Case "0001"
                    sBinaryToHexadecimal += "1"
                Case "0010"
                    sBinaryToHexadecimal += "2"
                Case "0011"
                    sBinaryToHexadecimal += "3"
                Case "0100"
                    sBinaryToHexadecimal += "4"
                Case "0101"
                    sBinaryToHexadecimal += "5"
                Case "0110"
                    sBinaryToHexadecimal += "6"
                Case "0111"
                    sBinaryToHexadecimal += "7"
                Case "1000"
                    sBinaryToHexadecimal += "8"
                Case "1001"
                    sBinaryToHexadecimal += "9"
                Case "1010"
                    sBinaryToHexadecimal += "A"
                Case "1011"
                    sBinaryToHexadecimal += "B"
                Case "1100"
                    sBinaryToHexadecimal += "C"
                Case "1101"
                    sBinaryToHexadecimal += "D"
                Case "1110"
                    sBinaryToHexadecimal += "E"
                Case "1111"
                    sBinaryToHexadecimal += "F"
            End Select
        Next
    End Function

    Function sHexadecimalToBinary(ByRef sHex As String) As String
        sHexadecimalToBinary = ""
        For j As Integer = 1 To sHex.Length Step 1
            Select Case Mid(sHex, j, 1)
                Case "0"
                    sHexadecimalToBinary += "0000"
                Case "1"
                    sHexadecimalToBinary += "0001"
                Case "2"
                    sHexadecimalToBinary += "0010"
                Case "3"
                    sHexadecimalToBinary += "0011"
                Case "4"
                    sHexadecimalToBinary += "0100"
                Case "5"
                    sHexadecimalToBinary += "0101"
                Case "6"
                    sHexadecimalToBinary += "0110"
                Case "7"
                    sHexadecimalToBinary += "0111"
                Case "8"
                    sHexadecimalToBinary += "1000"
                Case "9"
                    sHexadecimalToBinary += "1001"
                Case "A"
                    sHexadecimalToBinary += "1010"
                Case "B"
                    sHexadecimalToBinary += "1011"
                Case "C"
                    sHexadecimalToBinary += "1100"
                Case "D"
                    sHexadecimalToBinary += "1101"
                Case "E"
                    sHexadecimalToBinary += "1110"
                Case "F"
                    sHexadecimalToBinary += "1111"
            End Select
        Next
    End Function

    Function iBinaryToDecimal(ByRef sBin As String, ByRef sNotation As String, ByRef iAddress As Integer) As Double
        iBinaryToDecimal = 0
        For j As Integer = sBin.Length To 1 Step -1
            If Mid(sBin, j, 1) = "1" Then
                iBinaryToDecimal += (2 ^ (sBin.Length - j))
            End If
        Next
        If sNotation = "signed" And iBinaryToDecimal > ((2 ^ (iAddress - 1)) - 1) Then
            iBinaryToDecimal -= (2 ^ iAddress)
        End If
    End Function

    Sub InterfaceVerifyAddress()
        Do
            Call Console.Write("?Address: ")
            usAddress = Console.ReadLine()
            If Not (bVerifyAddress(usAddress) = True) Then
                Call Console.WriteLine("Invalid input")
            End If
        Loop Until bVerifyAddress(usAddress) = True
    End Sub

    Sub InterfaceVerifyMax()
        Do
            Call Console.Write("?Decimal: ")
            usMax = Console.ReadLine()
            If Not (bVerifyMax(usMax, Convert.ToInt32(usAddress), usNotation) = True) Then
                Call Console.WriteLine("Invalid input")
            End If
        Loop Until bVerifyMax(usMax, Convert.ToInt32(usAddress), usNotation) = True
    End Sub

    Sub InterfaceVerifyNotation()
        Do
            Call Console.Write("?Sign: ")
            usNotation = Console.ReadLine().ToLower
            If Not (usNotation = "signed" Or usNotation = "unsigned") Then
                Call Console.WriteLine("Invalid input")
            End If
        Loop Until usNotation = "signed" Or usNotation = "unsigned"
    End Sub

    Sub InterfaceVerifyBin()
        Do
            Call Console.Write("?Bin: ")
            usBin = Console.ReadLine()
            If Not (bVerifyBin(usBin, Convert.ToInt32(usAddress)) = True) Then
                Call Console.WriteLine("Invalid input")
            End If
        Loop Until bVerifyBin(usBin, Convert.ToInt32(usAddress)) = True
    End Sub

    Sub InterfaceVerifyHex()
        Do
            Call Console.Write("?Hex: ")
            usHex = Console.ReadLine().ToUpper
            If Not (bVerifyHex(usHex, Convert.ToInt32(usAddress)) = True) Then
                Call Console.WriteLine("Invalid input")
            End If
        Loop Until bVerifyHex(usHex, Convert.ToInt32(usAddress)) = True
    End Sub

    Sub InterfaceDecimalToBinary()
        Call Console.WriteLine("Decimal to binary conversion")
        Do
            Call InterfaceVerifyAddress()
            Call InterfaceVerifyNotation()
            Call InterfaceVerifyMax()
            Call Console.WriteLine(sDecimalToBinary(Convert.ToDouble(usMax), usNotation, Convert.ToInt32(usAddress)))
            Do
                Call Console.Write("Would you like to go again? y/n: ")
                sReturn = Console.ReadLine().ToLower
                If Not (sReturn = "y" Or sReturn = "n") Then
                    Call Console.WriteLine("Invalid choice")
                End If
            Loop Until sReturn = "y" Or sReturn = "n"
            Call Console.WriteLine()
        Loop Until sReturn = "n"
    End Sub

    Sub InterfaceDecimalToHexadecimal()
        Call Console.WriteLine("Decimal to hexadecimal conversion")
        Do
            Call InterfaceVerifyAddress()
            Call InterfaceVerifyNotation()
            Call InterfaceVerifyMax()
            Call Console.WriteLine(sBinaryToHexadecimal(sDecimalToBinary(Convert.ToDouble(usMax), usNotation, Convert.ToInt32(usAddress))))
            Do
                Call Console.Write("Would you like to go again? y/n: ")
                sReturn = Console.ReadLine().ToLower
                If Not (sReturn = "y" Or sReturn = "n") Then
                    Call Console.WriteLine("Invalid choice")
                End If
            Loop Until sReturn = "y" Or sReturn = "n"
            Call Console.WriteLine()
        Loop Until sReturn = "n"
    End Sub

    Sub InterfaceBinaryToDecimal()
        Call Console.WriteLine("Binary to decimal conversion")
        Do
            Call InterfaceVerifyAddress()
            Call InterfaceVerifyNotation()
            Call InterfaceVerifyBin()
            Call Console.WriteLine(iBinaryToDecimal(usBin, usNotation, Convert.ToInt32(usAddress)).ToString)
            Do
                Call Console.Write("Would you like to go again? y/n: ")
                sReturn = Console.ReadLine().ToLower
                If Not (sReturn = "y" Or sReturn = "n") Then
                    Call Console.WriteLine("Invalid choice")
                End If
            Loop Until sReturn = "y" Or sReturn = "n"
            Call Console.WriteLine()
        Loop Until sReturn = "n"
    End Sub

    Sub InterfaceBinaryToHexadecimal()
        Call Console.WriteLine()
        Do
            Call InterfaceVerifyAddress()
            Call InterfaceVerifyBin()
            Call Console.WriteLine(sBinaryToHexadecimal(usBin))
            Do
                Call Console.Write("Would you like to go again? y/n: ")
                sReturn = Console.ReadLine().ToLower
                If Not (sReturn = "y" Or sReturn = "n") Then
                    Call Console.WriteLine("Invalid choice")
                End If
            Loop Until sReturn = "y" Or sReturn = "n"
            Call Console.WriteLine()
        Loop Until sReturn = "n"
    End Sub

    Sub InterfaceHexadecimalToDecimal()
        Do
            Call InterfaceVerifyAddress()
            Call InterfaceVerifyNotation()
            Call InterfaceVerifyHex()
            Call Console.WriteLine(iBinaryToDecimal(sHexadecimalToBinary(usHex), usNotation, Convert.ToInt32(usAddress)))
            Do
                Call Console.Write("Would you like to go again? y/n: ")
                sReturn = Console.ReadLine().ToLower
                If Not (sReturn = "y" Or sReturn = "n") Then
                    Call Console.WriteLine("Invalid choice")
                End If
            Loop Until sReturn = "y" Or sReturn = "n"
        Loop Until sReturn = "n"
        Call Console.WriteLine()
    End Sub

    Sub InterfaceHexadecimalToBinary()
        Do
            Call InterfaceVerifyAddress()
            Call InterfaceVerifyHex()
            Call Console.WriteLine(sHexadecimalToBinary(usHex))
            Do
                Call Console.Write("Would you like to go again? y/n: ")
                sReturn = Console.ReadLine().ToLower
                If Not (sReturn = "y" Or sReturn = "n") Then
                    Call Console.WriteLine("Invalid choice")
                End If
            Loop Until sReturn = "y" Or sReturn = "n"
            Call Console.WriteLine()
        Loop Until sReturn = "n"
    End Sub

    Sub Main()
        Dim sInputChoice As String = ""
        Call VersionInformation()
        Call DisplayOptions()
        Do
            Call Console.Write("?: ")
            sInputChoice = Console.ReadLine().ToLower
            Select Case sInputChoice
                Case "dec2bin"
                    Call InterfaceDecimalToBinary()
                Case "dec2hex"
                    Call InterfaceDecimalToHexadecimal()
                Case "bin2dec"
                    Call InterfaceBinaryToDecimal()
                Case "bin2hex"
                    Call InterfaceBinaryToHexadecimal()
                Case "hex2dec"
                    Call InterfaceHexadecimalToDecimal()
                Case "hex2bin"
                    Call InterfaceHexadecimalToBinary()
                Case "display"
                    Call DisplayOptions()
                Case "about"
                    Call VersionInformation()
                    Call Console.WriteLine()
                    Call Console.Write("Press enter to continue...")
                    Call Console.ReadLine()
            End Select
            If Not (sInputChoice = "quit") Then
                Call Console.WriteLine()
                Call DisplayOptions()
            End If
        Loop Until sInputChoice = "quit"
    End Sub

    Sub DisplayOptions()
        Call Console.WriteLine("Options:")
        Call Console.WriteLine("dec2bin - Decimal to binary conversion")
        Call Console.WriteLine("dec2hex - Decimal to hexadecimal conversion")
        Call Console.WriteLine("bin2dec - Binary to decimal conversion")
        Call Console.WriteLine("bin2hex - Binary to hexadecimal conversion")
        Call Console.WriteLine("hex2dec - Hexadecimal to decimal conversion")
        Call Console.WriteLine("hex2bin - Hexadecimal to binary conversion")
        Call Console.WriteLine("display - Show these options")
        Call Console.WriteLine("about - Show information about this program")
        Call Console.WriteLine("quit - Exit this program")
        Call Console.WriteLine()
    End Sub

    Sub VersionInformation()
        Call Console.WriteLine("ZBinc: Decimal/Binary/Hexadecimal Conversion")
        Call Console.WriteLine("License: Public Domain")
        Call Console.WriteLine("Written by Zero-Hero")
        Call Console.WriteLine()
    End Sub

End Module
Will hunt for bugs and/or things to improve when I wake up. Need sleep.
ZH/Franky

Post by ZH/Franky »

I've written a version of AK3N (my ISBN 10/13 Converter) in the form of a GUI:
ImageImage
MSVB.NET is a bitch when it comes to sharing code if you're creating a Windows Forms application (instead of just one file, there's lots of other files that MUST be correct). So, I'll instead post a link to the entire directory (compressed with 7-Zip) containing everything:
http://www.fileqube.com/shared/JvbPY172672

In any case, here's the main code (I've used a mixture of apps/system hungarian notation, so it should be quite easy to understand what each bit does (like which part refers to a radio button, groupbox, etc)).:

Code: Select all

Option Explicit On
Option Strict On
Public Class AK3N

    Function sConvertN10toN13(ByRef usISBN10 As String) As String
        Dim iMax As Integer = 0
        sConvertN10toN13 = "978" + Mid(usISBN10, 1, 9)
        For j As Integer = 2 To 12 Step 2
            iMax += (Convert.ToInt32(Mid(sConvertN10toN13, (j - 1), 1))) + (3 * (Convert.ToInt32(Mid(sConvertN10toN13, j, 1))))
        Next
        sConvertN10toN13 += ((10 - (iMax Mod 10)) Mod 10).ToString
    End Function

    Function bVerifySum10(ByRef usISBN10 As String) As Boolean
        Dim iMax As Integer = 0
        bVerifySum10 = True
        If usISBN10 Like "##########" Or usISBN10.Length = 10 And Mid(usISBN10, 1, 9) Like "#########" And Mid(usISBN10, 10, 1) = "X" Then
            For j = 10 To 2 Step -1
                iMax += ((Convert.ToInt32(Mid(usISBN10, (10 - (j - 1)), 1))) * j)
            Next
            If Not (Mid(usISBN10, 10, 1) = "X") Then
                iMax += Convert.ToInt32(Mid(usISBN10, 10, 1))
            Else
                iMax += 10
            End If
            If Not ((iMax Mod 11) = 0) Then
                bVerifySum10 = False
            End If
        Else
            bVerifySum10 = False
        End If
    End Function

    Function sConvertN13toN10(ByRef usISBN13 As String) As String
        Dim iMax As Integer = 0
        Dim iCount As Integer = 0
        sConvertN13toN10 = Mid(usISBN13, 4, 9)
        For j As Integer = 10 To 2 Step -1
            iMax += ((Convert.ToInt32(Mid(sConvertN13toN10, (10 - (j - 1)), 1))) * j)
        Next
        If Not ((iMax Mod 11) = 0) Then
            Do
                iCount += 1
            Loop Until ((iMax + iCount) Mod 11) = 0
            If iCount = 10 Then
                sConvertN13toN10 += "X"
            Else
                sConvertN13toN10 += iCount.ToString
            End If
        Else
            sConvertN13toN10 += "0"
        End If
    End Function

    Function bVerifySum13(ByRef usISBN13 As String) As Boolean
        Dim iMax As Integer = 0
        bVerifySum13 = True
        If usISBN13 Like "#############" Then
            If Not (Mid(usISBN13, 1, 3) = "979") Then
                For j As Integer = 2 To 12 Step 2
                    iMax += ((Convert.ToInt32(Mid(usISBN13, (j - 1), 1))) + (3 * (Convert.ToInt32(Mid(usISBN13, j, 1)))))
                Next
                If Not (((10 - (iMax Mod 10)) Mod 10) = Convert.ToInt32(Mid(usISBN13, 13, 1))) Then
                    bVerifySum13 = False
                End If
            Else
                bVerifySum13 = False
            End If
        Else
            bVerifySum13 = False
        End If
    End Function

    Private Sub txtInput_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtInput.KeyPress
        If rdbInputISBN10.Checked = True Then
            If txtInput.Text.Length = 10 Then
                Select Case e.KeyChar
                    Case Chr(8)
                    Case Else
                        e.KeyChar = Nothing
                End Select
            Else
                Select Case e.KeyChar.ToString
                    Case "0" To "9"
                    Case Chr(8)
                    Case "X"
                        If Not (txtInput.Text.Length = 9) Then
                            e.KeyChar = Nothing
                        End If
                    Case "x"
                        If txtInput.Text.Length = 9 Then
                            txtInput.Text += e.KeyChar.ToString.ToUpper
                        End If
                        e.KeyChar = Nothing
                    Case Else
                        e.KeyChar = Nothing
                End Select
            End If
        ElseIf rdbInputISBN13.Checked = True Then
            If txtInput.Text.Length = 13 Then
                Select Case e.KeyChar
                    Case Chr(8)
                    Case Else
                        e.KeyChar = Nothing
                End Select
            Else
                Select Case e.KeyChar.ToString
                    Case "0" To "9"
                    Case Chr(8)
                    Case Else
                        e.KeyChar = Nothing
                End Select
            End If
        End If
    End Sub

    Private Sub btnConvert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConvert.Click
        If txtInput.Text = "" Then
            Call MsgBox("Please enter a value")
        ElseIf rdbInputISBN10.Checked = True Then
            If Not (txtInput.Text.Length = 10) Then
                Call MsgBox("ISBN10 number must be 10 digits")
            ElseIf Not (bVerifySum10(txtInput.Text) = True) Then
                Call MsgBox("Invalid ISBN-10 number")
            Else
                txtOutput.Text = sConvertN10toN13(txtInput.Text)
            End If
        ElseIf rdbInputISBN13.Checked = True Then
            If Not (txtInput.Text.Length = 13) Then
                Call MsgBox("ISBN13 number must be 13 digits")
            ElseIf Not (bVerifySum13(txtInput.Text) = True) Then
                Call MsgBox("Invalid ISBN-13 number")
            Else
                txtOutput.Text = sConvertN13toN10(txtInput.Text)
            End If
        End If
    End Sub

    Private Sub rdbInputISBN10_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdbInputISBN10.CheckedChanged
        txtInput.Text = ""
        txtOutput.Text = ""
    End Sub

    Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
        txtInput.Text = ""
        txtOutput.Text = ""
    End Sub

    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click
        End
    End Sub

End Class
I'm also going to post an executable (compressed with 7-Zip), in case any of you are interesting in using this, but don't have a copy of MS VB.Net 2008 to compile the source code linked above. Here it is:
http://www.fileqube.com/shared/axXVrZTfz172687
To run it, you'll need the .NET framework installed. I'm not sure exactly which version, but I'm using VB.Net 2008 so I think it's version 3.5 of the .NET framework that you'll need.
Last edited by ZH/Franky on Sun Dec 07, 2008 2:56 am, edited 4 times in total.
h4tred

Post by h4tred »

Tell me when you wrote it in C.
ZH/Franky

Post by ZH/Franky »

h4tred wrote:Tell me when you wrote it in C.
It'll be a long time until I'm able to write good code in C (and a while until I even try coding in C). On the same note, it'll also be a long time until I'm highly skilled with VB.Net.
adventure_of_link
Locksmith of Hyrule
Posts: 3634
Joined: Sun Aug 08, 2004 7:49 am
Location: 255.255.255.255
Contact:

Post by adventure_of_link »

h4tred wrote:Tell me when you wrote it in C.
Shut up.
<Nach> so why don't the two of you get your own room and leave us alone with this stupidity of yours?
NSRT here.
h4tred

Post by h4tred »

No!

You. Shut. Up.
I didn't say anything wrong, so how dare you tell me to shut up. All I said is that I am interested in it when its done in C. Thats all. How the fuck is that flaming or are you just finding excuses to say "shut up" to me?
creaothceann
Seen it all
Posts: 2302
Joined: Mon Jan 03, 2005 5:04 pm
Location: Germany
Contact:

Post by creaothceann »

Franky:
Use PNG next time, instead of JPG with insanely high compression.
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
ZH/Franky

Post by ZH/Franky »

adventure_of_link wrote:
h4tred wrote:Tell me when you wrote it in C.
Shut up.
As much as I knew he was taking the piss, I don't want my thread to be derailed, so rather than respond to h4tred with a swift "fuck you", I responded peacefully.
dickhead wrote:No!

You. Shut. Up.
I didn't say anything wrong, so how dare you tell me to shut up. All I said is that I am interested in it when its done in C. Thats all. How the fuck is that flaming or are you just finding excuses to say "shut up" to me?
If you have nothing meaningful to say, then don't say anything at all. You're not welcome around these boards anyway, so if people want to tell you to shut up, they can. I don't particularly like you, either. If it were up to me, you'd already be banned, right down to the ISP level.

You have no right to harrass other people as you've been doing for some time now.
creaothceann wrote:Franky:
Use PNG next time, instead of JPG with insanely high compression.
Meh, I usually just hit printscreen, paste it into mspaint and save it as jpeg. Sure, there'll be a few artifacts in the image, but I'm not at all bothered. I do use png occasionally though. I like compression, and it's not as if you need every pixel to be perfect anyway.
creaothceann
Seen it all
Posts: 2302
Joined: Mon Jan 03, 2005 5:04 pm
Location: Germany
Contact:

Post by creaothceann »

PNG also uses compression, and it's much more effective here since your pictures use few colors and color gradients.

JPG is for photographs.
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
ZH/Franky

Post by ZH/Franky »

I've cleaned up some of the code in AK3N:

Code: Select all

Option Explicit On
Option Strict On
Public Class AK3N

    Private Sub txtInput_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtInput.KeyPress
        If rdbInputISBN10.Checked = True And txtInput.Text.Length = 10 Or rdbInputISBN13.Checked = True And txtInput.Text.Length = 13 Then
            If Not (e.KeyChar.ToString = Chr(8)) Then
                e.KeyChar = Nothing
            End If
        ElseIf rdbInputISBN10.Checked = True Then
            If e.KeyChar.ToString.ToUpper = "X" And txtInput.Text.Length = 9 Then
            ElseIf Not (e.KeyChar.ToString Like "#" Or e.KeyChar.ToString = Chr(8)) Then
                e.KeyChar = Nothing
            End If
        ElseIf Not (e.KeyChar.ToString Like "#" Or e.KeyChar.ToString = Chr(8)) Then
            e.KeyChar = Nothing
        End If
    End Sub

    Private Sub btnConvert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConvert.Click
        If txtInput.Text = "" Then
            Call MsgBox("Please enter a value")
        ElseIf rdbInputISBN10.Checked = True Then
            If Not (txtInput.Text.Length = 10) Then
                Call MsgBox("ISBN10 number must be 10 digits")
            ElseIf Not (bVerifySum10(txtInput.Text) = True) Then
                Call MsgBox("Invalid ISBN-10 number")
            Else
                txtOutput.Text = sConvertN10toN13(txtInput.Text.ToUpper)
            End If
        ElseIf rdbInputISBN13.Checked = True Then
            If Not (txtInput.Text.Length = 13) Then
                Call MsgBox("ISBN13 number must be 13 digits")
            ElseIf Mid(txtInput.Text, 1, 3) = "979" Then
                Call MsgBox("ISBN-13 numbers of prefix 979 cannot be converted to ISBN-10")
            ElseIf Not (Mid(txtInput.Text, 1, 3) = "978") Then
                Call MsgBox("ISBN-13 prefix must be 978")
            ElseIf Not (bVerifySum13(txtInput.Text) = True) Then
                Call MsgBox("Invalid ISBN-13 number")
            Else
                txtOutput.Text = sConvertN13toN10(txtInput.Text)
            End If
        End If
    End Sub

    Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
        txtInput.Text = ""
        txtOutput.Text = ""
    End Sub

    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click
        End
    End Sub

    Private Sub rdbInputISBN10_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdbInputISBN10.CheckedChanged
        txtInput.Text = ""
        txtOutput.Text = ""
    End Sub

    Function sConvertN10toN13(ByRef usISBN10 As String) As String
        Dim iMax As Integer = 0
        sConvertN10toN13 = "978" + Mid(usISBN10, 1, 9)
        For j As Integer = 2 To 12 Step 2
            iMax += (Convert.ToInt32(Mid(sConvertN10toN13, (j - 1), 1))) + (3 * (Convert.ToInt32(Mid(sConvertN10toN13, j, 1))))
        Next
        sConvertN10toN13 += ((10 - (iMax Mod 10)) Mod 10).ToString
    End Function

    Function bVerifySum13(ByRef usISBN13 As String) As Boolean
        Dim iMax As Integer = 0
        bVerifySum13 = True
        For j As Integer = 2 To 12 Step 2
            iMax += ((Convert.ToInt32(Mid(usISBN13, (j - 1), 1))) + (3 * (Convert.ToInt32(Mid(usISBN13, j, 1)))))
        Next
        If Not (((10 - (iMax Mod 10)) Mod 10) = Convert.ToInt32(Mid(usISBN13, 13, 1))) Then
            bVerifySum13 = False
        End If
    End Function

    Function sConvertN13toN10(ByRef usISBN13 As String) As String
        Dim iMax As Integer = 0
        Dim iCount As Integer = 0
        sConvertN13toN10 = Mid(usISBN13, 4, 9)
        For j As Integer = 10 To 2 Step -1
            iMax += ((Convert.ToInt32(Mid(sConvertN13toN10, (10 - (j - 1)), 1))) * j)
        Next
        If Not ((iMax Mod 11) = 0) Then
            Do
                iCount += 1
            Loop Until Not (((iMax + iCount) Mod 11) <> 0)
            If Not (iCount <> 10) Then
                sConvertN13toN10 += "X"
            Else
                sConvertN13toN10 += iCount.ToString
            End If
        Else
            sConvertN13toN10 += "0"
        End If
    End Function

    Function bVerifySum10(ByRef usISBN10 As String) As Boolean
        Dim iMax As Integer = 0
        bVerifySum10 = True
        For j = 10 To 2 Step -1
            iMax += ((Convert.ToInt32(Mid(usISBN10, (10 - (j - 1)), 1))) * j)
        Next
        If Not ((iMax Mod 11) = 0 And Mid(usISBN10, 10, 1) = "0") Then
            If Not (Mid(usISBN10, 10, 1).ToUpper = "X") Then
                iMax += Convert.ToInt32(Mid(usISBN10, 10, 1))
            Else
                iMax += 10
            End If
            If Not ((iMax Mod 11) = 0) Then
                bVerifySum10 = False
            End If
        End If
    End Function

End Class
h4tred

Post by h4tred »

VB.NET turd wrote:If you have nothing meaningful to say, then don't say anything at all. You're not welcome around these boards anyway, so if people want to tell you to shut up, they can. I don't particularly like you, either. If it were up to me, you'd already be banned, right down to the ISP level.

You have no right to harrass other people as you've been doing for some time now.
If that ain't the pot calling the kettle black...... :roll:
adventure_of_link
Locksmith of Hyrule
Posts: 3634
Joined: Sun Aug 08, 2004 7:49 am
Location: 255.255.255.255
Contact:

Post by adventure_of_link »

Referring to Franky as a VB.net turd doesn't help much either asshole

sorry dude, but he needs to be put in his place.
<Nach> so why don't the two of you get your own room and leave us alone with this stupidity of yours?
NSRT here.
h4tred

Post by h4tred »

Referring to Franky as a VB.net turd doesn't help much either asshole
Well you fat piece of shit, what would you suggest? Permabans? Apologies to the people I trolled?
adventure_of_link
Locksmith of Hyrule
Posts: 3634
Joined: Sun Aug 08, 2004 7:49 am
Location: 255.255.255.255
Contact:

Post by adventure_of_link »

h4tred wrote:Permabans?
Yes.
h4tred wrote:Apologies to the people I trolled?
Yes.

Piece of shit? don't make me laugh. so far all you're doing is trolling TWO different software developers, yet contributed NOTHING more than idiotic and useless flames.
<Nach> so why don't the two of you get your own room and leave us alone with this stupidity of yours?
NSRT here.
h4tred

Post by h4tred »

Which means, the solution is the ban hammer.

Its there, on the table over there. All that needs to happen is a moderator with the tools to use it.
adventure_of_link
Locksmith of Hyrule
Posts: 3634
Joined: Sun Aug 08, 2004 7:49 am
Location: 255.255.255.255
Contact:

Post by adventure_of_link »

Don't talk to me about it.

Talk to the one who banned your mudlord nick.
<Nach> so why don't the two of you get your own room and leave us alone with this stupidity of yours?
NSRT here.
ZH/Franky

Post by ZH/Franky »

GTFO of my thread, h4tred.
grinvader
ZSNES Shake Shake Prinny
Posts: 5632
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Post by grinvader »

adventure_of_link wrote:Talk to the one who banned your mudlord nick.
You keep forgetting I merely did it because he asked me to.

Fix that.
皆黙って俺について来い!!

Code: Select all

<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
adventure_of_link
Locksmith of Hyrule
Posts: 3634
Joined: Sun Aug 08, 2004 7:49 am
Location: 255.255.255.255
Contact:

Post by adventure_of_link »

grinvader wrote:
adventure_of_link wrote:Talk to the one who banned your mudlord nick.
You keep forgetting I merely did it because he asked me to.

Fix that.
I was trying to say that I don't have the power to ban people, but whatever.
<Nach> so why don't the two of you get your own room and leave us alone with this stupidity of yours?
NSRT here.
Dullaron
Lurker
Posts: 199
Joined: Mon Mar 10, 2008 11:36 pm

Post by Dullaron »

h4tred go away. :roll:
Window Vista Home Premium 32-bit / Intel Core 2 Quad Q6600 2.40Ghz / 3.00 GB RAM / Nvidia GeForce 8500 GT
ZH/Franky

Post by ZH/Franky »

delete this post.
Post Reply