小编Bha*_*vin的帖子

在php中替换Array中的Object

我有一个数组有多个对象(比如3个对象),每个对象有3个"键 - 值"对.

$PredefinedResult 是这样的:

[
    {
        "EffectiveStatusId":0,
        "EffectiveStatus":"abc",
        "RecordCount":0
    },
    {
        "EffectiveStatusId":0,
        "EffectiveStatus":"def",
        "RecordCount":0
    },
    {
        "EffectiveStatusId":0,
        "EffectiveStatus":"ghi",
        "RecordCount":0
    }
]
Run Code Online (Sandbox Code Playgroud)

我有另一个对象数组,其名称为$MainResult:

[
    {
        "EffectiveStatusId":1,
        "EffectiveStatus":"abc",
        "RecordCount":7
    },
    {
        "EffectiveStatusId":6,
        "EffectiveStatus":"def",
        "RecordCount":91
    }
]
Run Code Online (Sandbox Code Playgroud)

预期结果 :

我想用对象替换里面的类似$PredefinedResult对象,$MainResult并希望得到如下结果:

[
    {
        "EffectiveStatusId":1,
        "EffectiveStatus":"abc",
        "RecordCount":7
    },
    {
        "EffectiveStatusId":6,
        "EffectiveStatus":"def",
        "RecordCount":91
    },
    {
         "EffectiveStatusId":0,
         "EffectiveStatus":"ghi",
         "RecordCount":0
    }
]
Run Code Online (Sandbox Code Playgroud)

我尝试了什么:

我试过这个代码,但它没有给我想要的结果.

$FinalResult = array_replace($PredefineResult,$MainResult);
Run Code Online (Sandbox Code Playgroud)

任何人都可以帮助我如何获得上面提到的预期结果?

php arrays codeigniter object

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

与textfield的iphone alertview

我有UIAlertView一个UITextField在里面.我想键入邮件ID并提交UIAlertViewOK按钮,但UITextFieldUIAlertView没有响应,请帮帮我.

thankz

iphone cocoa-touch objective-c uialertview

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

为什么didEnterRegion叫了两次?

我在我的iOS应用程序中使用位置服务即区域监控,这是我的代码

//this for creating region
-(void)createRegion
{
    [dictionary setValue:@"23 St, New York" forKey:@"title"];
    [dictionary setValue:[NSNumber numberWithDouble:40.742878] forKey:@"latitude"];
    [dictionary setValue:[NSNumber numberWithDouble:-73.992821] forKey:@"longitude"];
    [dictionary setValue:[NSNumber numberWithDouble:(300.0)] forKey:@"radious"];

    [regionArray addObject:[self mapDictionaryToRegion:dictionary]];
    [self initializeRegionMonitoring:regionArray];
}
- (CLRegion*)mapDictionaryToRegion:(NSDictionary*)dictionary {
    NSString *title = [dictionary valueForKey:@"title"];

    CLLocationDegrees latitude = [[dictionary valueForKey:@"latitude"] doubleValue];
    CLLocationDegrees longitude =[[dictionary valueForKey:@"longitude"] doubleValue];
    CLLocationCoordinate2D centerCoordinate = CLLocationCoordinate2DMake(latitude, longitude);

    CLLocationDistance regionRadius = [[dictionary valueForKey:@"radius"] doubleValue];

    return [[CLRegion alloc] initCircularRegionWithCenter:centerCoordinate
                                                   radius:regionRadius
                                               identifier:title];
}

