« first day (823 days earlier)      last day (4126 days later) » 

user752723
12:09 AM
hi. :)
 
@rlemon whats that random image site?
 
Simply don't get started with it. Saves a ton of money.
 
youd use it to test, it pulls random images
 
you want random images? 4chan.org/b/ :P
 
lol
 
user752723
12:12 AM
hi. :D
 
user752723
so why all the hate of regex? i dont get why it's so bad... :( i know its bad, everyone says so, i just dont know why? :P
 
It's not bad, it's awesome.
 
user752723
ah well a lot of php nuts say its bad... i cant even post a question without someone mentioning how bad it is... (exagerating a bit, but you get my point. :))
 
user752723
like here (someone just posted it like a second ago in a php room): codinghorror.com/blog/2008/06/…
 
user752723
they posted it when i asked the same question i wrote here...
 
user752723
 
Regex is HORRIBLE if you want to parse HTML though.
 
i got a hard-to-explain one, so i'll just post a fiddle jsfiddle.net/VgjXr
if you rollover the bckgrnd it moves the clipped image around randomly
but it moves the scroll bars round too
which i dont want ...
I reckon this isn't possible. someone tell me this isn't possible so I can do something else :)
 
@edzillion sorry, which browser are you using through which you're seeing the described behavior?
 
well the fiddle shows it
rollover the box a few times
 
@edzillion and a browser renders the fiddle.
 
12:24 AM
ah. of course chrome
 
I see no rollover effect in chrome canary or firefox.
 
1 sec
I needed to save it 'update'
yeah. that's it (pologies for my jsfiddle noobness)
shows in both chrome and ff
 
As a uni lecturer, my crap prefect says I can't use JS as a good example of functional languages. Would you mind help me with examples to prove him wrong?
 
actually. not in ff, which is interesting
 
why not apply overflow:hidden on the container, @edzillion
 
12:30 AM
YES thanks
i had it on the image ...
this chatroom implementation is crazy good
'star this as useful for the transcript'! well that sounds badass AND somewhat ominous :)
 
@CaptainGiraffe Probablky the ES5 spec? Show him that the functions exist to use JS in a functional way.
 
css only modal/lightbox
now off to play some games instead of obsessing over random stuff that I wont even use..
 
Can anybody tell me why 123.45 - 123.00 is 0.4500000000000028 ?
I know that js uses high precision numbers when using decimals... but how is THAT the answer?
 
rounding error.
 
12:45 AM
How common do you think that is? Am I safe to truncate after the first 2 decimal numbers?
Thank you @copy I will check that out.
 
No, wait
 
@DerekSmith Extremely common.
 
And if you truncate, what about rounding down?
 
@KendallFrey good point.
@copy Thanks for the references. That's all I need guys :) On my way...
 
12:49 AM
sorry was afk
 
Remember that floating-point numbers only have about 15 significant digits. After that, it's garbage.
 
iz good becauz iz slow
 
So if you do 123.456789 - 123.45678, you get about 15 digits starting at the 100 digit.
However, when a number is converted to string, it shows the digits beginning at the first non-zero digit.
 
using stupid English... fast track to cools-ville
 
12:51 AM
@KendallFrey That doesn't explain why his example does not work
 
damn, loktar made me want to play video games instead of being productive.
bye
 
1:44 AM
what a waste of a day
 
 
2 hours later…
3:16 AM
!!> (![]+[])[-~[]]
 
@phenomnomnominal "a"
 
Is it possible to do the whole alphabet like that?
 
