- 博客(40)
- 资源 (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
733
原创 change swift compile version in xcode build settings
Build settings -> Swift Compiler - Version YES swift 2.3 NO swift 3.0
2016-07-14 10:20:48
1065
转载 到底什么时候才需要在ObjC的Block中使用weakSelf/strongSelf
到底什么时候才需要在ObjC的Block中使用weakSelf/strongSelf 2014-11-22, SAT | COMMENTS Objective C 的 Block 是一个很实用的语法,特别是与GCD结合使用,可以很方便地实现并发、异步任务。但是,如果使用不当,Block 也会引起一些循环引用问题(retain cycle)—— Block 会 retain
2016-07-13 23:39:26
594
原创 Popup custom view on current view
很多时候需要在原视图上弹出一个自定义视图让用户确认一些东西. 通常的做法一般使用UIAlertView/UIAlertController. 但是做为自定义它们的风格可能与app不符. 思路如下: 1) 创建一个UIViewController,背景是一个UIImageView,Autolayout至全屏,图片选用半透明的,目标是为了显示前一页的部分内容 2) 通过presentVi
2016-04-19 16:32:12
471
原创 ASUS RT-N16 DD-WRT ipkg update
http://www.wentztech.com/radio/Linux/files/DDDWRT-iftop.html
2016-04-13 23:30:04
642
原创 Wireshark OS X can't detect interface
原因是权限问题. sudeMacBook-Pro-3:dev sujian$ ls -la | grep bp crw------- 1 root wheel 23, 0 4 8 13:25 bpf0 crw------- 1 root wheel 23, 1 4 8 13:25 bpf1 crw-------
2016-04-08 13:33:42
460
转载 通过Reactivecocoa绑定UISwitch到NSUserDefault
RACChannelTerminal *switchTerminal = self.someSwitch.rac_newOnChannel; RACChannelTerminal *defaultsTerminal = [[NSUserDefaults standardUserDefaults] rac_channelTerminalForKey:@"someBoolKey"]; [switch
2016-03-31 12:33:51
1643
原创 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
6878
原创 在OSX下使用命令行修改IP与网关
sudeMacBook-Pro-3:~ sujian$ networksetup -listnetworkserviceorder An asterisk (*) denotes that a network service is disabled. (1) Thunderbolt Ethernet (Hardware Port: Thunderbolt Ethernet, De
2016-03-29 13:34:46
4874
原创 Detect volume change
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(systemVolumeChanged:) name:@"AVSystemController_SystemVolumeDidChangeNotification" object:nil]; - (void)
2016-02-16 10:34:02
652
原创 RAC笔记
//signal1,signal2有任何一个被订阅,即x等于一个RACTuple RACSignal *signal1 = [RACSignal defer:^RACSignal *{ NSLog(@"aaaa"); return [RACSignal return:@"hello111"]; }];
2016-01-26 10:26:59
2392
转载 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
890
原创 在mac下通过tcpdump抓iPhone包
rvictl -s 87b8622c5748dea98a982aa41026fbbb80dc8922 87b8622c5748dea98a982aa41026fbbb80dc8922 为udid lo0 gif0 stf0 en0 en1 en2 p2p0 awdl0 bridge0 utun0 en4 rvi0 之后rvi0就是设备句柄,可以用tcp
2015-09-21 14:24:50
1821
原创 解决在xcode里使用magic mouse,左右滑动引起的卡住
在xcode代码编辑区域里滑动mm鼠标来切换前页后页有一定机率会造成整个xcode无响应,很长时间以来,我总是为被这个问题困扰. 前面使用xcode 7.1时又出现了,偶尔发现了一些问题.由于我本机使用了多手势工具Jitouch,再加上xcode自带的手势,这两货在一块很容易搞死xcode. 解决过程如下: 1. 移除左右滑动功能 defaults write com.ap
2015-09-16 14:37:00
1855
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
521
原创 mantle的Array与dictionary
json格式: NSDictionary *dict = @{ @"name": @"Bob", @"cars": @[ @{ @"make":@"ford",
2015-09-02 18:27:25
1258
原创 Reactivecocoa-publish、multicast、replay、replayLast
//-replay 总是收取最后的内容,而并不执行signal 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 __block int num = 0; RACSignal *signal = [[RACSignal createSignal:^RACDisposable *(i
2015-08-27 14:20:48
1214
转载 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
1013
转载 osx launchctl mongodb 自启动
mkdir -p ~/Library/LaunchAgents cp /usr/local/Cellar/mongodb/2.0.6-x86_64/homebrew.mxcl.mongodb.plist ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist laun
2015-05-21 15:21:44
863
原创 ReactiveCocoa系列-隐藏显示placehold
//创建textField获得焦点信号,当信号发生时返回@YES RACSignal *didBeginEditingSignal = [[self rac_signalForSelector:@selector(textFieldDidBeginEditing:) fromProtocol:@protocol(UITextFieldDelegate)] mapReplace:@Y
2015-02-25 21:38:00
1143
翻译 获取其它app的路径,以iPhoto为例
CFStringRef path = CFPreferencesCopyAppValue(CFSTR("LibraryPath"), CFSTR("com.apple.iPhoto"));
2013-02-20 12:57:32
538
转载 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
1044
转载 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
665
转载 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
721
转载 拼接三幅图
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
1176
转载 在播放过程中如何取得到当前的播放时间
可以从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
1834
原创 NSImageView setImage失效?
今天碰到一个奇怪的问题,使用NSImageView setImage时,UI没有效果。后发现NSImageView的指针是空。 后来发现 AlbumViewCell *cell = [[AlbumViewCell alloc] initWithNibName:@"AlbumViewCell" bundle:nil]; 必须先调用一次[cell view],否则IB不会分配AlbumV
2012-05-07 15:15:41
1666
原创 会变色的背景透明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
5067
原创 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
1849
转载 NSView淡入淡出
淡入动画: [NSAnimationContext beginGrouping]; [[NSAnimationContext currentContext] setDuration:2.0]; [[theSuperview animator] addSubview:theView]; [NSAnimationContext endGrouping]; 淡出动画:
2012-04-29 09:27:24
1342
原创 点击应用程序左上角关闭 程序退出
把window的消息委托给AppDelegate,再到AppDelegate.m里加入以下函数 - (BOOL)windowShouldClose:(id)sender //close box quits the app { [NSApp terminate:self]; return YES; }
2012-04-28 15:21:34
1361
原创 NSColor创建方法
ColorSync实用工具 NSColor *rgb = [NSColor colorWithDeviceRed:0.2471 green:0.2471 blue:0.2471 alpha:1];
2012-04-28 14:59:09
2252
转载 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
972
原创 取其它app安装路径
取其它app安装路径 NSString* iTunesPath = [ [ NSWorkspace sharedWorkspace ] absolutePathForAppBundleWithIdentifier: @"com.apple.iTunes" ]; if( iTunesPath ) { // iTunes installed, do something }
2012-03-09 14:29:40
724
原创 JComboBox向上弹出
主要就是重载JComboBox里的firePopupMenuWillBecomeVisible方法,使其改变它的弹出行为 下面为示例代码:MainFrame.javapackage com.futuredial.MyApplet; import java.applet.*;import java.awt.*;import java.awt.event.*;
2007-09-14 17:38:00
1137
原创 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
1220
原创 Berkeley DB使用全解
在开发桌面级应用程序时,常常需要用到可持续存储技术,做为保存程序在退出之前所使用的数据,如变量,对象,窗口位置,大小.一般我们会使用office access这类桌面型文件数据库,或者是使用注册表.但是它们都有一些不尽人意的缺陷.比如:1. mdb文件无法在没有安装office的系统上访问,直少得需要为它单独安装一个组件2. 它与注册表没法实现c++结构存储,
2007-09-13 15:11:00
7971
原创 重叠IO技术在服务器端的应用
在处理TCP并发线程上,一般我们采用一个线程处理接受客户端的连接,然后开出一个线程处理与这个客户端的交互过程.但是,跟据机器的性能与操作系统的限制,一般在几百个并发线程,也就是同时处理几百个客户端连接. 为了处理更多的客户端连接,不得不考虑换一种网络模型,目前比较流行的有select,完成端口,重叠IO,本文主要介绍重叠IO的实现 //重叠IO投递WSARecv的例子#i
2007-09-11 16:18:00
1822
2
原创 控件子类化
当程序使用你自已所实现的派生控件子类时,主窗口的消息是无法到达你的子类函数的.这时,你有两个方法:1. 使用DDX_Contrl(pDX,IDC_BUTTON,mMyButton)把你的子类与当前窗口挂接,以至于让WM_LBUTTONDOWN等消息顺利到达你的子类处理函数.2. 或者是通过使用m_btnMyButton.SubclassDlgItem(IDC_BUT
2007-09-07 19:02:00
1679
原创 在STL/MFC里的链表类强大支持下,回头看看曾经走过来的路...(原创)
这些天开始搞BREW,因为它没有STL/MFC的链表支持,所以不得不巩固一下以前所学的链表,有些感想,想与大家分享一下#include "stdafx.h"#include struct Student{ long number; float score; Student *next;};Student *head; //链首指针Student *Create(){ Student *pS;
2005-04-28 00:51:00
2193
7
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