问题列表 - 第14823页

在C中实现Tree的指针问题

我正在为我的任务实现一个avl树.

#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>

struct TreeNode {
  char *item;
  struct TreeNode *left;
  struct TreeNode *right;
  signed char balance;
};

typedef struct TreeNode Node;

void _print_avl (Node *, int , const char *);

Node * get_new_node (char *);
int avl_insert(Node *, char *);
void print_avl (Node *);
void avl_swr(Node*);

int main (int argc, char *argv[])
{
  Node *root = get_new_node("thura");
  avl_insert(root, "thur2");
  print_avl(root);

  avl_insert(root, "thur1");

  return 0;
}

int avl_insert(Node *root, char *item)
{
  assert(root);

  if( …
Run Code Online (Sandbox Code Playgroud)

c algorithm tree binary-tree

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

如何以编程方式获取iPhone国际移动设备标识?

呼叫#*06#告诉IMEI(国际移动设备身份)该设备.我检查了国际编号计划,发现这实际上是IMEI编号.

是否有可能以编程方式获得它?

谢谢

iphone objective-c imei

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

ASP.Net声明性地将页面属性中的值传递给用户控件

我需要找到一种声明方式(不在代码隐藏文件中)将ASP.Net网页中的属性值传递给用户控件的方法.以下是我正在尝试做的一个简单示例,但我无法让它工作.这是我正在创建用户控件对象的aspx页面的标记:

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs"  Inherits="_Default" %>
<%@ Register Src="~/MyUserControl.ascx" TagName="MyUserControl" TagPrefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <uc1:MyUserControl ID="MyUserControl1" runat="server"
      UserControlProperty = '<%# Bind("PageProperty") %>' />
    </div>
    </form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

这是aspx页面背后的代码(aspx.cs):

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page 
{
    public int PageProperty { get; set; }

    protected void Page_Load(object sender, EventArgs e)
    { …
Run Code Online (Sandbox Code Playgroud)

c# asp.net user-controls

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

什么是rails项目中的db/development_structure.sql?

我的rails应用程序的我的/ db文件夹中有一个development_structure.sql(rails 2.3.4,ruby 1.8.7),我不确定它到底是做什么的.

  1. 某些特定环境需要它吗?(我想我读过它用于测试的地方)
  2. 我需要将它添加到我的git存储库吗?

sql ruby-on-rails

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

如何访问维基百科

我想从维基百科访问HTML内容.但它显示拒绝访问.

我怎样才能访问Wiki.请给出一些建议

c# wikipedia

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

C++函数指针作为静态成员

我无法想出将函数指针声明为静态成员的语法.

#include <iostream>
using namespace std;

class A
{
    static void (*cb)(int a, char c);
};

void A::*cb = NULL;

int main()
{
}
Run Code Online (Sandbox Code Playgroud)

g ++输出错误"无法声明指向`void'成员的指针".我假设我需要用括号做一些事情但是void A ::(*cb)= NULL也不起作用.

c++ function-pointers

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

运行嵌入在我的应用程序中的Apache DS

我正在尝试在我的应用程序中运行嵌入式ApacheDS.在阅读http://directory.apache.org/apacheds/1.5/41-embedding-apacheds-into-an-application.html后,我构建了这个:

public void startDirectoryService() throws Exception {
    service = new DefaultDirectoryService();
    service.getChangeLog().setEnabled( false );

    Partition apachePartition = addPartition("apache", "dc=apache,dc=org");
    addIndex(apachePartition, "objectClass", "ou", "uid");

    service.startup();

    // Inject the apache root entry if it does not already exist
    try
    {
        service.getAdminSession().lookup( apachePartition.getSuffixDn() );
    }
    catch ( LdapNameNotFoundException lnnfe )
    {
        LdapDN dnApache = new LdapDN( "dc=Apache,dc=Org" );
        ServerEntry entryApache = service.newEntry( dnApache );
        entryApache.add( "objectClass", "top", "domain", "extensibleObject" );
        entryApache.add( "dc", "Apache" );
        service.getAdminSession().add( entryApache );
    }
}
Run Code Online (Sandbox Code Playgroud)

但运行后我无法连接到服务器.什么是默认端口?或者我错过了什么?

这是解决方案: …

java apache ldap apacheds

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

Hibernate list()是否有效返回重复项?

是否有人知道Hibernate的有效性Criteria.list()Query.list()返回多次出现的同一实体的方法?

我偶尔会发现在使用Criteria API时,在我的类映射定义中更改默认提取策略(从"select"到"join")有时会影响对同一实体的多少引用可以出现在结果输出中list(),并且我我不确定是否将此视为一个错误.javadoc没有定义它,只是简单地说"匹配的查询结果列表".(多谢你们).

如果这是预期和正常的行为,那么我可以自己重复删除列表,这不是问题,但如果它是一个错误,那么我宁愿避免它,而不是重复删除结果并试图忽略它.

有人有这方面的经验吗?

java hibernate

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

集合类的__eq__方法的一个很好的例子是什么?

我正在研究一个我想为其创建__eq__方法的集合类.事实证明它比我想象的要细致入微,而且我注意到内置集合类的工作原理有几个错综复杂.

对我来说最有帮助的是一个很好的例子.__eq__在标准库或任何第三方库中是否有任何方法的纯Python实现?

python api collections equality

6
推荐指数
2
解决办法
8417
查看次数

停止模糊功能中的jQuery模糊事件

我有一个文本框,我正在使用模糊事件来使用正则表达式验证文本.如果失败,我希望文本框保持焦点.我知道在常规的javascript中你可以return functionName();在实际的html控件中的onblur事件中说.在$(document).ready()函数中绑定blur事件时,有没有办法做类似的事情.或者只是将焦点设置为"这个".感谢您的帮助.

$(document).ready(function() {");
    $('input:text.sqlValidation').blur(function() {");
        var sqlInjectionRegX2 = /...Regex.../;
        var value = this.value;
        if (sqlInjectionRegX2.test(value)) {
            alert('The text you have entered may contain malicious code and can not be submitted.');
            this.value = '';
            return false;
        }
        else return true;
    });
});
Run Code Online (Sandbox Code Playgroud)

jquery events focus blur setting

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