小编sel*_*tch的帖子

在LEFT JOIN中使用变量作为表名的MYSQL查询

SELECT var1,var2,var3,table_name 
FROM table1 LEFT JOIN table_name on var3=table_name.id
Run Code Online (Sandbox Code Playgroud)

意思是我想动态地离开连接表,取决于table_namefrom的值table1,因为var3从那里获取.

但以上查询结果如下

table table_name不存在

我的mysql限制错误?

mysql left-join

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

.draggable的Jquery .trigger('stop')方法

$('#element').draggable ({
    stop: function () {
        alert ('stopped');
        //do some action here
    }
}).trigger('stop');
Run Code Online (Sandbox Code Playgroud)

没有任何反应,思想#element现在是可拖动的,事件在拖动完成后执行.我尝试.triggerHandle过和'dragstop'eventtype一样,没有运气

jquery event-handling draggable

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

objective-c实例变量

几年前有一个问题是re-instance vs class方法.它用以下代码说明.我理解大部分,除了为什么我需要实例变量"age"和实例方法"age"?

不会使用@synthetize创建实例变量"age"的getter和setter吗?

Static int numberOfPeople = 0;

@interface MNPerson : NSObject {
     int age;  //instance variable
}

+ (int)population; //class method. Returns how many people have been made.
- (id)init; //instance. Constructs object, increments numberOfPeople by one.
- (int)age; //instance. returns the person age
@end

@implementation MNPerson
- (id)init{
    if (self = [super init]){
          numberOfPeople++;
          age = 0;
    }    
    return self;
}

+ (int)population{ 
     return numberOfPeople;
}

- (int)age{
     return age;
}

@end
main.m:

MNPerson *micmoo = [[MNPerson …
Run Code Online (Sandbox Code Playgroud)

variables methods class objective-c instance

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

成功doinbackground调用时禁用Android禁用按钮

以下代码在行上提供致命异常异步任务#2 v1.setEnabled(false).

这意味着在成功通话时禁用按钮.在v.setEnabled(false);之前的后台任务运行良好.请帮忙 :(

public void onClick(View v) {
    Intent intent = new Intent(DISPLAY_MESSAGE_ACTION);
    //this one would work
    //v.setEnabled(false);

    final View v1=v;
    mRegisterTask1 = new AsyncTask<Void, Void, Void>() {

    @Override
    protected Void doInBackground(Void... params) {
        boolean success = 
            ServerUtilities.receipt (((String)v1.getTag()).substring(3),"acknowledged");

        if (success) {
            //this one causes Async Task exception
            v1.setEnabled(false);
        } 
        else {
        }
        return null;
    }

    @Override
    protected void onPostExecute(Void result) {
        mRegisterTask1 = null;
    }
Run Code Online (Sandbox Code Playgroud)

android asynchronous fatal-error

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

Objective-c添加具有不同属性的数组相同实例

我正在尝试以下代码来创建实例,分配属性,添加到数组.然后,分配新属性并再次添加.但是,数组将包含2个相同的对象(等于添加的第二个对象).Message类只有几个(非原子的,保留的)NSStrings/Integer属性.这可能与我对指针的理解有关,有人可以解释一下吗?

    self.messages=[[NSMutableArray alloc]init];
    Message *m=[[Message alloc]init];
    m.cb=@"2402";
    m.ck=1001;
    m.msg=@"as";
     [self.messages addObject:m];

    m.cb=@"2422";
    m.ck=1002;
    m.msg=@"aadfsdsdfdssdklsdflkh";
    [self.messages addObject:m];
    NSLog(@"%@",self.messages);
Run Code Online (Sandbox Code Playgroud)

arrays objective-c ios

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

objective-c语法 - 为什么使用methodNameVariable :( type)变量anotherVariable :( type)anotherVariable

我知道的大多数语言使用以下语法:

function name (var1,var2,var3) {
    //do stuff with variables
}
Run Code Online (Sandbox Code Playgroud)

然而,Objective-C使结构更加复杂

- (function type) functionName:(type)var1 var2:(type) var2  var3:(type) var3{
}
Run Code Online (Sandbox Code Playgroud)

为什么不

- (function type) functionName:(type) var1 (type) var2 (type) var3{
}
Run Code Online (Sandbox Code Playgroud)

有可能做到以下,它会产生什么意义?

- (function type) functionName:(type)var1 randomName:(type) var2  anotherName:(type) var3{
}
Run Code Online (Sandbox Code Playgroud)

syntax objective-c

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