« first day (371 days earlier)      last day (4582 days later) » 

1:10 AM
 
 
2 hours later…
2:58 AM
0
Q: How do I permanently disable javascript strict warnings in Firefox?

FrancisWhen I open Firefox (8 Beta and 7) and load a page with firebug open, I get a load of javascript strict warnings, so I disable javascript strict warnings so my page loads will speed up, which works until I restart Firefox. Every time I open Firefox, javascript strict warnings are enabled. I even ...

 
 
1 hour later…
4:21 AM
I think I broke jsfiddle jsfiddle.net/SL8g4/1
 
 
1 hour later…
5:39 AM
@wHiTeHaT All? You solved all of Project Euler's problems?
 
 
1 hour later…
6:56 AM
Anyone have a good idea on how to solve Problem 32?
Could bruteforce it
 
does any one knows how to get value in text area from the url query string using GET method
 
What?
 
i mean to say url is like this 1.html?name=adf I want the value adf in text area
 
Sure. It's basic PHP.
 
Yes i can do this with PHP but i'm developing chrome extension this will not work with php
 
7:01 AM
Oh, so you want to do it with JavaScript?
 
yes..
 
Okay
Is there a possibility of there being more parameters?
We should create a function assuming there will be, anyway, though
 
no there is only one parameter..
 
One sec, AndyE answered a question like that, looking for it now
241
Q: Get query string values in JavaScript

EminIs there a pluginless way of retrieving querystring values via jQuery (or without)? If so, how, and if not what plugin do you recommend?

 
Okay. A simple approach would be document.getElementById('textarea').value=location.href.substring(location.href.‌​indexof('?'))
 
7:05 AM
@Zirak well i know how to get query sting in javascript but not able to pass that value in text area..!!
 
@Amaan Don't use innerHTML
 
@Zirak Why?
 
@BasicBridge So you just want to know how to add some text into a textbox?
 
@Zirak Edited the code there, but why?
 
@Amaan Slower than DOM methods, much more dangerous (both to security, as it makes injecting html easier, and to other nodes)
 
7:07 AM
Oh, my code there is wrong
 
yup only that thing..!! i'm able to get the value in query string.. but not able to pass that in text area
 
That extracts everything after the ?. Just change the ? to a =
 
textareaElement.value += string;
The value property of every input element contains its...value.
Gladly, the DOM is intuitive (except for the parts about text nodes being inserted everywhere)
 
@Zirak can you show me a full example..
 
hi guys
 
7:10 AM
That is the full example, assuming that textareaElement is your text area element, and that string is what you want to append to its value
 
I use this jsfiddle.net/7SNAr to get the query string but pls just help to to pass that value in textarea
 
I'm building a drupal module using Services, and a mobile app using Phonegap. This mobile app will talk with Drupal to do some admin stuff. I'm currently looking for JS frameworks I could use to leverage/optimize my code. I've looked at backbone, knockout & angularjs. Backbone seems to be the best in my opinion (I don't like dirty html). Is it a wise opinion ? Anything else I should know/learn ?
 
document.getElementById("yourTextareaId").value += getValue(whateverYouWant); or use any other DOM selection methods you want. That's. It.
 
Zirak : what he wants to know is how to "getValue(whateverYouWant)" :)
no ?
oh no :)
 
@FlorianMargaine Optimize your code? Frameworks don't optimize your code. They can't. They tightly couple within themselves, and are usually the size of a bagillion suns. Frameworks are for "I wanna code this in 10 seconds without thinking too much"
2
 
7:16 AM
@Zirak : yeah, but you know what I mean. Making my code easier to read. Having low level stuff abstracted and make complex apps work flawlessly
using MVC if possible to have a clear structure
 
uh, no, it makes it easier to make complex things, since you don't have to abstract yourself. But nothing works flawlessly, no matter what people tell you
Also, if you want optimizations, you abstract the low-level yourself for precisely what you need. Frameworks are general purpose, not "I want this exactly"
 
yeah... by the way, any advice on the framework to use ?
 
Nope, I don't like using frameworks. ;)
 
But heard some good things about backbone and knockout
 
7:19 AM
ok :)
I know where my choice is heading then
I'll still look for a few stuff before
 
Solved problem 32 on Project Euler. Anyone know how I can optimize it a little more. Runs in about half a second for me
 
If you have several options, just try 'em all until you find one that fits your needs. Less personal than text editors, but about as important.
 
ok my last question might be funny one.. is there any to use POST method in <a href="">.. ????
 
well, it's for an open source project, so it's mostly about how it will be better for everybody
 
