News:

Happy New Year! Yes, the current one, not a previous one; this is a new post, we swear!

Main Menu
Menu

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.

Show posts Menu

Topics - Chavo

#1
JavaOp Support Archive / Re: JavaOp 2.1.2 To-Do List:
September 15, 2009, 06:15:15 PM
changelog goes in SVN commit! Generalizations = bad!
#2
Step 1: Have a regular, adequate sleep schedule
Step 2: drink enough water
Step 3: don't each too much sugar/have a balanced diet
Step 4: boost your metabolism with daily exercise
Step 5: Defeat insomnia by avoiding ocular stimulation right before bedtime
Step 6: Tired? Take a nap!

I've personally tried this method and while it seems like there are a lot of steps, there are NO CRASHES and NO SIDE EFFECTS!!!  Also, it is 100% FREE

I really think we should try to market this guys, we could put 5 Hour Energy and Random Energy Pill X out of business!


/cheap jab at Lead  :-*
#3
General Discussion / Winners
August 30, 2009, 11:39:34 PM
For those of you even mildly interested in Heroes of Newerth, the dota-clone game that is in closed beta which I have been participating in heavily:

Team fiVe (my team), won the very first Competitve HoN tournament.  This wasn't a very big tournament and was primarily to help promote the cause, but still an exciting achievement! :)

http://www.gamereplays.org/heroesofnewerth/portals.php?show=news&news_id=532608&home
#4
Gaming / Heroes of Newerth Beta
June 22, 2009, 03:34:05 PM
I have a few extra keys for this game if anyone is interested.  I'm not sure how much I can tell you in a public place like this because of the NDA, but I can tell you that it's a purist clone of DotA with a huge amount of improvements due to the fact that it has it's own engine rather than being a mod of Warcraft 3.  Hit me on AIM if you need more info than that.  The site is heroesofnewerth.com, but there's literally zero information there right now.  I'm not sure how soon they'll be releasing details but it should be in the next monthish.
#5
if that's not an attempt at trolling, you probably should give up on javaop
#6
Botdev / W3G->W3GS
February 23, 2009, 01:22:43 PM
Project Goal
Host and 'replay' a warcraft3 replay file as a multiplayer custom game on battle.net.  Because warcraft3 replays are essentially just instructions for the engine to play the game over, it should be possible to use a replay file to instruct the engine to perform similar actions in a multiplayer context.  The W3GS protocol is known well enough to have determined that the action packets are extremely similar to the action blocks used in the warcraft 3 replay format which makes this even easier.

General process overview

  • parse replay file for player information, map filename, action list, and chat
  • create battle.net lobby with player information and map signature
  • allow human players to join as ghosted observers (they cannot see each other so as to avoid player-id limitations)
  • start game and inject modified actions & chat at the correct times

The problem
I currently have this process working with one catch: actions are injected properly but ignored by remote clients.  I have determined that this issue is almost certainly because of a specific portion of the data in an action block.

this is an example action block as it exists in the replay file

1F              timeslot block, contains action block (see w3g_format.txt, w3g_actions.txt)
2B 00          length of data to follow
FA 00          time in milliseconds since last interval
01              player ID of the action
26 00          action block length
16              action ID: change selection
02              select mode
01 00          number of objects
74 71 00 00  objectID1
76 72 00 00  objectID2
16              action ID: change selection
01              select mode
01 00          number of objects
26 73 00 00  objectID1
40 74 00 00  objectID2
1A              action ID: pre subselection
19              action ID: select subgroup
38 30 30 6E  itemID (constant)
26 73 00 00  objectID1
40 74 00 00  objectID2


The action block portion of the data follows the same format for W3GS packets with some differences in header data which is easy to create.  The issue here is that the objectID values are, at my best guess, relative memory pointers.  The objectID values for the objects created at map startup at the same for a given map.  When new objects are created, their assigned objectIDs may not necessarily be the same.  Generally they can be the same if the same sequence of events happens (I believe time itself is not important, which strengthens my belief that these point to memory locations).  Furthermore, once an object has been assigned ObjectIDs, they do not change.  Objects of the same type (acolytes, for example) will have the same offset between objectIDs which makes sense since two acolytes should take up the same amount of space in memory.  Different units/buildings will have different offsets.  When I say offset, I mean the difference between objectID1 of two sequentially created objects of the same type.  At this point, I do not have a strong opinion regarding the importance of the second objectID. Sometimes it is the same as objectID1, sometimes it is not.

