- 博客(41)
- 资源 (4)
- 收藏
- 关注
转载 (git)You have not concluded your merge (MERGE_HEAD exists).
You have not concluded your merge (MERGE_HEAD exists).Please, commit your changes before you can merge.git commit了本地代码,然后pull的时候,提示有三个文件conflict,直接把那三个文件移除,再pull后列出了需要对比的代码,把其中的冲突文件对比好后,再pull,xc
2016-08-18 22:11:40
629
原创 change swift compile version in xcode build settings
Build settings -> Swift Compiler - VersionYES swift 2.3NO swift 3.0
2016-07-14 10:20:48
991
转载 到底什么时候才需要在ObjC的Block中使用weakSelf/strongSelf
到底什么时候才需要在ObjC的Block中使用weakSelf/strongSelf2014-11-22, SAT | COMMENTSObjective C 的 Block 是一个很实用的语法,特别是与GCD结合使用,可以很方便地实现并发、异步任务。但是,如果使用不当,Block 也会引起一些循环引用问题(retain cycle)—— Block 会 retain
2016-07-13 23:39:26
539
原创 Popup custom view on current view
很多时候需要在原视图上弹出一个自定义视图让用户确认一些东西. 通常的做法一般使用UIAlertView/UIAlertController. 但是做为自定义它们的风格可能与app不符.思路如下:1) 创建一个UIViewController,背景是一个UIImageView,Autolayout至全屏,图片选用半透明的,目标是为了显示前一页的部分内容2) 通过presentVi
2016-04-19 16:32:12
414
原创 ASUS RT-N16 DD-WRT ipkg update
http://www.wentztech.com/radio/Linux/files/DDDWRT-iftop.html
2016-04-13 23:30:04
595
原创 Wireshark OS X can't detect interface
原因是权限问题.sudeMacBook-Pro-3:dev sujian$ ls -la | grep bpcrw------- 1 root wheel 23, 0 4 8 13:25 bpf0crw------- 1 root wheel 23, 1 4 8 13:25 bpf1crw-------
2016-04-08 13:33:42
411
转载 通过Reactivecocoa绑定UISwitch到NSUserDefault
RACChannelTerminal *switchTerminal = self.someSwitch.rac_newOnChannel;RACChannelTerminal *defaultsTerminal = [[NSUserDefaults standardUserDefaults] rac_channelTerminalForKey:@"someBoolKey"];[switch
2016-03-31 12:33:51
1581
原创 Xcode 7.3 cannot create __weak reference in file using manual reference counting
Set Build Settings -> Apple LLVM 7.1 - Language - Objective C -> Weak References in Manual Retain Release to YES.参考:http://stackoverflow.com/questions/36147625/xcode-7-3-cannot-create-weak-ref
2016-03-30 15:03:58
6807
原创 在OSX下使用命令行修改IP与网关
sudeMacBook-Pro-3:~ sujian$ networksetup -listnetworkserviceorderAn asterisk (*) denotes that a network service is disabled.(1) Thunderbolt Ethernet(Hardware Port: Thunderbolt Ethernet, De
2016-03-29 13:34:46
4232
原创 Detect volume change
[[NSNotificationCenterdefaultCenter]addObserver:selfselector:@selector(systemVolumeChanged:)name:@"AVSystemController_SystemVolumeDidChangeNotification"object:nil];- (void)
2016-02-16 10:34:02
588
原创 RAC笔记
//signal1,signal2有任何一个被订阅,即x等于一个RACTupleRACSignal*signal1 = [RACSignaldefer:^RACSignal*{ NSLog(@"aaaa"); return [RACSignalreturn:@"hello111"]; }];
2016-01-26 10:26:59
2289
转载 Xcode升级后插件失效的原理与修复办法
find ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins -name Info.plist -maxdepth 3 | xargs -I{} defaults write {} DVTPlugInCompatibilityUUIDs -array-add `defaults read /Applicati
2015-11-10 11:17:57
847
原创 在mac下通过tcpdump抓iPhone包
rvictl -s 87b8622c5748dea98a982aa41026fbbb80dc892287b8622c5748dea98a982aa41026fbbb80dc8922 为udidlo0 gif0 stf0 en0 en1 en2 p2p0 awdl0 bridge0 utun0 en4 rvi0之后rvi0就是设备句柄,可以用tcp
2015-09-21 14:24:50
1745
原创 解决在xcode里使用magic mouse,左右滑动引起的卡住
在xcode代码编辑区域里滑动mm鼠标来切换前页后页有一定机率会造成整个xcode无响应,很长时间以来,我总是为被这个问题困扰.前面使用xcode 7.1时又出现了,偶尔发现了一些问题.由于我本机使用了多手势工具Jitouch,再加上xcode自带的手势,这两货在一块很容易搞死xcode.解决过程如下:1. 移除左右滑动功能defaults write com.ap
2015-09-16 14:37:00
1764
1
原创 Core animation 学习笔记
图层每一个UIView都有一个CALayer 改变UIView里Layer的frame,bounds,backgroundColor都会影响UIView添加到父图层的子图层,当只设置bounds时.position为 {0,0} anchorPoint为{0.5,0.5} 子图层的中心位置 CALayer *subLayer = [CALayerl
2015-09-11 11:08:47
433
原创 mantle的Array与dictionary
json格式:NSDictionary *dict = @{ @"name": @"Bob", @"cars": @[ @{ @"make":@"ford",
2015-09-02 18:27:25
1194
原创 Reactivecocoa-publish、multicast、replay、replayLast
//-replay 总是收取最后的内容,而并不执行signal123456789101112131415161718192021222324 __block int num = 0; RACSignal *signal = [[RACSignal createSignal:^RACDisposable *(i
2015-08-27 14:20:48
1142
转载 iOS8 adaptive segue
Here is a quick summary of the segues and an example for each type. You'll want to do more research/experimentation if you decide to implement them.Show - Pushes the destination view controller on
2015-08-26 22:51:30
947
转载 osx launchctl mongodb 自启动
mkdir -p ~/Library/LaunchAgentscp /usr/local/Cellar/mongodb/2.0.6-x86_64/homebrew.mxcl.mongodb.plist ~/Library/LaunchAgents/launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plistlaun
2015-05-21 15:21:44
825
原创 ReactiveCocoa系列-隐藏显示placehold
//创建textField获得焦点信号,当信号发生时返回@YES RACSignal *didBeginEditingSignal = [[self rac_signalForSelector:@selector(textFieldDidBeginEditing:) fromProtocol:@protocol(UITextFieldDelegate)] mapReplace:@Y
2015-02-25 21:38:00
1101
翻译 获取其它app的路径,以iPhoto为例
CFStringRef path = CFPreferencesCopyAppValue(CFSTR("LibraryPath"), CFSTR("com.apple.iPhoto"));
2013-02-20 12:57:32
501
转载 CFString convert char *
char * MYCFStringCopyUTF8String(CFStringRef aString) { if (aString == NULL) { return NULL; } CFIndex length = CFStringGetLength(aString); CFIndex maxSize = CFStringGetMaximumSizeForEnco
2012-12-31 10:18:59
969
转载 VMWare Shared folders horrendously slow
This has annoyed me for ages and I have finally found the proper cause/solution: This slow performance, specially the 5-10 seconds delay between clicking on a folder/file and actually gettin
2012-12-26 10:50:27
608
转载 Xcode 4.3 not presenting Autoresizing panel in Size Inspector
xcode 4.3 找不到size inspector,见下面方法http://stackoverflow.com/questions/9370072/xcode-4-3-not-presenting-autoresizing-panel-in-size-inspector
2012-11-27 14:25:34
678
转载 拼接三幅图
Here is a function i whipped up that takes 1 image, and stretches just the middle...-(NSImage *)image:(NSImage *)image leftCapWidth:(float)leftWidth middleWidth:(float)middleWidth rightCapWidt
2012-05-20 22:31:22
1124
转载 在播放过程中如何取得到当前的播放时间
可以从VideoState->video_st->codec->reordered_opaque取到的时间戳,然后转换为时间就可以了。VideoState->video_st->codec->reordered_opaque * av_q2d(VideoState->video_st->time_base)
2012-05-10 10:02:09
1732
原创 NSImageView setImage失效?
今天碰到一个奇怪的问题,使用NSImageView setImage时,UI没有效果。后发现NSImageView的指针是空。后来发现AlbumViewCell *cell = [[AlbumViewCellalloc] initWithNibName:@"AlbumViewCell"bundle:nil];必须先调用一次[cell view],否则IB不会分配AlbumV
2012-05-07 15:15:41
1628
原创 会变色的背景透明NSButton
效果图://ColorTextButton.h#import @interface NSButton (ColorButton)- (void)setHoverColor:(NSColor *)textColor;- (void)setNormalColor:(NSColor *)textColor;- (void)setPushColor:(NSColor *)text
2012-05-03 13:48:43
4979
原创 Cocoa下实现SplashScreen
#import @interface SplashWindow : NSWindow- (id)initWithSplashImage:(NSString*)imgfile;@end//SplashWindow.m#import "SplashWindow.h"@implementation SplashWindow- (id)initWithSplashImag
2012-05-03 13:07:28
1790
转载 NSView淡入淡出
淡入动画:[NSAnimationContext beginGrouping];[[NSAnimationContext currentContext] setDuration:2.0];[[theSuperview animator] addSubview:theView];[NSAnimationContext endGrouping];淡出动画:
2012-04-29 09:27:24
1265
原创 点击应用程序左上角关闭 程序退出
把window的消息委托给AppDelegate,再到AppDelegate.m里加入以下函数- (BOOL)windowShouldClose:(id)sender//close box quits the app{ [NSApp terminate:self]; return YES;}
2012-04-28 15:21:34
1264
原创 NSColor创建方法
ColorSync实用工具NSColor *rgb = [NSColorcolorWithDeviceRed:0.2471green:0.2471blue:0.2471alpha:1];
2012-04-28 14:59:09
2177
转载 Objective-C application starts
When an Objective-C application starts, it starts by running the function named main(). It doesn't have to be in the file "main.m" but that's how the Xcode wizard sets things up.Inside the wizard-
2012-03-20 18:36:45
921
原创 取其它app安装路径
取其它app安装路径NSString* iTunesPath = [ [ NSWorkspace sharedWorkspace ] absolutePathForAppBundleWithIdentifier: @"com.apple.iTunes" ];if( iTunesPath ) { // iTunes installed, do something}
2012-03-09 14:29:40
681
原创 JComboBox向上弹出
主要就是重载JComboBox里的firePopupMenuWillBecomeVisible方法,使其改变它的弹出行为 下面为示例代码:MainFrame.javapackage com.futuredial.MyApplet; import java.applet.*;import java.awt.*;import java.awt.event.*;
2007-09-14 17:38:00
1082
原创 applet通过JSObject调用javascript函数
Applet代码示例:package com.futuredial.MyApplet; import java.applet.*;import java.awt.*;import java.awt.event.*;import netscape.javascript.*; //位置在%JAVA_HOME%/jre/lib/plugin.jar里 publi
2007-09-14 17:36:00
1155
原创 Berkeley DB使用全解
在开发桌面级应用程序时,常常需要用到可持续存储技术,做为保存程序在退出之前所使用的数据,如变量,对象,窗口位置,大小.一般我们会使用office access这类桌面型文件数据库,或者是使用注册表.但是它们都有一些不尽人意的缺陷.比如:1. mdb文件无法在没有安装office的系统上访问,直少得需要为它单独安装一个组件2. 它与注册表没法实现c++结构存储,
2007-09-13 15:11:00
7771
原创 重叠IO技术在服务器端的应用
在处理TCP并发线程上,一般我们采用一个线程处理接受客户端的连接,然后开出一个线程处理与这个客户端的交互过程.但是,跟据机器的性能与操作系统的限制,一般在几百个并发线程,也就是同时处理几百个客户端连接. 为了处理更多的客户端连接,不得不考虑换一种网络模型,目前比较流行的有select,完成端口,重叠IO,本文主要介绍重叠IO的实现 //重叠IO投递WSARecv的例子#i
2007-09-11 16:18:00
1746
2
原创 控件子类化
当程序使用你自已所实现的派生控件子类时,主窗口的消息是无法到达你的子类函数的.这时,你有两个方法:1. 使用DDX_Contrl(pDX,IDC_BUTTON,mMyButton)把你的子类与当前窗口挂接,以至于让WM_LBUTTONDOWN等消息顺利到达你的子类处理函数.2. 或者是通过使用m_btnMyButton.SubclassDlgItem(IDC_BUT
2007-09-07 19:02:00
1603
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人