I am developing a sample application with wcf and angularjs. I have tested the wcf method with rest client and it works fine.
But when i tried to post the data it gives me this error.
XMLHttpRequest cannot load http://localhost:53455/eSuperVision.svc/CreateUser. Invalid HTTP status code 405
I ...
Each boolean takes false, which is 7 bytes if you're lucky - so in one kb you can have 146 booleans. If you use binary data a boolean is a bit, and you can store 8196 booleans in a kb
BACK IN MY DAY: We had to reformat a computer without network capability, so we had to back up everything by copying it onto a floppy and moving it over the sneakernet. We had three floppies.
@JanDvorak Assume a frictionless, spherical base64
Your 98 mb array would become a 1.75 mb array if you encode it as binary data and not a textual format like JSON
You can then read it into a Buffer as one chunk and then work on it as binary data - reading it as Ints and using bitwise operations - that way you wouldn't even need to have 98mb in memory ever.
You'd just have 1.75 of memory taken, a 56 fold improvement and access would likely be even faster and so would writing it back.
well I'm making a bot for a voxlap game. In reality the map is RLE'd, compressed with zlib, then transmitted over ENet with the packet compressor enabled. So I only receive about 682000 bytes from the server, then the bot sets up a simple HTTP server that takes requests from the voxel clients that want the map data in JSON.
@AwalGarg its a beautiful language, though I think all UI stuff is lacking. Screw curly braces! Unfortunately in comparison to JS its obviously a much more mature and consistent language too!
The "batteries included" slogan is really accurate. Its nice to see that ES6 plans on bringing a lot of the features that I love in python, but its readability and customisability (e.g. operator overloading) I love (though some hate)
@CSᵠ terrible behavior of typeof, ==, frameworks becoming old as last hour, too much unstability etc. These are not signs of JS being bad, it is just evolving. It will be awesome as python (and PHP :P) one day. I love JS a lot.
Also generally avoiding default parameters alltogether if possible can be a good idea. It makes your code easier to follow, maintain, and refactor. Granted there are cases where they are good/useful..
You mixed up the order of the arguments in your $.extend (target should be first), it should be:
settings = $.extend(settings, options);
See this fiddle and the docs for $.extend()
To avoid confusion you can also extend your settings with your defaults like this:
methods.init = function(opti...
@poke Depends what you're doing.. but setup/configuration would likely be a case where defaults are a good thing. But in general writing a function like "function doThing(data, doOptionalThing) { ... }", you should just consider doOptionalThing a required parameter. When reading through the code, you know whats happening rather than having to go look at the docs/source for 'doThing' to see that doOptionalThing is default 'false' or that it may even have a second param.
Then again I'm also a proponent of inline comments.. for example code calling 'doThing' would look like doThing({ data: "test" }, /*doOptionalThing*/false). Means you don't have to think about what doThing might be doing at all, or what your params might be doing.. its all there for you.
Yeah, that makes sense. Although I’m not a fan of doThing(data, false) / doThing(data, true) calls anyway. They are not self-explanatory enough. JavaScript would need named arguments there: doThing(data, doOptionalThing = true).
@poke ^ agreed, which is why having inline comments like that for the params is useful :)
@FlorianMargaine Also a great pattern.. but I think it works best if you have simpler functions that only have a single parameter that is going to change the behavior. If it starts being more complex then having helper functions start to be more confusing. Granted you could also argue that you should write complicated functions like that.. :)
@FlorianMargaine But it does happen sometimes, or if you're inheriting code from someone else, etc.. the inline comments can still be helpful if you aren't going to refactor the offending functions
@poke Absolutely :) The tradeoff being vertical space and polluting your local scope with additional var declarations. Not things that are the end of the world for sure, but I find the alternative to have less of a downside
For compatibility with tape drives that use fixed block sizes, programs that read or write tar files always read or write a fixed number of records with each I/O operation.