iOS疯狂讲解之Xcode菜单及快捷键大全

Xcode7最新app打包发布详细过程(二) 承接上一遍文章,继续讲解app打包的过程。 20、生成你的项目的appID, 21、开始生成描述文件,点击描述文件右上方的+号,回来到选择开发证书的地方,此处包含两个名字相同的开发证书,一个是博主生成的,另一个是同事生成的,两个证书的不同之处在于生成的时间不同,最主要的是生成证书的时候使用的钥匙串文件不同。 22、选择完开发证书再选择设备, 23、给描述文件命名(后面需要在 阅读详情

001.png

2.偏好设置

通过“command+,”快捷键或”Xcode|Preferences”菜单呼出偏好设置。

(1)主题及字体(Preferences->Fonts & Colors)

选中一种主题(theme),例如“Midnight”,然后shift选择Source Editor/Console中的所有项,点击Fonts设置字体。Xcode默认字体为menlo,可选Consolas、Monaco等其他等宽字体。

(2)文本编辑配置(Preferences->Text Editing)

Editing:

  • Show Line Numbers:在gutter中显示行号。

  • Code folding ribbon:显示折叠ribbon。

  • Page guide at column:显示一行最多支持80个字符的提示分割线。

Indentation:

  • Prefer indent using:Spaces(为保持一致的视觉呈现和行末注释对齐,建议使用空格)

  • Tab width:4 spaces(tabexpand,1个tab=4个空格)

  • Indent width:4 spaces(自动缩进步长=4个空格)

(3)SCM(Preferences->Source Control)

Enable Source Control:启用/禁用XCode自带Source Control Manager(SCM)。

(4)SDK/Simulator(Preferences->Downloads)

Downloads->Components:可下载SDK和Simulator。

(5)构建输出目录(Preferences->Locations->Locations)

  • 当选择为Default时,Derived Data的目录为~/Library/Developer/Xcode/DerivedData。

  • 当选择为Relative时,Derived Data的目录为当前.xcodeproj所在的目录。

  • 当选择为Custom时,Derived Data的目录需自定义。

不建议使用绝对路径,因为写死之后,换环境或换平台,又要重新修改路径,建议使用相对路径(Relative)。

3.代码阅读

(1)View Navigator

command+0:Show/Hide left tool panel

command+1-8:Project/Symbol/Find/Issue/Test/Debug/Breakpoint/Log Navigator

option+command+0:Show/Hide right tool panel

option+command+1/2:show the file/quick help inspector

(2)View Editor Organization

control+1:Show Related Items(例如Superclasses/Subclasses、Callers/Callees、Protocol Implementor/Implemented、Includes/Included By)。可输入实时搜索匹配。

control+2/3:Show Previous/Next History。可输入实时搜索匹配。

control+4:Show Top Level Items。

control+5:Show Group Files(当前文件夹内的所有文件)。可输入实时搜索匹配。

control+6:Show Document Items(当前文件的Symbols)。可输入实时搜索匹配。

可直接选中符号,然后“Navigate->Reveal in Symbol Navigator”,打开该接口的符号列表。

(3)Focus Switch

command+J:焦点切换(Move Focus),可配合鼠标和方向键。带‘+’的“Move focus to a new assistant editor”可以快速在辅助编辑窗口中打开头文件(*.h)/实现文件(*.m,*.mm)。

shift+command+J:在项目导航中定位当前文件(Reveal in Project Navigator)。

(4)Symbol Jump

control+command+↑/↓:切换头文件/实现文件(switch between a source file (.m,*.mm,*.cc) and the associated header file(.h))。

shift+command+O:Open Quickly,可快速查找文件、符号。

command+点击Editor中选中的符号:跳转到符号定义(jump to definition)。

control+command+J:跳转到指定符号的定义处或实现处(Go to Declaration/Definition)。有时工程正在Loading、Indexing或Processing files时,“command+点击”无法响应,此时可试试control+command+J。

在Project Navigator中选中文件右键或通过菜单“File->Show in Finder”:在Finder中定位该文件。

(5)Symbol Navigator

command+点击Editor中选中的非单一层次定义符号:Show in Symbol Navigator:

filter0:底部输入符号(show symbols with matching name)= filter1 result+filter3 result

filter1:show only class and protocol symbols (hide other global symbol types),包括project和system层次。

filter2:show only project-defined symbols,过滤显示当前工程中的符号。filter2的结果是filter1的子集,较常用。

filter3:show only containers(hide members),过滤显示包含该单词的符号。

(6)Help

option+点按:查看选中符号的帮助提示(Quick Help for Selected Item)。

option+双击:打开选中符号的帮助文档。

4.代码编辑

(1)File | New

control+command+N:File | New | Workspace

shift+command+N:File | New | Project

(2)Text Editing

command+[/]:向前/向后缩进

option+command+[/]:Move Line Up/Down

command+/:注释选中的代码

Parentheses/Brackets/Braces Matching:双击某个分隔符(如()、[]、{} 等),Xcode会选中匹配代码块。

(3)Eidtor Window/Tab Switch

command+shift+[/]:切换标签页

单指左右滑动(control+command+←/→):在单标签页打开的多个文件间切换

(4)Code Folding

option+command+←/→:折叠当前代码块

option+shift+command+←/→:折叠该文件内所有代码块(方法/函数)

(5)Console & Scheme

shift+command+Y:显示控制台(Show/Hide the debug area)

option+command+R:编辑配置(Edit Scheme)

(6)Gutter & Ribbon

焦点列:灰色深度与代码嵌套深度相关,鼠标悬停可突出显示右侧相应代码块,鼠标单击可折叠右侧相应代码块(Code Folding)。

说明:从左到右,依次是“导航窗格(Navigator)->边列(Gutter)->焦点列(Focus

Ribbon)->代码编辑窗口(Standard Editor)”。

(7)Auto Completion

esc(command+.):就当前输入上下文呼出/隐藏Auto

Completion提示:上下方向键在提示中选择选项,enter(return)选中,tab可一截一截匹配;tab可在各个占位符之间移动。

输入Objective-C对象及 ],自动完成中缀符(infixnatation)包围。

