Open Side Menu Go to the Top

07-10-2012 , 01:53 PM
Quote:
Originally Posted by gaming_mouse
i recently read this article and found it helpful.
Interesting article thanks.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
07-10-2012 , 02:25 PM
Quote:
Originally Posted by sorrow
I'm getting there (and just discovered Firebug

I'm now stuck with what events to attach too. Looks like jQuery doesn't trigger the normal dom events like "onchange"
Is this for when text in a textbox is changed? I usually stack `onkeyup` and `onkeydown` as this seems to cover all browsers when a character changes in a textbox in a way I like it to behave. It's pretty ugly but try experimenting with something like:

Code:
    <INPUT TYPE="text" NAME="field1" onkeyup="MyFunction()" onkeydown="MyFunction()">

...

<script>
    function MyFunction()
    {
        alert("changed");
    }
</script>
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2012 , 04:08 PM
Quote:
Originally Posted by WiltOnTilt
i was just looking for something a bit more user friendly, like preconfigured login/pass/path to log, easily export/save/search/watch in real time. command line is ok just thought there might be something better
Have you used Splunk? Not exactly what you're asking for but it's incredibly powerful for log indexing and aggregation.

Free for <500MB of logs/day
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2012 , 07:54 PM
jQuery actually has a much better method for binding events to elements, which is the on() method.

<input type="text" id="field1">

<script>
$(function() { // wrap your code in this so it binds after DOM is ready
$("#field1").on('change', function() {
// whatever you need to do
});
});
</script>
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2012 , 09:00 PM
Quote:
Originally Posted by Freakin
Have you used Splunk? Not exactly what you're asking for but it's incredibly powerful for log indexing and aggregation.

Free for <500MB of logs/day

But incredibly expensive to pay for...
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2012 , 11:11 PM
yesterday's dailywtf was really good:

http://thedailywtf.com/Articles/The-...re-SHEEIT.aspx

i especially liked:

Code:
// Convert to negative number
varInt := StrToInt('-' + IntToStr(varInt));
and

Quote:
"I found this piece of code in the SDK from leading microchip vendor," Jérôme wrote, "this array is used for parsing commands arguments from their embedded command line."

Code:
static struct boolean_s boolean_table[] = {
    {"Yes", TRUE},          {"OKay", TRUE},
    {"YOUBET", TRUE},       {"True", TRUE},
    {"1", TRUE},            {"0", FALSE},
    {"ON", TRUE},           {"OFF", FALSE},
    {"No", FALSE},          {"NOWay",FALSE},
    {"False", FALSE},       {"YEAH", TRUE},
    {"YEP", TRUE},          {"NOPE", FALSE},
    {"NOT", FALSE},         {"Maybe",__TIME__[7]&1},
};
(i don't understand what's up with the case sensitivity but the fact that "maybe" is properly handled really sells it imo.)


additionally, there's a new xkcd thing:

http://what-if.xkcd.com/1/



