小编Car*_*efx的帖子

Heroku vs VPS定价

我将构建一个rails应用程序,它基本上为几个facebook应用程序(iframe)提供用户上传的文件(不是很多,比如每个客户端最多1MB).

我不确定我应该采取什么样的路线.现在我正在考虑使用heroku + amazon S3而不是VPS.我知道heroku/amazon路线略贵,但我有0个部署/扩展经验,虽然我不反对学习新东西,但我担心考虑到我来自设计/我可能有点太多了前端开发背景.

在这种情况下,你们认为哪种方法效果最好?

ruby-on-rails vps heroku amazon-s3

7
推荐指数
2
解决办法
3346
查看次数

加载jQuery,等等

我需要从javascript动态加载jQuery和jQuery UI,然后检查它是否已加载并在之后执行某些操作.

function loadjscssfile(filename, filetype){
 if (filetype=="js"){ //if filename is a external JavaScript file

  var fileref=document.createElement('script');
  fileref.setAttribute("type","text/javascript");
  fileref.setAttribute("src", filename);
 }
 else if (filetype=="css"){ //if filename is an external CSS file
  var fileref=document.createElement("link");
  fileref.setAttribute("rel", "stylesheet");
  fileref.setAttribute("type", "text/css");
  fileref.setAttribute("href", filename);
 }
 if (typeof fileref!="undefined")
  document.getElementsByTagName("head")[0].appendChild(fileref);
}


loadjscssfile("http://localhost/js/jquery-1.3.2.min.js", "js");
loadjscssfile("http://localhost/js/jquery-ui-1.7.2.custom.min.js", "js");
Run Code Online (Sandbox Code Playgroud)

我做了一些研究,发现我需要使用回调或settimeout.麻烦的是我在javascript中真的很新,这真的让我很难过.谁能让我朝着正确的方向前进?

javascript jquery load wait

4
推荐指数
1
解决办法
1万
查看次数

PHP Silex微框架语法解释

在过去的几天里,我一直在玩Silex.我无法理解以下代码段的工作原理.

我没有兴趣在什么它做,而是怎么它做它.

    use Silex\Application;
    use Symfony\Component\HttpFoundation\Request;
    use Symfony\Component\HttpKernel\HttpKernelInterface;

    $app->get('/foo', function (Application $app, Request $request) {
       $subRequest = Request::create('/', ...);
       $response = $app->handle($subRequest, HttpKernelInterface::SUB_REQUEST, false);

        return $response;
    });
Run Code Online (Sandbox Code Playgroud)

我很困惑

function (Application $app, Request $request)
Run Code Online (Sandbox Code Playgroud)

根据我的理解,这是一个匿名函数,被称为$ app-> get方法的参数.这个匿名函数中的两个参数如何工作?具体是什么:

Application $app, Request $request

谢谢!

php symfony silex

1
推荐指数
1
解决办法
606
查看次数

标签 统计

amazon-s3 ×1

heroku ×1

javascript ×1

jquery ×1

load ×1

php ×1

ruby-on-rails ×1

silex ×1

symfony ×1

vps ×1

wait ×1