« first day (1467 days earlier)      last day (3456 days later) » 

8:02 AM
sl Displays animations aimed to correct users who accidentally enter sl instead of ls. SL stands for Steam Locomotive.
 
!!eval:"Test"
.
 
and
some
multiline
text
 
0_o
i broke my queue
 
3 mins ago, by Jan Dvorak
and
some
multiline
text
 
.
 
8:12 AM
2 mins ago, by Jan Dvorak
3 mins ago, by Jan Dvorak
and
some
multiline
text
 
/
I think I'm trying to use a blocking queue wrong.
 
in javascript?
 
java
 
oh. why java?
 
why not?
 
8:15 AM
too verbose
 
lol
there aren't many non-scripting languages that are less verbose than java
 
Ruby? Python?
 
those are both scripting languages
 
haskell?
 
people still use haskell?
 
8:18 AM
I do
I'm sorry, but ArrayList<ClassName> className = Collections.sort(new Comparator<ClassName>(){int compare(ClassName a, ClassName b){return ...}}) is just wrong.
 
that's why we have lambdas now
and diamonds
 
Do they work already? Nice!
What does the code look like now?
ruby: ary = ary.sortBy{|x| [x.a, x.b]}
 
ArrayList<ClassName> className = Collections.sort(list, compare -> { ... })
or something of the sort.
 
Haskell: ary' = sortBy (comparing \x->[a x, b x]) ary
@Justin you still have to declare the variable type, don't you?
When do diamonds take effect?
 
It's just type inference for generics, so you don't have to explicitly list them.
 
8:24 AM
Haskell can infer everything ;-)
 
ArrayList<ClassName> className = new ArrayList<>();
 
oh. Thanks
Oh, and only in Haskell you can do this: let 2+2 = 5 in 2+2
 
We also have streams in j8 now.
ArrayList<String> className = new ArrayList<>();
className.stream().anyMatch(String::contains("blah"));
I also really like Groovy.
 
I don't know Groovy
 
Groovy is awesome sauce.
 
8:27 AM
link?
 
It's like java but with all those features common in scripting languages like dynamic typing and whatnots
 
so... a slightly verbose scripting language? :-)
 
Yup
It works with java though. Dunno the technical details, but you can parse pure java classes dynamically as a groovy script
or vice-versa
it's essentially a scripting language that compiles to jvm bytecode
 
Check out jRuby ;-)
 
I'm not a fan of ruby :p
 
8:32 AM
I hope groovy won't try to force me allman-style indentation
 
can use any indention you want
doesn't even need indention
 
What about javascript?
 
what about it?
i've never really had any use for it, i don't do much web development.
when i do it's backend stuff with python or php
 
check out node.js
 
no javascript for me.
 
8:38 AM
Why?
Groovy seems quite similar to jRuby
except I have no intention in writing JVM programs. Maybe if I got an Android
 
doesn't need to be compiled to run
.
 
same applies to Ruby, ...
 
i just mean, groovy isn't for "writing JVM programs"
it can be run via a groovy interpreter, or it can be compiled to jvm bytecode. works the same either way.
 
I really like Haskell's interactive console
 
groovy has the same
and i have one on the bot if i can get the message queue working
 
8:42 AM
nice.
 
Ohh hi!
!!eval:"Hi"
 
@Unihedron I'm fixing our threading stuff.
 
Cool, gotcha
 
@Unihedron Ever used blocking queues?
 
Nope.
 
8:46 AM
I wanted to put chat messages in a blocking queue from the AJAX threads, then get them in the main thread and use a cached thread pool for processing
 
in Java, 2 hours ago, by Justin
@Unihedron !!java for java classes, !!eval for statements, !!load to cache a class to be called later.
^ Sounds insane.
 
Lol!
Well you wanted to be able to run full java classes
so now you have that
 
Can't we extract classes from scripts and run that seperately in order?
 
Huh?
If you want to save a class use !!load
it saves it to the cache/classloader
 
aka "class TypeName{(class decl)} statement" or "statement class TypeName{(class decl)}" would allow compiling that class, then setting it available for use within the statements
 
8:49 AM
That's ridiculous
use !!load public class SomeClass { ... }
 
Having separate commands to evaluate a class is worse though, and is harder to keep track of everything, even worse when we get to the part about loading gists.
Speaking of which, how do you unload global variables / classes?
with groovy
 
The commands serve different purposes. !!load is for permanently loading a class into the classloader. !!eval is for evaluating statements/scripts. !!java is for running a java class (and calling the main method)
there's really no way to combine those
 
So how do you run a Java class?
 
!!java: class blah blah
it calls the main method
via reflection
 
!!java: class Main{
  {
    System.out.println("hi");
  }
}
 
8:52 AM
That would probably work.
 
!!java: private class Main {
  public static void main(String[] arg) {
    System.out.println("hi");
  }
}
 
preferably like this, since the result of main() is what gets output. System.out isn't redirected to chat

!!java: private class Main {
public static String main(String[] arg) {
return "Hi";
}
}
 
!!java: class Rawr {
  static class Printer {
    static void print() {
      System.out.println("hi");
    }
  }
  public static void main(String[] main) {
    Printer.print();
  }
}
Is he here?
!!eval:"hi"
 
I'm fixing the threading stuff
 
oh.
I can run the latest commit on your branch yes?
 
8:54 AM
Yes.
You can't do what you're trying to do though. It would just just print "hi" in the console.
 
Hmm...
 
I can add imports and fields for accessing the javaBot API
so that you can actually send a message
 
Gotta mess with System.out later :P
System.setOut(new PrintStream() {
  @Override
  public void println() {
    Console.get().print(+"\n");
    JavaBot.sendMessage(); // or something
  }
})
 