The challenge here is to determine if it is possible to alter these objectIDs in such a way that the clients will be able to use the memory pointers correctly (seems unlikely if initialization isn't predictable) or to manipulate the game setup in such a way that the objectIDs will be correct for players watching the game.

I attached a zip file with some of my example data that I've been generating.  Any insight on this objectID challenge would be appreciated.
#7
Unix / Linux Discussion / Uses for extra server resources
February 04, 2009, 06:14:59 PM
This isn't necessarily restricted to *nix platforms, but I have a significant amount of processing power available on my home network that I feel is being underutilized.  Specifically, a web server (Debian) that is probably at a good load (.07, .03, .01) for a web server but could easily handle more web services or provide more requests for database applications (MySQL database is local to the webserver), a FreeNAS box that is horribly underutilized (P4, 512MB RAM machine that does nothing but handle backups at the moment, the only reason I have this machine as a NAS is because it has the tertiary IDE port that allows me to RAID more drives). Lastly, I have a beast that I was using as a test machine for a while, but it's been sitting in the closet turned off for a month now.  I run most of my vm applications on my desktop that has plenty of resources available to do so.

Any ideas on what to do with the extra power? I've never really been interested in donating processor power to the *@HOME projects, but I'm looking for some good uses of these computers that are either interesting or useful.
#8
I have a microcontroller project that currently accepts input via a serial connection.  I'd like to extend by allowing wireless input.  I've done a bit of research and decided the easiest way would be for me to use the Bluetooth Serial profile (adding a Bluetooth module to implement a serial bluetooth receiver should be easy).  The part I have no experience with is creating an application to utilize the bluetooth stack and create the serial connection.  I was wondering if anyone had any experience here with bluetooth programming, or even j2me/similar mobile programs as I will likely want the application to work on my cell phone or PDA (Palm OS 2.x). 

Some specific questions I have include,
  • Do I need to include device discovery as part of the steps to create a Serial connection between the controller and device?
  • Are there any pitfalls to avoid when developing a mobile program compared to a desktop application or programming for an embedded device (a la microcontroller programming)?
  • Recommendations on language, API, IDE, or platform to use?
#9
Entertainment District / This is not a rick-roll
November 05, 2008, 01:44:51 AM
http://garyc.mooo.com:3232/rr/

(note link is harmless, but requires javascript/flash to be enabled)

#10
Entertainment District / Clean Install
April 14, 2008, 10:59:35 PM
This is an article from TheDailyWTF.com that I found particularly humorous.

Quote from: http://thedailywtf.com/Articles/A-Clean-Install.aspx
Originally posted by "Dirk"...

    A friend of mine recently bought a product called PrintMaster. He had some trouble installing the software and called me up for some tech support. He was receiving an Error 1305, for which a quick Google search lead me towards the following:

        ... Completing a clean installation of the program will help to prevent conflicts that can occur. The remainder of this note describes the procedure...

    All right, I thought a clean install, let's read on and see how to do a clean install:

       1. Place a small amount of nonabrasive, liquid soap on the shiny side of the CD or DVD.
       2. Using your fingertips and warm water, gently rub the soap on the disc in a circular motion.
       3. Rinse the disc thoroughly and dry it using a clean, soft T-shirt or lint-free towel. Do not use paper towels or tissue paper.
       4. Install the program.

    Doing a "clean install" has now taken on a new meaning for me.
#11
Gaming / Pardus
November 27, 2007, 01:52:17 AM
Anyone into space-based, tick-based, browser-based MMORPGs?

I recently got into Pardus.

The tutorial is really boring and fairly lame, but it does a good job of teaching the basics.  Once into the actual game, it really gets fun.


Check it out and if you decide to play, I'm Chavo on Artemis, based in Sirion (Union, Heaven's Wrath Alliance).  Even if you don't start in the Union, its an easy day or two fly to our sector (where we can give you some starting resources to speed things up ;))
#12
I needed something to consistently find the closest mirror.  At first I was thinking pings, but realized that relying on ICMP traffic would be a bad gauge if some mirrors disable it.  Then I considered location lookups based on IP but that is too broad for many purposes and often inaccurate.  So behold this 'psuedo-ping' solution! :P