(8)Find & Replace

command+F:当前文件查找。

option+command+F:当前文件替换。

  • Find:可指定查找内容(Text/References/Definitions/Regular Expression);

  • 放大镜:下拉可查看最近查找历史;

  • In Project:查找范围(可指定Group);

  • Text:匹配规则(可指定Containing,Matching,Starting with,Ending with);

  • Case:是否区分大小写(可指定 Matching/Ignoring)。

shift+command+F(command+3):全局查找。也可以在选择符号后,右键(control+点击)->Find Selected Text in workspace...

option+shift+command+F:全局替换。

  • Replace:逐个替换;

  • All:所有替换;

  • Done:替换完成。

5.辅助编辑(Assistant Editor)

Assistant Editor有点类似VC中的Code Definition Window。

option+command+enter:打开Assistant Editor。

command+enter:关闭Assistant Editor。

使用快捷键进行切换或跳转动作时,若同时按下option可以在辅助编辑窗口中打开相应文件或符号(For optional navigation (Option-clicking or Option-choosing a file), opens the file in a new Assistant editor pane.)。若在辅助窗口中操作,则在主窗口(Standard Editor)中打开。

  • option+点击Project Navigator中选中的文件:在辅助编辑窗口中打开选中文件。

  • option+command+点击Editor中选中的符号:在辅助编辑窗口中打开符号定义(jump to definition in assistant editor)。

  • option+control+command+↑/↓:在辅助窗口中打开对应的头文件(*.h)/实现文件(*.m,*.mm,*.cc)。

点击查看shift+command+O、shift+command+F(command+3)选中的文件或符号时,可同时按下option在辅助编辑窗口中打开。

在control+1~6中打开选择结果时,均可同时按下option在辅助编辑窗口中打开。

