小编Ali*_*ani的帖子

如何在C++中转换/转换指向引用

如何将指针(Object *ob)传递给原型的函数void foo(Object &)

c++ pointers casting reference type-conversion

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

make bootstrap twitter dialog modal draggable

我正在尝试用这个jquery插件制作bootstrap twitter对话模式draggable:

http://threedubmedia.com/code/event/drag#demos

但它不起作用.

var $div = $('html');
console.debug($('.drag'));
$('#modalTest')
    .drag("start", function(ev, dd) {
        dd.limit = $div.offset();
        dd.limit.bottom = dd.limit.top + $div.outerHeight() - $(this).outerHeight();
        dd.limit.right = dd.limit.left + $div.outerWidth() - $(this).outerWidth();
    })
    .drag(function(ev, dd) {
        $(this).css({
            top: Math.min(dd.limit.bottom, Math.max(dd.limit.top, dd.offsetY))
            , left: Math.min(dd.limit.right, Math.max(dd.limit.left, dd.offsetX))
        });
    }); 
Run Code Online (Sandbox Code Playgroud)

你知道我该怎么办?

jquery modal-dialog draggable twitter-bootstrap

45
推荐指数
6
解决办法
9万
查看次数

从用户控件调用父页面中的方法

我在aspx页面中注册了一个用户控件在用户控件中单击按钮事件时,如何调用父页面代码隐藏中的方法?

谢谢.

c# asp.net user-controls webusercontrol

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

通过将字段存储为字节而不是字符串来存储数十亿个文档,将在Lucene索引中优化多少空间和处理

我理解倒排索引的概念以及字典存储优化如何帮助在主存中加载整个字典以便更快地查询.

我试图了解Lucene索引是如何工作的.

假设我有一个String类型字段,对于Lucene中索引的2000亿个文档只有四个不同的值.该字段是存储字段.

如果我将字段更改为Byte或Int类型以表示所有4个不同的值,并重新索引并存储所有2000亿个文档.

此数据类型更改的存储和查询优化是什么?如果有的话.

请建议我是否可以在笔记本电脑上进行一些测试以获得理解.

lucene algorithm nlp information-retrieval

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

在用户控制页面上打开时,jquery对话框未关闭

我使用了jQuery对话框.父级具有用户控件,其具有用于在单击时打开弹出页面的图像.aspx页面有取消按钮来关闭jquery方法,它是有效的.我在父页面上添加了我的jquery文件.我把对话框div放在父页面上.

问题是关闭jquery对话框并重新加载父对话框.如果我在弹出页面的标题上添加了我的jquery文件,则会调用该函数,但错误是:

JavaScript运行时错误:对象不支持属性或方法"对话框".此外,取消按钮没有关闭jquery.

但是,当我在弹出页面上取消注释我的jquery文件时,取消按钮可以正常工作.但是关闭弹出窗口并重新加载父页面的另一个按钮,没有调用jquery方法,弹出页面重新加载而没有关闭.

我的代码在jQuery中

function openmodel(url, name, width, height) {
  var maxHeight = dialogMaxHeight(height);
  var dialogHeight = height;
  if (height > maxHeight)
    dialogHeight = maxHeight;   

  $('#dialog-model').dialog({
    my: "center",
    at: "center",
    of: window,
    autoOpen: false,
    resizable: true,
    max_height:'auto',      
    height: 'auto',
    width: width,
    title: name,
    modal: true,
    draggable: true,        
    open: function( ) { 
        $(this).load(url);           
    }, 
 });

$('#dialog-model').dialog('open');
return false;
}

function CloseDialogmodel() {    
    $('#dialog-model').dialog({
        autoOpen: false,
        resizable: true,     
        title: name,
        modal: true, 
    });

    $('#dialog-model').dialog('close');
 }


function CloseDialogModelAndReloadParent() {    
   CloseDialogmodel(); }
Run Code Online (Sandbox Code Playgroud)

aspx页面背后的代码: …

javascript asp.net jquery

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

jquery手风琴激活不起作用

accordion喜欢这个

<div id="accordion">
    <h3 id="idname1">text</h3>
    <div>
        Text TEXT text
    </div>
    <h3 id="idname2">text</h3>
    <div>
        Text TEXT text
    </div>
    <h3 id="idname3">text</h3>
    <div>
        Text TEXT text
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

现在我希望人们点击一个链接(在页面顶部),然后该面板将打开en人们将在每次调用我的函数时看到它

$('.myclass').click(function() {
    // this is to open the right pannel 
    var getal = $(this).attr('id');
    alert(getal); // i get the right name

    $("#accordion").accordion('activate', 1);
});
Run Code Online (Sandbox Code Playgroud)

我的控制台给了我这个错误

错误:对于accordion小部件实例,没有这样的方法"激活"

我不知道问题是什么我尝试过很多不同的东西,但都没有用.

html javascript jquery jquery-ui accordion

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