Run it with debug on if you want more verbose information.

/*
* Find the fastest mirror! :)
*/
import java.io.IOException;
import java.net.ConnectException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;

public class MirrorSelector {

private static boolean DEBUG = false;
private static int MAX_TIME = 1000; // timeout time in ms and default length if an error occurs

public static InetSocketAddress selectMirror(InetSocketAddress[] mirrors)
{
Socket s = new Socket();
long[] times = new long[mirrors.length];
long start;

for(int i=0;i<mirrors.length;i++)
{
try{
s = new Socket();
start = System.currentTimeMillis();
s.connect(mirrors[i], MAX_TIME);
times[i] = System.currentTimeMillis() - start;
s.close();
if(DEBUG)
System.out.println("Connecting to " + mirrors[i] + " took " + times[i] + "ms");
}
/* I considered condensing all the specific exceptions into a generic handler
* since they all respond basically the same way
*/
catch(SocketTimeoutException ste)
{
System.out.println("Address " + mirrors[i] + " timed out");
times[i] = MAX_TIME;
}
catch(ConnectException ce)
{
System.out.println("Connect Exception: " + ce.getMessage() + " for " + mirrors[i]);
if(DEBUG)
ce.printStackTrace();
times[i] = MAX_TIME;
}
catch(SocketException se)
{
System.out.println("Unable to connect to " + mirrors[i]
     +", there may be a problem with your network connection.");
if(DEBUG)
se.printStackTrace();
times[i] = MAX_TIME;
}
catch(IOException ioe)
{
System.out.println("Error connecting to " + mirrors[i]);
if(DEBUG)
ioe.printStackTrace();
times[i] = MAX_TIME;
}
}

int fast_id = 0;
long fast_time = MAX_TIME;
for(int i=0;i<times.length;i++)
{
if(times[i] < fast_time)
{
fast_id = i;
fast_time = times[i];
}
}

return mirrors[fast_id];
}

public static InetSocketAddress getClosestMirror(String hostname, int port)
{
InetAddress[] ips;

try{
ips = InetAddress.getAllByName(hostname);
}
catch(UnknownHostException uhe)
{
System.out.println("Unable to resolve host: " + port);
return null;
}

InetSocketAddress[] mirrors = new InetSocketAddress[ips.length];
for(int i=0;i<ips.length;i++)
{
mirrors[i] = new InetSocketAddress(ips[i], port);
}

return selectMirror(mirrors);
}


public static void main(String[] args)
{
System.out.println("Fastest: " + getClosestMirror("google.com", 80));
}
}
#13
I have a simple script that I use to keep an application running on a windows machine:


:loop
;// execute a shell command
IF ERRORLEVEL == 1 GOTO loop
pause > nul


The program this is keeping alive I'm wanting to move to an offsite server that is running Linux.  Obviously I'll need to convert the script to something bash can understand, but the ERRORLEVEL variable is where I am lost.  ERRORLEVEL in Windows is a variable that holds the integer return value of the last command that executed.  For any normal program termination that is usually 0.  I have this particular program set to return 1 (System.exit(1)) when there is an error.  It logs the error on its own and this script restarts the program.  Anyone know the linux equivalent?
#14
General Programming / MySQL performance.
March 21, 2007, 10:23:57 AM
I'm writing an application/website that have a shared MySQL database (local to both).  I've abstracted all the mysql queries to their own layer so that my program could easily be switched to another type of backend.  In any case, I'm trying to decide how to implement some of the classes that handle queries.

First Decision:
a) maintain one/few connections to the myssql server using keepalive requests
b) open/close connection for every set of queries (ie open at the beginning of every method, close at the end of every method)

