小编Tho*_*son的帖子

即使使用customErrors ="Off"(在ubuntu/mono上),Web.config也不会远程显示错误

这是我的Web.config文件:

<?xml version="1.0"?>
<configuration>
    <system.web>
        <customErrors mode="Off" />    
        <compilation debug="true" strict="false" explicit="true />    
        <pages>
          <namespaces>
            <clear />
            <add namespace="System" />
            <add namespace="System.Collections" />
            <add namespace="System.Collections.Generic" />
            <add namespace="System.Collections.Specialized" />
            <add namespace="System.Configuration" />
            <add namespace="System.Text" />
            <add namespace="System.Text.RegularExpressions" />
            <add namespace="System.Web" />
            <add namespace="System.Web.Caching" />
            <add namespace="System.Web.SessionState" />
            <add namespace="System.Web.Security" />
            <add namespace="System.Web.Profile" />
            <add namespace="System.Web.UI" />
            <add namespace="System.Web.UI.WebControls" />
            <add namespace="System.Web.UI.WebControls.WebParts" />
            <add namespace="System.Web.UI.HtmlControls" />
          </namespaces>
          <controls>
            <add src ="~/controls/maleBed.ascx" tagPrefix ="mycontrol" tagName ="male"/>
            <add src ="~/controls/femaleBed.ascx" tagPrefix ="mycontrol" tagName …
Run Code Online (Sandbox Code Playgroud)

asp.net mono web-config custom-errors

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

iphone项目符号列表

有没有办法在iPhone上制作一个子弹点列表?

如果将项目符号列表复制并粘贴到IB中的UITextView中,则会显示该列表.无论如何以编程方式执行此操作?

谢谢

汤姆

iphone uitextfield

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

为BOOL变量编写getter和setter

显然,使用obj-c,通常没有理由编写getter和setter(感谢有用的mr @synthesize).

所以现在,需要做到这一点,我遇到了一个我不知道如何编写它们的问题.:p

我敢肯定我可能不会以正确的方式解决我的问题 - 只是将我的对象子类化得更容易 - 但我正在尝试编写类别代码以添加属性,因为(在开头)它更快,因为我想学习如何在我的应用程序中使用类别代码.

我有这个:

-(BOOL)isMethodStep {
    return self.isMethodStep;
}

-(void)setIsMethodStep:(BOOL)theBoolean {
    if(self.isMethodStep != theBoolean){
        self.isMethodStep = theBoolean;
    }
}
Run Code Online (Sandbox Code Playgroud)

我在setter中没有if查询就试过了,但似乎都没有用.使用断点加载它表明,由于某种原因,它会陷入getter方法的连续循环中.

这段代码是对的还是我做错了什么?

谢谢汤姆

cocoa objective-c ios

7
推荐指数
2
解决办法
6544
查看次数

通过XMPPFramework for iOS发送消息

如何通过XMPPFramework为objc和ios发送消息?

它现在真的让我烦恼.我需要使用一些自定义XML构建自定义方法并将其发送到特定的JID.

有任何想法吗?

谢谢.

iphone cocoa-touch xmppframework

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

处理codeigniter mysql插入中的重复键

我想做的是这样的:

function registerUser($username, $password){

$this->db->insert('tblUsers', array('username'=>$username, 'password'=>md5($password)));
if($this->db->_error_number()==1062){
    return "DUPLICATE";
}
return true;

}
Run Code Online (Sandbox Code Playgroud)

但是,如果有一个重复的密钥,那么它不会让我得到这个_error_number()位.它显示如下错误:

在此输入图像描述

如何让codeigniter停止出错并将错误号传递给我以便妥善处理?

谢谢

mysql codeigniter

7
推荐指数
2
解决办法
7812
查看次数

禁用UITextField上的触摸但不是所有用户交互

我有一个UITextField,但我希望能够控制它何时被聚焦以及什么时候没有聚焦.

为了实现这一点,我需要能够阻止该文本字段上的触摸事件.我知道我可以在它前面放一个按钮并手动执行它,但我想知道是否有任何方法只是禁用元素上的触摸.

非常感谢.

uitextfield touches ios

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

为什么MKMapView让我入海?

我有这个代码来设置用户位置的地图:

MKCoordinateSpan span;
span.latitudeDelta=0.2;
span.longitudeDelta=0.2; 

CLLocationCoordinate2D location=mapView.userLocation.coordinate;
location = mapView.userLocation.location.coordinate;

MKCoordinateRegion region;
region.span=span;
region.center=location;

[mapView setRegion:region animated:TRUE];
[mapView regionThatFits:region];
Run Code Online (Sandbox Code Playgroud)

现在,当我这样做时,mapView.showsUserLocation=YES它显示我在正确位置的位置(在我的设备上,以及模拟器中的苹果公司),但是,上面的代码两次都把我放在非洲附近的某个海域!

有任何想法吗?

iphone mapkit mkmapview

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

找到int的"字符串长度"

基本上我想返回int - >值中的位数,如下所示:

(int)1 => 1
(int)123 => 3
(int)12345678 => 8
Run Code Online (Sandbox Code Playgroud)

我对C一无所知,所以请耐心等待.我知道目标c,但我使用整数和浮点数代替NSNumbers.我意识到我可以将int转换成客观的c对象,但这看起来很冒险,如果我能用C做到这一点,我将会知道它的未来.

谢谢

c

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

addSubview增量保留计数?

我测试了它,看起来确实如此.所以我的问题是,它总是增加保留计数.

所以每次我做这样的事情:

UIView *theView = [[[UIView alloc] initWithFrame:(CGRect)aFrame] autorelease];
[self.view addSubview:theView];
Run Code Online (Sandbox Code Playgroud)

我实际上是在泄漏记忆吗?

我有一个全局属性@property (nonatomic, retain) UILabel *ingredientsTextLabel;,我viewDidLoad使用此代码实例化:

我只有名为的属性,在我的标题中没有属性,所以没有getter和setter.在我的viewDidLoad:

    ingredientsTextLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, ingredientsScrollView.frame.size.width, ingredientsScrollView.frame.size.height)];
    [ingredientsTextLabel setBackgroundColor:[UIColor clearColor]];
    [ingredientsTextLabel setFont:[UIFont fontWithName:@"Helvetica" size:18]];
    [ingredientsTextLabel setText:ingredientsText];
    [ingredientsTextLabel setNumberOfLines:0];
    [ingredientsTextLabel setLineBreakMode:UILineBreakModeWordWrap];
    NSLog(@"%i",[ingredientsTextLabel retainCount]); // here retain count is 1

    CGSize maxSize = CGSizeMake(ingredientsScrollView.frame.size.width, 9999);
    CGSize ingLabSize = [ingredientsText sizeWithFont:ingredientsTextLabel.font
                                    constrainedToSize:maxSize
                                        lineBreakMode:ingredientsTextLabel.lineBreakMode];

    [ingredientsTextLabel setFrame:CGRectMake(ingredientsTextLabel.frame.origin.x, ingredientsTextLabel.frame.origin.x, ingredientsTextLabel.frame.size.width, ingLabSize.height)];
    [ingredientsScrollView addSubview:ingredientsTextLabel];
    NSLog(@"%i",[ingredientsTextLabel retainCount]); // here retain count is 2! …
Run Code Online (Sandbox Code Playgroud)

iphone release retaincount

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

当mysql返回重复错误时获取记录的ID

当mysql错误返回重复键时,有没有办法在插入后检索记录(主键)的ID?

EG我将如何解决这个问题:

$sql = "INSERT INTO table (`col1`, `col2`) VALUES ('$val1', '$val2')";
$result = mysql_query($sql);
if($result){
  $id = mysql_insert_id();
}
else {
  if(stristr(mysql_error(), "duplicate"){
    $sql = "SELECT `id` FROM `table` WHERE `col1`='$val1' AND `col2`='$val2'";
    $result = mysql_query($sql);
    $row = mysql_fetch_array($result);
    $id = $row['id'];
  }
  else {
    die(mysql_error());
  }
}
Run Code Online (Sandbox Code Playgroud)

在这里,我不得不做两个sql语句,这不仅需要花费时间和精力,还需要重复代码.

我无法使用,ON DUPLICATE KEY UPDATE因为我想使用最后插入的id更新不同的表,或者无法复制的记录的id.

那么,我正在做我正在做的事情吗?或者有没有办法获得行的ID?

谢谢

php mysql

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