which one is the fastest? [closed] - javascript

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm working on a website which is used on Chrome and IE8. I made it with Javascript and it works fine on Chrome but it is slow on IE.
Is VBScript faster than Javascript on IE? Would I translate my code in VBScript for IE?

VBScript is executed for web sites on IIS(web servers), JavaScript mostly on client side.
I do not see how it would not work on any browsers unless you uploading something to client machines as vbs file. That is dangerous and could be considered as security threat - antivirus program may simply block it or delete file all together.
Basically question is not about if VBScript supported or not by any browsers simply because browsers never-ever touching VBScript, but what you attempt to do with VBScript. And anyone who is saying that it does not supported by any browser need to take a lessons from W3S school all over again.
It is different purpose scripting languages on the web: VBScript for servers side processing while JavaScript mostly to be used running on client side. And before anyone starts discussing that JavaScript can be used on server side please look what I put in bold letters. There are javascript libraries AJAX and JQUERY etc. which can be used to process data as well as connecting to web servers.
If you are looking for replacement of VBScript - C# is the best place to start since you already working on Microsoft platform, NET would be logical choice. There is lot of other languages to choose from but you need carefully consider what your project is all about, budget and time needed to rebuild your project/site.
However you can write VBScript and JavaScript batch files for local execution but as I understand that is not part of your question.

Related

