小编giu*_*ppe的帖子

在PHP中解析包含点的字符串

我会解析以下字符串:

$str = 'ProceduresCustomer.tipi_id=10&ProceduresCustomer.id=1';                 
parse_str($str,$f);
Run Code Online (Sandbox Code Playgroud)

我希望将$ f解析为:

array(
    'ProceduresCustomer.tipi_id' => '10',
    'ProceduresCustomer.id' => '1'
)
Run Code Online (Sandbox Code Playgroud)

实际上,parse_str回报

array(
        'ProceduresCustomer_tipi_id' => '10',
        'ProceduresCustomer_id' => '1'
    )
Run Code Online (Sandbox Code Playgroud)

除了编写我自己的函数之外,还有人知道是否有php函数吗?

php parsing

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

Core Graphics的内存问题

我通过使用Core Graphics的原语"手动"绘制表格.单击按钮时,视图将重新绘制.问题是,当我在Instruments中分析代码时,VM区域会不断增加,而堆和匿名VM会振荡(我希望它).

在此输入图像描述

有关CoreAnimation的详细信息:

在此输入图像描述

我的drawRect的摘录:

- (void)drawRect:(CGRect)rect
{

    // Drawing code
    CGContextRef context     = UIGraphicsGetCurrentContext();

    CGRect paperRect         = CGRectMake(self.bounds.origin.x+hourLabelSize+self.marginX,
                                           10 +self.cellBorder  ,
                                          self.bounds.size.width,
                                          self.cellHeight * 48
                                          );
    // custom shadow
    drawLinearGradient(context, paperRect, whiteColor.CGColor, lightGrayColor.CGColor);
    CGContextSaveGState(context);
    CGFloat outerMargin = 5.0f;
    CGFloat eventSize;
    // Draw table
    CGRect hourRect;
    CGRect outerRect;
    CGMutablePathRef outerPath;
    CGRect strokeRect;
    CGRect rowRect;
    for (int j=0; j < 7;j++)
    {
    for (int i=0; i < numberOfRows; i++)
    {
        // Odd index means we are in the half of an hour …
Run Code Online (Sandbox Code Playgroud)

memory-leaks memory-management core-animation core-graphics ios

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

Laravel获取配置变量

在Laravel 5.0(我知道它已经老了,但项目不是我的)我开始了 config/app.php

return [
...
'languages' => ['en','it'],
...
]
Run Code Online (Sandbox Code Playgroud)

然后,我有一个刀片包装 resources/views/frontend/includes/menus/guest.blade.php

 @foreach (Config::get('languages') as $lang => $language)
Run Code Online (Sandbox Code Playgroud)

但是,Laravel说foreach没有有效的参数,这意味着Config :: get('languages')返回null.我无法在app.php中设置自定义变量?

laravel

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

在UITableViewCell中获取UITextField行

UITextFields在一个自定义单元格中有两个UITableView.我需要编辑和存储textFields的值.当我在里面单击时,UITextField我必须知道它所属的行,以便将值保存到本地数组的正确记录中.如何获取textField的行索引?我试过了 :

-(void)textFieldDidBeginEditing:(UITextField *)textField
{

     currentRow = [self.tableView indexPathForSelectedRow].row;


}
Run Code Online (Sandbox Code Playgroud)

但当我点击UITextFieldRow时,currentRow不会改变.只有当我点击(选择)整行时才会改变...

uitableview uitextfield ios

4
推荐指数
3
解决办法
4485
查看次数

单击时未调用UITableView didSelectRowatIndexPath

非常奇怪!它适用于所有地方但在这里

- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

{
 MyViewController* cliente = [[MyViewController alloc] initWithModeAndClientId:2 c:cid];

            cliente.delegate                    = self;
            UINavigationController *n = [[UINavigationController alloc] initWithRootViewController:cliente];

            n.navigationBarHidden     = NO;
            [[n navigationBar] setBarStyle:UIBarStyleBlack];
            [self presentViewController:n animated:YES completion:nil];
}
Run Code Online (Sandbox Code Playgroud)

如果我点击该行点击一下,MyViewController几秒钟后即可显示!如果我点击两次,它会迅速显示!在Profiler中,单击没有任何反应......我没有didDeselectRowAtIndexPath方法.

uitableview ios

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

按多个空格NodeJS拆分字符串

我在节点中有这个:

>out
'java    1303 root  187u   CHR  166,0      0t0 14586 /dev/ttyACM0\n'
>typeof out
'string'
> out.split("\\s+"); 
[ 'java    1303 root  187u   CHR  166,0      0t0 14586 /dev/ttyACM0\n' ]
Run Code Online (Sandbox Code Playgroud)

我希望分裂的字符串,例如['java','1303','root'...]

javascript string node.js

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

PNG图像从未取消分配

内存调试仍然很痛苦.我使用导航控制器加载了4个VC.每个VC都有自己的PNG图像,用于多个控件.在Instruments中,我意识到大多数VM区域都被ImageIO_PNG_Data占用.当我推送/弹出VC时,那些VM增加并且永不减少(我假设dealloc某些VC也会释放图像). 在此输入图像描述

当然,调试是在模拟器中完成的.

memory-management instruments ios

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

NSCalendar月份范围

这段代码

NSDateComponents *component = [[NSDateComponents alloc] init];
NSCalendar       *gregorian = [[NSCalendar alloc]   initWithCalendarIdentifier:NSGregorianCalendar];
[component setMonth:1];
[component setYear:2013];
[component setDay:1];
currentMonth = [gregorian dateFromComponents:component];
NSLog(@"Date in MonthView %@ ",currentMonth);
Run Code Online (Sandbox Code Playgroud)

给我以下日期

Date in MonthView 2012-12-31 23:00:00 +0000
Run Code Online (Sandbox Code Playgroud)

为什么?月份范围应该从0到11?

nscalendar ios

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

NSDictionary misteries

我用过很多次:

NSMutableDictionary* temp   = [[NSMutableDictionary alloc] init];
[temp setDictionary:[[NSDictionary alloc] initWithObjectsAndKeys:
                                            [currentEvent objectForKey:@"title"],@"titolo",
                                            [currentEvent objectForKey:@"testo"],@"testo",
                                            [currentEvent objectForKey:@"start"],@"date",
                                            [NSString stringWithFormat:@"%d",lastId],@"att_id",
                                            [currentEvent objectForKey:@"pr_id"],@"pr_id",
                                            nil]];
            NSLog(@"%@",temp);
Run Code Online (Sandbox Code Playgroud)

但这一次,日志打印出来:

2013-11-22 14:39:08.152 MyApp[93198:70b] {
    titolo = asdasda;
}
Run Code Online (Sandbox Code Playgroud)

为什么它只是一个对象?在调试器中,我可以看到currentEvent已经设置了所有kesy/objest ...

nsdictionary ios

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