若在按下option的同时按下shift通常会出现一个导航窗格,可选择在new window/tab/assistant-editor显示打开。

ForOption-Shift navigation (Option-Shift-click or Option-Shift-choose a file), Xcode displays a graphical navigation chooser showing the current layout. The chooserprompts you to open the file in anyopen editor pane in any window and tab, or to open the file in anew editor pane, window, or tab.

20140219220929453.png

6.环境变量(Build Setting Macros)

(1)查看环境变量宏

命令行进入HelloWorld工程目录,执行xcodebuild命令并带上“-showBuildSettings”参数:

$ xcodebuild -project HelloWorld.xcodeproj -target HelloWorld -configuration Debug -showBuildSettings > xcodebuild_showBuildSettings.txt

则xcodebuild_showBuildSettings.txt中保存了Build settings for action build and target "HelloWorld”,其中dump了所有的环境变量。

(2)Xcode5(Mac OS X 10.9)的部分环境变量

约定1:~=当前账户的HOME目录,例如“/Users/faner”。

约定2:build构建基础路径:BUILD_PATH = ~/Library/Developer/Xcode/DerivedData/Build。可通过“File->Project Settings”查看Derived Data Location。

约定3:环境变量宏(Build Setting Macros)引用格式:${MACRO},同Build Phases Run Script中的语法。

下面是摘选自xcodebuild_showBuildSettings.txt的部分常用环境变量。

(a) ARCH & PLATFORM & SDK

ARCHS = i386

CURRENT_ARCH = i386

PLATFORM_DIR = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform

PLATFORM_NAME = macosx

SDKROOT = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk

SDK_DIR = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk

SDK_NAME = macosx10.9

(b) PROJECT & SOURCE

PROJECT = HelloWorld

PROJECT_DIR =~/Projects/Learn Objective-C/HelloWorld

PROJECT_FILE_PATH =${PROJECT_DIR}/HelloWorld.xcodeproj

PROJECT_NAME = HelloWorld

SOURCE_ROOT =${PROJECT_DIR}

SRCROOT =${PROJECT_DIR}

(c) BUILD & CONFIGURATION

BUILD_DIR =BUILD_PATH/Products

BUILD_ROOT =BUILD_PATH/Products

BUILT_PRODUCTS_DIR =BUILD_PATH/Products/Debug

CONFIGURATION = Debug

CONFIGURATION_BUILD_DIR =BUILD_PATH/Products/Debug

CONFIGURATION_TEMP_DIR =BUILD_PATH/Intermediates/HelloWorld.build/Debug

(d) PRODUCT & TARGET

PRODUCT_NAME = HelloWorld

PRODUCT_TYPE = com.apple.product-type.tool// Project Template: Command Line Tool

TARGET_BUILD_DIR =BUILD_PATH/Products/Debug

TARGET_NAME = HelloWorld

(3)设置环境变量

Product -> Edit Scheme(option+command+R)->Arguments->Environment Variables中可以添加自定义环境变量(Name为名称,Value为值)。

7.运行调试

(1)Console

shift+command+Y:显示控制台(Show/Hide the debug area)

shift + command + K:清除控制台(Clean)

(2)Build

Product -> Edit Scheme(option+command+R)->Info->Build Configuration:选择生成版本(Debug or Release)

command + B:构建(Buid)

(3)Target

一个Target是指在一个Project中构建的一个产品,它包含了构建该产品的所有文件,以及如何构建该产品的配置。

一个定义好构建过程的Target成为一个Scheme,可在Scheme中定义Target的六种构建过程:Build/Run/Test/Profile/Analyze/Archive。

Product -> Edit Scheme(option+command+R)->Manage Schemes可对Scheme的六种构建过程进行配置(可配置项包括Info、Arguments、Options)。

在Project Navigator中选中某个xcodeproj(例如QQ.xcodeproj),将进入Project Setting页面,可点击左侧图标show/hide project and targets list:

