Register
Email: Password:
Forum » General Programming thread
  • « previous
  • 1
  • 2
  • 3
  • » next
  • General Programming thread

    E_net4 17 years ago
    Use this thread to say anything about programming.
    Including questions, suggestions, small programs, etc.
    #
    Amarth 17 years ago
    I just compiled a C++ program that loads a Java VM (Sable's) and runs a Hello World class in it.

    And it even worked.

    Also, I have a SVN account for KDE4. Beat that.
    #
    E_net4 17 years ago
    ...Huh, am I supposed to beat that?
    #
    harwe 17 years ago
    haha wow,.....
    #
    Anarion 17 years ago
    Anyone here tried out the Ruby language? Anyone written anything with it?
    #
    LunaticNeko 17 years ago
    Nope. And here, we only use the java.net.* package to nuke each other's comp.
    #
    E_net4 17 years ago
    This may be also a place to show your Piet programs.
    #
    MageKing17 17 years ago
    "Anarion" said:
    Anyone here tried out the Ruby language? Anyone written anything with it?
    I once looked at some Ruby code, but never written anything in it.

    Hey Amarth, quick Perl question. Suppose I wanted an IRC bot to reset itself... that is, disconnect totally, load all settings from scratch, and reconnect? Without closing it down, modifying the settings, and restarting it, obviously. ;P
    #
    Amarth 17 years ago
    I don't know... Custom code, I think. Provide subroutines for those three things and they're easily reused.
    #
    MageKing17 17 years ago
    "Amarth" said:
    I don't know... Custom code, I think. Provide subroutines for those three things and they're easily reused.
    No, really?

    I know how to disconnect... that's fairly easy. However, when I do that, it kind of stops running. I want it to reconnect with a fresh batch of settings (so perhaps reconnect isn't the right term ).
    #
    Amarth 17 years ago
    Well, the POE kernel will quit if you unregister for all events. Don't unregister the events if you don't want it to quit. Or perhaps unregistering and re-registering them in one quick pass (ie, in the same subroutine) also doesn't quit the run() method, I don't know.

    Unless you quit by sending POCOIRC_SHUTDOWN, that seems to be some new way of doing it. Then don't send that and disconnect manually.

    Another way would be to set up a loop that only quits when some flag 'trulyreallyabsolutelypositivelywantstoquit' evaluates to true. While the flag is false, register for all events, load settings and start the bot.

    Anyway, I don't know what your code is all about, I don't know how you read and write settings, how you quit, how you connect, ... in your code. For what I know, we might be talking about different things here ('I want to reconnect, but reconnect is not the right word' - am I supposed to understand you? ). Don't expect me to read your mind.
    #
    Murska 17 years ago
    "E_net4" said:
    ...Huh, am I supposed to beat that?

    I was SO close to saying "No, you should beat it." when I saw this...
    #
    MageKing17 17 years ago
    "Amarth" said:
    Another way would be to set up a loop that only quits when some flag 'trulyreallyabsolutelypositivelywantstoquit' evaluates to true. While the flag is false, register for all events, load settings and start the bot.
    Perfect, that's what I should do.

    "Amarth" said:
    Anyway, I don't know what your code is all about, I don't know how you read and write settings, how you quit, how you connect, ... in your code. For what I know, we might be talking about different things here ('I want to reconnect, but reconnect is not the right word' - am I supposed to understand you? ). Don't expect me to read your mind.
    I could've sworn I've shown you MageBot's code at some point or another. Hell, you half-wrote most of it.
    #
    E_net4 17 years ago
    I'm trying to make a Piet Interpreter. But for now, I have no idea on how to get the hue and darkness differences between two colours.
    #
    Amarth 17 years ago
    Try Wikipedia and more Wikipedia.
    #
    E_net4 17 years ago
    Wii thanks.
    I hope you'll see a Piet Interpreter soon.
    #
    Amarth 17 years ago
    HAI
    CAN HAS STDIO?
    VISIBLE "HAI WORLD!"
    KTHXBYE

    <!-- m --><a class="postlink" href="http://lolcode.com/home">http://lolcode.com/home</a><!-- m -->
    #
    Anonymous1157 17 years ago
    HAI
    CAN HAS DOWNLOAD?
    KTHXBYE
    #
    Barebones 17 years ago
    "Amarth" said:
    HAI
    CAN HAS STDIO?
    VISIBLE "HAI WORLD!"
    KTHXBYE

    <!-- m --><a class="postlink" href="http://lolcode.com/home">http://lolcode.com/home</a><!-- m -->

    http://macrochan.org/source/W/X/WX4GYH2ER3DALM5BB44Z75SN4L6BFWRB.jpeg

    I'm a nice guy so I'll link it instead of killing all the dialup users.
    #
    Anonymous1157 17 years ago
    ... What exactly is it? And what language is the text in?
    #
    Barebones 17 years ago
    "Anonymous1157" said:
    ... What exactly is it? And what language is the text in?

    It's all 4chan related.

    Because serious posts require serious replies.

    Anyways its all based in perl and compiled, etc etc all the jumbo of creating your own reference.

    http://lolcode.com/contributions/ploximeth-s-compiler
    #
    E_net4 17 years ago
    Funny...

    HAI
    CAN HAS STDIO?
    IM IN YR LOOP
    VISIBLE "THIS EEZ SPAM!"
    IM OUTTA YR LOOP
    KTHXBYE
    #
    Amarth 17 years ago
    "Barebones" said:
    http://lolcode.com/contributions/ploximeth-s-compiler
    Oh! What an evil way of creating a language!
    #
    Anonymous1157 17 years ago
    I'm guessing we're supposed to compile it ourselves. Oh, goodie.
    #
    E_net4 17 years ago
    Is there a way to compile some code ourselves? As in, an EXE file?
    #
    harwe 17 years ago
    isnt perl a script you can run rather than compiling it... ??? meh im not sure myself anyway
    #
    MageKing17 17 years ago
    "harwe" said:
    isnt perl a script you can run rather than compiling it... ??? meh im not sure myself anyway
    Perl code is compiled, then run. The only difference is that the compiled version is generally not saved.
    #
    Anonymous1157 17 years ago
    "MageKing17" said:
    "harwe" said:
    isnt perl a script you can run rather than compiling it... ??? meh im not sure myself anyway
    Perl code is compiled, then run. The only difference is that the compiled version is generally not saved.
    By "Generally not saved", do you mean that there's no way to do it whatsoever, or that nobody wants to because the language compiles fast enough to make transferring the code more economical?
    #
    Grim Reaper 17 years ago
    "Anonymous1157" said:
    "MageKing17" said:
    "harwe" said:
    isnt perl a script you can run rather than compiling it... ??? meh im not sure myself anyway
    Perl code is compiled, then run. The only difference is that the compiled version is generally not saved.
    By "Generally not saved", do you mean that there's no way to do it whatsoever, or that nobody wants to because the language compiles fast enough to make transferring the code more economical?
    I'd say the latter.
    #
    MageKing17 17 years ago
    "Grim Reaper" said:
    "Anonymous1157" said:
    By "Generally not saved", do you mean that there's no way to do it whatsoever, or that nobody wants to because the language compiles fast enough to make transferring the code more economical?
    I'd say the latter.
    Pretty much, yeah. Plain text code is easier to deal with. Perl compiles & runs it fairly quickly, so it's more convenient to keep everything in code form. You could, of course, compile Perl code into an executable... but unless you're making a program you intend to distribute to people who don't have cygwin, I don't see the point.
    #
    Amarth 17 years ago
    Also note that compiled = processor architecture+OS dependant. Thus extremely unportable.

    You might all use Windows + x86, but the FOSS world doesn't really care too much about Windows.
    #
    E_net4 17 years ago
    My Visual Basic code to convert a Hex value into a Dec value isn't working. Could someone check?
    txtHex holds the Hexadecimal value.
    Private Hexs() As Integer

    Private Sub cmdConvert_Click()
    Dim Final As Long
    Dim i As Long
    Dim lengh As Long
    lengh = Len(txtHex.Text)
    ReDim Hexs(lengh) As Integer
    For i = 1 To lengh
    If Not IsNumeric(Mid(txtHex.Text, i, 1)) Then
    Select Case Mid(txtHex.Text, i, 1)
    Case "A": Hexs(lengh - i) = 10
    Case "B": Hexs(lengh - i) = 11
    Case "C": Hexs(lengh - i) = 12
    Case "D": Hexs(lengh - i) = 13
    Case "E": Hexs(lengh - i) = 14
    Case "F": Hexs(lengh - i) = 15
    End Select
    Else
    Hexs(lengh - i) = Int(Mid(txtHex.Text, i, 1))
    End If
    Next i
    Final = 0
    For i = 1 To lengh
    Final = Final + Hexs(i) * 16 ^ (lengh - i)
    Next i
    txtDec.Text = Final
    End Sub
    #
    Amarth 17 years ago
    Yay, about everything I hate about VB in one post. Anyway, one solution that works for me is
        Private Sub cmdConvert_Click()
    Dim Final As Long
    Dim i As Long
    Dim lengh As Long
    lengh = Len(txtHex.Text)
    Dim Hexs(lengh) As Integer
    For i = 1 To lengh
    If Not IsNumeric(Mid(txtHex.Text, i, 1)) Then
    Select Case Mid(txtHex.Text, i, 1)
    Case "A" : Hexs(i) = 10
    Case "B" : Hexs(i) = 11
    Case "C" : Hexs(i) = 12
    Case "D" : Hexs(i) = 13
    Case "E" : Hexs(i) = 14
    Case "F" : Hexs(i) = 15
    End Select
    Else
    Hexs(i) = Int(Mid(txtHex.Text, i, 1))
    End If
    Next i
    Final = 0
    For i = 1 To lengh
    Final = Final + Hexs(i) * 16 ^ (lengh - i)
    Next i
    txtDec.Text = Final
    End Sub
    though you might need to change it to your local VB dialect (mine is VB.Net 2005)

    A better solution might be
        Private Sub cmdConvert_Click()
    txtDec.Text = CLng("&H" & txtHex.Text)
    End Sub
    #
    E_net4 17 years ago
    Huh... O.o You mean... You must be kidding, right??
    ... Argh, bummer.
    #
    E_net4 16 years ago
    I am now reviving this thread to tell you about a test I did.
    I created a Visual Basic program to tell me the speed of pixel drawing using 3 drawing methods: PSet, BitBlt and StretchBlt

    PSet is a VB function that draws a pixel in a certain position with a certain colour.
    BitBlt is a Windows API function that draws an area of a source into another.
    StretchBlt is similar to BitBlt, as it's capable of setting different resolutions from the source's resolution.

    I'll tell you more about it later, I'm in a rush to school. <!-- m --><a class="postlink" href="http://www.esnips.com/doc/1848ed42-6143-4e24-a8b0-1718541e3ec2/Drawing-Speed">http://www.esnips.com/doc/1848ed42-6143 ... wing-Speed</a><!-- m -->
    #
    Forum » General Programming thread
  • « previous
  • 1
  • 2
  • 3
  • » next
  • Post Reply


    Your email:
    Your name: