|
A MIRACLE posted:Also what I suspect, but I'm not sure if it's like, a hardlinking issue or some other unixy nonsense that I don't fully understand. do you have other executables that you need in the /usr/sbin directory? If not, just install node somewhere else and take that directory out of your $PATH. OR, just replace /usr/sbin's node with whatever you really want it to be. OR, (...someone help me out here. the poster has options, let's tell him/her what options they have!)
|
# ? Jul 15, 2013 20:24 |
|
|
# ? May 26, 2024 23:49 |
thanks for helping. I installed node again and now it lives in a different directory. Same issue though:Bash code:
|
|
# ? Jul 15, 2013 20:27 |
|
does node --version produce any output now, or still no?
|
# ? Jul 15, 2013 20:43 |
smug forum rear end in a top hat posted:does node --version produce any output now, or still no? Magically, a system restart has fixed all of my problems.
|
|
# ? Jul 15, 2013 21:02 |
|
Very new to javascript. However I am attempting to extend the functionality of a website by adding or altering some javascript. I am having a difficult time locating the javascript objects which I need to use. I know what the name of the object might be like, and I know what some of the values of the properties might be like. I attempted to locate them using firebug but they seem to be nested in a complicated way. Does anyone have any pointers on getting started with something like this?
|
# ? Jul 16, 2013 21:06 |
DholmbladRU posted:Very new to javascript. However I am attempting to extend the functionality of a website by adding or altering some javascript. I am having a difficult time locating the javascript objects which I need to use. I know what the name of the object might be like, and I know what some of the values of the properties might be like. I attempted to locate them using firebug but they seem to be nested in a complicated way. Does anyone have any pointers on getting started with something like this? What's the URL (if public) and what are you trying to change about it?
|
|
# ? Jul 16, 2013 21:10 |
|
A MIRACLE posted:What's the URL (if public) and what are you trying to change about it? Unfortunately it is not external. Essentially I want to move the contents of one div to another. However the way the page is designed its a little more complicated than doc.getelementbyid("mybox).innerhtml+="Stuff" The page implements some MVC architecture so I need to add/remove using javascript methods available or maybe add prototype methods? Is there a browser which will recursively search through all dom nodes instead of those just expanded?
|
# ? Jul 16, 2013 21:20 |
|
DholmbladRU posted:Very new to javascript. However I am attempting to extend the functionality of a website by adding or altering some javascript. I am having a difficult time locating the javascript objects which I need to use. I know what the name of the object might be like, and I know what some of the values of the properties might be like. I attempted to locate them using firebug but they seem to be nested in a complicated way. Does anyone have any pointers on getting started with something like this? It sounds like you are trying to modify a specific object not in the global scope (probably it is closed into a function and not exposed externally). If that is the case then be aware that this is literally one of the worst things you can do in terms of maintainability and legibility: 1) modifying an object, in place, 2) that is not meant to be public, 3) from a distance. Even just one of those is a very very bad idea. You are doing all three. I'm not saying there is absolutely no case in which you should do this, but be aware that you can easily cause months of headaches for somebody else (or even yourself) down the line when you forgot that you did this and wonder why the gently caress something isn't acting the way it should. So if you do do this (and probably should not), at the very very least leave notes in really obvious places documenting what you did and why. Ok so in terms of actually reaching that object, yeah, you'll have to show us the code, it really depends. If it's declared using var as a local variable inside a function, you are just poo poo out of luck. You have to replace the whole function with one that exposes the object you want. Of course when the thing that the thing you replaced gets updated, you will break lots of poo poo (see what I mean about maintainability?). If the function it's in is also local, you have to replace the thing that contains it and so forth until you give up and do something more sane. If it's not a local "var", then it is probably exposed accidentally and you can probably grab it from the global scope directly by name once that bit of code ran. Although easier to do this is actually the most dangerous approach because it relies on accident and there are a million and one things that will break it or break because of what you did. Either way, it's a very very bad idea. Post more of your problem and I'm sure we can come up with something way saner.
|
# ? Jul 16, 2013 21:21 |
|
DholmbladRU posted:Unfortunately it is not external. Essentially I want to move the contents of one div to another. However the way the page is designed its a little more complicated than What MVC architecture? Is there a framework? Why exactly is it more complicated then modifying innerHTML. There is no way to answer your question without more details. quote:Is there a browser which will recursively search through all dom nodes instead of those just expanded? I don't understand this question.
|
# ? Jul 16, 2013 21:23 |
|
Please excuse the messy code, I am sure I am probably using the most convoluted code for something that jQuery could probably do for me in a heartbeat but I am not a programmer by trade and just using what I know. I need some help getting this to function properly, it is for a website and when a user clicks on one of the navigation buttons I want a DIV to animate based on which one was clicked but I want to do it dynamically without having to have a block of code for each div like I had before. For instance, someone clicks a nav item with the ID of "hello", it should animate a DIV with the ID "helloDIV". I think the point that this code breaks down is in the animate line, I don't think the variable is being interpreted properly. I have tried all kinds of alternatives but I'll be the first to admit that I don't really have much of an idea what I am doing and would appreciate any insight into my fumbling. The code works perfectly and does exactly what I want if I remove the variable down in the animate line and just replace it with the id of one of the DIVs that I want to animate, but that would mean I need a block of code like this for every piece of content I put on my website. code:
|
# ? Jul 26, 2013 05:50 |
|
That code is a mess, but at a cursory glance this should get it working. ChangeJavaScript code:
JavaScript code:
|
# ? Jul 26, 2013 07:43 |
|
Cawd Rud posted:That code is a mess, but at a cursory glance this should get it working. Change Huh, I could have sworn that was the first way I did it and I added the ' because it wasn't working. This fixed it though! Thanks!
|
# ? Jul 26, 2013 09:25 |
|
Is there any way in Javascript (in a Node context) to have an object 'catch' when an unimplemented method is called on it? A bit like forwardInvocation in Objective-C or method_missing in Ruby. The reason why is that I'm not enjoying mocking stuff in my Javascript tests when all I want to do is assert a method was called, so a 'proxy' object that could record all method calls performed on it that could be asserted against later seems like a nice idea (or possibly a Horror, I'm not sure yet). Rosetta Code has some example JS but it doesn't seem to work...any ideas?
|
# ? Jul 26, 2013 10:16 |
|
Beta versions of node.js might have Proxy, which are what you're looking for. It sounds like a horror, though.
|
# ? Jul 26, 2013 10:36 |
|
Hey all, Figured this would be the best place for a typescript question. I saw a demo today of typescript, basically a 101 on what it does. I've been interested in it for a while but haven't got around to using it on a project yet. Has anyone got any experience with it they could share? Also when watching the demo there were a few minor issues e.g. Some incorrect assignments were not being flagged as errors, and some inaccurate jquery.d.ts definitions. Do you guys feel typescript is t a decent level for use on commercial projects yet?
|
# ? Jul 27, 2013 14:56 |
|
toiletbrush posted:Is there any way in Javascript (in a Node context) to have an object 'catch' when an unimplemented method is called on it? A bit like forwardInvocation in Objective-C or method_missing in Ruby. The reason why is that I'm not enjoying mocking stuff in my Javascript tests when all I want to do is assert a method was called, so a 'proxy' object that could record all method calls performed on it that could be asserted against later seems like a nice idea (or possibly a Horror, I'm not sure yet). Rosetta Code has some example JS but it doesn't seem to work...any ideas? What testing framework are you using? If you don't mind pulling in a library explicitly for stubbing and spying, bond has a spy that should be able to collect method calls (and their arguments) for you to assert against later.
|
# ? Jul 27, 2013 15:20 |
|
Any tips on using JSFiddle with a 1366x768 screen? Ugh. So tiny.
|
# ? Jul 27, 2013 19:59 |
|
Bob Morales posted:Any tips on using JSFiddle with a 1366x768 screen? Ugh. So tiny. JS Bin works better for me on smaller screens since you can easily toggle the HTML/CSS/JS/Console/Output views.
|
# ? Jul 27, 2013 23:47 |
|
Deus Rex posted:JS Bin works better for me on smaller screens since you can easily toggle the HTML/CSS/JS/Console/Output views. Oh that is nice.
|
# ? Jul 28, 2013 01:24 |
|
I've got a weird NPM permissions issue. I'm running Mountain Lion, and have my umask set to 0027. NPM works fine except for when I want to install packages globally via sudo, which inherits my permissions. I can install packages globally, but I cannot use them because the files are not world readable:code:
code:
code:
code:
|
# ? Aug 1, 2013 05:33 |
|
I don't think you're suppose to use sudo when installing npm modules. It looks like sudo changes the owner to root, which you shouldn't be running as? Installing things into /usr/local that should belong to the current user and not to root.
|
# ? Aug 1, 2013 06:38 |
|
Haven't touched Javascript since I took an Intro to JS course like 3 years ago; is there any equivelant to String.Empty from C#? Watching some tutorials for Unity and this guy tends to use a set of empty quotes frequently. Wasn't sure if there was a more "proper" way to get the same results.
|
# ? Aug 1, 2013 12:59 |
|
Sab669 posted:Haven't touched Javascript since I took an Intro to JS course like 3 years ago; is there any equivelant to String.Empty from C#? Watching some tutorials for Unity and this guy tends to use a set of empty quotes frequently. Wasn't sure if there was a more "proper" way to get the same results. Empty string literal. That's how you do it. You do empty arrays and objects in a similar manner... code:
akadajet fucked around with this message at 13:21 on Aug 1, 2013 |
# ? Aug 1, 2013 13:15 |
|
Sab669 posted:Haven't touched Javascript since I took an Intro to JS course like 3 years ago; is there any equivelant to String.Empty from C#? Watching some tutorials for Unity and this guy tends to use a set of empty quotes frequently. Wasn't sure if there was a more "proper" way to get the same results. code:
If you want to fiddle around with loose typing you can drop one of the equal signs. The only reason I put ".toString()" in the first method is because some rear end in a top hat developer might decide they need to call that method on something that's not a string. loving around with "this" in javascript is a pretty common thing, which is why doing the straight comparison is usually a better idea for stuff like this.
|
# ? Aug 1, 2013 16:57 |
|
He's not asking how to test for an empty string. Just how to create one.
|
# ? Aug 1, 2013 20:20 |
|
Strong Sauce posted:I don't think you're suppose to use sudo when installing npm modules. I don't know man, I'm just doing what I'm told. Modules install locally just fine (without using sudo). It's only when I try to install global packages that I run into trouble. quote:$ npm install -g supervisor
|
# ? Aug 1, 2013 23:54 |
|
You need to change your entire /usr/local folder to set yourself (not root) as owner. That is why you cannot run without sudo is because you borked it before by using sudo. sudo chown -R $USER /usr/local http://foohack.com/2010/08/intro-to-npm/#what_no_sudo
|
# ? Aug 2, 2013 05:45 |
|
akadajet posted:He's not asking how to test for an empty string. Just how to create one. I was bored, and what the heck else do you use String.Empty for?
|
# ? Aug 2, 2013 14:46 |
|
Mogomra posted:I was bored, and what the heck else do you use String.Empty for? Beats me. I never thought it was worth the extra characters in C#.
|
# ? Aug 2, 2013 15:32 |
|
Strong Sauce posted:You need to change your entire /usr/local folder to set yourself (not root) as owner. That is why you cannot run without sudo is because you borked it before by using sudo. Anything outside of /home being owned by a standard user is bad practice, especailly in /usr. He should fix his problem by uninstalling the NPM module and reinstalling it without sudo.
|
# ? Aug 2, 2013 16:53 |
|
Mogomra posted:I was bored, and what the heck else do you use String.Empty for?
|
# ? Aug 2, 2013 17:50 |
|
Plorkyeran posted:It was marginally faster than "" in C# 1.0 (to a degree that is unlikely to have ever mattered in any application ever created). These days it's just there for people who love making everything as verbose as possible. But but if you use magic values in your code and you have to redefine the empty string...
|
# ? Aug 2, 2013 18:23 |
|
Munkeymon posted:But but if you use magic values in your code and you have to redefine the empty string... I get that you're not serious. That said, aren't strings in C# immutable, like in Java and Javascript? And because of that, don't Java string literals get translated into static code and every instance of a particular string literal is the same instance? Is that not the case in C#? If it is, then string.Empty is the same as every "" in code.
|
# ? Aug 2, 2013 18:42 |
|
Wheany posted:I get that you're not serious. That said, aren't strings in C# immutable, like in Java and Javascript? And because of that, don't Java string literals get translated into static code and every instance of a particular string literal is the same instance? Is that not the case in C#? You used to be able to change the value of string.Empty via reflection, but not the value of "". Barring stupid shenanigans like that, they do compile to the same thing (after the JIT gets to it; the IL is different).
|
# ? Aug 2, 2013 18:57 |
|
xtal posted:Anything outside of /home being owned by a standard user is bad practice, especailly in /usr. He should fix his problem by uninstalling the NPM module and reinstalling it without sudo. Eh, if you run npm install without sudo, who else would own the files created by npm? Even doing an ls -la /usr/local just now, everything is owned by me.
|
# ? Aug 2, 2013 19:41 |
|
I was basically just told you should use String.Empty in C# because it's more "apparent" to someone else reading your code (or yourself in the future) what you're doing, where as just a set of quotes might imply to the reader something was left out. Or something. I used to always just use the double-quotes all the time for appending non-strings to strings instead of the Convert class' ToString method, or use them when I just want an empty string until someone much smarter than I said otherwise
|
# ? Aug 2, 2013 20:46 |
|
Is there a proper way to replace images with canvas elements to modify them "in place"? (Trying to apply an image filter to all the images in a page, if it helps.) Right now, for each image I'm creating a canvas element, drawing the image onto the canvas and then replacing the image element with the canvas. That seems to work alright, but calling getImageData() then spawns a "This operation is insecure" error.
|
# ? Aug 2, 2013 22:48 |
|
Vlad the Retailer posted:Is there a proper way to replace images with canvas elements to modify them "in place"? (Trying to apply an image filter to all the images in a page, if it helps.) Yep, can't do that by default, because it's insecure, because you could maliciously modify or use the image data. If the image server has the appropriate CORS ( http://en.wikipedia.org/wiki/Cross-origin_resource_sharing ) headers set, then you can do it.
|
# ? Aug 2, 2013 22:58 |
|
That makes sense. I don't suppose there's a workaround for that, then?
|
# ? Aug 2, 2013 23:02 |
|
|
# ? May 26, 2024 23:49 |
|
Vlad the Retailer posted:That makes sense. I don't suppose there's a workaround for that, then? Probably not, and if there was, it would be soon closed as a security hole.
|
# ? Aug 2, 2013 23:48 |