小编Jea*_*ean的帖子

SQL Server:SELECT n FROM(VALUES(0),(0),(0),(0))t(n)

我在脚本中看到了这一点

SELECT n FROM (VALUES(0),(0),(0),(0)) t(n)
Run Code Online (Sandbox Code Playgroud)

我知道它的作用.它返回一个名为'n'的列,有4行,每列的值为0.但是,这是什么意思?什么是t(n),什么是'n'?

sql-server

3
推荐指数
2
解决办法
2401
查看次数

将五个字符串传递给objective-c xcode中的方法

我只是在考虑一个编程设计问题:

比如,我将5个字符串传递给从一个类到另一个类的方法.它们的详细信息如下:主机名主机域用户子域用户名密码

哪个更好?1.将它们作为NSString对象的数组传递或2.重新定义被调用的方法以接受5个不同的NSString参数?

这是一种更有效的方法吗?

objective-c nsstring

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

iOS:日期转换导致错误的日期

我以前用几种格式做了好几次.无法理解这里有什么可以忽略的!日期转换不能那么难!:)但似乎太烦人了.我得到这样的字符串: 2013年8月9日06:44:01:950AM

我试图用这段代码将它转换为日期:

[Date_Converter getDateFromString:date withFormat:@"MMM dd YYYY HH:mm:ss:SSSa"]
Run Code Online (Sandbox Code Playgroud)

并在DateConverter.m中

+(NSDate *) getDateFromString:(NSString *) strDate
                   withFormat:(NSString *) format {

    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setDateFormat:format];
    //[formatter setTimeZone:[NSTimeZone localTimeZone]];
    NSDate *dateFromStr = [formatter dateFromString:strDate];
    return dateFromStr;
}
Run Code Online (Sandbox Code Playgroud)

NSDate从上面的方法得到的返回值是这个! 2013-01-04 19:14:01 +0000

输入日期为 2013年8月9日06:44:01:950AM

怎么会这样?对于各种其他日期格式,我已经多次使用相同的方法.请帮忙.我在这里俯瞰什么?

更新 将格式更改为

[Date_Converter getDateFromString : date
       withFormat : @"MMM dd yyyy hh:mm:ss:SSSa"];
Run Code Online (Sandbox Code Playgroud)

但它仍然返回null.请帮助.

最后提供了什么 添加[formatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]]; 到目前为止转换为@MartinR建议如下!

iphone objective-c nsdate nsdateformatter ios

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

如何将Facebook整合到iPhone App中

我知道这是一个经常被问到的问题; 但我的观点是:从iPhone App连接到FB的推荐或经过验证的方法是什么.

类型1:我在这里看到了教程.它使用AsiHttpRequest,Json库在FB墙上发布.

类型2:有一个教程在这里上Facebook网站本身,这是使用相同的图形API,但好像是用不同的API调用张贴在墙上,登录等.

以上两种哪种更好?Type-1使用外部库,但教程非常明确.Type-2似乎直接来自Facebook,但后来不知道教程是如何更新/过时的(没有指明日期).

iphone facebook-graph-api ios

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

将'const char*'发送到'const uint8_t*'类型的参数错误

我正在编写一个iOS应用程序,我已经在Constants文件中声明了一个字符串常量:

NSString * const kHeader = @"name,age,gender";
Run Code Online (Sandbox Code Playgroud)

在Constants.h中

FOUNDATION_EXPORT NSString * const kHeader;
Run Code Online (Sandbox Code Playgroud)

并尝试将此字符串写入ViewController类中的NSOutput流,如下所示:

[outputStream写:[kHeader UTF8String] maxLength:[kHeader length]];

这显示了一个编译器警告:将 'const char*'发送到'const uint8_t*'类型的参数(又名'const unsigned char*')在指向不同符号的整数类型的指针之间进行转换

这是什么意思?我该如何解决这个问题?请帮忙.Googl'ing没有产生太多有用的结果.

objective-c compiler-warnings ios

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

使用 t(n) 和多个交叉连接进行查询

我试图从 Stackoverflow 线程中理解这个查询:

--create test table
CREATE TABLE dbo.TestTable(
      Col1 nchar(4000) NOT NULL
    , Col2 nvarchar(MAX) NOT NULL
    );

--load 10000 rows (about 2.8GB)
WITH 
    t4 AS (SELECT n FROM (VALUES(0),(0),(0),(0)) t(n))
    ,t256 AS (SELECT 0 AS n FROM t4 AS a CROSS JOIN t4 AS b CROSS JOIN t4 AS c CROSS JOIN t4 AS d)
    ,t16M AS (SELECT ROW_NUMBER() OVER (ORDER BY (a.n)) AS num FROM t256 AS a CROSS JOIN t256 AS b CROSS JOIN t256 AS …
Run Code Online (Sandbox Code Playgroud)

t-sql sql-server

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

核心图:标签策略不是自动时,不会出现网格线

我试图在iPhone应用程序中使用Core Plot绘制简单的统计数据.我最初使用标签政策作为两个轴的CPTAxisLabelingPolicyAutomatic,并且网格线看起来很好,如下所示:

在此输入图像描述

您可以看到图形具有垂直和水平网格线.然后,我将标签政策更改为

    axisSet.xAxis.labelingPolicy = CPTAxisLabelingPolicyNone;
    axisSet.yAxis.labelingPolicy = CPTAxisLabelingPolicyAutomatic;

NSUInteger labelLocation = 0;
NSMutableArray *customLabels = [NSMutableArray arrayWithCapacity:xAxisLabels.count];
CPTMutableTextStyle *textStyle = [[CPTMutableTextStyle alloc] init];
textStyle.color = [CPTColor lightGrayColor];

for (NSNumber *tickLocation in customTickLocations) {
    CPTAxisLabel *newLabel = [[CPTAxisLabel alloc]
                              initWithText:[NSString stringWithFormat:@"%@",(NSDate *)[xAxisLabels objectAtIndex:labelLocation++]] textStyle:textStyle];
    newLabel.tickLocation = [tickLocation decimalValue];
    newLabel.rotation = 25.0;
    newLabel.offset = 10.0;
    [customLabels addObject:newLabel];
}
axisSet.xAxis.axisLabels =  [NSSet setWithArray:customLabels];
Run Code Online (Sandbox Code Playgroud)

但是,因为当我为X轴添加自定义标签时,X轴网格线(即垂直线)没有出现.只能看到水平网格线,您可以在App的下方屏幕截图中看到:

在此输入图像描述

core-plot ios

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