用于XML文件生成的机器学习算法

我有一个游戏应用程序,其中包含必须跨越迷宫的角色.游戏可以生成数千个不同的迷宫,角色可以根据用户的选择移动并手动穿过迷宫.我们需要增加显示每个迷宫的正确方法的可能性.因此,我们添加了根据xml文件移动字符的可能性.

这个XML文件非常复杂,通常大约有三十五万行.让我们说它在以下结构中(但更复杂):

  <maze-solution>
  <part id="1">
  <sector number="1">
    <action>
        <equipment>heavy</equipemnt>
        <movement>
            <start-position>1250></start-position>
            <angle>23.43</angle>
            <duration>0.44</duration>
        </movement>
        <action-type>run</action-type>
        <character>1</character>
        <protection>none</protection>       
    </action>
    <action>
        <equipment>light</equipemnt>
        <movement>
            <start-position>4223></start-position>
            <angle>233.43</angle>
            <duration>0.32</duration>
        </movement>
        <action-type>walk</action-type>
        <character>1</character>
        <protection>none</protection>       
    </action>
    <action>
        <equipment>heavy</equipemnt>
        <movement>
            <start-position>1231></start-position>
            <angle>84.134</angle>
            <duration>0.454</duration>
        </movement>
        <action-type>run</action-type>
        <character>2</character>
        <protection>none</protection>       
    </action>
    <action>
        <equipment>heavy</equipemnt>
        <movement>
            <start-position>932></start-position>
            <angle>34.43</angle>
            <duration>0.50</duration>
        </movement>
        <action-type>duck</action-type>
        <character>1</character>
        <protection>none</protection>       
    </action>   
  </sector>
  <sector number="2">
    <action>
        <equipment>heavy</equipemnt>
        <movement>
            <start-position>1250></start-position>
            <angle>23.43</angle>
            <duration>0.44</duration>
        </movement>
        <action-type>run</action-type>
        <character>1</character>
        <protection>none</protection>       
    </action>
    <action>
        <equipment>light</equipemnt>
        <movement>
            <start-position>4223></start-position>
            <angle>233.43</angle>
            <duration>0.44</duration>
        </movement>
        <action-type>walk</action-type>
        <character>1</character>
        <protection>none</protection>       
    </action>
    <action>
        <equipment>heavy</equipemnt>
        <movement>
            <start-position>1231></start-position> …
Run Code Online (Sandbox Code Playgroud)

c# xml algorithm machine-learning

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

无法使用iframe的jQuery UI draggable

我在主站点中有一个iframe(这是一个机器人图标).我无法使用jqueryui draggable()函数使iframe元素可拖动.

代码片段如下

$("#testIframe").draggable();
Run Code Online (Sandbox Code Playgroud)
#testIframe {
  position: absolute;
  bottom: 0;
  right: 0;
  background: #ccc;
  padding: 10px;
  width: 200px;
  height: 100px;
}
Run Code Online (Sandbox Code Playgroud)
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<div class="parent">
Parent text....
  <div class="child">    
    <iframe id="testIframe" width="100%" height="300" src="//jsfiddle.net/iamraviteja/09hdej6t/2/embedded/" frameborder="0"></iframe>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

我的问题: 如果你试图拖动 testIframe,你就无法拖动它.为什么?

iframe jquery jquery-ui jquery-ui-draggable

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

SQL Server从navigator.userAgent检测其他浏览器

我有一张如下表:

create table SiteLog (UserAgent nvarchar(255))
insert into SiteLog values 
('Mozilla/5.0 (iPad; CPU OS 9_3_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13F69 Safari/601.1'),
('Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0'),
('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586'),
('Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36'),
('Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.12 Safari/537.36 OPR/14.0.1116.4') 
Run Code Online (Sandbox Code Playgroud)

UserAgentnavigator.userAgent客户端用户填写.我想将记录分类为以下6个类别:

  1. 火狐
  2. 边缘
  3. IE
  4. 铬 …

sql sql-server user-agent

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

在C#中实现完整的二叉树,而不是二进制搜索树

我试图在C#中实现二叉树,而不是二进制搜索树.我实现了下面的代码,它工作正常,但不是我想要的.基本上我正在尝试实现一个完整的二叉树,但是使用我的下面的代码,我得到一个不平衡的二叉树.

Input : 10, 20, 30, 40, 50, 60, 70, 80, 90, 100
Desired Output : 

                        10
                     /       \
                 20            30
               /    \         /  \
            40        50    60    70
           /  \      /
         80    90  100     


Current Output : 
                                10
                              /    \
                            20      30
                                  /    \
                                40      50    
                                       /   \
                                     60     70
                                           /  \
                                         80    90  
                                              /
                                            100   
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

  class Node 
  {
    public int data;
    public Node left;
    public Node right;

    public Node() 
    {
      data = 0;
      left = null;
      right …
Run Code Online (Sandbox Code Playgroud)

c# algorithm tree binary-tree

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