我正在尝试将Bower用于Web应用程序,但发现自己遇到了某种代理问题:
D:\>bower search jquery
bower retry Request to https://bower.herokuapp.com/packages/search/jquery failed with ECONNRESET, retrying in 1.2s
bower retry Request to https://bower.herokuapp.com/packages/search/jquery failed with ECONNRESET, retrying in 2.5s
bower retry Request to https://bower.herokuapp.com/packages/search/jquery failed with ECONNRESET, retrying in 6.8s
bower retry Request to https://bower.herokuapp.com/packages/search/jquery failed with ECONNRESET, retrying in 15.1s
bower retry Request to https://bower.herokuapp.com/packages/search/jquery failed with ECONNRESET, retrying in 20.3s
bower ECONNRESET Request to https://bower.herokuapp.com/packages/search/jquery failed: tunneling socket could not be established, cause=Parse Error
Run Code Online (Sandbox Code Playgroud)
相关要点:
如何测试Swift 2.0中的函数是否抛出?如何断言正确ErrorType抛出?
我使用UITextViewDelegate和添加InputAccessoryView中textViewDidBeginEditing:
[textView setInputAccessoryView:doneBar];
Run Code Online (Sandbox Code Playgroud)
doneBar不是零,它出现在第二次打开时.
有没有其他人这个问题?
提前致谢.
我想要得到一个宽度UIBarButtonItem.
这不起作用:
barbuttonitem.customView.frame.size.width
Run Code Online (Sandbox Code Playgroud)
这也行不通:
barbuttonitem.width
Run Code Online (Sandbox Code Playgroud) 我有这个日期格式化程序:
NSDateFormatter *timeFormatter = [[NSDateFormatter alloc] init];
[timeFormatter setDateFormat:@"HH:mm"];
Run Code Online (Sandbox Code Playgroud)
如果我用这个:
NSDate *myDate = [timeFormatter dateFromString:@"13:00"];
Run Code Online (Sandbox Code Playgroud)
它返回:
"1:00"
Run Code Online (Sandbox Code Playgroud)
这是因为模拟器已关闭24小时.但对于我的应用程序,我真的需要"13:00"而不是"1:00"
--- 编辑1 ---
添加了新代码:
NSCalendar *calendar= [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSCalendarUnit unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit;
NSDateFormatter *timeFormatter = [[NSDateFormatter alloc] init];
[timeFormatter setDateFormat:@"HH:mm"];
NSDate *timeForFirstRow = [timeFormatter dateFromString:@"13:00"];
NSDateComponents *dateComponents = [calendar components:unitFlags fromDate:timeForFirstRow];
NSInteger hour = [dateComponents hour]; //This will be 1 instead of 13
NSInteger minute = [dateComponents minute];
Run Code Online (Sandbox Code Playgroud) 我写了一个简单的扩展来解码html实体:
extension String {
func htmlDecode() -> String {
if let encodedData = self.data(using: String.Encoding.unicode) {
let attributedString = try! NSAttributedString(data: encodedData, options: [NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute: String.Encoding.unicode], documentAttributes: nil)
return attributedString.string
}
return self
}
}
Run Code Online (Sandbox Code Playgroud)
现在它在行上抛出一个错误if let attributedString …:
***由于未捕获的异常'NSRangeException'终止应用程序,原因:'*** - [__ NSArrayM objectAtIndex:]:索引4超出边界[0 .. 2]'
而self不是零什么的,只是一个String像这样的:
self = (String) "...über 25'000 Franken..."
这种奇怪的NSArray例外来自哪里?
简短的问题:是否有可能window.open()在UIWebView使用中检测到UIWebViewDelegate或是否有其他方法可以达到此目的?当window.open()-Event被激活以显示时,我需要url UIAlertView.
我想知道是否可以检测到在WKWebView中播放的电影?
另外,我想知道打开的流的确切URL?
使用"第一天"修改日期时,PHP中有一种非常奇怪的行为.
'first day' ' of'?设置当前月份的第一天.(http://php.net/manual/de/datetime.formats.relative.php)
$currentMonthDate = new DateTime("2014-07-30 10:26:00.000000");
echo $currentMonthDate->format('Ym');
$currentMonthDate->modify('first day');
echo $currentMonthDate->format('Ym');
Run Code Online (Sandbox Code Playgroud)
201407/201407 好的
$currentMonthDate = new DateTime("2014-07-31 10:26:00.000000");
echo $currentMonthDate->format('Ym');
$currentMonthDate->modify('first day');
echo $currentMonthDate->format('Ym');
Run Code Online (Sandbox Code Playgroud)
二十○万一千四百〇七/ 201408 为什么?
$currentMonthDate = new DateTime("2014-08-01 10:26:00.000000");
echo $currentMonthDate->format('Ym');
$currentMonthDate->modify('first day');
echo $currentMonthDate->format('Ym');
Run Code Online (Sandbox Code Playgroud)
201408/201408 好的
我在运行PHP 5.2的生产服务器上发现了这种行为,所以我认为这是一个古老的错误,但它发生在PHP 5.3(http://phptester.net/)和我们的测试服务器上的5.5.
如果我在PHP 5.2中使用"本月的第一天",则会出现相同的行为.在PHP 5.5中,"本月的第一天"按预期工作.
是"第一天" - 行为是一个错误吗?如何在PHP 5.2中获得"本月的第一天"而不进行奇怪的转换string和date?
我想在原始javascript中将1种颜色的动画(过渡)转换为另一种颜色.
我不想使用任何框架(jquery,mootools)或css3.纯粹的原始javascript.
我真的很难做到这一点,有人可以帮助我吗?:)
objective-c ×4
ios ×3
iphone ×3
swift ×3
animation ×1
bower ×1
colors ×1
datetime ×1
javascript ×1
php ×1
proxy ×1
transition ×1
uitextview ×1
uiwebview ×1
unit-testing ×1
wkwebview ×1
xcode ×1