@joe.edwards said:
So now we need to see a JVM running inside JS running inside a JVM running inside JS...
See here, then nest to your liking...
@joe.edwards said:
So now we need to see a JVM running inside JS running inside a JVM running inside JS...
Does any post in this thread have anything to do with it's predecessor?
Ooh, I get it! You're guys doing a markov chain with posts instead of words! That's pretty genius!
I do like that paper he (indirectly) linked to.
"So we're confronting a group of 1st year students with an ambiguous piece of code that describes a concept that's known to be hard to understand if no one ever explained to you. It's also known about half of the students already have multiple years of coding experience under their belt (due to hobby projects) while the other half has exactly zero. Then, after a three week programming crash course, we repeat the test an find no improvement. So, do we conclude that the course was shit? Or that people can't gain several years worth of experience in three weeks? Nah, obviously some people must have been born as programmers while others were not!"
(Actually, this thread should be called "XBox One", but that wouldn't line up so nicely with the Google thread.)
So, after Microsoft presented the XBox One, reception seems to be less than stellar. But aside from all the typical George Orwell style conspiracy theories (as a developer, it's interesting to know that a vast part of today's consumers are apparently physically incapable of turning devices off if they only have a standby switch), there is an interesting patent Microsoft apparently registered last year. What do you think about that?
In other news, I'm thrilled by one of the lesser-known killer features, according to (For up to two apps at the same time) I never thought I'd see the day!
Not that the lastest versions of Windows couldn't do that all by their own, without any help from misbehaving programs. Try to switch back to "classic style" in Vista or anything more recent and be amazed.
When GTK on windows looks better than the native shell, you should start to worry.
Is it just me, or did the sidebar turn somehow... meta ... in the last month? Or at least more meta than usual.
@morbiuswilters said:
@alphadogg said:COBOL has been around even longer than C, is still in widespread use and is in fact being actively developed by IBM. And it sucks even more than C! By your logic, you should guve it a try. You'll love it!@morbiuswilters said:
@alphadogg said:So, what's your favorite language now?I don't know that I have one. Maybe C, because it's stuck by the principle of being portable assembly
So, for you, C is the best language out there, but it sucks, and all other established languages also suck, and new languages suck even more?
That sums it up pretty well.
Besides, I didn't say C was the best at everything, I just admire their spirit of "Fuck the fucking programmer". It's like Go, except people use it.
@blakeyrat said:
@everyone said:
PONI!!!
@anonymous_guy said:
Any moron who decides to put a shared library (*.so) in /usr/share/lib or /var/lib should be buried under a million copies of the FHS.
Are you trying to tell us something?
@Nagesh said:
Neither one, I'm afraid. I just tried to do what all the cool kids here (i.e. morbs/blakey) are doing. But I think I still have to practice.@PSWorx said:
You don't quit crack just because your dealer is an asshole either, after all.
Is this from your personal experience as a delaer or addict?
@Bulb said:
I would actually call channels a serious WTF. It really goes together with the lack of generics. Things like channels, or associative collections, the other thing go builds in, are sufficiently complex that they may need to be evolved, or special versions may be needed in some environment or something. If they were done in a library it would be much better, but it would require generics. I am all for special syntax for them, but think the implementation really shouldn't be tied to the language.That's actually one of the points where I can understand the reasoning behind Go.
A whole new trilogy of star wars films, made by Disney...
@da Doctah said:
Any movie (not directed by Ang Lee) in 3D.FTFTFY
@blakeyrat said:
What are "harmful inline styles"?
@blakeyrat said:
What else should I sanitize off of RSS-supplied HTML being fed into a DIV? Styles that aren't inline perhaps?
@blakeyrat said:
Quick question for anybody still subscribing to this thread:For Java, NekoHTML and TagSoup work pretty well - they're specialized SAX parsers, so they'll pass a stream of "tag open" and "tag close" events to you instead of a fully constructed DOM, which does wonders for your memory usage. I don't know about similar projects for .NET, but there might be a port if you're lucky.What's the BEST (most technically-correct) way of stripping <SCRIPT> tags from a block of HTML? I could run the whole thing through the C# web control and traverse the DOM but that strikes me as super-slow, there has to be a better way, right?
What else should I sanitize off of RSS-supplied HTML being fed into a DIV? Styles that aren't inline perhaps?
Hmm... I wonder if spammers also support WebSocket. If they do, you could get quite a few infos about the spammer's setup and the restrictions they have the JS VM running under (if any). If you found a sufficiently stupid spammer, you might even turn the spiders into your very own distributed computing grid...
@morbiuswilters said:
Yeah, but one day they're going to wake up and be irrelevant and there will be much bawling and cries of "How did this happen? Where did all the money go??"In germany, they currently have around 95% market share as a search engine. There are studies showing that students are significantly less likely to find a paper if it's not indexed by google. I don't have figures for the ad market, but it's likely similar there. I don't see how they'll become irrelevant any time soon. You don't quit crack just because your dealer is an asshole either, after all.
@gu3st said:
"Maybe people will use Google+ so we can harvest more personal data"If they did this “just“ for the data, that would at least be understandeable. But the thing is, even then their actions don't make the tiniest bit of sense: They' re already getting more data than Facebook probably ever will. They already have permission to cross-link search data, ad traces, analytics data, GPlay purchases, Gmail address books and contents of mails and address book and GPS data from probably any android device in use. Hell, they don't even need a Like button - they'll get pings free of charge from every website which has any kind of ad, analytics script or CDN-hosted library from them embedded. Which pretty much is every website. They're probably knowing more about my past, my browsing habits, my secret desires and dirty secrets and what I did an hour ago than Facebook - without me ever writing a word on G+
Sad, but hardly surprising. After Reader, looks like the next service that falls prey to the G+ First Doctrine. I wouln't mind much if they hadn't closed down XMPP. That they do though, shows, that in their new course, driving people to G+ actually seems to have higher priority than actually keeping their products usable.
Out of curiosity, did they bother to provide a pseudo-“explanation“ like Twitter did when they locked down their API? Something along the lines of “we believe that using XMPP or other non-G+ software may cause serious confusion in the precious little minds of our user base and may lead to an unapproved user experience. Therecore, we're commited ourselvelves to minimize user exposal to those high-risk services.“
@Ben L. said:
You can also call strings as functions, leading to this:$callback = $_GET['callback']; $callback( $result );
Wow! I knew PHP had some bad security holes - but I didn't know they actually have special syntax so it's easier to write new ones.
I think I'll propose !!foo
as shorthand for "execute URL parameter foo
as a root shell, then wipe all logs." for the next version.
@Psychosmurf said:
$sync_system_name = sprintf( ... );
...
$this->syncSystem = new $sync_system_name( ... );
@Ben L. said:
I want to see an implementation of the Java standard library where every function returns a String and the String class has enough methods to make a moderate amount of Java programs continue to "work".
@boomzilla said:
But... but... think of all the heated debates in 1999 and 2000 whether new years was really the start of the new millennium or not. Think of all the new years parties that'd have stuck up with boring molybdomancy instead.I actually find the one based years to be retarded. Not because I think there was a year zero, but because it makes so many things stupid, like 1990 is part of the 80s. Since the BC/AD distinction came several hundred years later, what difference does it make if we have one retarded decade / century in the distant past in exchange for reasonable dates now.
@morbiuswilters said:
@Planar said:Or take a few math courses above elementary-school level...WTF does that have to do with anything? The math involved is extremely basic arithmetic.
@Planar said:
1-based causes a lot more bugs than 0-based.[citation needed]
You want to implement a simple XOR-based encryption obfuscation. Or an animation script. Or anything else where you have to continuously loop over your array, depending on a counter.
Which one is more intuitive?
This: currentValue = array[counter % array.size]
Or this: currentValue = array[((counter - 1) % array.size) + 1]
Wenn ist das Nunstück git und Slotermeyer?
Ja! Beiherhund das Oder die Flipperwaldt gersput!
@blakeyrat said:
@PSWorx said:Eh... synchronous - asynchronous... it's just a single letter... I can't be bothered to read every single letter you write before quoting you after all... @blakeyrat said:I'm just curious (and haven't checked it), does that really work? Because that would mean that popup protection works across callbacksNooooo. That's why I said use a synchronous AJAX request. Unless I've once-again reversed the definition of "synchronous" and "async"... (looks it up) ok no I'm good. So now I can act smug and condescending.
READ MY POST BEFORE REPLYING YOU CRETIN IDIOT MORON MAN DUMMY!
Two things:1) Spammers generally don't have the ability to inject code into the page, and if you *do* have that ability (i.e. you've cracked the web server open or you've installed a toolbar on-the-sly) you can do much more invasive and annoying shit anyway.
I assumed in the example that the popup code was on the site with full permission of the owner - because the code probably came from one of the more morally flexible ad networks or somesuch which paid the owner good money to put it on the site. After all, the whole mechanism is there to protect users, not site owners.
@blakeyrat said:Well, that was the exact point I was trying to make. If an async callback could "inherit" the permission from a user event, the whole thing would be useless. But since that was never stated, this whole example is moot now. I'm sad.2) Your code won't work anyway because it's an async call; you leave the click handler long before the AJAX request fires off it's "data received" event. And even if your AJAX was incredibly fast so that wasn't true, the "data received" event isn't allowed to create pop-ups anyway (since it's not a direct response to user action) so it wouldn't matter.
@Cassidy said:
If that is the case, then TRWTF is Java (or something) "pulling an IE"[1], confusing results with success.
[Dork mode on]
According to spec, if you do a query //foo
that means "Get all descendants that have local name foo
and that belong to the current default namespace". Unfortunately, the spec doesn't say a word about how you declare what "the current default namespace" is - that's left to implementors. Now, Java - as we'd expect from them - made the most practical and reasoneable choice and hard-wired it to the empty namespace without any way for you to change it. That works well if everything you deal with is in the empty namespace (as it is for documents with no namespace declarations at all). But as soon as you want to access something that isn't - like you now - you need to deal with prefixes, namespace contexts, etc...
[Dork mode off]
@Cassidy said:
@PSWorx said:
If you feel masochistic, here is a good tutorial that's badly presentedWTF is up with that embedded markup and pink highlight? Or is FF refusing to display it in all its glory?
[1] flawed processing to produce correct results. When the processing is later fixed, the real (incorrect) results are accurately displayed.
I can't see any pink highlights in chrome, but agreed, on second thought that is not a good tutorial. Have a more readable impromptu-tutorial here:
x
but you might as well use jax
, foo
or purpledildo
.getNamespaceURI()
. For a single prefix, you can "simplify" the implementation by having that method just return your URI, and the other methods return your prefix, no matter the input. Yes, you have to do this yourself. No, there is no AbstractNamespaceContext or somesuch.This looks very much like a namespace issue. What you want to do is not to query for //endpoint
but //x:endpoint
, where x
is bound to http://java.sun.com/xml/ns/jax-ws/ri/runtime
. Unfortunately doing this binding with the Java XPath library is, as some in this forum would put it, a goddamned fucking pain in the ass, which involves way more code than is healthly or in any way reasonable, even for java. If you feel masochistic, here is a good tutorial.
If there are no other namespaces in your document, it's usually easier to turn off namespace processing completely. You can do this by setting the feature http://xml.org/sax/features/namespaces
of your parser to false
. At least this worked for Xerxes, I haven't tried it yet with JAXB...
@blakeyrat said:
Issue 1: I'm having: my Google Reader list is about 150 feeds. When I make my API call, the poor server has to ping 150 other servers to get the most recent feed items.
And this is a problem exactly... why? Unless you're pinging them one-after-the other, how would the number of feeds affect the time your API call needs to complete? Also, dumb question, are you employing all the usual HTTP headers? Expires, conditional GET, etc etc...
As for databases, I've worked with couchDB and it's pretty much written for applications like this. It can handle loads of concurrent gets and updates without slowing down and throwing in another server is trivial. It comes at the cost of having rather... peculiar transaction and query models. Or, to put it bluntly, it can't do joins. Period. The development team says it's out of scope and won't ever be implemented. In fact, thanks to their transaction moel of "eventual consistency", you can't even reliably join stuff yourself in your client, after you've pulled it out of the DB. You can actually work around this for a large number of use cases (which should include yours) but if you realize you NEED joins, don't try to hack them in or it WILL drive you insane. Just switch to something else.
@blakeyrat said:How the heck does Google Reader do it?
A large fraction of blogs manage their RSS through FeedBurner. Another large fraction is hosted on Blogger. Guess which company runs both services? The Google Reader guys didn't need pubsubhubbub to get feeds pushed to them, they just had to shoot an e-mail to the neighbor department.
@blakeyrat said:
That, or send a synchronous AJAX request so you're technically still in the handler when the data gets returned and you can open the new window.
I'm just curious (and haven't checked it), does that really work? Because that would mean that popup protection works across callbacks - which would make the whole point pretty pointless.
As a spammer, I could just do
someLegitimateButton.onclick = function() { setInterval(openViagraPopup, 10000); }
and game the whole thing. Am I missing something?
This already looks sufficiently scary without background knowledge, but just out of morbid curiosity, could you explain what sys.dual is?
@drurowin said:
@dhromed said:(...)I can't remember who it is with the dildo fetish though.
@dhromed said:(...)Care to join me in a belt of Scotch? It's all that's helping me understand this place right now.
@da Doctah said:
Next stage: use image search!Some time after compiling the above list, I decided to Google the phrase poodle on a stick.
The sheer number and diversity of hits is alarming.
@Ben L. said:
Ah, I see. The FAQ made it sound like you could have multiple, somehow different empty interfaces, which made me think of Java's marker interfaces. (without the marker part... and the interface part...) But I guess if you have no type hierarchy but still need some kind of root type, defining it in terms of interfaces could be reasonable.
The typeinterface{}
is "any value with a method set that is a superset of the empty set". That's useful in the same cases java.util.Object and C#'s object are useful. For example, fmt.Print accepts any value and prints it to stdout. reflect.ValueOf allows yo to look at the properties of any value. map[string]interface{} is roughly equivelent to a JSON object.
So Go doesn't support any dynamic linking? (So it doesn't even support plugins as your original comment incorrectly implied..) Wow, Jesus, great fucking systems language there.
You know, we joke about the Go designers being 40 years behind the times, but static linking?? A feature so out-of-date it's not even supported anymore in C: The Language That Supports More Ill-Conceived Shit From the 70s Than A George McGovern Rally???
What worries me more is that it seems less an oversight/feature deferred to later versions than a dedicated opinion of the Go team. I don't have the time to find the original source, but this implies that the Go developers apparently consider dynamic linking harmful. Writing a plugin architecture in Go is a known open problem.
This seems to be oddly in line with other Google-designed programming frameworks. If the Dart and the Chrome extension API are any indication, I bet if you asked the Go developers how to write a plugin, you'd get "write them as a separate process and communicate via stdout/sockets/plain text files/morse code" as an answer. For efficiency. And, "you know, in most cases, you don't really need plugins anyway".
(That is, DSLs are an awesome thing and I'd be perfectly fine with Go restricting itself to a set of clearly-defined use-cases and leaving out other features because they are out of scope. But where are the use cases for Go?)
@Ben L. said:
You're missing the fact that the concrete type of any interface value is known at compile time (because at some point, you're giving something that expects an interface a value that is not an interface).Depends what you're doing. A lot of the benefits of interfaces in Java come from the fact that you don't need to know the implementation when compiling a class that takes an interface. Without that, plugins would be pretty much impossible after all.
@morbiuswilters said:
The thing is, if you're going to have duck typing, then why have interfaces at all? Or even any declared types? The only plausible reason is performance: by being able to do the duck typing at compile time it doesn't have to be done at runtime.
From what I got, Go makes most sense if you see it as duck typed with a shiny wrapping. By that thought, "interfaces" really only exist in the context of functions calling members on them, not while they are "implemented".
So
Type FunnyAnimal interface {
bark() (string)
meow() (string)
}...
doStuff(foo FunnyAnimal)
doStuff(foo) // assumes foo has methods bark() and meow() that both returns strings and takes no arguments. or else.
foo
or if foo
was even implemented with FunnyAnimal
in mind. I don't think duck typing is a particularly good idea in general, but at least that would make kind of sense. At least, that's how I'd understand it.
Then again, the official Go FAQ doesn't exactly inspire one with confidence about the development team:
@Go FAQ said:
Types can satisfy many interfaces at once, without the complexities of traditional multiple inheritance.Inheritance vs polymorphism: Apparently still a hard problem.
@Go FAQ said:
(...) the Go compiler does not report warnings, only errors that prevent compilation. There are two reasons for having no warnings. First, if it's worth complaining about, it's worth fixing in the code. (And if it's not worth fixing, it's not worth mentioning.) Second, having the compiler generate warnings encourages the implementation to warn about weak cases that can make compilation noisy, masking real errors that should be fixed.Didn't we have that discussion around here just a few days ago?
@Go FAQ said:
Interfaces can be very lightweight—an interface with one or even zero methods can express a useful concept.Interfaces are defined by their methods. But there are also interfaces with zero methods.
@dhromed said:
The answer is, of course, to not use inheritance in javascript. If you need inheritance, your application has clearly outgrown its scripty nature.
I perfectly agree with that - but unfortunately, there seem to be more and more people who think javascript is so awesome that it obsoletes all other programming languages on the planet - like, e.g. the developers of Chrome or Firefox. Hence you're kinda stuck with it if you want to write browser extensions or halfway cross-platform compatible mobile apps without getting insane. However complex your application may be.
Hmm, I've never actually thought about call()ing a constructor before - I guess that happens if you write too much classical OO. :)
Thanks for the infos, guys and sorry for the derailment - you may now resume your regularly scheduled flamewar.
@joe.edwards said:
@PSWorx said:Ok, bad example :). But let me try again. Consider this:What do you do?Refactor. No, really.
class A {
int _x;
public A(int x) {
this._x = x;
}public String sayHello() {
return "Hi from A! (x=" + _x + ")";
}}
class B extends A {
public B(x) {
super(x);
}public String sayHello() {
return "Hi from B! (x=" + _x + ")";
}
}
@joe.edwards said:
Objects have constructors (actually any function can be a constructor, which smells funny but isn't so bad), and you can assign initial values to your instance properties there. This should solve both your "same underlying object" problem and your "dummy websocket" problem.
function MyFoo() {}function MyBar() {
this.baz = new Baz(); // each instance gets its own freshly constructed Baz (defined elsewhere)
}MyBar.prototype = new MyFoo();
var myBar = new MyBar();
myBar instanceof MyBar; // true
myBar instanceof MyFoo; // true
How to write a constructor is not the problem. But that approach only works as long as MyFoo has no internal state - or it's constructor is so trivial that you can easily initialize the state yourself, like you just did.
But suppose MyFoo's constructor was like this:
function MyFoo(a, b, c) {
this.baz = new Baz(a, b, new Xyz(c));
}
@joe.edwards said:
This is correct, but you can also tack new properties onto existing instantiations of objects to accomplish what Douglas Crockford calls "parasitic inheritance".
@Douglas Crockford said:Classical inheritance is about the is-a relationship, and parasitic inheritance is about the was-a-but-now's-a relationship.
Example: Suppose you have a "class" of objects that represent some expensive, volatile resources and need to do some heavy processing in the constructor - say a websocket connection with some custom processing and client-side state. Let's calls those type A objects.
I want some of those objects to have slightly different behavior than the others, let's call them type B. In traditional OO, I'd make a subclass B : A, so each of my new B objects gets its own corresponding A object with its own websocket connection hidden inside. No problems there.
Now I want to use prototypical inheritance, so I design all the new bells and whistles for my B object and create a new A object as the prototype. Oh, wait, now all my B objects suddenly share the same underlying websocket connection. In fact, I'd have to open a completely useless websocket connection only so I have a prototype instance, long before I'd actually need any of the objects. WTF?
Ok, prototypical inheritance didn't work, let's try parasitical inheritance. So my "constructor" for B is now just a function that creates a new A object, then manually overwrites all methods that need some changing. (Let's also hope the author of the A objects remembered to call all methods by "this" and not by closure) Beautiful. There is no way to do anything resembling "instanceof" later, but whatever, it works. Only, I've not made any use of prototypes at all.
So, my question is: What did I do wrong? Is there any non-WTF way to do this via prototypes? And if not, why do we have the prototype mechanism at all and why is everyone so hyped about it?
@MiffTheFox said:
Sorry, but Blakey is right here, both on that a) JS and DOM are independent of each other and b) that's important.JavaScript was designed by Netscape. DOM was designed by Netscape. JavaScript was designed to interface with DOM and vice versa.
For a), don't forget VBScript which during the time of IE monopoly ran on enough machines that it was actually used for client scripting in some products, I think. It's got full access to the DOM APIs but nevertheless has nothing to do with JS.
For b), you can observe that when watching the WHATWG mailing lists. When it comes to DOM, they'll happily churn out one horribly convoluted new scripting API after the other, but they generally seem to be careful not to step on ECMA's feet when it comes to new language features for JS.
(Which is actually pretty surprising as they't don't seem to have any problems stomping on the feet of every other standards body out there)
Keep in mind that Google probably designed about 10% of modern JavaScript JavaScript/DOM "javascript-the-stack" DOM through Google Gears.Despite all the "participation", there's still basically only one guy in the WHATWG that decides what gets into the spec in the end and what doesn't. That guy gets a Google paycheck. So I think 10% is a rather polite understatement.
Eh, no-one's typing in URLs anymore anyway. Just tell them to google ✓ and they'll be fine.