No
It used to be, but was fixed
Because sort doesn't return window or something
 
	this.View = function(view, controller, json) {
		if (typeof view === 'object' && typeof controller === 'undefined') {
			json = view;
			view = undef;
		}
		if (typeof controller === 'object' && typeof json === 'undefined'){
			json = controller;
			controller = undef;
		}
		if (!JSON.parse(json) || (typeof view === 'undefined' && typeof controller === 'undefined' && typeof json === 'undefined'))
		{
			//TODO: raise error that the info passed in isn't json
			return;
		}
		return { 'type': 'view', 'data': json };
I am doing the parameter checking in a "correct" fashion, right?
 
3:44 AM
sd
Ah, sorry
A coworker just noticed that this fails in Chromium for Linux:
"use strict";

for (var name in { "bar": true }) {
	console.log(name);
}
Without the "use strict", no problem. I also have no trouble using name as a variable outside the context of the for..in loop. Any thoughts on what's up here?
 
Does strict mode allow for...in?
 
It should
 
Yeah. If I change the name of the variable to something other than name it works.
"ReferenceError: name is not defined"
 
is name a reserved keyword?
nope
hmm
 
!!> "use strict";for (var name in { "bar": true }) {console.log(name);}
 
3:53 AM
@SomeKittens "undefined" Logged: "bar"
 
works is Chrome on OS X too
 
so if you use "k" instead of name it works?
@phenomnomnominal yeah, I expect this is local (for some reason) to Chromium
 
@jcolebrand Right :/
 
strange
 
3:56 AM
idk, sounds odd to me
I would just use k anyways, since you're iterating over the keys
 
I how do the Chromium version numbers map to the Chrome ones? I'm running a copy of Ubuntu in a VM and just installed Chromium, it's showin' up as version 18.0.1025.151, which is super behind Chrome on my Mac. But it's the current one in the Ubuntu app store thang
Heh, fair enough. It's just weird.
@benlevywebdesign Hey
 
@Sidnicious Don't use the Ubuntu repository for Chromium
 
For serious?
 
Yeah. It's not maintained anymore
 
@Sidnicious so you work on okcupid
 
4:01 AM
@SomeKittens. Huh, thanks a lot. Do you know if the .deb on the Google website the best option?
@benlevywebdesign I do :)
 
@Sidnicious fun
 
@Sidnicious Yeah
 
@Sidnicious Its a good site
 
It'll also auto-update
 
@SomeKittens Nice! I'm kinda miffed that they still offer it in the software center, then. We'll see if the current version sorts it.
@benlevywebdesign Thanks dude!
 
4:07 AM
Any thoughts on how to do my parameter checking above faster, or if that seems the most maintainable way?
 
@Sidnicious your welcome dude and are they getting rid of the beaker logo?
 
Curious if anyone here writes code in ASP.NET MVC(3) during the day?
 
@jcolebrand I can't see anything to improve on, but I'm a backend developer these days :). Hopefully someone else does.
 
@Sidnicious thanks
@Sidnicious well I am playing in nodejs, you can join me ;-)
 
I've wished for a library to abstract that stuff away, though — seems like it wouldn't be too bad to make one that lets you declare which args are optional and what you're expecting in each slot.
I love playing with Node
 
4:19 AM
I'm working on a pseudo MVC3 lib for node, replete with controllers, views, razor, etc
I realize that's a) ambitious, and b) not extremely useful
However, I like the tinkering, and I like the idea of it
 
0
Q: Line Feed or Carriage Return - What to use?

absk007 Line Feed and Carriage Return behaves similarly. Which one to use when? OR Can it be used alternatively? <script> alert("Hello \u0009 World"); alert("Hello \x0D0A World"); alert("Hello \u000D World"); </script>

 
A couple of OkCupid Labs projects like combosaurus.com are done completely in Node, written in IcedCoffeeScript.
 
Yay coffeescript!
 
Sounds fun — it still feels like organizing Node sites has a looong way to go. Didn't someone make a Node port of LINQ a while back that was super awesome?
@benlevywebdesign Huh, I think you may be on to something. I don't know anything about it but I'm curious now. I'm gonna ask around tomorrow.
Razor's a templating language, no?
 
@Sidnicious idk, but I might could use that ...
@Sidnicious it is, a view engine
What do you think of this syntax for a Controller class, lemme explain a few things first:
exports = module.exports = function() {
	this.Index = function _index(id) {
		this.ViewBag = {"cole":"is cool"};
		this.ViewBag["thing1"] = "thing2";
		return this.Json({
			"hi": "world"
		})
	}.bind(this);
}

exports.config = module.exports.config = {
	"Index": ["GET"]
};
 
4:24 AM
@Sidnicious well I don't like the new pink background logo
 
I auto-prototype-constructor the class for you, so you get this.Json, this.View, this.Text, this.Xml where you can just return them, kind of like how you return in C# now
And it will auto-link the view if one exists, etc.
the config value is if you want to do something like [HttpPost] since there isn't exactly attribution of functions in javascript
 