@Amaan Right off the bat, cache i * j, you're using it three times
 
7:21 AM
@BasicBridge : form.
or ajax
but no, <a> doesn't allow post method
 
okz.
 
@Zirak Oh, yeah.
Takes 10ms less than before
And 40 now
20 now. So an average of 35ms less.
 
@Amaan: you can also cache stringify(i,j)
 
That's what I was doing right now
 
hmm, the string concatenation could be micro-optimized methinks
 
7:25 AM
@Zirak How, youthinks?
 
also, is ternary operator faster for if(str.indexOf(i) == -1) ?
 
Dunno yet
 
maybe using === or ! is fater
faster*
 
On same type, == is faster
 
@FlorianMargaine No, using === makes it slower
 
7:26 AM
At least I think it is...?
 
Yeah, I think so too
 
well, I'd think using === is faster since there is no casting needed
 
There's no casting needed on same type checks, too
 
but there is a check to see if there is a need to cast, isn't there ?
 
One sec, I'll look at the spec
Nope, the first thing it does is check if they're the same type: es5.github.com/#x11.9.3
Anyway, string concatenation is already expensive, don't think optimizing it will make any difference (maybe 4 picoseconds average)
Oh, why do you need both ans and finAns?
Nevermind
 
7:31 AM
ans so I can make sure none are repeated
 
 
1 hour later…
8:48 AM
@FlorianMargaine "frameworks to optimize my code" It doesn't work like that, frameworks offer abstractions not efficiency
 
9:18 AM
usually what you get from frameworks is exact opposite of optimization
 
9:39 AM
Btw, @tereško, jQuery's array-look-alike values weren't jQuery's fault. (see the question if you're interested)
 
9:56 AM
Pretty much why I dont like frameworks
On that matter I should do something of value
 
It's so nice to not work on a crappy computer. I finally installed Git, and will soon install a Linux distro (probably Ubuntu), and run node!
 
o/
I just realised dom-shim doubles as a dom compliancy test \o/
I just need to find a nice way to do it
 
How does the dom shim fare on IE9?
 
100% pass so far.
virtually 100% pass on IE8
Apart from that contains method you said breaks :\
Dom-shim will work on IE9, chrome, ff, saf, opera and try to work on IE8
There are severe limitations with IE8 that means you can only get a subset of the dom shimmed
Same with ES5-shim, it works 100% on all but IE8 (and IE7/6)
Oh and the people that said "dont extend the dom" are right.
Unless you know what your doing, really dont extend the dom.
 
10:13 AM
by "extend the dom", you mean like adding stuff to HtmlElement.prototype or whatever?
 
Yeah, that.
I have to do this dance to get handles on the prototypes
And I have to do this dance to write to the prototypes
Anyway I've realised the purpose of the DOM-shim is not to fix IE but to normalize all modern browsers
 
You can't fix IE with js. Only the apocalypse can fix IE
 
Meh I can get IE8 90% of the way towards DOM4 compliancec
 
 
1 hour later…
11:49 AM
Anyone got an idea of how to solve Problem 25 on Project Euler? I was thinking of just extracting the digits before the decimal and add the number after the e+ to get the total number of digits
But then i realized that anything above an e+300 is Infinity
So, that approach was rendered useless
Please don't tell me to use a BigInt library. If I have to, then explaining how the library works would be greatly appreciated
Okay, so Google tells me that there are better ways of finding the digits of a number. Logarithm in base 10 + 1 is the total number of digits.
 
@Amaan , can you plot the number of digits to position in sequence for first 10 , 20 digits ?
problems like this are not solved by brute force
 
@tereško Yeah, maybe
@tereško Probably give me a sequence that I can use, right?
 
Or learn maths o/
 
well , the graph should show you what the solution's formula will have to describe
 
Hmm
 
11:55 AM
maybe you are lucky and graph is actually a straight line
 
I don't think that's going to happen
 
map it
 
Alright
1,1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,5,5,5,5,5,6,6,6,6,6
Output of digits for first 30 terms
 
i said up to 10 digits , but , oh well .. it look linear to me
 
6,5,5,4,5,5
 
12:08 PM
this is why i said hat you need to do this for 10 digits +
 
And that is why I did
 
no , you did for 6 digits
 
Oh, no. 6,5,5,4,5,5 is the number of times you get a 1 then a 2 then 3 and so on
 
maybe look up the word "digit"
 
Alright. Thanks for your help, anyway
Aaah. Damn, brain malfunction. I was thinking terms, not digits
Sorry
10 digits is too much. Crashes Chrome for me. So clearly, brute-forcing is not the answer
 
