学习ojective之一

xgboost 逻辑回归:objective参数(reg:logistic,binary:logistic,binary:logitraw,)对比分析 熟悉xgboost的小伙伴都知道,它在训练模型时,有train()方法和fit()方法,train方法使用如下:params ={'eta': 0.1, 'max_depth': 4, 'num_boost_round':20, 'objective': 'reg:logistic', 'random_state': ... 阅读详情

1.字符串格式化

NSString *p =@"an apple";

NSLog(@"whatis this? it is %@", p);

Objective-C中的字符串格式化输出

 

在使用诸如NSLog, [NSString stringWithFormat:]之类的函数时,都是基于c/c++风格的字符串格式化工作的.本来c/c++就没怎么用过,到iphone开发开发

转自http://blog.kungfusoft.com/programming/iphone/topic-281.html

在使用诸如NSLog, [NSString stringWithFormat:]之类的函数时,都是基于c/c++风格的字符串格式化工作的.

 

本来c/c++就没怎么用过,到iphone开发开发时掺合上NS系的对象,格式化输出更是一头的乱.

看了一下Programming Guide for Cocoa的文档,还是有比较详尽的说明的,整理出来备查.

 

格式定义

The formatspecifiers supported by the NSString formatting methods and CFString formattingfunctions follow the IEEE printf specification; the specifiers are summarizedin Table 1. Note that you can also use the “n$” positional specifiers such as%1$@ %2$s. For more details, see the IEEE printf specification. You can alsouse these format specifiers with the NSLog function.

Table 1 Formatspecifiers supported by the NSString formatting methods and CFString formattingfunctions 定义   说明

%@      Objective-C object, printed as the stringreturned by descriptionWithLocale: if available, or description otherwise. Alsoworks with CFTypeRef objects, returning the result of the CFCopyDescriptionfunction.

%%       ‘%’ character

%d, %D, %i        Signed 32-bit integer (int)

%u, %U       Unsigned 32-bit integer (unsigned int)

%hi       Signed 16-bit integer (short)

%hu      Unsigned 16-bit integer (unsigned short)

%qi       Signed 64-bit integer (long long)

%qu      Unsigned 64-bit integer (unsigned longlong)

%x        Unsigned 32-bit integer (unsigned int),printed in hexadecimal using the digits 0–9 and lowercase a–f

%X       Unsigned 32-bit integer (unsigned int),printed in hexadecimal using the digits 0–9 and uppercase A–F

%qx      Unsigned 64-bit integer (unsigned longlong), printed in hexadecimal using the digits 0–9 and lowercase a–f

%qX     Unsigned 64-bit integer (unsigned longlong), printed in hexadecimal using the digits 0–9 and uppercase A–F

%o, %O       Unsigned 32-bit integer (unsigned int),printed in octal

%f 64-bit floating-point number (double)

%e        64-bit floating-point number (double),printed in scientific notation using a lowercase e to introduce the exponent

%E        64-bit floating-point number (double),printed in scientific notation using an uppercase E to introduce the exponent

%g        64-bit floating-point number (double),printed in the style of %e if the exponent is less than –4 or greater than orequal to the precision, in the style of %f otherwise

%G       64-bit floating-point number (double),printed in the style of %E if the exponent is less than –4 or greater than orequal to the precision, in the style of %f otherwise

%c        8-bit unsigned character (unsigned char),printed by NSLog() as an ASCII character, or, if not an ASCII character, in theoctal format \\ddd or the Unicode hexadecimal format \\udddd, where d is adigit

%C       16-bit Unicode character (unichar),printed by NSLog() as an ASCII character, or, if not an ASCII character, in theoctal format \\ddd or the Unicode hexadecimal format \\udddd, where d is adigit

%s        Null-terminated array of 8-bit unsignedcharacters. %s interprets its input in the system encoding rather than, forexample, UTF-8.

%S        Null-terminated array of 16-bit Unicodecharacters

%p        Void pointer (void *), printed inhexadecimal with the digits 0–9 and lowercase a–f, with a leading 0x

%L        Length modifier specifying that afollowing a, A, e, E, f, F, g, or G conversion specifier applies to a longdouble argument

%a        64-bit floating-point number (double),printed in scientific notation with a leading 0x and one hexadecimal digitbefore the decimal point using a lowercase p to introduce the exponent

%A       64-bit floating-point number (double),printed in scientific notation with a leading 0X and one hexadecimal digitbefore the decimal point using a uppercase P to introduce the exponent

%F        64-bit floating-point number (double),printed in decimal notation

%z        Length modifier specifying that afollowing d, i, o, u, x, or X conversion specifier applies to a size_t or thecorresponding signed integer type argument

%t Length modifier specifying that a following d,i, o, u, x, or X conversion specifier applies to a ptrdiff_t or thecorresponding unsigned integer type argument

%j Length modifier specifying that a following d,i, o, u, x, or X conversion specifier applies to a intmax_t or uintmax_targument

 

平台依赖

Mac OS X usesseveral data types—NSInteger, NSUInteger,CGFloat, and CFIndex—to provide aconsistent means of representing values in 32- and 64-bit environments. In a32-bit environment, NSInteger and NSUInteger are defined as int and unsignedint, respectively. In 64-bit environments, NSInteger and NSUInteger are definedas long and unsigned long, respectively. To avoid the need to use differentprintf-style type specifiers depending on the platform, you can use thespecifiers shown in Table 2. Note that in some cases you may have to cast thevalue.


AI技术在电商中的实际应用 人工智能、电商、推荐系统、个性化、机器学习、深度学习 1. 背景介绍 电子商务行业近年来发展迅速,用户数量不断增长,商品种类日益丰富。然而,随着市场竞争的加剧,电商平台面临着如何提升用户体验、提高转化率、挖掘潜在商机等一系列挑战。人工智能(AI)技术作为一种新兴技术,凭借其强大的数 阅读详情

相关推荐

ffmpeg中av_read_frame阻塞的原因与解决方案

最近用到ffmpeg,想要av_read_frame立即返回,但是看网上的博客,都没有详细的解说,那就自己看源码。 两种方法: 设置回调打断函数和设置超时 超时,但是如果只设置该参数,依然会在av_read_frame中阻塞, av_dict_set(&inputDic, "stimeout", "2*1000*1000", 0); // milliseconds //打断回调 m_avformatCtx->interrupt_callback.callback = interru

weixin_43360707的博客 1万+

Ojective c 多态中,有关类的问题

Ojective c 多态中,有关类的问题

1388

Python读取Matlab v7.3数据

文章目录Matlab保存数据Python读取 v7.3 Mat Matlab保存数据 在matlab设置中,常规->MAT文件,选择MATLAB版本7.3或更高版本保存数据。 注意保存数据的文件名为 corre.mat,保存的数据数组为data; 后面python的读取中会用到这两个参数 Python读取 v7.3 Mat 先安装hdf5storage库,再使用以下代码,就可以读取到mat中的数据,注意 import hdf5storage import numpy as np dataDi

weixin_43121914的博客 1081

Objective-C小白入门:什么是Objective-C

Objective-C 咳咳,今天我是你的私教美少女朵朵,开始上课。 接触一门新语言,先要了解它的历史。 Objective-C 是一种简单的计算机语言,设计为可以支持真正的面向对象编程。Objective-C 通过提供类定义,方法以及属性的语法,还有其他可以提高类的动态扩展能力的结构等,扩展了标准的 ANSI C 语言。类的语法和设计主要是基于 Smalltalk,最早的面向对象编程语言之一。 如果你以前使用过其他面向对象编程语言,那么下面的信息可以帮助你学习 Objective-C ...

程序媛乐园 5248

Workbench中直接调用ICEM CFD进行网格划分

自从ANSYS 12.0之后,ICEM CFD就从Workbench中被分离出去,作为一个独立的程序使用了。取而代之的是Meshing模块。 在Meshing的属性节点菜单中右键点击Mesh,选择Insert > Method,插入方法。 选择需要划分网格的几何体,点击apply。此时Geometry显示为1 Body。 设置Method为MultiZone,如果不设置成这个的话,找不到进入ICEM CFD的入口。如果要划分四面体,可以在Mapped Mesh Type中选择其他类型。

Yan的博客 6512

CST Studio Suite安装详细教程(附安装包)CST Studio Suite 2024超详细安装教程

CST Studio Suite 2024安装指南摘要:本文详细介绍了CST Studio Suite 2024电磁仿真软件的下载与安装流程,包含23个图文步骤说明,从解压安装包到配置许可证服务器。重点提示了以管理员身份运行、自定义安装路径等关键步骤,并提供了常见问题解决方案和入门技巧。该软件适用于天线设计、PCB分析等高频电磁场仿真,安装后需通过localhost:27000连接许可证服务器完成激活。

pythonqiang9的博客 1万+

Ojective-C学习笔记(1)

工欲善其事必先利其器,想要学习iOS开发,必须要有一些必要的设备才行。 准备工作: 一台苹果电脑,系统版本号10.13.4。安装Xcode软件,版本号9.3。以及一部苹果手机。一切都准备好了,开始我的iOS学习之旅吧。 首先学习的是Objective-C这门编程语言。使用Xcode创建一个OC的项目。 使用Xcode新建一个工程,选择macOC->Command Line Tool,点击n...

weixin_30394981的博客 217

【数学模型】灰色关联分析

数学模型-灰色关联分析

suic009的博客 1万+

ojective-C学习笔记(6)复合

通过之前的学习,知道了继承是在两个类之间建立关系的一种方式,它可以避免许多重复的代码。 使用复合可以组合多个对象,让它们分工协作。事实上,我们经常同时使用继承和复合来创建自己的类,掌握两个概念十分重要。 下面通过一个小程序来了解复合是什么。 //Tire类 @interface Tire : NSObject @end @implementation Tire - (NSString *)d...

weixin_30590285的博客 238

树莓派 5 AI 套件(Hailo)示例

该用户自定义类作为输入传递给回调函数,该函数在管道输出上运行。它用于主程序与回调函数之间的通信。它对 hailo_rpi_common::app_callback_class 进行了扩展,并可根据应用程序的具体情况定制附加变量和方法。

机器人控制与仿真应用 4115

FPGA发展趋势:异构计算、AI加速、可重构计算

FPGA技术正朝着异构计算、AI加速和可重构计算三大方向发展。作为高效能计算平台,FPGA在异构架构中与CPU/GPU协同工作,发挥低延迟、高能效优势;在AI领域通过定制化架构实现边缘推理加速;其硬件可重构特性支持动态适应多样化计算需求。最新进展包括部分可重构技术、智能网卡和边缘AI应用。未来,FPGA将在自适应计算、量子接口和软件定义硬件等领域持续突破,成为异构计算架构的核心组件,推动硬件与软件的深度融合。性能对比显示FPGA在能效比(5-20TOPS/W)和灵活性方面具有显著优势。

2301_79143213的博客 969

Ojective学习之五

NSLog(NSString *format….) 数组(NSArray、NSMutableArray---父子关系) 见下图   词典对象(NSDictionary、NSMutableDictionary) 见下图 集合对象(NSSet、NSMutable

1056

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

ojective学习之二

2.类定义与实现: BenzCar.h @interfaceBenzCar:Car {    NSString *pName;    NSString *id;    } @property NSString*pName; -(void)getGas:(in

666

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

ojective学习之四

24. Foundation框架: #import (1)数字、字符串和集合 数字对象(NSNumber):NSNumber用于数字对象转换,将数字转化成NSInteger等, +(NSNumber *)numberWithChar:(char)value; +(NS

779

Ojective-C学习纪录2

数据转换类型 Convert NSString to int 1 NSString *aNumberString = @"123"; 2 int i = [aNumberString intValue];   Convert int to NSString 1 int

土豆丝炒肉专栏 568

ojective-C学习笔记(7)Foundation框架

一些有用的数据类型 范围 NSRange range1; range1.location = 10; range1.length = 20; NSRange range2 = {10, 20}; NSRange range3 = NSMakeRange(10, 20); 几何数据类型 struct CGPoint { CGFloat x; CGFloat y; }...

weixin_30786617的博客 215

Ojective-C学习笔记(2)

在上篇随笔中我用Xcode创建了一个OC项目。这次我要重新建一个项目,并添加一些代码来体验OC语法的魅力。 首先来学习一下OC中的布尔类型(BOOL),它有两个值 YES 和 NO ,实际上是一种带符号的字符类型。 来写一个函数判断两个整数是否相等。 #import <Foundation/Foundation.h> BOOL areIntsSame(int a, int b){ ...

weixin_30381793的博客 332

iOS学习之路3-Ojective-C语言介绍

Objective-C 是在 C 的基础上,加入面向对象特性扩充而成的通用型高级编程语言。Objective-C主要应用于Mac OS X 和iOS系统及其相关 API 如Cocoa、Cocoa Touch。Objective-C 最初源于 NeXTSTEP 系统,尔后由 OS X 和 iOS 继承下来。目前主要支持的编译器有 GCC与Clang。 ...

weixin_34200628的博客 194

ojective-C学习笔记(6)继承

在学习的上一个小程序中,有几个类的接口和实现都非常的相似,我是通过复制粘贴的方式来编写的。 可以使用继承来减少重复的代码。只有代码少了,bug才无处藏身。 OC是单一继承,可以使用OC的其他特性来达到多继承的效果,这个以后会学到的,不用着急。 有关继承的术语 超类(super class):是被继承的类。 父类(parent class):是超类的另一种叫法。 子类(subclass):是执行继承...

weixin_30912051的博客 134

ojective-C学习笔记(5)关于面向对象编程

先了解几个OC中有关面向对象编程的术语 类(class)是一种表示对象类型的结构体。这里所说的结构体和C语言中的结构体不是一回事。 对象(object)是一种包含值和指向其类的隐藏指针的结构体。 实例(instance)对象的另一种叫法。 消息(message)是对象可以执行的操作,通知对象去做什么。 方法(method)是为响应消息而运行的代码。 方法调度(nethod dispatcher)是...

weixin_30416497的博客 178

ojective-C学习笔记(3)关于面向对象编程

面向对象编程(Object-Oriented Programming)的首字符缩写为OOP。 在学习OOP之前,先来看看OOP的一个重要概念:间接(indirection)。 间接在编程中体现在通过指针间接获取某个值,而不是直接取值。比如我们打电话是通过通讯录间接选择要联系的人,而不是直接在手机中输入对方的手机号码。 变量与间接 先来看下面的代码: int main(int argc, const...

weixin_30437847的博客 291

Ojective-C学习笔记(4)关于面向对象编程

在面向对象编程中使用间接 在学习之前,先看一个过程式编程的例子。 // // main.m // OOP // // Created by ccyag on 21/4/18. // Copyright © 2018年 ccyag. All rights reserved. // #import <Foundation/Foundation.h> typedef enum{ ...

weixin_30384031的博客 168

Ojective C入门

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

weixin_34205076的博客 96

Ojective-C入门请读

既然决定了成为ios的人,满腔的鸡血也别急着洒,过岗前壮士且听我一言,带上这些干货喝了这杯烈酒。说不定以后的路会好走一些。

IT_Panda_ffm 722

Ojective-C 回顾、总结

oc总结 第一章:类和面向对象 1.类和对象的区别:类是一组具有相同(特征)属性和行为(功能)的事物的集合。类描述这类事物应该具有哪些行为和特征,而对象真正去实现行为和特征,对象是类的具体。 .m ,.h文件存储的内容 .h文件:声明性的东西,属性,方法,协议 .m文件:实现.h文件中声明的东西。 第二章:属性 属性定义和属性合成器 @propert

互通有无,绿水长流 863
下一篇: ojective学习之二
shareCode
博客等级 码龄15年 125粉丝 40原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值