That would be really cool
 
So you can see where we already have ViewBag support, return types, auto-wiring, etc, right?
 
I'm not super familiar with .NET, so I'm not sure what that last pert meant
 
And you can extend the BaseController if you like
@Sidnicious which part, attributes?
 
4:26 AM
Right
 
Ok, check this C# method out:
[HttpPost]
public ActionResult Index(id){
   return Json(new {"thing":"thing"});
}
 
Huh. That makes me think of a Python decorator. If you know what that is, are they similar?
 
This method can only be called by a POST method
@Sidnicious I don't, but I expect they are. Most languages that are typed in that format are similar
Obviously JS doesn't have all the same things
The other thing I'm going to do is (it's 70% written already) match up parameter names with variables passed in
I'm going to lowercase match everything, which could cause some folks grief, but ffs, if you rely on casing to distinguish your var names, you're already screwing up
 
query string/POST parameters?
 
Aye
The only one I'm not sure about yet is this type: GET /Index/ThingView/1 where 1 is the ID you're looking for
I've got to think on that a bit longer
 
4:31 AM
Ah, so I see how that ties into attributing functions, cool :)
 
Aye
Won't that be cool?
 
I like how Express handles that: /Index/ThingView/:id
 
If it's attributed to prevent GET requests, for isntance, I'll kick it
@Sidnicious ok, so how can I get that from this?
7 mins ago, by jcolebrand
exports = module.exports = function() {
	this.Index = function _index(id) {
		this.ViewBag = {"cole":"is cool"};
		this.ViewBag["thing1"] = "thing2";
		return this.Json({
			"hi": "world"
		})
	}.bind(this);
}

exports.config = module.exports.config = {
	"Index": ["GET"]
};
Remember, convention over configuration
I don't want to force any more configuration than I have to
obvious first solution is to tie it into the configuration object, of course
exports.config = module.exports.config = {
    "Index": {"verbs": ["GET"],
              "defaultParam": "id" }
};
 
Where's the URL in there?
I see Index, but where does ThingView come from?
 
whoops
@Sidnicious it doesn't in this case, as I was just using an example
 
4:33 AM
er, the /ThingView component, I mean
 
some URL
 
Fedora 18 is out ! :D
 
I haven't exactly robustified the route handling yet, I'm just working on basic convention based coding
However, @Sidnicious I should ask if you're familiar with how MVC3 does controllers?
 /app
    /controllers
        /HomeController.cs
   /views
       /Home
            /Index.aspx
Right?
 
I legitimately don't know .NET or C#, I've just been picking up little bits and pieces from a couple of guys that are working on a .NET project at OkC :D
 
I got a satellite office in Oklahoma City :D
 
4:37 AM
Oh, sorry, namespace collision :). I meant OkCupid.
 
ooooh, ok
 
Yeah, I guess it'd depend on how you do routing — but I like the Express convention of "if it starts with a colon, we'll assume it's a parameter". In your case, would it make sense to pass it, say, as an implicit first argument to the function?
 
implicit how?
oh, I didn't fully finish explaining >.<
ok, so in my app you have three folders: Controllers,Views,Models (I haven't quite decided on the Models thing, but the idea there was to expose that internally so you don't have to require them, idk)
If you have a js file in the root of Controllers (right now I only parse the root) then it assumes that's a Controller file, so the filename becomes the root of the path
So if the above file we're using is called "ColesController.js" then the URL would look like:
/coles/index/
But I also have a convention that index is the default for a given controller, so I also add a secondary route: /coles/ to the lookup table
so I'm using the function names explicitly declared on module.exports = function (){ this.functionName, this.functionName, etc }
and because of that convention, I'm also able to do the default routing on views, etc. Or you can specify a view name to use
hence the previous code about this.View(view,controller,json)
So, given all this auto-route-building, how do I go about specifying a default parameter? >.<
 
and exports.config is a magic property that lets you add options to each route?
 
