小编Dmi*_*sev的帖子

如何屏蔽"." 炭?

可能重复:
如何让jQuery选择带有的元素.(期间)他们的身份证?

我试着运行以下代码:

$('#info-mail.ru .domain-info').toggle();
Run Code Online (Sandbox Code Playgroud)

这里的例子

#info-mail.ru我理解为解释为id ="info-mail"和class ="ru",但我有以下结构:

<div id="info-mail.ru">
    <p class="domain-info">
        Some cool info
        Some cool info
        Some cool info
        Some cool info
    </p>
</div>
Run Code Online (Sandbox Code Playgroud)

我该如何屏蔽"." 选择语句中的char?或者唯一的方法是替换所有"." 用"_"(例如)?

TIA!

javascript jquery

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

Cassandra或MongoDB具有良好的扩展性和大量查询

我有以下情况.有很多对数据库的查询(通常是写评论,阅读配置文件等等),而且,我认为读取比写入更多.我希望很有可能将db扩展到多个服务器.所以,我喜欢nosql :)据我所知,通过阅读博客和StackOverflow上的问题答案(例如这一个),在这种情况下最好的选择是使用Cassandra.

所以,问题是 - 卡桑德拉更适合我的目的吗?为什么?

第二个问题是关于Tornado的异步客户端库- 你知道一些这方面的实现吗?正如您在上面链接的Wiki页面上看到的那样,只有mongodb和couchdb的异步客户端.这个事实也阻止了我.

也许我现在可以使用MongoDB(原因是异步库esces,也许在第一次它会比几个服务器上的Cassandra更快但没有异步),并且在一段时间之后将mongo中的数据转换为cassandra.你怎么看待这件事?

python asynchronous tornado mongodb cassandra

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

类图中的HashMap(UML)

我为Java应用程序构建了UML 2.0类图。在我的代码中,我具有HashMap数据类型的属性。但是,据我所知,UML标准中没有HashMap数据类型。问题是-我可以将HashMap用作类属性的数据类型吗?

更新

也许在图中,我只应该指向java.util包?也许将Map类放在此包中的图表上?

java hash uml hashmap

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

触发事件后,复选框仍未选中

