What is the best JavaScript compression/obfuscation tool? [closed] - javascript

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
What kind of a tool would you recommend for JavaScript compression and/or obfuscation? A google search comes back with a lot of online tools, but I am not sure how to gauge their effectiveness/usefulness.
Is there a tool that you would recommend for this?
Thanks,

There are many tools that transform Javascript in something different. I currently classify these tools in the following objectives:
Minify: make the code smaller by removing comments, renaming variables...
Compress: Compress using non destructive compression of javascript
Optimize: Make the code run faster (ex: Closure)
Obfuscate: Protect the code
My order has some meaning behind it. Because generally the higher level includes all be features below.
So a good Javascript Obfuscator is able to minify, compress, optimize...
Many tools do some of these levels well individually. They can be combined making them more effective but my experience has shown that combining several such tools make it a nightmare to try and pin point a problem.
My suggestion for a good overall Javascript obfuscator would be to use jscrambler.com
For optimization and minification google closure (has sugested by aepheus) is a excellent solution.

Closure Complier: http://code.google.com/closure/compiler/
YUI Compressor: http://developer.yahoo.com/yui/compressor/
Come to mind. You'll want to take them for a spin with your own code, as a lot of factors come into play with minifying. Basically, see which one makes the smallest file (and verify that your code works as it should).

UglifyJS: https://github.com/mishoo/UglifyJS
The page contains a comparison with other minifiers if you scroll down a bit. One of the most notable parts is this:
UglifyJS is the fastest to run. On my laptop UglifyJS takes 1.35s for
DynarchLIB, while YUI takes 2.7s and GCL takes 6.5s.
It written in JavaScript, so no need for separate runtimes etc. It plays nicely with both node.js and npm.

you can also try http://openwaf-js-mini.appspot.com ,slightly better than YUI Compressor

Related

