小编Adr*_*ler的帖子

symfony vs cakephp

什么是概念上symfony和cakephp之间的区别?

php symfony1 cakephp

54
推荐指数
8
解决办法
3万
查看次数

Backbone.js或Ember.js与Ruby on Rails

我正在寻找比较Ember.js和Backbone.js的信息,以便与Ruby on Rails后端一起使用.有没有人有使用这两个客户端框架的经验,并愿意提供一些有关它们的见解?

ruby-on-rails backbone.js ember.js

26
推荐指数
2
解决办法
7143
查看次数

Backbone JS:如何在导航到另一个URL时清理视图?

我有一个Homeview,其中包含一些页面上的子视图,当我使用路由器导航到另一个页面时,如何清理现有视图,并为我要导航到的页面构建新视图?

此应用程序没有模型/集合,只有视图.

谢谢!

部分代码:

Home = Backbone.View.extend({
    template: "static/js/templates/home.html",

    initialize: function() {
      _.bindAll(this);
      this.render();
    },

    render: function() {
      var view = this;

      // Fetch the template, render it to the View element and call done.
      namespace.fetchTemplate(this.template, function(tmpl) {
        view.el.innerHTML=tmpl();
        view.subRender();
      });

      return this;
    },
    subRender: function() {
      var view = this;
      var videoView = new Subview1({
        el: $('#wrapper1'),
        homeView: view
      });
      var timeView = new Subview2({
        el: $("#wrapper2")
      });
    }
 });
Run Code Online (Sandbox Code Playgroud)

javascript backbone.js

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

Skype4Java通过Mac OS上的Scala

我正在运行Mac OS 10.6,Java 1.6_17,Scala 2.8.1 final.我正在尝试使用Skype4Java进行简单的Skype通话,方法如下:

$>export JAVA_OPTS=-d32

$>scala -classpath .:./skype/release/skype.jar

scala> com.skype.Skype.makeCall("echotest")
Run Code Online (Sandbox Code Playgroud)

我收到了错误

"invalid attempt to access memory at location 0x0 ... bus error". 
Run Code Online (Sandbox Code Playgroud)

有没有人经历过这个并找到解决方案?

注意:当我使用命令行java运行它时,我可以通过调用其中一个示例来完美地使用此api.尝试使用命令行scala执行相同的示例失败,并显示上述错误.

java macos scala skype4java

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

Mongoose,按填充字段排序查询

据我所知,可以使用Mongoose()对填充的文档进行排序.

我正在寻找一种方法来按一个或多个填充字段对查询进行排序.

考虑这两个Mongoose模式:

var Wizard = new Schema({
    name  : { type: String }
, spells  : { [{ type: Schema.ObjectId, ref: 'Spell' }] }
});

var Spell = new Schema({
    name    : { type: String }
,   damages : { type: Number }
});
Run Code Online (Sandbox Code Playgroud)

示例JSON:

[{
    name: 'Gandalf',
    spells: [{
            name: 'Fireball',
            damages: 20
        }]
}, {
    name: 'Saruman',
    spells: [{
            name: 'Frozenball',
            damages: 10
        }]
}, {
    name: 'Radagast',
    spells: [{
            name: 'Lightball',
            damages: 15
        }] …
Run Code Online (Sandbox Code Playgroud)

javascript sorting mongoose mongodb node.js

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

存储HTML5地理位置数据

如何在Rails 3中存储和处理网站用户的地理位置(long和lat),以便检查我们是否已经在每个页面请求中为该用户的会话中保留这些详细信息(如果我们是没有详细信息,那么我们应该从浏览器请求用户的位置,然后将这些详细信息存储在会话中)?

ajax html5 ruby-on-rails geolocation ruby-on-rails-3

11
推荐指数
2
解决办法
6819
查看次数

jQuery - 保持js数组和DOM对象列表同步?

假设我有一系列对象

[{href: 'some_uri', 'class': 'this-css-class'}, {href: 'another_uri', 'class': 'that-css-class'}]

我现在想将其映射到html列表:

<ul>
  <li class="this-css-class"><a href="some_uri">some_uri</a></li>
  <li class="that-css-class"><a href="another_uri">another_uri</a></li>
</ul>
Run Code Online (Sandbox Code Playgroud)

假设我向我的数组中添加了另一个对象,我想<li>在列表中添加一个新对象.相反,当我$('.that-css-class').remove()列出其中一个列表项时,我希望它也可以在数组中消失.

我想把它保存在jQuery中,因为我不想在项目中引入另一个框架.

非常感谢,这一直在我的脑海中.谢谢.

jquery dom

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

推迟删除视图,以便对其进行动画处理

假设我有一个显示基于属性的视图的模板:

{{#if App.contentsAreVisible}}
    {{view ToggleContents}}
{{/if}}
Run Code Online (Sandbox Code Playgroud)

通过设置,可以通过UI的任意数量的其他部分切换此区域 App.set("contentsAreVisible", [true/false]);

一切正常.

但是,我现在想要在切换视图时进行动画处理.连接didInsertElement到动画显示区域的工作,但我不能这样做willDestroyElement因为在动画有机会运行之前,该函数返回后立即删除元素.

App.ToggleContents = Ember.View.extend({

    // this works fine
    didInsertElement: function(){
        this.$().hide().show("slow");
    },

    // this doesn't work
    willDestroyElement: function(){
        this.$().hide("slow", function(){
            // animation is complete, notify that the element can be removed
        });
    }
});
Run Code Online (Sandbox Code Playgroud)

有没有办法告诉视图推迟从DOM中删除元素,直到动画完成?

这是一个互动示例的小提琴:http://jsfiddle.net/rlivsey/RxxPU/

javascript jquery ember.js

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

RequireJS - 集中管理模块

也许我在某个地方的文档中错过了这个但是这里.我有一个负责管理模块的核心控制器.到目前为止,我有大约20个模块,并且希望能够轻松地将它们配置为由核心加载.这意味着我需要大量的数组或大量的调用.在文字对象中创建模块列表然后让模块从中加载它的依赖项是否可接受/良好实践?这是我的意思的一个例子:

Config.js

modules = [
    'moduleA',
    'moduleB',
    'moduleC'
];
Run Code Online (Sandbox Code Playgroud)

Core.JS

define(
    ['config'],
    function(config) {
        // Somewhere in here I parse the list and require() each one ?   
        return {
            startAll : function() {
                console.log('starting all modules.');

                // Then call a method common to all 'modules' in the list above.
            }
        }
    };
  }
);
Run Code Online (Sandbox Code Playgroud)

我不确定这是一个好主意,因为我是RequireJS的新手,但我喜欢能够配置从一个地方加载哪些模块的想法.在我的模块中,我指的是我更具体地编写的UI小部件.

javascript dependencies requirejs

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

window.opener在firefox中为null

我有一个打开弹出窗口的页面

openWindow(top, 'prcsTypeSelectionPopup?event=prcsTypeSelection', 'lovWindow', {width:750, height:550}, true, 'dialog', pathCallBack);
Run Code Online (Sandbox Code Playgroud)

并且弹出窗口具有以下代码

function returnSelect()
{
    window.document.forms[0].choice_processType.value ;
    window.opener.document.forms[0].pevent.value = 'getprocessName';
    window.opener.document.forms[0].processName.value='';
    for (var i=0; i < document.forms[0].elements.length; i++)
   {
   if (document.forms[0].elements[i].checked)
      {
      window.opener.document.forms[0].processName.value=document.forms[0].elements[i].value;
      break;
      }
   }
   if(window.opener.document.forms[0].processName.value=='')    {
        window.opener.document.forms[0].lovProcessType.value = '';
        window.opener.document.forms[0].pevent.value = '';
   }
    window.opener.document.forms[0].submit();
    closeConn();
}

function closeConn()
{
         self.close();
}
Run Code Online (Sandbox Code Playgroud)

但是当页面加载到firefox中时,我得到错误,因为window.opener在returnselect()函数的第二行是null

function returnSelect()
    {
        window.document.forms[0].choice_processType.value ;
        --> window.opener.document.forms[0].pevent.value = 'getprocessName';
Run Code Online (Sandbox Code Playgroud)

任何想法如何克服这一点

提前致谢...

javascript firefox

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