Keeping in mind its on localhost, it seems like option a) would be more efficient, but b) seems to be the correct way if I'm following general IO paradigms.  For some calls, I could be doing 200 transactions in a second or two so I'm hesitant to choose b).


Second Decision:
What is the best way to store arrays of data?  Right now I'm using a varchar that holds a string with space delimitted integers but it seems there has to be a better way.


Third Decision:
a) fewer tables, more columns
b) more tables, fewer columns

does it matter?

Anything other suggestions from mysql design gurus?
#15
General Discussion / SMF boards question
January 23, 2007, 05:55:13 PM
I didn't know where else to put this.

for the "I'd like to join!", you have it setup so that regular members can create topics, but not reply to others

I'd like to mimic this behavior (for different functionality) on another board but don't see how you are doing so, help?
#16
General Security Information / SMF Security
January 19, 2007, 05:54:41 PM
A friend of mine was having problems with someone hacking his IPB installation for an online community with a large user base.  He didn't have the money to upgrade to the newest version of IPB so I suggested SMF.

Any SMF veterans have any tips for securing SMF for a large user base?  I'm looking at you iago and Sidoh.
#17
I'm helping a friend improve the way he is running an e-sports league (currently ~600 members).  One of the things that is in major need of improvement is the method of determining rating changes after a game.  I can't go into too much detail because I've been asked to keep specifics on a need-to-know basis.

If anyone would like to work on this with me, my statistics knowledge is limited enough that I need help with this :)  Basically it would involve writing a new rating system from the ground up that meets a number of qualifications and then rigorous testing of a number of circumstances where the existing system has flaws.

FYI: I've already employed the help of a real-life friend who is a Stats major, but his time is limited (the fool is quadruple majoring and hes in his final year).  He will however, be able to easily check up on any algorithms devised to make sure they make mathematical sense.
#18
Trash Can / test
October 17, 2006, 10:16:30 AM
test
#19
General Programming / [java] Rolling (Shared) Queue
October 14, 2006, 02:52:09 PM
So apparently I'm one of those strange people that still has a legitimate reason to do battle.net related programming.

I wrote my own bot with some very unique core features.  One of the biggest features is the ability to handle multiple connections to battle.net inside one process.  This lets me send outgoing messages on a 'rolling' or shared system.

For example, in any bot that I know of, if you wanted to send 10 long messages, it would probably take you a while to avoid flooding off.  However, with a rolling Queue setup, you can divide those messages over a number of connections so that they are displayed much faster while still avoiding flooding off.

I've written, tested, debugged, and racked my brian for improvements on the code I'm using and it works pretty well.  However, sometimes it will display messages in the wrong order (for example, if I enqueue'd messages 1,2,3,4,5,6,7,8,9,10 it might display them as 1,2,3,4,5,7,8.6,10,9).  The more messages in the queue(s), the more likely they will be displayed out of order. 

iago, this is the code that I was talking to you about a while back that we both forgot I still wanted help with :)

I'm looking for any ideas or suggestions to help elliminate the problem or any insight to why it is occuring because I've tried to anticipate and prevent it in my code. Without further ado:

Queue.java
package connect;

import java.util.Timer;
import java.util.TimerTask;
import java.util.PriorityQueue;

import util.BNetPacket;
import util.QueuePacket;

/***
* Queue manages timing of outgoing data for a given PacketThread connection.
* Numbers and algorithm for computing proper delays inspired by iago's JavaOp2 code (www.javaop.com)
*
*@author unTactical
*/
public class Queue {

private final PriorityQueue<QueuePacket> queue = new PriorityQueue<QueuePacket>();
private final Timer timer = new Timer();

private TimerTask current;
private PacketThread conn;
    private boolean queueReady = true;
    private boolean enabled = false;
    private long lastSent = System.currentTimeMillis();

//TODO: make these customizable
    int packetCost = 250;
    int byteCost = 17;
    int byteOverThresholdCost = 17;
    int thresholdBytes = 65;
    int maxCredits = 800;
    int creditRate = 5;
    int credits = 800;   
   
    public Queue(PacketThread connection)
    {
    conn = connection;
    }
   