0012.png

点击targets项可分别设置各target的Build Settings;右击可对target进行delete。

(4)Issue & Errors

编译错误(error)和警告(warning)过多时,只显示编译错误:

0013.png

点击底端的感叹号,即可只显示编译错误,忽略编译警告:

0014.png

(5)Run

command + R:运行(Run),可能会先编译。若按下control直接运行上次build的product(Run Without Building)。

command + .:停止运行(Stop)

(6)Breakpoint

command + \:当前行设置/取消断点;通过鼠标点击蓝色断点来启用/禁用当前行断点。

command + Y:全局激活或禁用所有的断点,激活进入调试模式(此时断点蓝色可见)。

边列(Gutter)中的断点/警告可右键呼出Reveal in Breakpoint/Issue Navigator。

trick:编辑断点(Edit Breakpoint):

  • Condition:设置断点的触发条件,例如“i==3”(注意不能有空格)表示当i等于3时该断点才会被触发。

  • Ignore:设置断点需要被忽略多少次才会中断,若设置成5则表示第6次遇到该断点时才触发。

  • Action:设置断点触发时的动作,可以为Debugger Command、Log Message、Shell Command或Sound。

例如可设置以下Debugger Command:

(1)读取std::string sig的内存buffer值:mem read sig.c_str() -c sig.size();

(2)打印NSData实例sig:po sig

(7)Debug

F6:下一步(Step Over),逐过程单步调试,不进入函数体。

(fn+)F7:进入(Step Into)函数体。可能与多媒体键有冲突,故需要fn辅助。

(fn+)F8:跳出(Step Out)函数体。可能与多媒体键有冲突,例如呼叫iTunes,故需要fn辅助。

control+command+Y:逐断点(continue)继续执行。

trick:移动指令指针(Move the instruction pointer):

0015.png

断点调试运行时,可以将绿色指针箭头(Line 47)移动到其他行(Line 49)或其他断点(Line 51)实现跳转执行。

(8)Watch

shift+command+M:Debug Workflow->View Memory。

command+K:Debug Workflow->Clear Console。

Debug Workflow->ShowDisassembly When Debugging,可进行汇编指令级调试。

trick:修改变量内存值(change memory value while debugging):

调试运行时,可以在底部的调试窗口(Debug Area,可通过Shift+Command+Y呼出)右键某个变量,除了可以进行View Memory/View Value As之外,还可以选择Edit Value运行时编辑内存变量的值。

这种手动设置指定值,在调试某些难以复现的bug或进行边界测试非常有用,可以避免在验证某个问题时反复改值重新编译。

(9)lldb调试命令:

  • n/next:step over;

  • s/step:step into;

  • finish:step out;

  • c/continue:goto next breakpoint;

  • expr/expression:Evaluate a C/ObjC/C++ expression(动态执行C/ObjC/C++表达式);

  • p/print/expr/expression:print as a C/C++ basic variable;

  • po/expr -O/expression -O:Print as an Objective-C object;

  • call:调用。其实上述p/po后接表达式(expression)也有调用的功能,一般只在不需要显式输出,或是无返回值时使用call,用于动态调试插入调用代码。

    例如可以在viewDidLoad:里面设置断点,然后在程序中断的时候输入以下命令:

1
    call [self.view setBackgroundColor:[UIColor redColor]]

继续运行程序,view的背景颜色将变成红色!

  • bt(backtrace),打印当前调用堆栈(crash堆栈),“bt all”可打印所有thread的堆栈(相当于command+6的Debug Session Navigation)。

  • image:可用于寻址,有多个组合命令,比较实用的一种用法是寻找栈地址对应的代码(行)位置。

例如某个UITableView总共有2个section,当其引用的currentSection.index≥2时将会引起[UITableView rectForHeaderInSection:]调用异常,可使用expr动态改值制造crash场景模拟调试。

此时crash时的控制台bt显示异常出现在应用层代码“0x00d055b8 - [FACategoryTableView FACategorySectionHeaderDidTouched:] + 744”处(其中0x00d055b8为当前栈(代码段)偏移量,744为栈帧偏移量——PC指针相对函数入口的偏移)。

那么具体是FACategoryTableView.m文件哪一行代码调用引起的异常呢?此时通过“image lookup --address”后接bt的call stack中的代码段偏移地址(0x00d055b8)即可定位出异常调用的代码行位置。

  • x/memory read:dump指定地址的内存(Read from the memory of the process being debugged),后接起止地址或-c指定count加起始地址。可help mem read查看帮助:

Syntax:

     memory read[]

Command Options Usage:

    size指定内存块(block/item)的大小,默认为1byte。

    --size):The size in bytes to use when displaying with the selected format.

   count指定内存块(block/item)的个数,可配合起始地址使用。

   -c( --count):The number of total items to display.

   format指定内容显示格式,格式符同print:c-char,s-string,d-decimal,x-hex。

   -f( --format):Specify a format to be used for display.

Command Samples:

   (a)起止地址

  (lldb)mem read 0x10b88f0c 0x10b88f0c+9

    0x10b88f0c: 39 38 37 36 35 34 33 32 31                       987654321

   (b)起始地址+内存块count

   (lldb)mem read 0x10b88f0c -c 9

    0x10b88f0c: 39 38 37 36 35 34 33 32 31                       987654321

  (c)起始地址+内存块size+内存块count(dump hex format)

   (lldb)memory read -s 1 -f x -c 9 0x10b88f0c

   0x10b88f0c: 0x39 0x38 0x37 0x36 0x35 0x34 0x33 0x32

   0x10b88f14: 0x31

  (d)起始地址+内存块size+内存块count(dump char format)

  (lldb)memory read -s 1 -f c -c 9 0x10b88f0c

  0x10b88f0c: 987654321

  (e)起始地址+内存块size+内存块count(dump string format)

  (lldb)mem read 0x10b5cf2c -f s -c 1

   0x10b88f0c: "987654321"

  (f)起始地址+内存块size+内存块count(dump int format)

  (lldb)memory read -s 4 -f x -c 3 0x10b88f0c

   0x10b88f0c: 0x36373839 0x32333435 0x109f0031

  • memory write:改写指定地址的内存(Write to the memory of the process being debugged)。可help mem write查看帮助:

   Syntax: memory write

[[...]]

(10)启用NSZombieEnabled调试EXC_BAD_ACCESS

当你对已释放的对象发送消息(90%的可能是对引用计数为0的对象再release)或release那些autorelease对象时,就会出现报EXC_BAD_ACCESS这样的错误。

默认设置下 Xcode不会给你定位具体是哪一行代码不该去使用已释放的对象,或者release用错了。

Product -> Edit Scheme(option+command+R) -> Diagnostics ,勾选“Objective-C”之后的“Enable Zombie Objects”。

设置NSZombieEnabled环境变量后,一个对象销毁时会被转化为_NSZombie;设置NSZombieEnabled后,当你向一个已经释放的对象发送消息,这个对象就不只是报EXC_BAD_ACCESS Crash,还会放出一个错误消息,然后以一种可预测的可以产生debug断点的方式消失, 因此我们可以找到具体或者大概是哪个对象被错误的释放或引用了。

注意:NSZombieEnabled只能在调试的时候使用,千万不要忘记在产品发布的时候去掉,因为NSZombieEnabled不会真正去释放dealloc对象的内存,一直开启后果自负!

参考

《Xcode Overview-About Xcode》《Xcode Keyboard Shortcuts and Gestures》

《Xcode Key Bindings & Gestures》《提升Xcode效率的小技巧》

《Xcode5.1离线安装》《Xcode插件》《用Vim编辑器辅助Xcode》《Vim命令图解和xVim使用》

《Xcode的文件组织》《Xcode设置命令行启动参数》

《Xcode环境变量及路径设置》《Xcode构建输出目录》

《从VC到Xcode》《workspace & subProject & target》

《Xcode创建静态库》《Xcode4制作静态库1》《Xcode4制作静态库2》

《Xcode4.3下制作framework》《Xcode添加依赖的静态库工程》

《Building static libraries with the iPhone SDK》《Static Libraries and Cross-Project References》

《Start Developing iOS Apps Today》

《使用Xcode创建Hello World项目》《使用Xcode5和Interface Builder创建Hello World App》

《LLDB Quick Start Guide》《LLDB to GDB Command Map》《Xcode gdb/lldb调试命令》

《Xcode LLDB Debug教程》《LLDB调试命令初探》《iOS应用崩溃日志揭秘》《经营你的iOS应用日志》


更多iOS疯狂详解:http://blog.csdn.net/wanglongblog

VTsystem背景检查函数Value Valid Value Valid是个非常实用的函数,如何让它灵活的为我们所用,便是本文的内容。 阅读详情

相关推荐

3D Gaussian Splatting:用于实时的辐射场渲染

3D Gaussian Splatting:用于实时的辐射场渲染 3d gaussian splatting for real-time radiance field rendering

m0_51976564的博客 1万+

记悲催的一天:Xcode卡死indexing processing file

indexing processing file,平日里Xcode打开项目经常会看到的一个加载状态,今天却把我难倒了。经过整整一天的查找解决方法,调试,终于解决了。虽然不是什么高深的问题,却着实浪费了一天,以此谨记! 起因: 很正常的码代码,粘贴复制调整,突然Xcode顶部加载状态栏就出现了indexing processing file的进度条,一直加载中,且代码自动补全,查找定义跳转都不好...

txz_gray的博客 8501

wsl2上运行带有Isaac Gym的程序报错: GPU Pipeline: disabled

显示GPU Pipeline:disabled,查找相关文档发现是WSL2目前不支持Isaac Gym,时,想要在wsl2上运行,最后报错如下。

2303_78660611的博客 962

Xcode不出错误提示,Indexing | Processing files

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34380296的博客 1897

基于FPGA与红外成像的眼动追踪系统设计与实现(教学向)

本文详细介绍了基于FPGA与红外成像的眼动追踪系统设计与实现。通过红外摄像头采集图像,利用FPGA进行实时图像处理和红外瞳孔追踪,结合Verilog编程实现多目标检测与瞳孔定位。该系统适用于嵌入式视觉教学,展示了硬件搭建、算法优化及实时显示的完整流程。

g5h6i7j的博客 827

ThingsBoard教程(七):模拟设备遥测

前言 各位读者好,截止目前,ThingsBoard系列文章已经做了六篇,分别是 ThingsBoard教程(一):ThingBoard介绍及安装 ThingsBoard教程(二):租户,租户配置,部件组模块的使用 ThingsBoard教程(三):系统设置模块的使用 ThingsBoard教程(四):规则链简介与操作 ThingsBoard教程(五):客户,资产管理 ThingsBoard教程(六):设备管理 上一篇我们讲解了如何使用设备管理来对设备进行增删改查,和设备配置的一些基本概念,本篇文章就带大

知无涯 4592

Xcode操作流

