小编Tie*_*eme的帖子

为什么不能在objective-c中创建抽象类

因为在objective-c中创建抽象类是不可能的,我想知道是否有人能告诉我为什么 objective-c的创建者没有将这个功能添加到该语言中.

*当然有一些解决方法来创建一个抽象类 - 但这不是我的意思.

abstract-class objective-c

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

如何使用mocha测试使用whatwg-fetch的代码?

我使用https://github.com/github/fetch在我的应用程序,它工作正常,但我想测试我的代码以摩卡和巴贝尔,因为我在写ES2016.

这不是开箱即用的.我越来越:

1) testApi.js Test api error handling:
 ReferenceError: fetch is not defined
  at callApi (callApi.js:10:10)
  at Context.<anonymous> (testApi.js:8:40)
Run Code Online (Sandbox Code Playgroud)

因为没有定义fetch.当我为浏览器构建时,webpack会公开fetch.

我尝试过使用https://github.com/bitinn/node-fetch,但是api略有不同,例如需要完整的url而不是相对路径.

有这个问题的解决方案吗?

javascript testing mocha.js fetch

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

如何在iOS 13中支持低数据模式?

iOS 13中引入了“低数据模式”。请参阅Apple的iOS 13概述的 “设置”部分:

低数据模式

我找不到与此有关的任何开发人员文档。

如MacRumors所说,这是第三方应用程序开发人员可以选择的吗?还是如AppleInsider所建议的那样,当未连接到Wi-Fi时,它只是暂停后台活动吗?

networking ios swift ios13

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

打开session.cookie_secure会注销我的用户吗?

我正在运行https网站,并希望在php.ini中打开这些以提高安全性:

session.cookie_httponly = 1
session.cookie_secure = 1
Run Code Online (Sandbox Code Playgroud)

我可以在网上找到很多关于这方面的信息,但是没有关于打开它时旧会话ID的持久性.

可以切换这个导致自动注销的用户,因为php现在需要安全的cookie,但登录的用户没有那些..只是在切换后?

php security session-cookies

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

在哪种情况下调用Facebook IOS FBSessionDelegate方法?

我很清楚,如果用户授予或拒绝许可,则会在登录时调用这些内容:

- (void)fbDidLogin;
- (void)fbDidNotLogin:(BOOL)cancelled;
Run Code Online (Sandbox Code Playgroud)

但我想知道何时可以调用以下FBSessionDelegate方法:

- (void)fbDidExtendToken:(NSString*)accessToken expiresAt:(NSDate*)expiresAt;
- (void)fbDidLogout;
- (void)fbSessionInvalidated;
Run Code Online (Sandbox Code Playgroud)

文件说:

//Called after the access token was extended.
- (void)fbDidExtendToken:(NSString*)accessToken expiresAt:(NSDate*)expiresAt;

//Called when the user logged out. 
- (void)fbDidLogout;

//Called when the current session has expired.
- (void)fbSessionInvalidated;
Run Code Online (Sandbox Code Playgroud)

现在什么时候会发生这样的事情?当我打电话给以下?

[Facebook authorize:nil];
Run Code Online (Sandbox Code Playgroud)

我没有机会得到一个fbDidLogout回电权吗?

也许如果用户通过Facebook应用程序从他的Facebook帐户中删除我的应用程序,这个方法会被调用吗?不,因为在那种情况下我的应用程序无法打开..

......所以在哪种情况下会被称为?

facebook fbconnect ios

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

将sass-loader与css-modules结合使用时出错

使用SASS时出现以下错误map-get.

ERROR in ./src/special.scss
Module build failed: ModuleBuildError: Module build failed: Unknown word (11:14)

   9 |
  10 | @mixin mediaquery($name) {
> 11 |     @media #{map-get($breakpoints, $name)} {
     |              ^
  12 |         @content;
  13 |     }
  14 | }
Run Code Online (Sandbox Code Playgroud)

这只发生在我同时使用sass-loader和另一个加载器时.

首先认为这是由PostCSS Loader引起的,但似乎是sass-loading导致问题而且在使用时不会改变scss css-modules.

我已经创建了一个示例代表来说明问题:https://github.com/tiemevanveen/sass-css-components-fail-example.