@Sidnicious well, no, I mean, I'm parsing it
wanna see the bastard code that mostly works? :D
right now I'm only interrogating config as tho it were an array, but I could use it to fashion variables, and use an array for ordering them
so if we gave {"Index":{"routeVariables":["customername","id"],"verbs":["GET",'post']}} (yes, I realize I mixed some things up, I believe in letting people break things) then the route could match:
/coles/index/:customername/:id and /coles/
for the second case I would assume you were passing querystring params not in-the-url
of course, that also requires the parameters in the function declaration to look like this.Index = function(id,customername){ or this.Index = function(customername,id){ (I really don't need to worry about ordering do I? I'm matching on name)
 
4:51 AM
can you introspect the names of function parameters?
 
I can
:D
That's as far as I can get, but yes, I can
look at line 80
 
oh god, ok :)
I wouldn't've thought of doing that, but it's pretty dang cool
 
:D
It works ... and it does what I need so I can match the params, yeah?
And because I'm loading all the controllers at node-start, I can "do compile time checking"
I can't test how the Controllers work, but I can definitely vet all the glue logic
if you declare a param in the "defaultParameters" array but not in the function signature, I can throw an error and bomb out
 
It's interesting, my first instinct would be something like this:
module.exports = {
	"/": function() {
		…
	}
	"POST /foo": function(bar) {
		…
	}
	"/:id" : function(id) {
		…
	}
};
 
Aye
And that's how a lot of the frameworks do it, or something similar
I don't like thinking about how my routes are configured, but I do want to allow someone to configure them if they need them
I just want glue logic so I can put files here, files there, and they all work together
I also really need to setup static routing
I'm thinking of forcing all the static routing to go through /static (like /controllers,/models and /views)
But one thing at a time
 
4:59 AM
I guess I like your approach, but I also like the idea of keeping everything inline. I wonder if something like this is too ugly:
module.exports = {
	Index: [{ "routeVariables": ["customername", "id"] }, function(customername, id) {
		…
	}]
};
meh
quick question, why is module.exports a function?
 
for the magic that is line 60 of that gist
that allows return this.Json in every class
or return this.View
 
Oh, I see. Woah, you make it inherit from BaseController
 
Yup
That's also how I expect to expose this.Models(modelName) so you don't have to require in the middle of a module, but you can still require if you want, because all this gets bound up at compile time but doesn't get run until you invoke it, of course
But for me, I like the idea of being able to just var m = this.Models('users'), user = m.get(id); ...
And by the same virtue I could just shortcut to this.Models('users').get(id)
And by that logic you could: return this.View(this.Models('users').get(id));
YAY GLUE LOGIC :D
 
Single-line glue logic!
 
:D Not that we always need it, but sure why not
I'm not going to stop someone from var a = require('../MyModels/custom/object.js')(config); but if I can stop me having to think about it, I like that plan more
The entire point of this app structure is convention over configuration. I just want to be able to drop into any point and know what's happening, and everything be really clean
It's absolutely not n-Tier
But, truth be told, it could be. Because you could use closures and have your models make httpRequest and it would all still work just like it would procedurally
huh, ya know, just telling you about this app architecture I've learned like 4 or 5 things about my app arch tonight >.< and here I thought I really understood it
However, I'm also glad I haven't shared too much of the BaseController yet ... that is a steaming pile of ... yeah
 
5:10 AM
I like being a rubber duck :)
Hehe
 
BAH! WTF?
oh, I should be &&
wait, should I? >.<
Here, let's rubber duck this :p
	this.Json = function(json) {
		if(typeof json !== 'object' && !JSON.parse(json)) {
			//TODO: raise error that the info passed in isn't json
			return;
		}
		return {
			'type': 'json',
			'data': json
		};
	};
 
I was talking to the guys on the .NET project a couple of days ago about how much it sucks when awesome concepts from one platform don't cross over to others, so this makes me happy.
 
Ahhh, I should just json = JSON.parse(json)?
@Sidnicious meh, this isn't as awesome as MVC3 :p
Then again, I'm one developer in like 2 nights of work, they're a team of dozens or hundreds across 6+ years
 
So I don't totally get this.Json, does it not define a route for /controller/Json?
 
noooo
 
5:13 AM
It's a special case like Index?
 
