Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - cooliojazz

Pages: 1 ... 9 10 [11] 12 13 ... 41
151
Computer Projects and Ideas / Re: Random Java Libs
« on: July 24, 2011, 03:06:37 pm »
The example is in the spoiler tags ;) If you need a better explanation of how it works, I can give that too though =P

152
Computer Projects and Ideas / Random Java Libs
« on: July 23, 2011, 02:52:04 pm »
I just finished converting the back end of my IRC bot into an IRC library, JIRC. It's a fairly easy way to add IRC stuff to anything. I only did the javadoc for the main class, so... =P The attached zip has the jar, javadoc, and source. Here's an example of how to use it (This is a simple command line IRC client, basically) Freel free to comment on things it needs or things you find odd =)
Spoiler For Example Below:
Code: [Select]
//Sorry about the lack of comments, I'm a lazy documenter... =\
//Modified to add a few more comments =P
import java.io.*;
import java.util.*;
import java.util.regex.*;

public class Test {
   
    static PrintStream sout = System.out;
    static BufferedReader sin = new BufferedReader(new InputStreamReader(System.in));
   
    public static void main(String args[]) {
        JIRC jirc = new JIRC("withg.us.to", "JIRC_Test", "JIRC Test Bot") {
            //I just used a nameless class (whatever the correct term is, idk), you probably would want to create a seperate extending class for code neatness, but this is small, so...
            //All the methods that need to be implemented are the event handlers.  I tried to make the event names pretty obvious, but...
            protected void onConnect() { //When JIRC connects to IRC (Or reconnects, it auto reconnects on disconnect)
                sout.println("Connected!");
                joinChannel("test");
            }

            protected void onPingged(String server) { //When you are pinged
                sout.println("Ping? Pong!");
            }

            protected void onServerMessage(String message) { //When the server sends you a message
                Date now = new Date();
                sout.println("-[" + now.toGMTString() + "]- " + message);
            }

            protected void onChannelMessageReceive(String channel, String nick, String message) { //When you receive a message directed at a channel you are in
                sout.println("[" + now.toGMTString() + "] #" + channel + ": <" + nick + "> " + message);
            }

            protected void onPrivateMessageReceive(String nick, String message) { //When you receive a private message directed at you
                sout.println("[" + now.toGMTString() + "] <" + nick + "> " + message);
            }

            protected void onChannelMemberPart(String channel, String nick) { //When someone leaves a channel you are in
                sout.println(channel + ": " + nick + " has left");
            }

            protected void onChannelMemberJoin(String channel, String nick) { //When someone joins a channel you are in
                sout.println(channel + ": " + nick + " has joined");
            }

            protected void onChannelMemberQuit(String nick, String message) { //When someone who is in one or more channels with you quits
                sout.println(nick + " has quit (" + message + ")");
            }
        };
        jirc.start(); //Start JIRC
Pattern JoinCommand = Pattern.compile("/(?:join|j) (.+)", Pattern.CASE_INSENSITIVE);
Pattern PartCommand = Pattern.compile("/(?:part|p)", Pattern.CASE_INSENSITIVE);
Pattern CACCommand = Pattern.compile("/cac (.+)", Pattern.CASE_INSENSITIVE);
Pattern NickCommand = Pattern.compile("/(?:nick|n) (.+)", Pattern.CASE_INSENSITIVE);
Pattern OpCommand = Pattern.compile("/op (.+)", Pattern.CASE_INSENSITIVE);
Pattern DeOpCommand = Pattern.compile("/deop (.+)", Pattern.CASE_INSENSITIVE);
Pattern RawCommand = Pattern.compile("/raw (.+)", Pattern.CASE_INSENSITIVE);
Pattern ListCommand = Pattern.compile("/(?:list|l) #(.+)", Pattern.CASE_INSENSITIVE);
Pattern ExitCommand = Pattern.compile("/(?:exit|e)", Pattern.CASE_INSENSITIVE); //Because I'm lazy, so I used regex to detect commands etc
        String ActiveIRCChannel = ""; //To keep track of the channel you are currently talking in
        try {
            while (true) { //Loop for console input
                while (sin.ready()) {
                    String msg = sin.readLine();
                    if (msg != null) {
                        Matcher m;
                        if ((m = JoinCommand.matcher(msg)).find(0)) {
                            jirc.joinChannel(m.group(1).replace("#", ""));
                        } else if ((m = PartCommand.matcher(msg)).find(0)) {
                            jirc.partChannel(ActiveIRCChannel);
                        } else if ((m = NickCommand.matcher(msg)).find(0)) {
                            jirc.changeNick(m.group(1));
                        } else if ((m = OpCommand.matcher(msg)).find(0)) {
                            jirc.opChannelMember(ActiveIRCChannel, m.group(1));
                        } else if ((m = DeOpCommand.matcher(msg)).find(0)) {
                            jirc.deOpChannelMember(ActiveIRCChannel, m.group(1));
                        } else if ((m = CACCommand.matcher(msg)).find(0)) {
                            ActiveIRCChannel = m.group(1).replace("#", "");
                            sout.println("Changed the active channel to " + ActiveIRCChannel);
                        } else if ((m = ListCommand.matcher(msg)).find(0)) {
                            Channel curchan = jirc.getChannelList().get(JIRC.inChannelList(jirc.getChannelList(), m.group(1)));
                            Person[] People = curchan.getAllMembers();
                            for (int x = 0; x < People.length; x++) {
                                sout.println(People[x].getName() + " (" + People[x].getModes() + ") Active: " + People[x].isActive());
                            }
                        } else if ((m = RawCommand.matcher(msg)).find(0)) {
                            jirc.sendRawMessage(m.group(1));
                        } else if ((m = ExitCommand.matcher(msg)).find(0)) {
                            sout.close();
                            sin.close();
                            System.exit(0);
                        } else if (msg.startsWith("/")) {

                        } else {
                            jirc.sendMessage(ActiveIRCChannel, msg);
                            sout.println("#" + ActiveIRCChannel + ": <" + jirc.getNick() + "> " + msg);
                        }
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Additionally, notice the "s" in "Java Libs".  That's because I also plan on converting the backend of TFE into a general purpose TI File lib, and maybe some others if I feel like it.  This is it atm though =)

153
Music Showcase / Re: JC Attempts Piano
« on: July 23, 2011, 12:58:40 am »
Ohaithur, I herd u leik remixes, so I... I gave you a remix. Sorry, I just couldn't finish that =P But anyways, JC, I loved that begging part, so I kinda took it, transcribed it, then added some. Have fun =D (Download Below!)

EDIT: If the first sentence confused you, it's called memes. Look it up! =P
EDIT2: I decided IT NEEDS MOAR RAINSTICK!!!!! cause ya know, constantly going just isn't enough

154
Music Showcase / Re: La Porte du Soleil ('80s Remix)
« on: July 21, 2011, 01:34:46 pm »
I <3 this song so much, both the original and the remix =D

155
News / Re: Five new Coders of Tomorrow hired
« on: July 20, 2011, 01:12:58 pm »
Congrats you guys! GLHF? =P

156
Minecraft Discussion / Re: Omnimaga minecraft server
« on: July 20, 2011, 02:09:23 am »
I have a minecraft server, which used to be on withg.us.to, but just got moved a few days ago to unrealphantasies.tk. It runs nomcraft, the mod I wrote (and am still writing, source can actually be found at http://sourceforge.net/projects/nomcraft/ in the svn), which actually adds mostly out of game features atm (eg irc, email type thing, etc). No idea what the capacity is on it, since I just bought the server a couple days ago, and haven't really done any load testing... feel free to join, but try not to mess with people's stuff =P

157
Music Showcase / Re: DJ CJ
« on: June 19, 2011, 06:35:23 pm »
I made a couple new songs, The Light in the Dark and A Night Online, and finished Lullaby for a Weary Soul.  I updated the first post, check it out!

158
Computer Programming / Re: Java - Load Images on Screen Display
« on: June 19, 2011, 02:08:03 pm »
I don't remember if this is just so you can use it in jars, but you can try it to see if it helps. To load "included" files, instead of
Code: [Select]
Image bg;
image pic;
bg = new ImageIcon("background.jpeg").getImage();
pic = new ImageIcon("face.png").getImage();
I always use
Code: [Select]
import java.awt.image.*;
import javax.imageio.*;
BufferedImage bg;
BufferedImage pic;
bg = ImageIO.read(getClass().getResource("background.jpeg"))
pic = ImageIO.read(getClass().getResource("face.png"))
EDIT: forgot the includes :P

159
TI Z80 / Re: TFE
« on: June 13, 2011, 05:27:37 pm »
That would be nice :D  And I probably won't update it now for a while, I have other things I'd like to work on, and this is getting decent, so I feel like I can leave it for a bit.  Unless there's big bugs or something.  Then I'll fix those ASAP ;)

160
TI Z80 / Re: TFE
« on: June 13, 2011, 05:20:22 pm »
Okay, one more update.  I changed it so it should look more "native", I think it should work on most platforms, I don't really know, but I hope :P Also, I added copy and pasting selections in the picture editor, (Switch between modes with "s" and "p") and added a window list menu, like there should be.  Lastly, I added a "settings" dialog so you can set the (Oh so useless) file comment and set the program name or picture number. Yeah, I think that's all... Feedback is useful! Kthxbye.

161
TI Z80 / Re: TFE
« on: June 08, 2011, 07:25:51 pm »
Okay, added the check for axe "continuously" and finished the rest of the 722 tokens, also added label highlighting. :)  I should make it so if you click a label name, it goes to the declaration... Hmm... Anyways... DJ, I was thinking of something like that, a run button that you could press and it would send it to wabbitemu.  I could probably do that... Also, if someone ever mad an on computer Axe compiler, I think it would be cool to just have a compile button in the IDE =)

162
TI Z80 / Re: TFE
« on: June 08, 2011, 01:25:52 pm »
Although I don't have it set to continuously watch for it, it will recognize and use Axe tokens and highlighting (things like comments or data blocks etc) if it has the axe header when you open it.  That is something I should add in the next version, continuos checking... Shouldn't be hard at all =)

163
TI Z80 / TFE - The TI File Editor
« on: June 07, 2011, 03:27:07 am »
Scroll down for the latest version...

Third time is a charm, eh?  If this one ends up failing, and by that I mean no one wants or uses it, I don't mean because it sucks and I stop developing it like the other two, then TFE is over =\ But w/e, I could spend so many paragraphs saying how this version is better, and how I built it correctly, etc, but you don't care, you just want to see the project.  In fact, I'll bet most of the people reading this haven't even seen the original two.  If you haven't, here's a tip: DO NOT LOOK THEM UP OR EVER THINK ABOUT THEM AGAIN.  Okay, am I done talking pointlessly?  Yeah, I think I am, here we go... Ignore all that, I write too much.



TFE (AKA TI File Editor)
TFE is an IDE for programming 83/84 calculators on your PC.  It's about 50-60% of what I would like the final product to be. I plan on supporting all TI-83/84 file types eventually, but for now it allows editing and creation of programs and pictures.


Program Editor Features:
-Sytax highlighting
-Axe differentiation
-Custom token definitions - Do things like redifine → as -> if you dont like using quick key etc.
Code: [Select]
Custom token definitions:
Look for the $home/.tfe/ directory on your computer.  This is where TFE looks for token sets.  There should be a file called config.txt.  This is a list of all the custom token sets it should load.  The syntax is as follows:

(config.txt)
[file name] [token set name]
test.tokens "Just for kicks"

The token set declaration is a bit more complicated.  It basically consists of finding which tokens you don't like being as they are by default and redefining them.
There are two ways to currently do this, replacing based on existing token, and replacing based on number.  Which is easier just depends on the token.

(xxx.tokens)
(If the first line is "AXE", the highlighter will use axe highlighting with this token set)
AXE
(Number replacement) 0:[first byte]|[second byte]|[new token]
0:4|0|->
(Name replacement) 1:[original token]|[new token]
1:→|->

Except loading new token sets, any other change will be reflected if you switch tokens without restarting the program.
-Label finder - Ctrl-Click a goto or a sub in axe to go to the matching label
-"Quick Keys" - basically shortcuts for common TI Symbols.  Here's the current list:
Code: [Select]
Ctl-Shift-S - →
Ctl-Shift-T - θ
Ctl-Shift-P - π
Ctl-Shift-L - ˪
Ctl-Shift-E - ℯ
Ctl-Shift-X - ᴇ
Ctl-Shift-R - ʳ
Ctl-Shift-Left - ◄
Ctl-Shift-Right - ►
Ctl-Shift-< - ≤
Ctl-Shift-> - ≥
Ctl-Shift-= - ≠
Ctl-Shift-- - ­(negative)
Ctl-Shift-(1-0) - (₁-₀)
UnrealHelper - A very simple code hints tool, which may be improved over time, Ctrl-H to toggle

Picture Editor Features:
-Toggleable grid (Ctrl-G)
-Resizable brush (Scroll or -= keys)
-Selections for cut/copy/pasting (Press s for selection mode, p for drawing mode)
-Moving selections
-Filling
-Edit history

Other Features:
-Data converter - Dump the raw data from files on your computer into .8xv files.

Yeah, doesn't look like much, huh?  I do plan on adding a lot of picture editing tools eventually, but it works and that is enough for now :P
As this is the first release, I expect a lot of bugs. I mean, I've only had like 2-3 people test it so far.  Please tell any you find to me!!!! Things I expect, so I don't need so be informed of, are tokens not showing up correctly.  Honestly, this is mostly a release to find a lot of the bugs and get feedback about what's missing or what needs to be added in general.  There are still some menial tasks that i've been doing just a little at a time which aren't finished, fixing all the tokens being one of them.  That's basically what I'll be doing till the next version, plus fixing bugs =\  Anyways, enough talking, try it! go for it! DOITNAO! =P Oh, did I mention it's in java, not .NET this time? :D OKAYOKAYI'MSORRYFORMYLONGPOSTS /me runs

164
Computer Programming / Re: JTextArea getText funtion?
« on: June 06, 2011, 11:48:22 pm »
Depenends on if you want the plain text or not.  If you want the actuall contents (EG html tags if it's type text/html , or rtf tags if it's text/rtf) or it's just type text/plain, just use input.getText(), if you're using any "rich" text format but you still just want the plain text, you can use input.getDocument().getText(0, input.getDocument().getLength());
Okay, I just wrote all that, then realized you said jtextarea, not jeditorpane or jtextpane, so everything i dsaid about rich text is inapplicable. =\ Anywasy, input.getText() is correct, why did you think it wasn't?

165
Miscellaneous / Re: jhgenius: time for a username change
« on: May 22, 2011, 07:14:25 pm »
Plus that way your whole nick'll fit in EFnet ;D
Umm...
Why? There are quite a lot of reasons actually:
   1. It's more simpler and shorter
   2. I can fit my whole username into EFNet
   3. Many people already call me jhgenius anyway
   4. Well I'm jhgenius on TIMGUL and Cemetech, so why not on Omnimaga?
:P

Pages: 1 ... 9 10 [11] 12 13 ... 41