« first day (811 days earlier)      last day (4128 days later) » 

12:03 AM
Btw, if anyone is good with some layouting etc and feels like improving the currently rather ugly web interface of my nodejs shoutcast clone pull requests are always welcome. It'll most likely end up as an AGPL project but I'm not completely sure about that.
Actually... do we have anyone here who has good knowledge of the various OSS licenses?
 
Define 'good knowledge'
 
Mostly if I'm missing some important points :) I'm considering AGPL because it's the kind of program that people could otherwise modify as much as they want without ever giving anything back because they'll never distribute it
I'm usually not a big friend of GPL-ish licenses but in this case I think it's the best one if I want to avoid companies from using it without giving anything back ever.
 
user813853
I have a newbie question ....
 
Just ask the question...
 
So you want to restrict modification of the source?
 
12:08 AM
Nope, but i want them to be published in case it's something nice that other people might like, too
 
user813853
I have a Textarea, and I can count the number of characters typed
 
user813853
but How to delete the last Character if it is more than a certain number ?
 
// like this?
if (modified)
{
    release();
}
 
exactly
 
Hmm.
I've never seen that before.
 
user813853
12:10 AM
like twitter ...
 
user813853
but
 
user813853
... ?
 
@ALJIMohamed If you're using an event listener (for keyup or friends), then simply cancel the event (preventDefault)
You can also simply slice the text upto the nth character (where n is the maximum amount)
 
As a user, I abhor the second approach.
 
@Zirak keyup will cancel input? iirc that was keydown. keyup the input is already added to.
 
user813853
12:14 AM
@Zirak I am using "onKeydown" to count the number of characters in the Textarea
 
keydown handler won't work
if I type "X" the X is inserted after tyhe keydown handler
so you only see the previous keystrokes
 
bah I don't remember the specifics, so try whichever you're using and change it if doesn't work, or something.
 
user813853
still don't understand your solution @Zirak
 
user813853
<textarea type="text" onkeydown="countCaracteres();" ></textarea>
 
user813853
now how to Stop the user from typing more if the countCharacters reach 30c ?
 
12:23 AM
@ThiefMaster I'd be happy to give it a shot. I just need some help getting it running under my install of Node. I've never done stuff with a packages.json and all that.
 
Just npm install - that will install all the dependencies.
 
Oh, sweet.
 
