我们如何能够在浏览器中进行编程
我看到一些网站推出了能够在浏览器中进行编程的出色服务。我认为这很棒,原因有很多。在公司场所,很多东西都被禁止安装网络解决方案,这真是太棒了。 YC 后面的初创公司有一个面试街,你可以在那里进行编程面试。这是一家很棒的初创公司,我想知道他们如何设法让编译器在浏览器中工作。
I'm seeing some websites coming up with awesome services of being able to do programming in browsers. This is great in my opinion for a lot of reasons. In corporate places, where a lot of things are banned from installing a web solution is brilliant. There's a interviewstreet a YC back startup, where you do programming interview. It's a great startup and I wonder how they manage to get compilers working in browser.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要服务器硬件来处理这个问题。我想我只在解释语言中看到过这个。他们将获取用户正在编程的内容并将其从服务器的其余部分沙箱化。执行此操作的一种简单方法是将语言作为程序内的脚本运行。他们会检查用户输入的代码,确保其中没有任何有害内容,然后执行它。
我见过的一些做得很好的网站是 Rails for Zombies 和 W3Schools。
关键实际上是将其与服务器的其余部分沙箱起来,这样它们就不会破坏服务器的其余部分(破坏网页和类似的东西)。
从另一个程序中执行程序的最简单方法是使用 eval,但这是一个巨大的安全风险,因为该代码可以对您的网站执行任何操作。
You need server hardware to handle this. I think I've only seen this for interpreted languages. They'll take what the user is programming and sandbox it from the rest of their server. One easy way of doing this is to run the language as a script inside of your program. They take a look at the code the user entered make sure there's nothing harmful inside of it and then execute it.
Some sites that I've seen this done well with are Rails for Zombies and W3Schools.
The key really is to sandbox it from the rest of your server, so they don't go off an destroy the rest of your server (vandalizing the web page and things of that sort).
The easiest way to execute programs from within another program is with eval, but it's a huge security risk as the code could do anything with your site.