1.Xcode IDE概览 说明:从左到右,依次是“导航窗格(Navigator)->边列(Gutter)->焦点列(Ribbon)->代码编辑窗口(Standard/Primary Editor)”。 边列(Gutter):显示行号和断点。 焦点列(Ribbon):灰色深度与代码嵌套深度相关:鼠标悬停可突出显示右侧相应代码块(Focus code blocks...

曾梦想仗剑走天涯 16万+

Y-Branch and a closed y-branch loop

双臂后面的区域,我们将它的双臂使用一个波导进行了连接,使得它本身形成了一个闭合回路,因此,该结构被称作。它们均是用来对经过它们的光束能量进行分割的一种器件。首先,我们知道一点,在光波导层面,今天给大家介绍一下,什么是。

u011699626的博客 636

深入了解Xcode 7——代码编辑

Coding in Xcode 7...

痴_Pro的博客 850

基于 FastAPI + LangGraph + LLM 大语言模型的通用 Agent 多智能体系统架构设计与开发实战、产业应用

FastAPI是一个现代、快速(高性能)的Python Web框架,专门用于构建API。它由Sebastián Ramírez(@tiangolo)创建,基于Starlette(用于Web部分)和Pydantic(用于数据部分)构建。性能优先:FastAPI是当前最快的Python Web框架之一,性能与NodeJS和Go相当。这得益于其基于Starlette的异步架构,能够充分利用Python 3.6+的async/await特性。开发效率。

AI天才研究院 239

Allegro16.6详细教程(二)

3-D Viewer,可以直接在allegro中看到board file的3-D顯示效果。3-D Viewer對於PCB Editor Products,只有環境變數中的OpenGL顯示功能開啟後才有效,而對於APD/SiP是無效的。2.3-D viewer是在一個獨立的視窗中打開的。3-D environment環境支援多種顯示內容的過濾,取景視角和顯示效果的選項,透過遊標可以直接控制放大,移動,翻轉等操作。

axingxiansen的博客 1938

高效使用xcode

转载:http://www.cocoachina.com/ios/20140731/9284.html (via:VongLo's Dev Space原文:Supercharging Your Xcode Efficiency) 好莱坞电影里经常看到黑客们手指在键盘上飞速跳跃,同时终端上的代码也随着飞舞。如果你也想像电影里那样,那么你来对地方了。这篇教程将会教你在Xcode...

iteye_14589的博客 134

C#面试题及详细答案120道(01-10)-- 基础语法与数据类型

C#与.NET部分重点解析了7个核心问题:1)C#与.NET的依存关系;2)值类型与引用类型的内存差异;3)装箱拆箱的性能损耗;4)string/String与int/Int32的实质等价性;5)const与readonly的初始化区别;6)可空类型的应用场景;7)ref与out关键字的参数传递机制。内容包含原理对比、代码示例和优化建议,适合开发者系统掌握C#核心概念。(1

大剑师兰特的GIS世界 1988

高效利用你的Xcode

好莱坞电影里经常看到黑客们手指在键盘上飞速跳跃,同时终端上的代码也随着飞舞。如果你也想像电影里那样,那么你来对地方了。这篇教程将会教你在Xcode编程中更像程序员,你可以称之为魔法、疯狂的技术、好运当头或者黑客。毫无疑问,在学习完本教程之后,不管你怎么认为,都会感觉很酷,同时能更高效地运用Xcode,甚至可以通过这些新发现使你的代码免于毁灭。 原文地址 开始日常Xcode任务快捷键Xc

sunyazhou13的专栏 547

全球国家地区城市数据

MySQL全球国家地区城市数据报。。。。。。。。。。。。

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

iOS开发Xcode7免费真机调试教程

从Xcode7开始,Xcode 不需要$99/$299升级开发者直接可以进行真机调试 调试步骤 1.假设已经你已经有了苹果账号,下载并安装好了Xcode7 2. 打开Xcode-> Preferences ->Accounts  点加号增加一个Apple ID 3.添加后发现 多了一行以Apple ID 账号名称为名称的Team,我的是 fox sky,如图所示,iOS/M

780

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

[分享]iOS开发 - Xcode 7真机测试详解

1.准备 注意:一定要让你的真机设备的系统版本和app的系统版本想对应,如果不对应就会出现一个很常见的问题:could not find developer disk image 首先,准备好下面的设备机相关软件 MAC版本:OSX10.10.4 Xcode版本:Xcode7 beta5 真机设备:iPad Air(iOS 8.1.3)/...

weixin_34050427的博客 202

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

xcode快捷键

1、打开所有文件界面: (1)command + 1; (2) 2、显示或者隐藏导航器面板: (1)command + 0; (2) 3、显示或者隐藏使用工具面板: (1)command + option + 0; (2) 4、搜索快捷键: (1)command + shift + f 或者 command + 3; (2) 5、直接跳转到某个类: (1)command +

sgliquangang的专栏 1540

iOS开发 实战篇---Xcode7免费真机测试流程

Xcode 7真机测试详解   1.准备 注意:一定要让你的真机设备的系统版本和app的系统版本想对应,如果不对应就会出现一个很常见的问题:could not find developer disk image 首先,准备好下面的设备机相关软件 MAC版本:OSX10.10.4Xcode版本:Xcode7 beta5(点击下载) 真机设备:iPad Air(iOS 8.1.

Lorne_Coder的博客 2166

Xcode基本操作

[From]http://blog.csdn.net/phunxm/article/details/17044337 1.Xcode IDE概览 说明:从左到右,依次是“导航窗格(Navigator)->边列(Gutter)->焦点列(Ribbon)->代码编辑窗口(Standard/Primary Edi...

weixin_30487201的博客 358

PHPExcel异常处理终极指南:从捕获到日志记录的10个最佳实践 [特殊字符]

PHPExcel作为强大的PHP电子表格处理库,异常处理是确保应用稳定性的关键环节。本文将为您详细介绍PHPExcel异常处理的最佳实践,从基础捕获到高级日志记录,帮助您构建更健壮的电子表格应用。 ## 📊 为什么PHPExcel异常处理如此重要? 在使用PHPExcel进行Excel文件操作时,可能会遇到各种问题:文件格式错误、内存不足、权限问题、数据格式异常等。良好的异常处理机制能够:

gitblog_00740的博客 1009

Xcode编辑器之基本使用(一)

前言. 苹果原生xcode使用介绍文档 1.Xcode IDE概览 说明: 从左到右,依次是“导航窗格(Navigator)->边列(Gutter)->焦点列(Ribbon)->代码编辑窗口(Standard/Primary Editor)”。 边列(Gutter):显示行号和断点。(上图未显示,可通过command + , 找到 Text Editing -&gt...

weixin_34087503的博客 7989

Xcode 7各版本(dmg)官方直接下载(离线下载)

Xcode7.0:https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_7/Xcode_7.dmg; Xcode7.1:https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_7.1

xiaojinIT的博客 3172

XCode7以上免证书真机调试教程

在Xcode 7中,苹果改变了自己在许可权限上的策略,此前Xcode只开放给注册开发者下载,但Xcode 7改变了这种惯有的做法,无需注册开发者账号,仅使用普通的Apple ID就能下载和上手体验。此前开发者需每年支付99美元的费用成为注册开发者才能在iPhone和iPad真机上运行代码,苹果新的开发者计划则放宽要求,无需购买,只要你感兴趣同样可以在设备上测试app。操作步骤:1.进入xcode,菜

justinjing的专栏 1万+

iOS开发 - Xcode7下解决使用三方库出现的warning问题

Xcode7下使用三方库会出现大量的warning问题,这时我们需要处理下

骑着蜗牛找马儿 1559

Xcode 禁用indexing

Xcode 禁用indexing

Sico2Sico 1357

Xcode 常用使用技巧说明,总有一个帮助你

本文整理了Xcode实用快捷键和配置技巧: 常用快捷键:Command+Click跳源码、Command+Enter显示代码提示、Shift+BackSpace删除整行、Option+Command+P刷新Preview等 自定义快捷键:通过修改IDETextKeyBindingSet.plist文件添加换行等自定义快捷键 代码格式化:推荐安装SwiftFormat插件实现代码自动格式化 其他实用操作:包括重构重命名(Shift+F6)、多选(Ctrl+G)、查找文件(Command+Shift+O)等 配

894
上一篇: iOS疯狂详解之ASIHttpRequest的简单封装
下一篇: iOS疯狂详解之视频播放MPMoviePlayerViewController
吊炸天-狂人
博客等级 码龄12年 87粉丝 42原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值