CSS3 vs JavaScript: What is the advantage? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
It seems with HTML5/CSS3, there is a larger push towards CSS-only animations, effects, navigations, etc.
Is this purely because of the tendency of C/Java/etc developers to use JavaScript 'incorrectly' (mostly in a semantic sense, I guess)?
Or is there an advantage of CSS over JavaScript? If so, why would CSS be better? Is it faster?
Also, semantically-speaking, shouldn't CSS only be used for styling/positioning? So is CSS starting to go outside the bounds of what it was designed for?
Is this purely because of the tendency of C/Java/etc developers to use JavaScript 'incorrectly' (mostly in a semantic sense, I guess)?
No, you've just about missed the point by a mile. The main reason people use JavaScript is because they want to support as many browsers as possible. CSS3 is a new technology, which only the latest and greatest browsers understand, whereas JavaScript has been around for decades.
Or is there an advantage of CSS over JavaScript? If so, why would CSS be better? Is it faster?
Yes, because the browser knows best how to make use of system resources to perform animations, and it can do that job best when implementing them natively using CSS (e.g. hardware acceleration). With JavaScript, you're relying on a browser's scripting engine to calculate animations for you, which can get very expensive.
But as mentioned above, the greatest drawback is lackluster support.
Also, semantically-speaking, shouldn't CSS only be used for styling/positioning? So is CSS starting to go outside the bounds of what it was designed for?
Broadly speaking, it has always been meant for presentation — separating that as a concern from content and structure, when HTML was riddled with presentational attributes munged all over the place, spelling development hell for any frontend developer of their time.
All these fancy effects you describe can easily be categorized under presentation (i.e. they don't have anything to do with application logic, business logic, content, data, etc), so it would seem apt that they should be done with CSS. And that brings us where we are today.
So, to summarize:
JavaScript is used when browser support is a foremost priority (and in business applications it almost always is). It is also often maintained as is if it's too costly to convert or migrate to another technology.
Otherwise, CSS is used. Of course, a JavaScript fallback is often provided. You'll often see this in experiments or new/startup projects.
I can't see a VS here. Actually I think a great web app should be made mixing both of them!
I like to think about JavaScript for user interactions and CSS for design. That's how I decide which one I should use for a specific purpose.
Now days you have a lot of great works from brilliant people in order to solve the compatibility issues. E.g.: http://modernizr.com/
One major issue is that not everyone's browser has Javascript enabled. So if you can achieve the same effects with HTML5/CSS3 it has the advantage that it will work on all modern browsers regardless of whether or not they have Javascript enabled.
Yes, css is faster than javascript.
In addition, javascript require additional http request, while you can avoid that if you'll use only css.

Which library should I use for server-side image manipulation on Node.JS? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I found a quite large list of available libraries on Node.JS wiki but I'm not sure which of those are more mature and provide better performance. Basically I want to do the following:
load some images to a server from external sources
put them onto one big canvas
crop and mask them a bit
apply a filter or two
Resize the final image and give a link to it
Big plus if the node package works on both Linux and Windows.
Answering my own question
I spent two days digging through Node.js graphics libraries.
node-canvas
I tried it first since I'm quite familiar with <canvas> API. It's a huge plus for a library.
it requires Cairo which doesn't have an easy Windows download. I found it in GTK+ distribution though.
moreover it needs native library binding code to be compiled on module installation. It uses Node-Waf which hasn't being ported to Windows yet.
gm
mature
runs on Windows smoothly
docs are ok but not thorough: I had to look up into source code to figure out what API is available
unfortunately there's no easy way to combine images with gm. Maybe there's some way to achieve that but I haven't found one after two hours spent with it.
node-imagemagick
The official repo has very few basic ImageMagick commands covered but I used this fork (good thing that NPM can pull libraries directly from git repositories). It has bindings for montage which does exactly what I need.
ImageMagick is quite slow, though it works on Windows.
Node-Vips
Huge plus: it uses an incredible VIPS library which I'm familiar with. VIPS is very fast and optimized for large images. It's very smart about utilizing hardware resources: if your machine has a lot of RAM it'll do all processing in memory but will switch to hard-drive caches if memory is scarce or required for other applications.
same as node-canvas it requires Node-Waf so it's not available for Windows yet.
I also looked at other libraries from the list but most of them are either very immature or do not suit my use case. I would really like to try migrating to either Node-Canvas or Node-Vips when Node-Waf gets ported to Windows but until then I'll stick to node-imagemagick.
I'd strongly advise you to check gm with GraphicsMagick.
Stable, feature rich, clean API, great docs, and fast.
And it works both on Windows and Linux / MacOS / BSD / ...
Her is the link to canvas implementation based on GDI+

Using CoffeeScript in a production environment [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I really like using CoffeeScript (1.1.1) for small projects and it worked out great so far. However before using it in a more broad environment I would like to hear second opinions on using it in production.
So my questions are:
How stable is the language itself?
Do I need to watch for upcoming changes which will break my code?
If the answer is yes to the question above: how well are older versions supported?
Is there a stable (bug-fix only) and a separate development branch?
If you already did use CoffeeScript in your product/website/etc please describe the scope in which it was used and your overall experience.
Thanks!
Note: I've already heard that "CoffeeScript support will be included in Ruby on Rails version 3.1." (Wikipedia) which is great because of the additional backing from the Rails community.
The language has been stable for the last six months (1.1.1 is basically just 1.0 with bugfixes). That's no guarantee of future stability, but I don't expect my book to be totally obsolete any time soon.
I'd say the best practices for avoiding version issues are
Make sure you document the version of CoffeeScript that your project was written for, and
Compile to JS under that version and keep the JS stored somewhere
Have good test coverage (in the words of Samuel Adams: Always a good decision!)
That way, when a new version of CoffeeScript is released, you have a JS backup to use in case your CoffeeScript code is broken. Breaking changes are a pain, but they're a pain common to nearly all languages except JavaScript—just ask a Rubyist who recently made the transition from 1.8 to 1.9, or a Pythonista who's still migrating their Python 2 code to Python 3.
The advice I can give for preventing your code from breaking under CoffeeScript version changes is to avoid syntactic edge cases. For example, func a:b, c used to mean func {a:b, c:c}, and now it means func {a:b}, c. That's an improvement (the old behavior was considered a bug), but some folks were caught off-guard by it. So use explicit punctuation whenever there's a hint of ambiguity; it makes for more readable code anyway.
Jeremy will have to comment on the stable/master distinction, since both branches exist but stable hasn't been updated since April (pre-1.1.0).
Check this: Has anyone used Coffeescript for a production application?

Different sort algorithms visually performed [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Any decent visualization of a couple different sort algorithms? I'm looking for something I can use in a demo, and willing to write my own (can't be that hard) but would prefer to use someone else's if I can.
NO applets though, the majority I'm finding are applets... Lightweight flash or canvas. I would like the following sorts:
Bubble
Selection
Insertion
O/E
Nice but not needed:
Merge
Quick
Heap
Raidix
Considering the lack of available ones, I wrote my own to answer this question.
I didn't like any of the ones available, so I wrote my own with a not-so-brief explanation to go along with it.
Sorts implemented:
Bubble
Selection
Insertion
Comb (with two alternate endings)
Shell
Quick
Heap
O/E
Radix
Options
Random
Partially sorted
Reversed
Few values
Data sets:
Large (~250 elements)
Small (~50 elements, works well for slower browsers and excellent on mobile devices such as an iPhone or iPod touch)
I've tried to make sure the time differences are as accurate as possible, please let me know if you have any suggestions for improvement.
The visualizations here are pretty good, they seem to be just gifs
http://www.sorting-algorithms.com/
This is a great video. More than just a visualization:
http://www.youtube.com/watch?v=t8g-iYGHpEA
I thought this site was fantastic, there's a few different plot types showing how the different algorithms work. A python implementation of each sorting algorithm is included as well.
Sorting Out Sorting is the classic work on the subject; if you Google the phrase, one of the first hits will be a full-length video. The quality looks a little fuzzy, since the computer video looks like it was made off a video copy of a 16mm print rather than the master (I have no idea if the master still exists) but it's probably a good introduction anyway. I'm glad to see it's available.
The classic visualization is the movie Sorting out sorting.
I just wrote exactly what you were looking for (I think), and was directed to this question. You can find it at: http://visualsort.appspot.com/. It allows you to write code (in CoffeeScript) and then shows what happens. There are a few built-in sorts, and I would be willing to add more if people send me code or make specific requests

Decent JavaScript IDE [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
What is a decent IDE for developing JavaScript, I'll be writing both client side stuff and writing for Rhino. Ideally It needs to run on Mac OSX, although something that runs on Windows too would be nice.
ADDITIONAL:
Having had a play with both js2 and Aptana, I think I'll be continuing to use Aptana. Mainly because I find emacs a bit hard to get my head round, although I did think that the error hi-lighting in js2 was better than that in Aptana.
I'm still looking for a way to visually debug my js code that is running atop Rhino...
Aptana IDE, absolutely. Stable, great syntax support for all the major javascript libraries, very good css and html editors. Also good support for php, air, ruby on rails and iPhone app development (I never tested this one).
Aptana can also connect to remote site via ftp (sftp in the pro edition) and to svn and cvs repositories.
It's based on Eclipse, so it's not exactly a lightweight application. But it's really, really good. You can also use it as an Eclipse plugin if you develop java wab app, but when I tested it in this version, about 1 year ago, it was not stable. Much better to use the standalone version.
If you're familiar with Emacs Steve Yegge's js2-mode could be worth a look.
Aptana Studio, both standalone and Eclipse plugin versions were quite ok last time I used them.
I have found the Spket Eclipse plugin very useful.
Take a look at WebStorm HTML/JavaScript Editor. It's lightweight and runs on MacOS. It supports debugging and running your code right from IDE and has very smart autocompletion capabilities for JavaScript both DOM-based and browser-based.
Komodo Edit/IDE is definitely the best IDE/editor (that I have used) for developing JavaScript.
Notable features include live error reporting, JavaScript macros and syntax auto-complete for ALL major frameworks!
If you have a very big application written in Javascript, there's only IntelliJ Idea. It parses multiple Javascript files and highlights not only syntax errors but undeclared variables and functions, allows to jump from function call to function definition, and more.
I've tried Emacs (because that's my favorite editor) and Komodo, and they don't come close. I guess it's the same for Eclipse.
Personally, I think that superior parsing and navigation abilties of Idea are only required when you're working with crappy undocumented code, otherwise I'd happily write the code in Emacs using js2-mode, but I'm working with huge poorly documented and buggy framework and it really helps to be able to jump to the source of the function or superclass to check how they work.

Categories

Resources