Why would I like to execute scripting language in JVM [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am not able to understand why and in what kind of scenario I would like to run scripting language inside JVM at server side. I mean we already have great libraries available in JAVA... why wouldn't I use use them to do stuff instead of running scripts in JVM?
Please help me understand this concept, Can someone please tell me one or two use cases where running scripting in JVM at server side will have advantages over using JAVA libraries.
The more general question here is "Why would I want to execute code in <some scripting language> in Java?", where Javascript is simply one example of such a language.
Quoting this article:
Some Java applications' requirements make integration with a scripting language necessary. For example, your users may need to write scripts that drive the application, extend it, or contain loops and other flow-control constructs. In such cases, it's sensible to support a scripting language interpreter that can read user scripts, then run them against your Java application's classes.
Basically: if you want to allow your users to customize your application in a way that requires the richness of a programming language.
Why Javascript specifically? That depends upon your application. There may be reasons to pick that (e.g. your target users already know Javascript), or not (e.g. Lua is more popular for scripting in the games industry).
One use i can think of is:
Javascript engine can be used to evaluate arithmetic expressions
which are in a String format.
example :: String expression = "2+4";
The below is the link to a example which uses java script engine to do this.
https://stackoverflow.com/a/3423360/4626402

Why not sending JavaScript files in browser-specific bytecode? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
There is no universal bytecode for JavaScript, but most JavaScript engines have their own bytecode. Since JavaScript files travel as source code string, they have to parse/compile source code string into bytecode at before execution.
However, as we can specify a user agent type (e.g. browser type and version) in HTTP request, can't we make the server keep bytecode for each browser and respond accordingly to save some time at client?
What's preventing us from taking this approach? I don't think browsers will have no problem even if some JavaScript files are given in bytecode and others in source string. Similarly, we have .pyc files in Python, and it runs well with .py files.
[Update]
Potential benefits I can think of are below.
You could save parsing time at client. Parsing is fast, but it may be worth to do it for low-end devices.
You could put some hints in bytecode. For example, JavaScriptCore (WebKit's JavaScript engine, JSC for short) patches bytecode with information gathered during runtime, such as types. JSC's bytecode is designed in a way that it has slots for such information.
In terms of maintainability, the server can always send the original source code string if the client's browser is unsupported, and there are not so many different JavaScript engines. Supporting four most popular browsers (Chrome, Firefox, IE and Safari) seems feasible to me. In addition, I don't see bytecode instruction set changing frequently.
All engines would need to make their byte code format public
The server would need to hold very many different byte code files, or even compile them on the fly
Browser detection is fraught with peril (user agents lie, proxies cache)
Bytecode rules might change between minor versions of a browser
The performance gains probably wouldn't be all that significant (especially when compared to network transfer times)

Does HTML work with any other language other than JavaScript? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Is there any other language which can be used with HTML in programming webpages other than JavaScript?
Thanks
As far as I understand your question we are talking for client-side language which is being interpreted by the browser, without additional plugin like JVM, flash player.
You can use a programming language which is compiled to JavaScript (CoffeeScript, Dart, JSX, TypeScript...) but the browser will interpret only JavaScript (except Internet Explorer which may supports VBScript and I guess Chrome which may be able to run Dart).
Yes, in the mainstream there is VBScript however it's only supported by Internet Explorer.
Really though your question comes down to where your HTML will be rendered and whatever the host renderer supports.
Yes, CSS is a language too. Then there are client-side technologies like Java and Flash too.
But why do you ask?
Web development uses server-side technologies like some PHP frameworks and ASP.NET, among other. On server-side coding you can program using C#, Java, PHP or a host of other languages, but they usually 'generate' HTML which is served to the client browser.
Does this answer your question?
Well, on the server side, any language can be used.
In the browser, you need a plugin, which could be for Java or something more esoteric like Tcl/Tk
Yes. You're talking about client side scripting. And there are other languages that can do that. I'm not really up to date, but back in the day, ActivePerl (a Perl distribution by ActiveState) had a version that ran in Internet Explorer.
You are referring to any form of client side Language which has to do with how you're browser interprets information.

Is there a prebuilt website with logins I can work from? (Just starting to use javascript) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I need to build a website that allows users to upload files and a few other actions. I have zero experience with javascript so I was wondering if there was some type of built site that already had logins coded so I could just work on the other logic?
I'm a long time delphi developer so I'm not new to programming. Any javascript video references would be great as well.
Thanks in advance.
You don't want to be handling logins with plain-old JavaScript unless you start building a super cool NodeJS setup, which, I wouldn't recommend if you have zero experience with JavaScript.
To ease your JS adventure, check out JQuery.com which makes it easier to code JS without worrying so much about browser quirks.
For easy server-side login, I recommend PHP since there are literally millions of tutorials and free code snippets out there, hosting is cheap, and an enormous community of PHP developers online to help you. To ease your PHP adventure, start with a framework such as CodeIgniter.
To answer your question, here's an example of a PHP + JavaScript (JQuery) login solution: http://blog.webwizo.com/2011/05/04/simple-login-with-php-and-jquery-ajax/
In order to upload files, you'll need a server-sided script, possibly done in PHP.
As for communicating with the server, it can be somewhat daunting for a beginner, but it's largely done via xmlhttprequest (otherwise known as AJAX).
Here's a tutorial on how to use it by W3CSchools, but there are plenty more on the net: http://www.w3schools.com/ajax/default.asp
One word of advice; don't make the mistake of relying of a JS library too soon; familiarize yourself with the language and its capabilities. A lot of answerers are just going to say "Use JQuery." You can (and possibly should), but it's important to know how Javascript works without it.

Am I allowed to run a javascript runtime (like v8) on the iPhone? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
According to this discussion, the iphone agreement says that it doesn't allow "loading of plugins or running interpreted code that has been downloaded".
Technically, I would like to download scripts from our server (embedded in a proprietary protocol).
Does this mean I wouldn't be allowed to run a runtime like v8 in an iphone app?
This is probably more of a legal question.
I think your interpretation is correct - You would not be allowed to download and execute JavaScript code in v8.
If there were some way to run the code in an interpreter already on the iPhone (i.e. the javascript engine in MobileSafari) then that would be permitted I think.
This is partially a technical question too. V8 as currently implemented won't run on the iPhone. No JIT-based VM will.
Well I embedded Lua into my application already and am programming most of the login in Lua and then downloading it to my iPhone for fast iteration, but this is only intended during development. Once I ship the scripts will be placed in the source and compiled into byte-code shipped along with the app just like any other resource.
I'd say this applies to V8 aswell.
I concur. My reading is also that DOWNLOADED scripts are not allowed. Pre-installed and user-written scripts are fine. But it is a fine distinction and IANAL etc etc.

Categories

Resources