The login for the admin interface is admin:test12345 (that's the default password in the config file)
 
I've never worked with express. Hell, I've only been using Node for 5 days or something.
k
 
The interface is currently pretty much bootstrap default with some stuff thrown into it
(I don't mind anyone suggesting layout-related stuff separately - probably easier anyway since that can contain dummy data ;))
 
user813853
12:28 AM
so my question ...
 
@ThiefMaster Aw, build failed. I wonder if it's because I'm on Windoze.
"Looks like a problem with node-gyp"
 
Did you install Python and VC++?
 
Hm... buffertools I guess? Yeah.. that one uses a C++ extension
 
Wait... misquote. Looks like a problem with buffertools
 
@KendallFrey: I think node 0.9+ doesn't need python anymore - they got rid of the WAF build system and use gyp instead
 
12:30 AM
I recall needing them for something.
 
Well shit.
 
Not sure what anymore.
 
Not gonna do this on a plane. Maybe when I get back from Vegas.
And chat sssuuuuucks on Delta's wifi. I have to refresh for updates -_-
 
But good to know that it doesn't work on windows.. need to fix that. I started this project partially to hand it in as a university project and I'll show it to my professor on my windows laptop... so I better fix that ;p
 
So, I'm out. I'll get it a look later.
@ThiefMaster Glad to be of service :-P
 
12:36 AM
0
Q: Table-Sort Script with Search Feature

John RI lost this JavaScript-based, sortable-table script that had a unique feature of a search box that made rows disappear when a user typed a word. Any idea where I can find a similar script to this? Again, it is all JavaScript based.

 
I hope this answers you question.
 
Does anyone think this function is a bad idea?
function constant(key, value) {
  Object.defineProperty(this, key, {
    get: function () { return value },
    set: function () { throw new Error('Constant cannot be set') }
  });
}
 
@ALJIMohamed jsfiddle.net/rlemon/uKgMD/1 here is how I would do it
again, don't limit .... inform.
and here i am... talking to myself.
user isnt even in the damn room anymore
bahaha... tweeted his ass
don't ask questions then walk away people
rlemon is in da house.
too bad :before and :after exist in the element and refer to the contents not the element(selector) it self.
I would like a :reallyBefore and :reallyAfter than inserted the contents before and after the selector matched elements .
 
12:57 AM
!!/ jquery before
@rlemon cough
 
@phenomnomnominal api.jquery.com/before
 
1:14 AM
did I say jQuery?
is jQuery CSS?
also Node.insertBefore works well for me when I need it.
If i'm using jQuery already I probably still won't use it :P some of their methods are too slow when the native alternative is so easy to use
like .attr and .prop I never use
.data is actually quite handy tho
now... for the real reason I came in here...
Seriously one of the funniest comment chains I've read in a while.
 
You didn't say CSS either haha
 
.....
I'm not even going to respond to that (with the exception of this response telling your my future response pattern).
 
1:29 AM
!!> (~63).toString(2)
 
@phenomnomnominal "-1000000"
 
!!> (~63)
 
@phenomnomnominal -64
 
Joshua Jackson is only 34?!?!?!?! I would have swore he was older.
But I guess in the mighty ducks he wasn't really that old... and I was only a few years younger than him in the film..
 
So he was 20 when dawson's creek started
James Van Der Beek is fantastic in Don't Trust the Bitch in Apartment 23
 
1:38 AM
yea kinda blew my mind. I mean i'm only 26 so the stars I saw in movies and shows as a Kid I imagine are so much older. I mean... look at Saved by the Bell. you have 30 year olds playing highschool kids. 90210? Fuck luke perry didn't even look like a teenager
lol ok i'm out
 
> This guy was in my creative writing class back in jr. college. He actually wrote an interesting story about an acorn with aspirations of being a tree. Nice guy, a bit smelly, but a solid writer.
 
LOL
 
He is one of the best people
 
rad
An interview question: if the homepage is taking too long to load, what could be wrong with the frontend?
 
@rad The client's using dialup
2
 
1:49 AM
too many asynchronous downloads from a single domain.
parser hangups on large loops
blocked scripts
too many userscripts being loaded
userscripts with conflicting code
shit man... the list is fucking huge
 
rad
wow
 
I would profile the js for sure
 
There is so much that can make your page load slow which is why inspectors and profilers were created... to help take the guess work out.
 
^
 
rad
1:51 AM
I see
 
Do we all remember the days of having to look in the bottom left for a yellow triangle from IE then read the stupid fucking cryptic messages to find out bugs?? anyone??
Back in the IE or NN only options days
 
The correct answer (but one that won't impress the guy) is "Let's crack open a profiler and find out.
 
@rlemon line 23242342343 object expected.
FUUU IE
 
So glad I missed out on those days
 
tell him the AJAX DJANGO BOOTSTRAP HTML5 V8 parser is missing a bit. you can fix it with a RESPONSIVE SASS JQUERY ROR script that will JOOMLA his RAD
 
1:53 AM
lol the line numbers were always WAY off
 
although I suppose RAD isn't a buzzword now a days
 
used to piss me off so much
 
back in 2003-2004 everyone was all RAD tools this and RAD kits that.
@Loktar see my not working greyscale script
have at er ;)
 
no where is it?
ive been randomly toying with this tonight jsfiddle.net/loktar/YaKZh
need to get a few kinks out, and pretty up the code
 
1:57 AM
then im going to write a blog post on it
 
damn I can't wait to read it and copy it and then reproduce a similar but different blog post of my own ;)
hits here I come... wait... I don't have ads... plans backfired again robbie!
 
lol
 
tbh I could probably take the time to write good articles.. I am not the brain child some of you guys are but I can smell bullshit and I think I have enough insights to help some people. But when it comes down to it I'm just never happy with my own writing.. I'll spend an hour on a post just to 'draft' it then never post it.
 
Same here. I make myself hit post anyway. Only way I'll ever improve.
There are a few really bad ideas that never saw the light of day
 
@SomeKittens you should show us them
 
2:01 AM
mine are good ideas (i think). else I would just discard the post... I just can't articulate my ideas in an article. I think I would be a better tutor.. one on one or one to an group or class.
I have no beef hashing out ideas or chatting or helping people here or on the main site.. but blogging kinda intimidates me
 
nice script @rlemon fading to grey and back would be sweet
 
idk why
 
They're gone. They've been:
 
also dude.. have you ever looked at my posts
they are all shit
 
@Loktar so my idea to rgb to hsl is correct?
 
2:02 AM
lol I just throw stuff up there top hopefully get better
 
I know it's not working... but did I at least take the right approach? (in your opinion)
 
yeah, theres another way as well just using rgb, w/o having to convert to hsl
 
I couldn't for the life of me figure out how to grey-scale rgb values. hsl seemed much much easier
 
@phenomnomnominal I tried to write a post about my mother's experience with Etsy, but it just turned into her ranting about how she didn't get sales (she didn't do much other than list)
 
hsv even better but css only supports hsl and rgb and hex
 
2:07 AM
umm @rlemon I have some terrible news dude
TERRIBLE news lol
this is insane actually..
 Array.prototype.forEach.call(document.all, function(el) {
        with(el.style) {
            webkitFilter = "grayscale(1)";
        }
    });
 
:(
fml
 
^ I didnt think it would work.. but it does
 
@rlemon You need to use a luma equation
 
I spent a god-damn hour on that shit!
 
yeah thats why I was hesitant to post it :P
 
2:07 AM
lol
 
wtf though that is nuts
 
no its cool... looks for the bottle
 
(.2126*r + .7152*g + .0722*b)/255
 
I just found it by accident stackoverflow.com/questions/609273/…
 
will return the color coords
 
2:08 AM
@Nile yeah thats what I was thinking
I remembered there was a formula to do it for rgb
/me will remember the term luma equation
 
In photography and computing, a grayscale or greyscale digital image is an image in which the value of each pixel is a single sample, that is, it carries only intensity information. Images of this sort, also known as black-and-white, are composed exclusively of shades of gray, varying from black at the weakest intensity to white at the strongest. Grayscale images are distinct from one-bit bi-tonal black-and-white images, which in the context of computer imaging are images with only the two colors, black, and white (also called bilevel or binary images). Grayscale images have many sh...
just search grayscale, it's under "converting color to grayscale"
 
git guys: how often do you commit?
 
every change :P
 
Every change
 
I'm an over commiter
I push every commit as well.
I don't like to let my commits sit unpushed
 
2:12 AM
@rlemon I sent you something to feel better about gray scaling : P
 
:) I see
thankyou.
 
np, its a badass game
anyone here besides myself play bastion?
also its only like 4-5 hours long the first play through
 
but really, it was a well worth it experience to have failed at it. I now know how to convert rbg to hsl and hsv
 
@Loktar another way to make something grayscale (not using luma) is to take the max(R, G, B) and the min(R, G, B), add them and average them (or divide by 510 if you want a %). that's HSL's algorithm for finding lightness
 
ah nice
 
2:13 AM
Yipe. I thought I committed too much.
 
so looks like i'm sitting on the shitty chair for the night...
he's so cute. I can't wake him
 
lol my cat does the same thing
 
My cat waits for me to get up and then steals the chair
 
MINE TOO
I got up to get a drink and came back to this....
 
I'm going to make a JavaScript rubix cube solver
 
2:16 AM
he moved...
@phenomnomnominal use the camera api and canvas to obtain the colours of the sides so the user doesn't have to enter them, merely put the cube infront of a webcam and rotate it
^ good idea if I ever saw one.
 
@rlemon that's what I was thinking
webgl it up
then solve the bitch
 
;) great minds think alike :P
 
tempted to do it with a professor cube just for shits
 
just because I'm a karma whore.... Upvotes please :P
protip: post images (one in comments one in the title) for double the karma. comment AND link karma === reddit awesomeness
 
How the fucking is padding calculated
If I have a wrapper that is 100% page height, then a div that is 16% the wrapper height, how will a 2% padding on that div be evaluated?
Fucking stupid:
> The percentage is calculated with respect to the width of the generated box's containing block, even for 'padding-top' and 'padding-bottom'.
 
2:42 AM
@rlemon > 1 up vote 1 down vote
 
2:53 AM
any debugging tips on why an $(selector).on('click', function(){}) wouldn't be firing?
 
3:03 AM
Does it work it you fire it from JS?
aka $(selector).click()
 
3:19 AM
ehh i ended up changing it to .live('click') and it works
 
user142019
Ohai.
 
i had another .on('click') the line above this one that was working, but this one wasn't for some reason
 
Do you know you can just do .click(function () { ... }); as a shortcut for .on("click", function () {... });?
 
yeah, i just like .on because its universal
 
jQuery is in no way universal.
 
3:31 AM
From the jQuery source:
function (data, fn) {
    if (fn == null) {
        fn = data;
        data = null;
    }

    return arguments.length > 0 ? this.on(name, null, data, fn) : this.trigger(name);
}
That's the jquery.fn.click function
So it just uses on
but it's less code
 
maybe universal is the incorrect term.. but i meant i can use it for any event
 
yeah and there are shortcuts for any event aswell
 
i understand.. just personal preference
 
4:00 AM
posted on January 04, 2013

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); try { var pageTracker = _gat._getTracker("UA-3727700-1"); pageTracker._trackPageview(); } catch(err) {} Hey geeks! We're beta testing a new site design. Please leave commen

 
Is there a reason the analytics code is right there? lol
 
4:21 AM
@Feeds wasn't something similar here the same time yesterday also? why?
 
 
2 hours later…
6:05 AM
Hello
 
I am using jquery datepicker for displaying a datetime control to the user... is there a way to show the server date and time for the jquery datepicker, because the selected date and time would be stored in database with respect to server time
Suppose the client side computer may have the timezone as Arizona and the server has the timezone of UTC... in that case... i want to store the selected time in terms of UTC
 
I'm not sure how datepicker works, but if it returns a Date object, you can use toUTCString()
!!> new Date().toUTCString()
 
@phenomnomnominal "Fri, 04 Jan 2013 06:17:38 GMT"
 
!!> new Date("Fri, 04 Jan 2013 06:17:38 GMT").toLocaleString();
 
6:18 AM
@phenomnomnominal "2013-01-04T06:18:30.000Z"
@phenomnomnominal "2013-01-04T06:17:38.000Z"
@phenomnomnominal "Fri Jan 04 2013 00:17:38 GMT-0600 (CST)"
 
 
7:11 AM
stackoverflow.com/questions/14152659/… epic question - might be deleted by time any one clicks it though :(
 
 
1 hour later…
 
1 hour later…
9:23 AM
hi friend this is naresh here. i am a beginner to javascript. i want take few months coaching classes to learn advanced about this language. I am from bangalore. so if you know anybody else or any institute name please give me the reference. thanks.
 
@nareshkumar visit www.w3schools.com for learning any web technology like javascript, php, etc.
 
there you will get all basic. i know the basic. want to learn advance, like pure object oriented way.
 
9:49 AM
> If Type(x) is String, then return true if x and y are exactly the same sequence of characters (same length and same characters in corresponding positions); otherwise, return false.
then this should return true:
(new String('a')) === (new String('a'));
it returns false :/
typeof returns object, ({}).toString.apply returns string...
 
@FlorianMargaine That's false because both operands are objects.
http://es5.github.com/#x11.9.6
(...)
Return true if x and y refer to the same object. Otherwise, return false.
 
10:23 AM
@RobW yeah, they use typeof so it's spit out as an object instead of a string
 
String is an object wrapper for strings. It just hosts a string, it's not a string itself, so any object-related rules are applied to it.
 
this is what caused my confusion:
({}).toString.apply(new String('a'))
"[object String]"
({}).toString.apply('a')
"[object String]"
 
Yeah, its Type is an object, but its [[Class]] is a string.
 
ah, got it
 
Did anyone ever had problems with 301/302 redirects?
 
10:30 AM
not specifically
what kind of problem?
 
I'm creating a proxy which adds CORS headers to the requests, but the browser (Chrome / Firefox) doesn't follow redirects.
When I use the --disable-web-security flag, Chrome processes the requests correctly.
Even an isolated example (no proxy) fails
Simple node server to reproduce: pastebin.com/d8X9fDVY
The spec (CORS) says:
Whenever the redirect steps are applied, follow this set of steps:
(...) or the user agent does not wish to make the new request for some other reason, apply the network error steps.
Which is quite vague >.>
 
!!> var d = new Date; d.toJSON() === d.toISOString();
 
@Zirak true
 
11:02 AM
hey
i am new to jquery.i start to design registration form validation.i used website jquery.com.without using any special plugin i make script it work fine but massage show only few second only help me please.....
 $(document).ready(function(){
		//var msg=$("p").text("Are you sure?");
		$("#form1").submit(function(){
			if ($('#fname').val()=="") {
				//$("#ms").show("slow");
				$("p").html("Are you sure?").show();
				//$(this).show("Are you sure?");
			}
		});
	});
 
@AnkurSaxena - It is sometimes helpful to go to jsfiddle.com or similar, and create a minimal example of your problem.
also, please press CTRL + K before you post code, as it will format the code better
 
@RobW hu... yeah :/
 
okey sir.....thank alot.....
 
There's no need for 'sir's
 
 
1 hour later…
12:35 PM
@Loktar The controls are fucking hard
Love it!
 
Florian, I knew I'd find you there...
Do you recall this question ?
7
Q: JSON.stringify deep objects

dystroyI need a function building a JSON valid string from any argument but : avoiding recursivity problem by not adding objects twice avoiding call stack size problem by truncating past a given depth Avoiding recursivity problem is simple enough : var seen = []; return JSON.stringify(o, function(_...

I answered it as I thought, no smart solution.
 
@dystroy Ah yeah, I wondered about that.
 
@Zirak I don't think there was any shortcut possible
So I made it the boring way
And I really really don't like Crockford's coding style ^^
nor his trivial comments before any simple test...
 
@dystroy nice. If possible, you should use a web worker
using JSON.pruned(window) freezes the browser for some seconds
 
Maybe...
In my tests it felt instantaneous
Even on Android (the main platform for this)
That would be a good reason to learn webworkers, though...
I add it to my TODO list
 
12:52 PM
@ThiefMaster You've used websockets on node, right? Is there a saner module than this?
 
@dystroy oh, android... it doesn't support web workers. caniuse.com/#feat=webworkers
 
I used socket.io
takes away all the dirty stuff and also handles fallbacks (xhr polling, jsonp polling, flash socket, etc.) if necessary
 
It didn't seem like socket.io particularly like non-socket.io client requests (as in, just using the WebSocket thingy).
 
12:54 PM
The client isn't a problem, I just want a server up.
 
@zirak A server for websockets ? [edited, fixed]
 
2 mins ago, by Zirak
The client isn't a problem, I just want a server up.
Yes, a server for websockets.
 
I code my websocket servers in Go
 
> ...websockets on node...
 
12:59 PM
Especially convenient when your file explorer hides the extension
 
@FlorianMargaine Weird that support was dropped after 2.1
 
@FlorianMargaine how the hell do you include .js
 
@FlorianMargaine its weird that thats legal, windows requires a filename if you create a file using the GUI
 
windows sucks
no freedom
 
1:13 PM
On linux there is no problem creating a file named ".js"
There is a filename, the extension is just part of it.
 
it's like experiencing life from behind glass... almost like looking through a window.
 
I've actually started to get used to using Windows
 
0
A: JavaScript repair bad html tag

Jan DvorakSince the DOM has already been broken, you need to take a step back and try to salvage the HTML. 1) Find the parents of the broken elements. While search&replace inside the document.body.innerHTML would probably work, you shouldn't really let regexes anywhere near large chunks of HTML . Perf...

lol at the comments at the top of the code...
//author: Jan Dvorak
// stackoverflow.com/a/14157761/499214
 
It still sucks, but I know which parts suck now. Instead of being surprised at every click
 
@dystroy cept for it's hidden on linux (debian et al) with the leading .
 
1:15 PM
@Event_Horizon You can disable "Hide extensions for known filetypes" and then have a filename like .js, methinks
 
It's a long time since the last time I listed files without showing invisible ones too
On nautilus, use Ctrl+H
 
@AmaanCheval I have them unhidden, it doesn't let you make a blank filename using GUI
in XP
 
same in 7
Git BASH or cygwin
 
@rlemon BIDI is really painful... I know some Unicode but dealing with those beast is hard...
 
1:32 PM
-3
Q: Disable injection

user1841964I am currently using: if (isset($_GET['b'])) { $bb = $_GET['b']; echo 'found'; } else { $bb = 'white'; echo 'notfound'; } and <body bgcolor="<?php echo $bb; ?>"> to allow the users to set the color of the page, what would be the safest method to avoid injection?

seriously.... what a stupid question
 
@rlement I don't get why the answer with htmlentities is being upvoted as there is nothing visible to protect.
 
you cannot protect anything! it's the client :P
this is what I don't get
 
@rlemon I had a similar discussion yesterday. Check the comments to my answer :
OP wanted to prevent some specific parts of the DOM from being modified by the user...
0
Q: jquery tooltip+live

dontHaveNameI have this code $(".tooltip").each(function(){ var tooltip = this.title; this.title = ""; $(this).live("mousemove",function(e){ $("#tooltip").html(tooltip).show(); }).live("mouseout",function(){ $("#tooltip").hide().empty(); }); ...

This discussion was full WTF...
 
well that escalated quickly
 
1:47 PM
lol... silly people.
"how do I parse HTML with regex in JS"
don't.
"that isn't an answer"
fine, dont and use a DOM and walk it
<some mumbo jumbo about how im wrong and mean and rude and blah blah blah>
stop trying to fix your car with a banana you fools!
 
You're not helpful at all.
 
you're not.
seriously... don't fucking parse HTML with regex.
you should walk it in a DOM
there are DOMS available in nodejs
 

« first day (811 days earlier)      last day (4128 days later) »