Module doesn't hasOwnProperty the method Json because Json is on the prototype :D
That's why you have to .bind(this) after each function (but that's a good sanity check anyways when you're reading your code just like in C# you have to declare them public)
You could still have private methods in that class file that aren't returned on the final function
 
Ah, sorry, I thought you were giving me an example of something that could be defined in a controller
That makes more sense
*This makes more sense
 
And my next goal after this is to fix it so you could just declare them all as functions on module.exports
@Sidnicious this is part of BaseController.js
So the whole point to working on this framework is I'm going to build an after-market version of this chatroom
 
Haha
Open source?
 
I still need socket.io support, I still need static files, but I also need to do user and room management
@Sidnicious but of course
Myself and two others wrote a basic version about 18 mos ago for nodeKnockout 2012, but we never finished it
I was never happy with the way the project was organized, and wanted to try my hand at the whole MVC3 thing, so I'm doing it this way.
 
5:17 AM
So just to confirm, when I post JSON data to a URL, the top-level object's properties are gonna get treated as parameters and passed to a route's handler function?
 
I'll store everything in couchbase (so right now it's at least a three step process, 1) install couchbase, 2) intall a driver for nodejs to couchbase, 3) install my app ... and that all assumes you use npm)
@Sidnicious idk, how does the JSON look?
I mean, presumably so, yes
And if you don't declare it in the parameter list you're hosed. I don't let you do fun things like reach into the request object ( :o )
 
Oh, I'm sorry, that's the function you call to generate a response. I was thinking of it as one that parses a request, because of the JSON.parse part.
 
Ahhh, yeah
This is one of the five (so far) response types
View, Json, Text, Xml, Raw
And XML takes a JSON object and auto-generates an XML object out of it (yay npm!)
total source so far is just over 3.5MB >.<
 
I guess I'd assume that the thing you pass to this.Json'd be an object, not a string, but handling it makes sense.
Woah, that's serious
 
I would assume so, but I want to prevent that being an edge case
 
5:21 AM
Yeah, that makes sense
 
What if you do this.Json(this.Models('model').get(id).name);
I mean, you should probably be shot :p
but I need to detect it
I could just assume that the developer knows best, but if I want anyone besides me to ever use this, I need to make it fairly foolproof and error-emitting
 
Heh, maybe, but wouldn't that just be returning a single JSON-formatted string?
 
no, it would be returning a string, which is not a JavaScript Object Notation
 
Because it doesn't have a top-level object...
merh
 
so I need to test if it's an object or if it parses.
 
5:23 AM
So ….get(id).name would be a string of JSON?
 
looks like I have to invoke a try{ JSON.parse } catch { failed } structure
@Sidnicious idk, because I didn't write the method :p
 
I assume that a single property called name is a string
a string is not a JSON object notation
 
Re. your NKO project, I still want something to come along and gently caress IRC into the 21st century, the Stack Exchange chat system is pretty smooth, so something more open would be awesome.
 
@Sidnicious imagine this, but extensible
 
5:25 AM
Yeah
 
hang on, check out the data models (as they are so far)
imagine being able to self-host your own SE chat
 
All right, but I'm gonna have to call it a night soon, It's after midnight here
 
that can onebox other SE chat posts, and that can onebox SE posts, and that you can write your own onebox for ... :D
@Sidnicious yeah, it's 11:30 here and I have to get up at 7 and I'm still charging through on code, doesn't bother me if someone has to sign out
I'm just excited, and this is going to be so much fun to write :D
 
Aw yiss, editing (with history) is one of the things I want most in the chat system of the future, along with server-side scrollback :D
moderation is really interesting
 
Here's another feature-set for you
 
5:28 AM
(as a core feature of a chat system)
 
self-hosted, no-database, in-memory chat, that doesn't require users to login, but uses the entire SE system as you see here (aside from the user tracking)
So use it like you would a web-based IRC client where it prompts you for a name
and after the configured number of messages, they are gone forever.
so when 501 gets posted, 1 is gone
Someone wants something like that for an arduino
 
What do they want to use it for?
 
in-house chat
I expect, idk, I didn't ask
 
Software as a physical appliance, I kinda like it
One side project I really want to work on is a simple platform for self-hosted apps, a dashboard that lets you drop in the URL of a git repo and have it cloned and started up, ready for use.
...and which takes care of updates, controlling services, uninstalling them, stuff like that.
 