12:23 PM
7th, 12th, 17th, 21st, 26th, 31st, 36th, 40th, 45th, 50th, 55th, 60th,  64th, 69th, 74th, 84th, 88th,93th
 2    3     4      5      6     7     8    9    10    11    12    13    14    15    16    17    18     19
at a blind guess , 1000 digit fibonacci number is at lower side of 4800th and 4900th item
 
12:40 PM
Hmm, thanks.
 
Large enough Fibonacci values have been proven to converge into (phi ^ n) / sqrt(5)? It can be solved with pen and paper.
 
Is what I found
Binet's formula
Where phi = (1+ sqrt(5))/2
 
12:56 PM
FFFFFFFFFFFFFF
Host objects Y U NO LIVE IN ECMASCRIPT LAND
try {
    var pd = Object.getOwnPropertyDescriptor(obj, method);
} catch (e) {
    if (e.message === "Could not convert JavaScript argument") {
        // Firefox says no you cant ask the propertyDescriptor of a host object
        return;
    } else if (e.message === "Illegal operation on WrappedNative prototype object") {
        // Firefox says no with another error message
        return;
    } else {
        console.log(e);
        // IE8 getOwnPropertyDescriptor fails on non-dom
        // so this is not DOM and shimmed
 
@Amaan Got the answer using good ol' pen & paper
Simply said that (phi ^ n) / sqrt(5) > 10^999 (10^999 has 1000 digits), and since whatever the number will be it'll be greater than that number, and then it was simple math.
 
i learned more physics at school then math ..
quick and dirty approximate solutions work well enough
 
blegh, physics. It's too close to reality
Who cares about trajectories and ricochets? Calculus FTW
 
// Check for `.call` property as IE8 thinks functions are typeof "object"
if (typeof pd.value !== "function" && !pd.value.call) {
:(
 
//woot?
typeof function(){}; //"function" in IE8 console
I doubt IE8 messed up the typeof operator table (es5.github.com/#x11.4.3)
 
1:12 PM
@Zirak Nice
 
Got the answer if you're interested
 
This explains it well using Logarithms. I'd understand it better if I got logarithms, but well..
@Zirak Na, I know what the answer is. I'm not going to submit it unless code I write by myself outputs the answer
Using the link's formula, you get (999+(LOG √5))/LOG(1.618)
Which gives me the answer easily using WolframAlpha
 
hey i'm developing google chrome plugin that select text from any site and post to other but i have problem when ever there is new line it will not detect it also does not detect spaces here is the code
`var sometext = chrome.contextMenus.create({"title": "Stream Selected ","contexts":["selection"], "onclick": postamtext});

function postamtext(info, tab) {
var posturl="http://www.example.com/browserplugin/index.php?status=SELTEXT";
chrome.windows.create({"url":posturl.replace("SELTEXT", info.selectionText), "type":"popup", "height":150,"width":600});
 
@Amaan Yeah, pretty much what I did
 
@Zirak So calculus covers logarithms and all of that, right?
 
1:16 PM
I got to this:
log(10) * 999 + log(5) / 2
-------------------------------- < n
log(phi)

And then it was just plugging it into a calculator
@Amaan Dunno the formal definition, but my definition is "if it has functions, it's a part of calculus"
 
hey all, in google chrome console, I try to use return in if statement, and it says "illegal return". Anyone experience this?
 
@JohnMerlino Yeah, you're not in a function, so you can't return
 
oh yeah
hey its only 9am, just woke up, cut me some slack for that one
 
@Amaan I think of logarithms as upside-down powers. log10(1000) = 3, since 10^3 = 1000
 
0
Q: HTML / Javascript in custom field textarea?

Jens TörnellIs there a filter for allowing HTML / Javascript into a custom field textarea? I'm using get_post_meta. On the frontpage I want the HTML / Javascript to run, not to be displayed.

 
1:26 PM
@Zirak Ah. Well, then, hopefully, it'll be covered when I learn calculus.
@Zirak Oh
 
finally doing some experiments with Three.js
 
1:41 PM
@Zirak on host objects
typeof Element.prototype.insertBefore
@IvoWetzel is three.js awesome? \o/
 
17/182 Chrome 14
 
@Zirak my chrome 14 fails only 12
 
@Raynos It's simple to use for sure
Trying to create some kind of bullet hell shoot'em'up
 
@Zirak of course it only "fails" those because the DOM-shim has to patch them.
 
got the basic camera and scene setup in around 10 min
 
1:45 PM
It basically shows what parts of the DOM the shim is patching
@IvoWetzel o/
 
already spreading tones of... white... planes!
Which is great!
 
Have you tried the node-webgl module?
 
I can focus on logic for now
 
It's a webgl like API to opengl through node
 
@Raynos 14.0.835.202 on Windows 7
 
1:45 PM
@Raynos Nope, I may give it a try later
I'm busy writing crappy prototype code :D
            speed = speed || 5;
            speed = speed / 100;
            w = w || 1;
            g = h || 1;
            rps = rps ? rps * (Math.PI * 2 / 1000) : 0;

            degrees = degrees || 0;
            degrees = (degrees / 180 * Math.PI);
            degrees -= Math.PI / 2;

            degrees = -degrees;

            var b = Bullets.get();
            if (!b) {
                return;
            }

            b.mesh.position.x = x || 0;
            b.mesh.position.y = y || 0;
>_>
 
@Zirak 14 on xp >_< dont tell me chrome fails on win7
can i one-up you for hacking Host method detection
 
In case you like blue backgrounds with orthographic stuff flying around
(no interaction yet, need to somehow create a mini version of BulletML for bullet logic...)
 
Like that would work on windows xp :P
 
Not my fault :P
Runs great on Ubuntu though
 
@IvoWetzel is a DOM-shim useful for performance?
Or is it better to hand-optimise DOM feature detection for performance?
 
1:50 PM
hm, depends
 
of course you should use a sensible subset of the DOM
 
as long as it uses < 50% CPU when doing something like $.html in a 30 fps loop, it should be fine
:D
 
A DOM-shim doesnt give you a foreign API
it emulates missing DOM features
What is $.html :S
 
$('#foo).html('Hello world! Im a bloated version of innerHTML!');
 
Why would you ever use innerHTML
its slow as hell :\
document.getElementById("foo").textContent = "Hello world, i am fast";
 
1:58 PM
@Raynos In all your functions, what's the t parameter?
Hehehe, I was listening to Iron Maiden's "Fear of the Dark", and at one point I'm absolutely sure they said "Fear of the DOM"
 
@Zirak t === test its part of the unit testing library
 
Wow, FF7 is super-mega-duper fast for that
 
@Zirak they are contrived examples, they are just dom nodes that dont live in documents
i.e. there is no reflow or drawing on altering that small dom chain
 
@Raynos AssertionError: el does not have method isDefaultnamespace, namespace -> Namespace?
 
2:14 PM
@Raynos Instead of getOwnPropertyDescriptor, did you try using in? Like, 'insertBefore' in Element.prototype
 
@TimStone something like that
@Zirak which part?
@TimStone its a rought test suite to test DOM4 compliance, lots of false positives and false negatives :P
 
Ah ;)
 
I dont really think it has too many false positives / false negatives
@TimStone I doubt your browser supports .isDefaultNamespace
@Zirak I need it for getting getter/setters
in checks wont do
Most of the false positives/negatives are in IE8
 
Fixing the name does allow all of the tests to pass in Chrome dev, at least.
 
Tom
2:28 PM
If there are any jQuery mobile folks here I added a bounty to this guy's question:
1
Q: Jquery mobile page navigation corrupts base url and causes ajax on main page to fail

user418775My main page is here: http://www.mydomain.com/main/main.php My login page is here: http://www.mydomain.com/main/pages/login.php Main.php uses ajax to fetch data in response to a tap event. This works fine until I navigate to my login page and then back to my main page. After going to the logi...

 
@TimStone Oh that!
 
Aye
 
@TimStone your right :)
.contains still fails in chrome14 on some things
Anyone know what the difference is between localname and tagname?
 
@Raynos What's localname? Link?
 
2:45 PM
It's the same as tagName but without the prefix I think
its basically for XHTML
<prefixthingy:localnameThiny />
would have localname === localnamethiny and tagname === prefixthingy:localnameThiny
I think at least.
 
localName is lower case.
 
I know very little about xhtml, namespaces & svg
@AndyE does tagname contain the prefix?
I should have just read the spec -.-
someone "RAYNOS Y U NO RTFS"
 
RAYNOS Y U NO RTFS U LINKED TO?
 
3:01 PM
@Tom to less info for this question
 
3:23 PM
is it not crazy that you have to use java for android and objective-c for iphone? Will the use of different language for each new technology invented ever end?
 
I cant be bothered to file a bug
but el.cloneNode() throw a not enough arguments error in firefox when it shouldnt
the argument is optional. Someone file it.
 
Apple will always be retarded and Google is a Java fanboy. Besides, how can you support a plethora of languages on something that small?
But yes, Objective-C is shit and so is Java.
 
why cant their just be one standard, to use one language, rather than forcing people to delve into new languages for every new invention by a different company
 
couse then theire power is lowered
 
But yes, Objective-C is shit and so is Java.
But yes, Objective-C is shit and so is Java.
@JohnMerlino Because standards don't work. You want something that works everywhere? Use C. Oh wait, C is completely static (except for the dangerous pre-processor commands). hmm, how can we solve it? And so, all other languages were born.
Also, sorry if I send something twice or not at all... internet connection is shit
 
3:30 PM
yeha but this is a war of hate. you cant even use java on the iphone. it banned.
only c, objective c, and javascript allowed
 
That's because apple is retarded
huh? you can use js on iPhone? How'd you do the GUI?
 
FIREFOX Y U SHIT.
Firefox flattens the entire prototype chain for the dom
so firefox is basically useless :\
 
you can pass json to objective-c, and also the iphone has safari so you can write javascript code that renders in browser
 
@Raynos that's sad
 
in fact, you can use a combinaiton of php, javascript, and objective-c together on the iphone
having a web server that sends json
 
3:35 PM
Whoever said "dont mess with host objects" was right
 
oh, not native, web apps. More meh.
 
@Raynos that's for the pinned DOM-shim?
 
@Nullable pretty much
I'm messing with host objects and its a right pain
 
3:56 PM
@Raynos: I've said that a lot :)
about not messing with host objects
kangax has said it a lot too
 
@TimDown yes.
But I'm going to say it's needed
I'm doing it to fix bugs in browsers.
I'll blog about it later.
 
just use wrappers and save yourself the stress
 
No.
wrappers are unelegant and inefficient
Function call overhead!
 
pff
native function calls are drop in the ocean of time that a DOM call takes
 
true.
Still I want to do this.
 
4:02 PM
It's more viable than it used to be
 
Defiantly
 
but still a stress
 
The aim of the DOM-shim is to make all modern browsers DOM4 compliant
You use the DOM-shim to normalize modern browsers, i.e. go from 90% compliance to 100% compliance
You don't use the DOM-shim to fix legacy browsers
 
4:20 PM
Anybody
ever found
a database for music ?
i mean i need to allow users to search for mp3s and play em via javascript
any pre-existant database ?
@Raynos
something i didnt expected :
meh i will just use ShoutCast
 
4:36 PM
@Abhishek Not that I know of, and it's unlikely that there is. For what it's worth, you've always got Grooveshark
 
Grooveshark is flash ?
 
Their player is flash
 
I was hoping to use HTML 5 audio :3
i prefer using HTML 5 (as i need x-browser stuff)
 
I actually meant to tag along their search engine to look for relevant music files
So if your user searches "Super Metroid", you just ask grooveshark, and show the (maybe parsed) results to the user.
 
Hmm
intresting idea
but how to play that exactly (use Grooveshark API ? )
well let me go and code :) i hope code will find me some way out ;)
 
4:47 PM
Ehm how do i unit tests .lookupPrefix ?
 
Playing the file? Once you got the link to it, why do you need them?
 
i am making a media player (twitch)
w8 lemme screenshot what i have got :3
thats what i have got so far :)
i want to allow users to play the content / songs they want to play init :) btw it runs purely on HTML 5 with Flash Fallback.
 
More tests! Someone check IE9, Saf, Opera for me.
 
@Raynos what are you upto sir ?
 
@Abhishek is it for desktops or for mobile devices?
 
4:56 PM
both :P
its liquid
 
it looks a bit too compact for desktop, and making it HTML5/flash wouldn't really make sense on a mobile device
 
:P Andriod
supports decent HTML5
 
true
 
i mean my media player works on Andriod :P .. and iOS
without hastles
both
 
but honestly, I have to say that native applications just "feel" nicer on android
 
4:57 PM
lol
its an embeddable applet :3
 
and if you're making it run in the browser, there's always the hassle of android unloading the tab
 
true
 
and on iOS there's also the fact of that safari only allows 9 open tabs at once
 
but its a part of my chat site (which now is quite independent)
 
(only checked that on iPad2)
oh
hmm
 
4:58 PM
i have some users / people in sponsor team
who want a decent media player inside the chat
 
I see
 
i was too nosey to make a simple play/pause button lol
so i gave em this ... now they want to allow peoples to choose music -_-
 
@Abhishek I'm upto unignoring you
I'ts really weird to ignore one person then just see someone else talking to themself
 
:|
 
And I'm going to ignore you again because you pinged me twice :(
thats really annoying
 

« first day (371 days earlier)      last day (4582 days later) »