您可以使用不同的分支进行测试:

只有第一个和最后一个分支运行没有错误.

我已经创建了日志源示例,以查看sass-loader返回的内容,看起来它并没有改变sass(但这也可能是我误解了加载器的工作方式).

没有css模块的另一个例子确实显示了正确的转换代码.. …

sass webpack css-modules

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

C++检测输入重定向

可能重复:
检测stdin是C/C++/Qt中的终端还是管道?

考虑我们有一个小程序,需要一些标准的C输入.

我想知道用户是否正在使用输入重定向,例如:

./programm < in.txt
Run Code Online (Sandbox Code Playgroud)

有没有办法程序中检测这种输入重定向方式?

c++ iostream io-redirection

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

在tableview中显示数组和字典值

我创建了一个数组,两个词典和一个tableview.tableview应显示数组的内容,该数组包含字典数据.当我尝试使用"[mArray addObject:(mDictionary)];"显示它时 它抛出异常,但如果我使用"[mArray addObject:[mDictionary objectForKey:@"firstname"]];" 它的工作正常.

你能帮助我理解它为什么会发生并且不能在不使用"objectForKey"的情况下显示字典值吗?

这是我的"ViewController.m".

#import "ViewController.h"

@implementation ViewController
- (void)viewDidLoad
{
    [super viewDidLoad];
    mArray = [[NSMutableArray alloc]init];
    mDictionary = [[NSMutableDictionary alloc]init];
    [mDictionary setValue:@"shanu" forKey:@"firstname"];
    [mDictionary setValue:@"kumar" forKey:@"lastname"];
    mDictionary2 = [[NSMutableDictionary alloc]init];
    [mDictionary2 setValue:@"hgjghjgf" forKey:@"firstname1"];
    [mDictionary2 setValue:@"ghjgjgfj" forKey:@"lastname1"];
    [mArray addObject:mDictionary];
    [mArray addObject:mDictionary2];

    CGRect frame = self.view.frame;
    UITableView *tableView = [[UITableView alloc]initWithFrame:frame style:UITableViewStylePlain];
    tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
    tableView.backgroundColor = [UIColor cyanColor];
    tableView.separatorColor = [UIColor blackColor];
    tableView.delegate = self;
    tableView.dataSource = self;
    [self.view addSubview:tableView];
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section …
Run Code Online (Sandbox Code Playgroud)

objective-c nsmutablearray ios

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

父级的CKEditor"溢出:滚动"导致工具栏在初始位置冻结

当您将div中的CKEditor添加到div中的div时:"overflow:scroll"滚动父div时工具栏将不会移动...

<div id="wrapper" style="overflow: scroll;">
    <div contenteditable="true">This is the ckedito</div>     
</div>
Run Code Online (Sandbox Code Playgroud)

一个例子可以在这里找到:http://jsfiddle.net/W8Dt4/

有谁知道围绕这个问题的解决方法?

我认为理想的行为是:

  • 当有足够的空间时,将工具栏保持在编辑器div的顶部.
  • 当顶部没有足够的空间并且底部有足够的空间时,将工具栏移动到编辑器div的底部.

overflow ckeditor

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

NSDateComponents返回错误的工作日

如果您将运行以下代码:

// January 16th 2015 10:20 AM in Amsterdam
var date = NSDate(timeIntervalSince1970: 1421400000)

var formatter = NSDateFormatter()
formatter.dateFormat = "dd-MMM"

let calendar = NSCalendar.currentCalendar()
calendar.firstWeekday = 2 // default when region == Netherlands

let units = NSCalendarUnit.YearCalendarUnit | NSCalendarUnit.MonthCalendarUnit
    | NSCalendarUnit.WeekOfMonthCalendarUnit | NSCalendarUnit.DayCalendarUnit
    | NSCalendarUnit.WeekdayCalendarUnit

// Loop days in January
for day in 1...14 {

    // select day in month
    var components = calendar.components(units, fromDate: date)
    components.day = day

    // get day and components
    let _date = calendar.dateFromComponents(components)!
    var …
Run Code Online (Sandbox Code Playgroud)

nsdatecomponents ios swift

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