You haven't used Azure yet have you?
you get some free basic servers, they can run nodejs or IIS apps right now
 
5:34 AM
I haven't -- but I mean self-hosted!
 
they can't do much more than what you would get from git pull and then start
do you mean locally?
 
Yeah
 
Microsoft is likely to release something like an in-house Azure in the next two years
 
I've heard that Azure is pretty ridiculous (in a good way)
 
I expect those things already exist
OMG, you should definitely seek out a local .NET User Group and get some hookups on freebies, at the very least, and go seek out what Azure has to offer you
 
5:37 AM
@All hey
 
I haven't heard of one — I mean, there are pieces that have been open sourced by places like Joyent and Nodejitsu, but I don't think any of it goes far enough.
 
Well, jump on it ;-)
What are you going to self-host with?
ruby, python, perl, C#, IIS, nodejs, batch?
(I have seen a webserver done in batch, yes)
 
Heh, I might check one out. I guess I've always felt weird about using proprietary stuff to build web apps. I don't have a problem building platform-specific stuff with proprietary tech, but the web has always felt special.
Still no reason not to try it out, though
 
The trick is not having to configure anything (like a database)
Those sorts of scripts are hard to write and have be correct all the time because of so many things changing, like how do you update the database?
(granted, that's why I'm using a document database, and it's all in couchbase, but I still had to install a driver for my language and platform)
 
(Ideally the thing would be agnostic as long as your app followed the right conventions)
 
5:41 AM
Which points out just what you'll have to do: have drivers for every potential technology, or make a way to install drivers on the Host
 
Yeah, I know what you mean. .NET makes that all super painless, right?
Oh, sorry, misread that
 
By and large it does, but it's not foolproof
 
My hope would be to give each app an isolated sandbox that it can set up from scratch.
But yeah, dependencies like databases and drivers would still be tricky.
Hey @codebrain
I think I'm gonna call it a night now. Good talk.
 
Hey Sid
 
night
I'll be here tomorrow night I'm sure
 
5:44 AM
'night sirs
 
Also, my object/json detection is working :D
 
cool
aw yiss
 
My C# room is empty ! Everyone's been booting :-P
 
@codebrain good, come talk to me about MVC3 in nodejs
 
Oops , too straight im not working on MVC yet..whats your doubt
 
5:46 AM
doubt?
I'm writing an MVC3 style architecture for nodejs
 
oh ..Are you an architect ?!?
 
apparently :p
 
lol..im nowhere near to you then ..i just got 1.5 years experience with C# and .net :-D
how is nodejs ? is it efficient and flexible ?
 
I mean, it's what you make of it
it's definitely flexibile
and it takes me about 0.3s to boot my mostly compiled webserver
 
thats cool ..Js has its own way :-P
 
5:52 AM
Is that a statement or a question?
 
its a statement may b a compliment for js developers ..
why do you want to write an mvc style architecture for node js ?
 
No, there are alreayd mvc architectures for nodejs
I specifically want one that has a strong semblance to ASP.NET MVC3
 
Oh. .hmm..sounds brilliant
 
I hope one day it is :D
 
jcole.listen(it will);
 
5:56 AM
How can i use google's Geocoding API https://developers.google.com/maps/documentation/geocoding/ , to get the lat and log in javascript ? i can get the reponse from the browser , how can i get it within javascript function ?

Ex : http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=true
 
@user1537158 why can't you make the above call as json to a webservice that isn't a browser?
 
@jcolebrand how can i do that ?
 
shame they don't provide a jsonp response
try calling the xml version with an ajaxified client?
hang on, lemme just try that
@user1537158 seriously, I figured there would be an XSS issue here, but no
Just run this code and see if you can't figure it out from there (assuming you're using jQuery, which most folks do nowadays) $.getJSON('http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphit‌​heatre+Parkway,+Mountain+View,+CA&sensor=true',function(data){console.log(data)})
 $.getJSON('http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=true',function(data){console.log(data)})
 
sure let me try that
works great @jcolebrand thank you v much for the help :)
 
@user1537158 in the future, just try that what I just gave you before asking about JSON
 

« first day (823 days earlier)      last day (4126 days later) »