yea, something like that.
 
Eventually we'll be ready for a prod build, then we can get rid of the lines with the console altogether.
 
8:58 AM
Except the bot can be in multiple chats at the same time
 
:o
Multiple instances of JavaBot or same instance connecting to various chats?
 
same instance
 
Good grief... xD
 
the command for running the scripts is actually thread safe though, so i guess it wouldn't matter.
 
Maybe we could still do the same. Just have the out printstream methods act as a proxy.
 
9:00 AM
yea
I want to set up the threading like this:
AJAX Thread -> Blocking Queue -> Main Thread => Worker threads
 
:)
And since we're in JAVA there's no worrying about starvation. ^_^
 
So messages come from the AJAX threads, get put into the blocking queue, then distributed to worker threads via a cached thread pool.
 
This plan is A++.
 
and my example up there is slightly off. cause there will be multiple AJAX threads.
 
Gotcha!
 
9:02 AM
AJAX => Queue -> Main => Worker threads
Then the only thing we have to worry about being thread safe is methods access by the worker threads, so just the API stuff basically.
the AJAX end isn't really a problem
 
9:14 AM
Ok, I just figured out a short algorithm for extracting classes from the script, compiling those and then run any following statements.
 
.
.
 
oo
it worked
!!eval:2+2
 
4
 
there we go
@Unihedron
 
9:25 AM
Eh... Great!
!!java: class Rawr {
  static class Printer {
    static void print() {
      System.out.println("hi");
    }
  }
  public static void main(String[] main) {
    Printer.print();
  }
}
 
startup failed:
UserScript: 1: unexpected token: @ line 1, column 14.
class Rawr {
^

1 error
 
..
 
!!java:
public class TestClass {
public static String main(String[] args) { return "Test" }
}
 
Test
 
must be public?
!!java:
public class Rawr {
static class Printer {
static void print() {
System.out.println("hi");
}
}
public static void main(String[] main) {
Printer.print();
}
}
 
9:26 AM
startup failed:
UserScript: 1: expecting '}', found 'public' @ line 1, column 97.
System.out.println("hi"); } } public sta
^

1 error
 
i dunno what you're trying to do exactly.
!!java:
public class Test {
public class Printer {
static String print() { return "hi" }
}
public static String main(String[] args) {
return Printer.print();
}
}
!!eval:""
!!java:
public class Test {
public class Printer {
static String print() { return "hi" }
}
public static String main(String[] args) {
return Printer.print();
}
}
 
startup failed:
UserScript: 1: expecting '}', found 'public' @ line 1, column 85.
ing print() { return "hi" } } public sta
^

1 error
 
!!java:
public class Test {
public class Printer {
public static String print() { return "hi" }
}
public static String main(String[] args) {
return Printer.print();
}
}
 
startup failed:
UserScript: 1: expecting '}', found 'public' @ line 1, column 92.
ing print() { return "hi" } } public sta
^

1 error
 
@Unihedron You broke it
 
9:31 AM
?
 
!!java:
public class Test {
public static String main(String[] args) {
return "Test";
}
}
 
Test
 
public class Test {
public static String print() { return "Testing" }
public static String main(String[] args) { return print(); }
}
oops
!!java:
public class Test {
public static String print() { return "Testing" }
public static String main(String[] args) { return print(); }
}
 
startup failed:
UserScript: 1: expecting '}', found 'public' @ line 1, column 72.
print() { return "Testing" } public sta
^

1 error
 
strange
!!java:
public class Test {
public static String print() { return "Testing"; }
public static String main(String[] args) { return print(); }
}
 
9:40 AM
startup failed:
UserScript: 1: expecting '}', found 'public' @ line 1, column 73.
print() { return "Testing"; } public sta
^

1 error
 
ha
 
Found the problem
Parsing the HTML doesn't preserve new lines. Which are important. but this might work...
!!java:
public class Test {
public static String print() { return "Testing"; };
public static String main(String[] args) { return print(); }
}
 
Testing
 
:)
@Unihedron
 
9:45 AM
Worked :p
 
!!java:
public class Test {
public static void print() { System.out.println("Hello World!"); };
public static void main(String[] args) { print(); }
}
 
Hello World!
 
:D !
 
Yar.
Lemme see if there's something I can do about the lines.
!!java:
public class Test {
public static String print() { return "Testing"; };
public static String main(String[] args) { return print(); }
}
 
Testing
 
9:48 AM
.
 
!!java:
public class Test {
    public static void print() { System.out.println("Testing"); };
    public static void main(String[] args) { print(); }
}
 
@Unihedron It sends whatever returns from main().
Though I think that formatting might be the fix.
!!java:
public class Test {
    public static String print() { return "Testing"; }
    public static String main(String[] args) { return print(); }
}
SO doesn't like sending empty messages
!!java:
public class Test {
public static String print() { return "Testing"; }
public static String main(String[] args) { return print(); }
}
 
startup failed:
UserScript: 1: expecting '}', found 'public' @ line 1, column 73.
print() { return "Testing"; } public sta
^

1 error
 
!!java:
public class Test {
    public static String print() { return "Testing"; }
    public static String main(String[] args) { return print(); }
}
 
null
 
9:57 AM
@Justin Maybe on the send message we should check if the string contains of all whitespaces, and send *Execution completed, no output.* if that's the case (with italics)
 
kk
 
Oh, you've got that handled.
Eh, never mind.
 
!!java:
public class Test {
    public static String print() { return "Testing"; }
    public static String main(String[] args) { return print(); }
}
 
Execution completed, null or no output
 
\o/
 
9:59 AM
:p
debugger hotswapping ftw
 
xP
 

« first day (1467 days earlier)      last day (3456 days later) »