小编Del*_*ynx的帖子

如何启用首先安装memcached的igbinary

我已经memcached安装了libmemcached.我也安装了igbinary.

这是我的php.ini:

; Directory in which the loadable extensions (modules) reside.
;extension_dir = "./"
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613/"

extension=apc.so
apc.enabled=1
apc.shm_size=128M

extension=memcached.so
session.save_handler=memcached
session.save_path="127.0.0.1:11211"

extension=igbinary.so
session.serialize_handler=igbinary
igbinary.compact_strings=On
Run Code Online (Sandbox Code Playgroud)

.

当我运行phpinfo()时,我看到启用了igbinary,但没有启用memcached:

apc
Serialization Support   php, igbinary 

igbinary
igbinary support    enabled
igbinary version    1.1.1
igbinary APC serializer ABI     0

Directive   Local Value Master Value
igbinary.compact_strings    On  On
Run Code Online (Sandbox Code Playgroud)

关于memcached的Phpinfo():

memcached
memcached support   enabled
Version     1.0.2
libmemcached version    0.51
Session support     yes
igbinary support    no 
Run Code Online (Sandbox Code Playgroud)

最后一行:igbinary support这就是问题所在.奇怪的是,正如你在标题apc下看到的那样:Serialization …

php memcached igbinary

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

Ember.js:HtmlBars和Handlebars.compile命令

运行我的应用程序时出现以下错误:

Uncaught Error: Cannot call `compile` without the template compiler loaded. Please load `ember-template-compiler.js` prior to calling `compile`.
Run Code Online (Sandbox Code Playgroud)

它与这段代码有关:

var CarouselView = Ember.View.extend({
    template: Ember.Handlebars.compile('{{view view.itemsView}}'),
    elementId: 'carousel',
    contentBinding: 'content',
    ...
Run Code Online (Sandbox Code Playgroud)

在ember.js github上已经存在与此问题相关的问题:https://github.com/emberjs/ember.js/issues/10265

但是我添加ember-template-compiler到我的package.json并再次得到相同的错误.

我做了: npm install --save-dev ember-template-compiler

这是我的package.json devDependencies:

 "ember-cli": "0.1.10",
 "ember-cli-app-version": "0.3.0",
 "ember-cli-content-security-policy": "0.3.0",
 "ember-cli-dependency-checker": "0.0.7",
 "ember-cli-htmlbars": "^0.6.0",
 "ember-cli-ic-ajax": "0.1.1",
 "ember-cli-inject-live-reload": "^1.3.0",
 "ember-cli-qunit": "0.3.0",
 "ember-cli-simple-auth": "^0.7.2",
 "ember-cli-simple-auth-cookie-store": "^0.7.2",
 "ember-cli-simple-auth-oauth2": "^0.7.2",
 "ember-cli-uglify": "1.0.1",
 "ember-data": "1.0.0-beta.12",
 "ember-export-application-global": "^1.0.0",
 "ember-template-compiler": "^1.8.0",
 "express": "^4.8.5",
 "glob": "^4.0.5" …
Run Code Online (Sandbox Code Playgroud)

ember.js ember-cli

9
推荐指数
2
解决办法
6446
查看次数

Ember.js值与HTML5文件上传绑定

我与文件上传一起使用Ember-data并不远.但我没有得到正确的价值绑定.下面是相关代码.

这是App.js

App.LandcodeNewRoute = Ember.Route.extend({
    model: function () {
        return this.store.createRecord('landcode');
    },
    actions: {
        saveLandcode: function () {
            this.currentModel.save();
        }
    }
});


// REST & Model
App.ApplicationAdapter = DS.RESTAdapter.extend({
    namespace: 'api'
});
App.Store = DS.Store.extend({
    adapter: 'App.ApplicationAdapter'
});

App.Landcode = DS.Model.extend({
    code: DS.attr('string'),
    image: DS.attr('string')
});

// Views
App.UploadFile = Ember.TextField.extend({
    tagName: 'input',
    attributeBindings: ['name'],
    type: 'file',
    change: function (e) {
        var reader, that;
        that = this;
        reader = new FileReader();
        reader.onload = function (e) {
            var fileToUpload = e.target.result; …
Run Code Online (Sandbox Code Playgroud)

javascript html5 ember.js

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

Ember.js将现有记录克隆到商店

我正在努力与Ember.js想要的概念.我想要的是以下内容.我现在有一个现有的Ember Data模型Article.让我们说id1将会显示/article/1.

当用户点击"新建"按钮时,它们将转换为"article.new"路线.看我的路由器:

App.Router.map(function () {
   this.resource('article', {path: '/article/:id'});
   this.resource('article.new', {path: "/article/new"});
}
Run Code Online (Sandbox Code Playgroud)

当用户在操作时单击" 复制"按钮时,将调用/article/1duplicateArticle操作.我直观地做了以下几点App.ArticleController:

duplicateArticle: function () {
   return this.transitionToRoute('article.new', this.get('model');
}
Run Code Online (Sandbox Code Playgroud)

然而,这是行不通的.我想因为我需要一条路径在我的文章中.新路线.但是,当用户单击"新建"按钮时,我不需要ID.

这个问题有效吗?

编辑:到目前为止我的尝试:

var currentArticle = this.get('model'); 
currentArticle.set('id', null); 
var duplicatedArticle = this.store.createRecord('article', currentArticle); 
duplicatedArticle.save();
Run Code Online (Sandbox Code Playgroud)

和:

var duplicatedArticle = Ember.copy(this.get('model'), true);
Run Code Online (Sandbox Code Playgroud)

和:

 var newArticle = JSON.parse(JSON.stringify(this.get('model')));
 var duplicatedArticle = this.store.createRecord('article', newArticle);
 duplicatedArticle.save();
Run Code Online (Sandbox Code Playgroud)

除了belongsTohasMany属性之外,最后一次尝试都有效.

这样做没有Ember方式吗?

参考文献:

Ember克隆模型用于新记录

有没有办法将Ember Object转换为普通的javascript对象?

迭代Ember.js余烬数据记录数组

如何克隆Ember数据记录,包括关系? …

ember.js ember-data

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

Ember.js Computed属性在排序后不会更新hasMany项

我有以下设置按日期显示我的订单: 白天订单

我有以下模板显示给定周的每个订单:(为简洁起见,我删除了一些html)

模板:

{{#each ordersByDate in ordersByDateOfWeek}}
    <div class="orders-by-date">
        <div>
            <span>{{order-date-formatted ordersByDate.date}}</span>
        </div>

        {{#each order in ordersByDate.orders}}
            {{order.number}} {{! updates correctly}}
            {{order.market.name}} {{! a hasmany property called here, does not update}}
        {{/each}}
    </div>
{{/each}
Run Code Online (Sandbox Code Playgroud)

计算性能:

ordersByDateOfWeek: function () {

    var result = []; // return value
    var object = null
    var date = null;


    // add every order to an array with a date an order objects
    this.forEach(function (order) {

        // get the date of the order …
Run Code Online (Sandbox Code Playgroud)

javascript ember.js

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

正则表达式挑战分别匹配相同的数字

我正在努力应对一个很好的挑战,分别匹配两个相同的数字,正则表达式.

在这里看到我想单独匹配的列表.

1,680,000,0001,680,000,000
3,350,0003,350,000
110,000110,000
11,100,00011,100,000
550,000550,000
1,0001,000
250250
49,50049,500
165,000165,000
49,50049,500
3,350,0003,350,000
165,000165,000
550,000550,000
550,000550,000
33,10033,100
18,10018,100
450,000450,000
Run Code Online (Sandbox Code Playgroud)

例如550,000550,000,两倍550,000或250250两倍250.我想匹配例如550,000和250.

我在RegexBuddy中测试了很多正则表达式,但是没有人做我想要的.也许你有建议?

regex

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

Ember.js使用Ember Simple Auth从代码中验证用户身份

我试图让用户通过代码进行身份验证.我有一个登录表单,用户可以登录,它就像魅力一样.

但是,当新用户注册并保存表单时,我希望在表单有效时在后台登录.

我怎样才能做到这一点?

我在API中找到了以下authenticate()方法:

对于没有身份验证路由的应用程序(例如,因为它打开了一个新窗口来处理身份验证),这是要覆盖的方法,例如:

App.ApplicationRoute = Ember.Route.extend(Ember.SimpleAuth.ApplicationRouteMixin, {
  actions: {
    authenticateSession: function() {
      this.get('session').authenticate('app:authenticators:custom', {});
    }
  }
});
Run Code Online (Sandbox Code Playgroud)

有谁知道如何实现这一点.当我打电话给this.get('session').authenticate()哪里放置识别和密码数据?

任何提示或建议都非常感谢!

编辑:也许可以使用与登录相同的身份验证器而不是app:authenticators:custom示例中的身份验证器?

ember.js

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

标签 统计

ember.js ×5

javascript ×2

ember-cli ×1

ember-data ×1

html5 ×1

igbinary ×1

memcached ×1

php ×1

regex ×1