(i'm sure everyone tracks both of these things but just in case.)

Last edited by tyler_cracker; 07-10-2012 at 11:13 PM. Reason: also GRAVEYARD OF BAD IDEAS
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-10-2012 , 11:49 PM
Quote:
Originally Posted by sdturner02
jQuery actually has a much better method for binding events to elements, which is the on() method.

<input type="text" id="field1">

<script>
$(function() { // wrap your code in this so it binds after DOM is ready
$("#field1").on('change', function() {
// whatever you need to do
});
});
</script>
I ended up with something pretty similar:
Code:
<script type="text/javascript">
$(document).ready( function() {
    $("#id_player1").blur( function() {
           //Stuff here.
     });
}
I didn't find on('change',...) in my travels.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-11-2012 , 01:40 AM
love that convert to negative number code
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-11-2012 , 01:41 AM
It's excellent I used to do

int pos = 3;
int neg = pos - (pos * 2);

Until someone showed me

int neg = 0 - pos;

lol
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-11-2012 , 01:51 AM
Quote:
Originally Posted by Gullanian
It's excellent I used to do

int pos = 3;
int neg = pos - (pos * 2);

Until someone showed me

int neg = 0 - pos;

lol
lol I did this TODAY infront of someone else over teamviewer, felt like a right ******

edit: even worse it was in excel where you can just do =-A12 instead of =A12 - (A12 * 2)

Last edited by _dave_; 07-11-2012 at 02:06 AM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-11-2012 , 01:59 AM
Quote:
Originally Posted by sorrow
I ended up with something pretty similar:

I didn't find on('change',...) in my travels.
http://api.jquery.com/change/
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-11-2012 , 02:01 AM
Anyone interested in developing a 'Leagues Management' application?

I'm looking to create something to manage and record 8-ball, 9-ball leagues and tournaments.

I've got something rudimentary put together at the moment, and i'm planning on releasing it as open source at some point.

Figured someone here might be interested.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-11-2012 , 07:45 AM
Whoever in here has the new MBP...any chance you tested Linux on it? Yay or nay as a devel-machine with Linux, max resolution etc?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-11-2012 , 08:16 AM
Haven't put Linux on it but it is the first computer I've had in a long time noticeably faster than my previous computer.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-11-2012 , 12:08 PM
This is still a WTF. - is a unary operator in pretty much every language!

Edit: @Gull
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-11-2012 , 12:15 PM
Quote:
Originally Posted by _dave_
lol I did this TODAY infront of someone else over teamviewer, felt like a right ******

edit: even worse it was in excel where you can just do =-A12 instead of =A12 - (A12 * 2)
It's bad because if n is really big the n*2 can overflow lol

I'm tempted to make a joke website listing algorithms of how to turn a positive number into a negative in as many hilarious ways as possible

@Neko do you mean the 0 is redundant? I still would want to use it as to me it just reads better and is clearer what you are doing
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-11-2012 , 12:16 PM
furthermore i think '-1 * foo' is faster than '0 - foo' on just about every processor.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-11-2012 , 12:32 PM
There's no fixed speed for a command or set of commands I've heard, also the speed of single commands can be influenced by the commands around it (for example CPU pipelining), so that would be pretty meaningless to measure I think!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-11-2012 , 12:36 PM
gull,

ok, don't take my word for it. go write some code and look at the generated assembly and let me know how often SUB is used vs MUL.

if you mean that the compiler will optimize the subtraction form into the multiplication form, then i guess that's true, but it's not what i was talking about.

also, claiming that your dumbass way of doing things is ok because the compiler will fix it is not getting you any points from me during an interview .

Last edited by tyler_cracker; 07-11-2012 at 12:38 PM. Reason: well, more points than 'i dunno lol' or 'football!!!!!!!!'
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-11-2012 , 01:03 PM
I realize that this is a vague question, but are there downsides to getting/is it silly to get an Android phone and a MBP? I'm used to Android, and I like it, but I wanna switch to Mac for my comp because holy **** my computers keep falling apart.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-11-2012 , 01:18 PM
Quote:
Originally Posted by Gullanian
There's no fixed speed for a command or set of commands I've heard, also the speed of single commands can be influenced by the commands around it (for example CPU pipelining), so that would be pretty meaningless to measure I think!
Eh. You might be right, but I sorta doubt that the answer to the simple question of "Which is faster in assembly, -1 * x or 0 - x?" is "it depends on what's around it. It might depend on type, though.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-11-2012 , 01:21 PM
you guys are all weirdos... the compiler/processor will use neither subtraction nor multiplication to negate a number

for an integer you just use the "neg" instruction (on x86 for sure) or take 2s compliment and add 1

for floating point, you xor the sign bit

EDIT: and +1 on what Neko said... unitary minus! writing 0-x or -1*x are both silly

Last edited by sng_jason; 07-11-2012 at 01:31 PM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-11-2012 , 01:34 PM
Quote:
Originally Posted by tyler_cracker
also, claiming that your dumbass way of doing things is ok because the compiler will fix it is not getting you any points from me during an interview .
bit harsh lol

0 - foo

seems 100% fine to me because it's clear I'm negating a number

-1 * foo

Is an optimisation with benefits that are completely negliable, or even compiles exactly the same. Also to me with 0 - foo it's a lot easier to understand my intent.

If I fail an interview on the fact that I do 0 - foo because they consider that practise lazy for relying on the compiler too much, good luck to them, I don't think I'd want to work there anyway!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-11-2012 , 02:01 PM
-1*foo seems more readable to me
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
07-11-2012 , 02:47 PM
Quote:
Originally Posted by NoahSD
I realize that this is a vague question, but are there downsides to getting/is it silly to get an Android phone and a MBP? I'm used to Android, and I like it, but I wanna switch to Mac for my comp because holy **** my computers keep falling apart.
I had a droid phone when I was in Australia with my MBPs and couldn't figure out to do anything with the phone connected to the computer. Granted, I spent about a minute on it before stopping. Shouldn't be any downsides to using a droid on a MBP, probably some hoops to jump through to get media from one to the other though.

Last edited by kerowo; 07-11-2012 at 02:48 PM. Reason: Well, that and the damage done to your immortal soul...
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

      
m