    public Queue(String DONOTUSESTHIS_FORTESTINGONLY) // for testing with QueueManager main function
    {
    }
   
    /** Supports disabling of the queue temporarily (useful for faster logon)
     *
     * @param status - enable/disable
     */
    public void enable(boolean status)
    {
    enabled = status;
    }
   
    /** Clear the queue if it gets too full  */
    public synchronized void clear()
    {
    queue.clear();
    }
   
    /** Primary function of Queue, schedules a packet to be sent, ordered by Priority and time scheduled
     *
     * @param data - packet to send to battle.net
     * @param priority - higher means it will be sent sooner
     */
    public synchronized void send(BNetPacket data, int priority)
    {
    QueuePacket q = new QueuePacket(data,priority);
    queue.add(q);
    if(queueReady)
    {
    long delay = getDelay(data.getBytes());
    timer.schedule(new QueueTask(),delay);
    queueReady = false;
    }
    }
   
    /** Tells us if this Queue is ready to send a message immediately or if it will have to be scheduled
     *
     * @return true if message can be sent immediately, false if we must schedule it
     */
    public synchronized boolean isReady()
    {
    return queueReady;
    }
   
    /** Lets us predict how long it will be before a new message can be sent based on this queue's status.
     * This is the core function that allows us to use a rolling queue system.
     *
     * @param priority - only consider packets in the queue matching or exceeding a given priority
     * @return amount to wait
     */
    public synchronized long getWait(int priority)
    {
    QueuePacket qpacket;
    updateCredits();
    int wait = credits;
   
    if(queue.size() > 0)
    {
    Object[] elements = queue.toArray();
    int tempCredits = credits;
    for(int i=0;i<elements.length;i++)
    {
    qpacket = (QueuePacket) elements[i];
    if(qpacket.getPriority() >= priority)
    getDelay(qpacket.getData().getBytes());
    }
    wait = credits;
    credits = tempCredits;
    }
   
    return wait;
    }
   
    /** Does the math for figuring out how long to wait after a message is sent
     * If you call this method, it adjusts the queue's status so if you don't really want to send the message,
     * make sure you return credits to its previous value.
     * I borrowed and tweaked this from iago's code.
     *
     * @param bytes - the longer the message, the more we need to wait.  This could be replaced with a length variable
     * @return time to wait after sending a message of length specified
     */
    private long getDelay(byte[] bytes)
    {   
    if(!enabled)
    return 0;
   
    // Add the credits for the elapsed time
    updateCredits();
        lastSent = System.currentTimeMillis();

        // Get the packet's "cost"
        int thisByteDelay = byteCost;       
        if(bytes.length > thresholdBytes)
            byteCost = byteOverThresholdCost;
        int thisPacketCost = packetCost + (thisByteDelay * bytes.length);

        // Check how long this packet will have to wait
        int requiredDelay = 0;
        // If we can't "afford" the packet, figure out how much time we'll have to wait
        if(credits < 0)
            requiredDelay = -credits * creditRate;

        // Deduct this packet from the credits
        credits -= thisPacketCost;
        return requiredDelay;
    }
   
    /** Since credits doesn't change on its own, we need a way to ensure its status is correct
     * when determining wait time.
     */
    private void updateCredits()
    {
        if(credits < maxCredits)
        {
            credits += (System.currentTimeMillis() - lastSent) / creditRate;
           
            if(credits > maxCredits)
                credits = maxCredits;
        }       
    }
   
    /** Waits after a message is sent and sends the next message in line, then schedules the next wait
     * If there is no next message to send, it sets the queue to a 'ready' status.
     *
     * @author unTactical
     */
    private class QueueTask extends TimerTask
    {
    QueuePacket data;   
   
    public void run()
        {
        if(!queue.isEmpty())
        {
        // send the message and schedule the next one
        data = queue.remove();
        byte[] tosend = data.getData().getBytes();
        conn.send(tosend);
        long delay = getDelay(tosend);
        timer.schedule(current = new QueueTask(),delay);

        queueReady = false;
        }
        else
        queueReady = true;
        }
    }
}


QueueManager.java
package _main;