- (void) initializeRegionMonitoring:(NSArray*)geofences {
    if(![CLLocationManager regionMonitoringAvailable]) {
       // [self showAlertWithMessage:@"This app requires …
Run Code Online (Sandbox Code Playgroud)

iphone cllocationmanager ios clregion

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

如果文本是阿拉伯语,请将UILabel文本右对齐

我在iOS App中实现了语言本地化.所以,现在用户可以在我的iPad应用程序中设置阿拉伯语.

我从服务器获取本地化的字符串响应,现在我想使用右对齐将此本地化字符串设置为我UILabel右到左格式.

更新:

我的服务器响应已经是RTL格式.现在,我只想在我的阿拉伯文本中设置文本对齐方式UILabel.

现在我必须编写代码来设置UILabel基于语言的对齐方式.

所以,我只是想知道是否有任何可用的属性UILabel,我可以UILabel在阿拉伯语的情况下制作右对齐的文本.

iphone objective-c alignment uilabel ios

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

多值网址地址簿iphone

我想在地址簿中创建一个新联系人.当您想要存储更多URL(Web地址到某些社交网络)时,会出现此问题.我的代码在iOS6的模拟器中完美运行.但在使用iOS6的真实iPhone中,存储除网址之外的所有值.我一直在找几天找不到解决办法,如果有人能提供帮助,我将非常感激.

我的代码:

-(void) addContactToAddressBook:(ABAddressBookRef) iPhoneAddressBook 
{

    CFErrorRef error = NULL;

    ABRecordRef newPerson = ABPersonCreate();

    //Name and phone number
    ABRecordSetValue(newPerson, kABPersonFirstNameProperty, (__bridge CFStringRef)_nameField.text, &error);
    ABMutableMultiValueRef multiPhone = ABMultiValueCreateMutable(kABMultiStringPropertyType);
    ABMultiValueAddValueAndLabel(multiPhone, (__bridge CFStringRef)_phoneField.text, kABPersonPhoneMainLabel, NULL);
    ABRecordSetValue(newPerson, kABPersonPhoneProperty, multiPhone,nil);

    //Email value
    ABMutableMultiValueRef emailMultiValue = ABMultiValueCreateMutable(kABMultiStringPropertyType);
    ABMultiValueAddValueAndLabel(emailMultiValue, (__bridge CFStringRef)_emailField.text, kABWorkLabel, NULL);
    ABRecordSetValue(newPerson, kABPersonEmailProperty, emailMultiValue, nil);
    CFRelease(emailMultiValue);

    //URL values
    ABMutableMultiValueRef urlMultiValue = ABMultiValueCreateMutable(kABMultiStringPropertyType);
    ABMultiValueAddValueAndLabel(urlMultiValue, (__bridge CFStringRef)_FacebookField.text, (CFStringRef)@"Facebook", NULL);
    ABMultiValueAddValueAndLabel(urlMultiValue, (__bridge CFStringRef)_twitterField.text, (CFStringRef)@"Twitter", NULL);
    ABMultiValueAddValueAndLabel(urlMultiValue, (__bridge CFStringRef)_linkedinField.text, (CFStringRef)@"Linkedin", NULL);
    ABMultiValueAddValueAndLabel(urlMultiValue, (__bridge CFStringRef)_googleField.text, (CFStringRef)@"Google+", NULL);
    ABRecordSetValue(newPerson, kABPersonURLProperty, urlMultiValue, …
Run Code Online (Sandbox Code Playgroud)

iphone xcode objective-c ios ios6

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

无法在iPhone上的html5视频标签上显示.mov文件

我尝试了不同的方法,用Iphone在HTML5页面上显示.mov视频(在linux上的"ISO Media,Apple QuickTime电影"),但它无效.

我的代码是:

<video width="320" height="240">
 <source src="test.mov">
</video>
Run Code Online (Sandbox Code Playgroud)

使用所有桌面浏览器(chrome,firefox ....),我可以显示视频.

任何的想法?

提前致谢.

iphone video html5 mov

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

Hibernate Collection缓存:如何使用?

我有两个实体 Book 和 Author。本书有作者的集合。我使用二级缓存来保存 Book 实体及其作者。调试时,我可以看到putForExternalReadBook 实例和集合中的每个作者都在发生。但是当我find(Book.class, ISBN)再次调用方法时,它只为书使用缓存,而每次从数据库中检索作者的集合。每次作者集合都放在二级缓存中。请让我知道是否需要更改缓存访问策略以进行收集。我正在使用 Jboss 6.0 Infinispan 5. 和 postgres 9 DBMS。

这是我的代码

package bookentity.ejb;
Run Code Online (Sandbox Code Playgroud)

/* * 要更改此模板,请选择工具 | 模板 * 并在编辑器中打开模板。*/

import java.io.Serializable;
import java.util.ArrayList;
import javax.persistence.Cacheable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.ManyToMany;
import javax.persistence.JoinTable;
//import javax.persistence.JoinColumns;
import javax.persistence.JoinColumn;
import java.util.Collection;
import java.util.List;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
//import javax.persistence.inv
import javax.persistence.OneToMany;



@Entity
@Cacheable
@Table(name = "BOOK")
@NamedQueries({@NamedQuery(name="findBookByAuthorName",query="SELECT b FROM Book b,            Author a …
Run Code Online (Sandbox Code Playgroud)

collections hibernate second-level-cache infinispan

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

删除表格行时,整个单元格移动到左侧,如何避免这种情况?

我有我的所有视图创建的MainStoryboard.storyboard文件.其中,我的一个视图控制器场景包含UITableView,其中包含3个不同的UITableViewCell.在三个中,两个是默认的UITableViewCell,而一个是CustomCell.请在下面找到相同的内容:

对于使用cell.textLabel.text显示文本的默认单元格

(图1:对于使用cell.textLabel.text显示文本的默认单元格)

对于自定义单元格,其中实现了自定义单元格类,并且UI基于故事板设计.

(图2:对于自定义单元格,其中实现了自定义单元格类,并且UI基于故事板设计.)

但是,在将此tableview更改为编辑模式时,为此单元格选择减号,单元格确实移动到左侧,因此其中的文本看起来像是从左侧裁剪的.这种情况仅适用于iOS7而非iOS6.

请让我知道可能是什么解决方案.

uitableview ipad ios uistoryboard ios7

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

表单数据丢失

我在codeigniter中有一个php应用程序,我遇到了以下问题.随机提交带有Ipad的表单时,会丢失帖子数据.我试过以四种不同的方式访问帖子数据.

print_r($this->input->post());
print_r($_POST);
print_r(file_get_contents('php://input'));
print_r($_REQUEST);
Run Code Online (Sandbox Code Playgroud)

所有这些都不返回任何内容或空数组.这种情况似乎只发生在使用Ipad或Iphone时,但它已经发生了一次桌面游览中的50多次测试.当在PC浏览器上大约100次测试时(firefox,chrome,IE)它没有发生,只有一次在safari中.

表格的代码;

<form id="email_report_form" name="email_report_form" method="post" accept-charset="utf-8" action="/handleajax/email_page" class="email_report_form ajaxform" onsubmit="return validate();">
    <div class="form_step_container clearfix">
        <div class="element clearfix">
            <div class="col_left">
                <label>Email: <span class="required">*</span></label>
            </div>
            <div class="col_right">
                <input type="text" name="form_email_to" id="form_email_to"  />
                <div>&nbsp;</div>
                <label>Separate multiple email addresses with a comma</label>
            </div>
        </div>
        <div class="element clearfix">
            <div class="col_left">
                <label>Your Message:</label>
            </div>
            <div class="col_right">
                <textarea name="form_email_message" cols="125" rows="5" onkeypress="return checkLength(event, this, 1000);"></textarea>
                <label>(Maximum of 1000 characters)</label>
                <br />
                <input type="hidden" name="redirect_path" id="redirect_path" value="" />
                <input type="submit" value="Send" class="btn …
Run Code Online (Sandbox Code Playgroud)

javascript php post codeigniter

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

ios项目的sqlcipher版本迁移

我正在使用旧版本的sqlcipheropen ssl应用程序。现在我为了Xcode 5iOS 7兼容性而迁移到新版本,但它没有解密旧版本的数据库。

请帮帮我。我在谷歌上搜索,发现cipher_migrate必须使用类似的东西,但不知道如何使用它。

database iphone openssl ios sqlcipher

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