我有以下观点:

   window.DmnView = Backbone.View.extend({
        template: _.template($("#tmpl_dmnListItem").html()),
        events: {
            "click .getWhois": "showWhois",
            "click .getDomain": "toBasket"
        },
        initialize: function() {
            this.model.bind('change', this.render, this);
            this.model.bind('destroy', this.remove, this);
            this.bind('toBasket', dmnListApp.toBasket, this);
        },
        render: function() {
            return $(this.el)
                    .attr("class", this.model.get("free") ? "dmnItem green" : this.model.get("checked") ? "dmnItem red" : "dmnItem red loader")
                    .html(this.template(this.model.toJSON()));
        },
        remove: function() {
            $(this.el).remove();
        },
        showWhois: function() {
            showBoxes(this.model.get("info"));
            return false;
        },
        toBasket: function() {
            this.model.toBasket();
            this.trigger('toBasket');
        }
    });

    window.DmnListApp = Backbone.View.extend({
        el: $("#regWrap"),
        events: {
            "keypress #dmnName": "checkAll"
        },
        initialize: …
Run Code Online (Sandbox Code Playgroud)

backbone.js

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

Tornado 和 PIL:从标题中打开图像

我的龙卷风应用程序接收标题中的图像。所以,我想重新调整它的大小并存储它。但我在打开图像时遇到问题 - 要创建 PIL 对象,我必须拥有带有图像的文件并将文件名传递给 PIL 图像模块的 open() 方法。但我那里只有标题和文件信息。我应该创建临时文件来创建 Image 对象吗?或者也许还有其他解决方案?

class ImageHandler(BaseHandler):
    def post(self):
        f = open("out.jpg", "w")
        im = Image.open(self.request.files["ImageUpload"][0]["body"])
        im.save(f, "JPEG")
        self.finish()
Run Code Online (Sandbox Code Playgroud)

蒂亚!

UPD1(@bernie)

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/tornado-2.2-py2.7.egg/tornado/web.py", line 988, in _execute
    getattr(self, self.request.method.lower())(*args, **kwargs)
  File "server.py", line 160, in post
    im = Image.open(StringIO(self.request.files["ImageUpload"][0]["body"]))
TypeError: 'module' object is not callable
Run Code Online (Sandbox Code Playgroud)

python tornado python-imaging-library python-2.7

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

Git:仅忽略文件夹的内容

我使用以下.gitignore文件(全局):

.idea
.svn
/media/covers/*
/media/tmp/*
/media/cache/*
/bin
/include
/lib
/local
*.log
*.pot
*.pyc
local_settings.py
Run Code Online (Sandbox Code Playgroud)

所以media/covers,media/tmp,media/cache我想忽略所有文件和文件夹,而不是该目录中的自己.这.gitignore文件以忽略media/covers,media/tmp,media/cache迪尔斯,我怎么能解决这个问题?

TIA!

git github gitignore

5
推荐指数
2
解决办法
4981
查看次数

在Ubuntu上安装Pillow时出错

细节:

操作系统:Ubuntu 12.04 LTS服务器

vm:VirtualBox 4.1.18

使用virtualenv

在dir中创建的virtualenv,与win7共享

错误

我执行pip install Pillow并得到此错误:

Downloading/unpacking Pillow
  Running setup.py egg_info for package Pillow

    warning: no previously-included files found matching '.hgignore'
    warning: no previously-included files found matching '.hgtags'
    warning: no previously-included files found matching 'BUILDME.bat'
    warning: no previously-included files found matching 'make-manifest.py'
    warning: no previously-included files found matching 'SHIP'
    warning: no previously-included files found matching 'SHIP.bat'
    warning: no files found matching '*.html' under directory 'docs'
    warning: no files found matching 'README' under …
Run Code Online (Sandbox Code Playgroud)

pip

5
推荐指数
0
解决办法
914
查看次数

无法在具有相同ID的元素上触发click事件

你能帮我理解 - 我弄错了.我有以下HTML代码:

<div id="container">
    <a href="#info-mail.ru" id="getInfo" onClick="return false;">Info mail.ru</a>
</div>
<div id="container">
    <a href="#info-mail.com" id="getInfo" onClick="return false;">Info mail.com</a>
</div>
<div id="container">
    <a href="#info-mail.net" id="getInfo" onClick="return false;">Info mail.net</a>
</div>
Run Code Online (Sandbox Code Playgroud)

和以下js代码(使用jQuery):

$('#getInfo').click(function(){
    alert('test!');
});
Run Code Online (Sandbox Code Playgroud)

这里的例子

"Click"事件仅在第一个链接元素上触发.但不是其他人.

我知道html页面中的每个ID应该只使用一次(但CLASS可以使用很多次) - 但它只应该(不是必须),因为我知道.这是我问题的根源吗?

TIA!

upd:大谢谢所有的解释!:)

javascript jquery

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

重复jQuery ajax请求

我向服务器发出ajax请求.有时我收到502错误.所以,如果发生这种情况,则会调用error()方法.

如果收到错误,我该如何重复请求?代码应如下所示:

$.ajax({
                url: 'http://server/test.php',
                type: 'GET',
                dataType: 'jsonp',
                cache: 'false',
                timeout: 32000,
                success: function(data) {
                  //some actions here
                },
                error: function(jqXHR, textStatus, errorThrown) {
                    console.log("Error[refresh]: " + textStatus);
                    console.log(jqXHR);
                    // here I want to repeat the request like "this.repeat()"
                },
            });
Run Code Online (Sandbox Code Playgroud)

javascript jquery

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

如何制作可以贴在屏幕边框上的表格

我的任务是制作一个粘性形式,它可以粘在屏幕的顶部或底部或左侧或右侧.因此,如果它粘在屏幕的左侧或右侧 - 它应该具有最大高度和固定宽度.如果它粘在顶部或底部 - 它应该具有固定的高度和最大宽度(屏幕宽度的100%).我怎样才能在c#4.0中创建它?也许有一些合适的现成解决方案?

UPDATE1

好吧,这是一个粘贴窗户的好链接.大thx!现在我在设置窗体的宽度和高度时遇到了问题,当它被鼠标移动并移动时.

namespace WordLearn
{
    public partial class FormWord : Form
    {
        private const int SnapDist = 70;
        private int currWidth = 0;
        private int currHeight = 0;

        public FormWord()
        {
            InitializeComponent();

        }



        private bool DoSnap(int pos, int edge)
        {
            int delta = pos - edge;
            return delta > 0 && delta <= SnapDist;
        }

        protected override void OnResizeEnd(EventArgs e)
        {
            base.OnResizeEnd(e);
            Boolean key = false;

            Screen scn = Screen.FromPoint(this.Location);
            if (DoSnap(this.Left, scn.WorkingArea.Left))
            {
                key …
Run Code Online (Sandbox Code Playgroud)

c# winforms

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