import java.util.HashMap;

import events.OutChatCommand;
import connect.Queue;
import plugins.Logger;
import util.BNetPacket;

/** Central point for all outgoing data to battle.net
*  - IndividalQueueArray: add to a specific bot
*  - AllQueueArray: add to all bots
*  - OpOnlyArray: add to the most available bot with ops
*  - NonOpArray: add to the most available both without ops
*
* @author unTactical
*/
public class QueueManager {

private static HashMap <String, Queue> all = new HashMap<String, Queue>();
private static HashMap <String, Queue> ops = new HashMap<String, Queue>();
private static HashMap <String, Queue> nonops = new HashMap<String, Queue>();

private QueueManager() {}

/** Lets us disable flood protection for a given Queue so that messages are sent immediately
*
* @param id - the name of the queue to enable/disable
* @param status - true to enable flood protection, false to disable
*/
public static void enable(String id, boolean status)
{
all.get(id).enable(status);
}

/** Add a Queue to the Manager
*
* @param id - name of the Queue
* @param q - Queue to manage
* @param hasOps - whether this bot handles 'operator' or non 'operator' messages by default
*/
public synchronized static void addQueue(String id, Queue q, boolean hasOps)
{
all.put(id,q);
if(hasOps)
ops.put(id,q);
else
nonops.put(id, q);
}

/** Remove a queue no longer in use
* This usually happens when we reset a connection.
*
* @param id - name of the Queue to remove
*/
public synchronized static void removeQueue(String id)
{
all.remove(id);
ops.remove(id);
nonops.remove(id);
}

/** Allows us to change whether a given Queue handles ops or non ops messages
*
* @param id - name of the Queue
* @param hasOps - true to handle 'operator' messages, false to handle non 'operator' messages by default
*/
public synchronized static void updateOps(String id, boolean hasOps)
{
if(hasOps)
{
nonops.remove(id);
if(!ops.containsKey(id))
ops.put(id, all.get(id));
}
else
{
ops.remove(id);
if(!nonops.containsKey(id))
nonops.put(id, all.get(id));
}
}

/** Allows us to change whether a given Queue handles ops or non ops messages
*
* @param id - int ID of the Queue to be looked up
* @param hasOps - true to handle 'operator' messages, false to handle non 'operator' messages by default
*/
public synchronized static void updateOps(int id, boolean hasOps)
{
updateOps(ConnectionManager.getInstance().getConnection(id).getName(), hasOps);
}

/** Remove all Queues
* Usually done when there is a connection error and all Queues must be reset
*/
public static void clearAll()
{
Object[] queues = all.values().toArray();
for(int i=0;i<queues.length;i++)
{
((Queue) queues[i]).clear();
}
}

/** Sends a message on all Queues in this Manager
*
* @param data - packet to send to battle.net
* @param priority - order in line, greatest first
*/
public static void sendAll(BNetPacket data, int priority)
{
Object[] queues = all.values().toArray();
for(int i=0;i<queues.length;i++)
{
((Queue) queues[i]).send(data,priority);
}
}

/** Send a message on a specific Queue
* Primarily done when a packet must be returned on the same Queue it was received (ie logon)
*
* @param data - packet to send to battle.net
* @param priority - order in line, greatest first
* @param id - name of the Queue we want to send the packet on
*/
public static void sendByName(BNetPacket data, int priority, String id)
{
Queue sender = all.get(id);
if(sender != null)
sender.send(data, priority);
else
Logger.logConsoleText("Sender id " + id + " is null!");
}

/** Send a message on a specific Queue
* Primarily done when a packet must be returned on the same Queue it was received (ie logon)
*
* @param data - packet to send to battle.net
* @param priority - order in line, greatest first
* @param id - int ID of the Queue to lookup
*/
public static void sendByID(BNetPacket data, int priority, int ID)
{
sendByName(data, priority, ConnectionManager.getInstance().getConnection(ID).getName());
}

/** Send a non 'operator' message. 
* The message will be sent on the first queue that is ready. If no queue is ready, it is added to the Queue
* that will be ready to send it soonest
*
* @param data - packet to send to battle.net
* @param priority - order in line, greatest first
*/
public static void sendOps(BNetPacket data, int priority)
{
Object[] queues = ops.values().toArray();
sendSpecified(queues,data,priority);
}

/** Send an 'operator' message.
* The message will be sent on the first queue that is ready. If no queue is ready, it is added to the Queue
* that will be ready to send it soonest
*
* @param data - packet to send to battle.net
* @param priority - order in line, greatest first
*/
public static void sendNonOps(BNetPacket data, int priority)
{
Object[] queues;
if(!nonops.isEmpty())
queues = nonops.values().toArray();
else
queues = ops.values().toArray(); // If there is no non-ops Queue available, it will be sent on an op Queue instead.

sendSpecified(queues,data,priority);
}

/** Checks all of the Queues availability and chooses (ideally) the first Queue that is ready to send the message.
* If no Queue is ready, it determines which Queue will be ready to send the message soonest and adds it to that one.
* (Ideally)
*
* @param queues - spefies whether we are checking the Ops Queue or the NonOps Queue
* @param data - packet to send to battle.net
* @param priority - a message of a higher priority is sent before messages of lower priority, so only check those relevant
*/
private static synchronized void sendSpecified(Object[] queues, BNetPacket data, int priority)
{
long highCredits = -999999;
int lowID = -1;
Queue current;

for(int i=0;i<queues.length;i++)
{
current = ((Queue) queues[i]);
long thisWait = current.getWait(priority);

if(thisWait == 800)
{
current.send(data, priority);
try {Thread.sleep(500); } catch(Exception e) {};
return;
}
else if(thisWait > highCredits)
{
highCredits = thisWait;
lowID = i;
}
}

if(lowID == -1) // this will happen if the queue is empty (ie a op message is requested but no op queue exists)
Logger.logConsoleText("Message not sent! lowID invalid!!");
else
((Queue) queues[lowID]).send(data, priority);

try {Thread.sleep(500); } catch(Exception e) {}; // wait a short time to account for non-0 travel time across internet
}

public static void main(String[] args)
{
addQueue("zero",new Queue(""),false);
addQueue("one",new Queue(""),false);
System.out.println("test1");
sendNonOps(new OutChatCommand(-1,"test1").getBNetPacket(),0);
System.out.println("test2");
sendNonOps(new OutChatCommand(-1,"test2").getBNetPacket(),0);
System.out.println("test3");
sendNonOps(new OutChatCommand(-1,"test3").getBNetPacket(),0);
System.out.println("test4");
sendNonOps(new OutChatCommand(-1,"test4").getBNetPacket(),0);
System.out.println("test5");
sendNonOps(new OutChatCommand(-1,"test5").getBNetPacket(),0);
System.out.println("test6");
sendNonOps(new OutChatCommand(-1,"test6").getBNetPacket(),0);
System.out.println("test7");
sendNonOps(new OutChatCommand(-1,"test7").getBNetPacket(),0);
System.out.println("test8");
sendNonOps(new OutChatCommand(-1,"test8").getBNetPacket(),0);
System.out.println("test9");
sendNonOps(new OutChatCommand(-1,"test9").getBNetPacket(),0);
System.out.println("test10");
sendNonOps(new OutChatCommand(-1,"test10").getBNetPacket(),0);
}
}
#20
AntiVirus' Home for Lost Toys / Rolla!
September 14, 2006, 12:59:56 AM
Tell me about it!  As you know I almost went there myself, so while I know everything they tell you to recruit you, I don't have the advantage of the perspective of a new student.  Since I'm still considering it for my graduate degree, what do you think?

Teachers:  understandable? ta's speak (real) english? do they go too fast? too slow?

Curriculum: How hard does it look to be? Are the curriculums pretty generic or well thought out and specialized for each major?  Do you actually learn anything in the classes (might not apply as a freshman :))

Campus Life:  How does the atmosphere feel in general, is the Student Union actively providing lots of fun activities? Interesting lectures/visitors? Campus sponsored events? Are the clubs generally too crowded/vacant?

Partying: mostly bar atmosphere? house parties? greek-oriented?

Just wondering :)