iphone开发常用代码(不断更新)

iOS开发:苹果2018最新款手机(iPhone XS Max、iPhone XR等)如何查看并获取手机的UDID 随着苹果设备的不断更新,作为苹果开发者来说既是好事也是坏事,好事是因为苹果设备的更新换代,淘汰了一部分旧设备更新了新设备,坏事就是要不断学习应对新的设备带来的问题,比如新屏幕尺寸的适配问题、获取手机的UDID方式等。 新款苹果机的手机UDID不会轻易的显示出来,比如之前苹果手机如果插入到Mac电脑上面,信任Mac电脑之后,电脑上的iTunes启动打开之后,... 阅读详情

iphone开发常用代码(不断更新)

iPhone 2009-06-26 11:24:20 阅读4214 评论8  字号:大中小 订阅

- (NSString *)URLEncodedString:(NSString *)string{
    NSString *result = (NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
                                                       (CFStringRef)string,NULL,CFSTR("!*'();:@&=+$,/?%#[]"),kCFStringEncodingUTF8);
    [result autorelease];
    return result;
}

//生成nonce
- (NSString *)generateNonce{
    CFUUIDRef theUUID = CFUUIDCreate(NULL);
    CFStringRef string = CFUUIDCreateString(NULL, theUUID);
    NSMakeCollectable(theUUID);
    return [(NSString *)string stringByReplacingOccurrencesOfString:@"-" withString:@""];
    //return (NSString *)string;
}

//生成Timestamp
- (NSString *)generateTimestamp{
    return [[NSString stringWithFormat:@"%d", time(NULL)] retain];
}

iPhone键盘改变颜色
只有这2种数字键盘才有效果:UIKeyboardTypeNumberPad,UIKeyboardTypePhonePad
keyboardAppearance = UIKeyboardAppearanceAlert 
代码如下:
  1.    NSArray *ws = [[UIApplication sharedApplication] windows];
  2.     for(UIView *w in ws){
  3.         NSArray *vs = [w subviews];
  4.         for(UIView *v in vs){
  5.             if([[NSString stringWithUTF8String:object_getClassName(v)] isEqualToString:@"UIKeyboard"]){
  6.                 v.backgroundColor = [UIColor redColor];
  7.             }
  8.         }
  9.     }

从一个界面push到下一界面左上角返回按钮文字设置

在父viewController中如下设置:
    UIBarButtonItem *backbutton = [[UIBarButtonItem alloc]init];
    backbutton.title = @"返回列表";
    self.navigationItem.backBarButtonItem = backbutton;
    [backbutton release];

navigationbar的back键触发其他事件
UIButton *back =[[UIButton alloc] initWithFrame:CGRectMake(200, 25, 63, 30)]; 
[back addTarget:self action:@selector(reloadRowData:) forControlEvents:UIControlEventTouchUpInside];
[back setImage:[UIImage imageNamed:@"返回按钮.png"] forState:UIControlStateNormal];
UIBarButtonItem *backButtonItem = [[UIBarButtonItem alloc] initWithCustomView:back];
self.navigationItem.leftBarButtonItem = loginButtonItem
[back release];
[backButtonItem release];
防止屏幕暗掉锁屏

[ [UIApplication  sharedApplication ] setIdleTimerDisabled : YES ];

将图片从左到右翻页效果显示
    
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 0, 470)];
    [imageView setImage:[UIImage imageNamed:@"Bg.jpg"]];
    self.myImageView =imageView;
    [self.view addSubview:imageView];
    [imageView release];
    CGContextRef context = UIGraphicsGetCurrentContext();
    [UIView beginAnimations:nil context:context];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    [UIView setAnimationDuration:0.5];
    [myImageView setFrame:CGRectMake(0, 0, 310, 470)];    
    [UIView commitAnimations];

让覆盖在下面层的视图接受触摸事件

searchImage.exclusiveTouch = YES;//第一层
searchImage.userInteractionEnabled = NO;
myMapView.exclusiveTouch = NO;//第二层
myMapView.userInteractionEnabled = YES;

View的缩放

NSValue *touchPointValue = [[NSValue valueWithCGPoint:CGPointMake(100,100)] retain];
[UIView beginAnimations:nil context:touchPointValue];
transform = CGAffineTransformMakeScale(0.1,0.21);
firstPieceView.transform = transform;
[UIView commitAnimations];    

代码循环添加按钮,其他空间也可以用类似方法添加


- (void)viewDidLoad {
    [super viewDidLoad];
    for(int i = 0; i < 5; i++){
        CGRect frame;
        Btn[i] = [[UIButton buttonWithType:UIButtonTypeCustom] retain];
        [Btn[i] setImage:[UIImage imageNamed:@"Button.png"] forState:UIControlStateNormal];//设置按钮图片
        frame.size.width = 55;//设置按钮坐标及大小
        frame.size.height = 84;
        frame.origin.x = (i%5)*57+5;
        frame.origin.y = 10;
        [Btn[i] setFrame:frame];
        [Btn[i] setBackgroundColor:[UIColor clearColor]];
        [Btn[i] addTarget:self act ion:@selector(btnPressed:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:Btn[i]];
        [Btn[i] release];
    }
}
//响应按钮事件
-(void)btnPressed:(id)sender{
    for(int i = 0; i < 5;i++){
        if([sender isEqual:Btn[i]]){
            NSLog(@"Btn[%d]:",i);
        }
    }
}

去除nsstring中的空格,table 以及newline,nextline

NSCharacterSet *whitespace = [NSCharacterSet  whitespaceAndNewlineCharacterSet ];
NSString * username  = [mUsernameField stringValue];
username = [username  stringByTrimmingCharactersInSet :whitespace];

UIImagePickerController


用
UIImagePickerController 选择、显示图片或视频,主要注意 UIImagePickerController 几个属性的设置
一:UI 显示样式,显示的格式确定
1: sourceType
@property(nonatomic) UIImagePickerControllerSourceType sourceType
enum {
UIImagePickerControllerSourceTypePhotoLibrary,
UIImagePickerControllerSourceTypeCamera,
UIImagePickerControllerSourceTypeSavedPhotosAlbum
};
typedef NSUInteger UIImagePickerControllerSourceType;
sourceType用来 确定用户界面显示的样式:
共三种格式(模拟器上的效果图)
UIImagePickerControllerSourceTypePhotoLibrary,
UIImagePickerControllerSourceTypeCamera,
iphone开发常用代码(不断更新) - 勇者之尊 - 等待

UIImagePickerControllerSourceTypeSavedPhotosAlbum
iphone开发常用代码(不断更新) - 勇者之尊 - 等待
为了区分是否支持视频格式,一般要用到下面这个函数,以便确定mediaTypes。
+ (BOOL)isSourceTypeAvailable:(UIImagePickerControllerSourceType)sourceType
2:    mediaTypes
@property(nonatomic,copy) NSArray *mediaTypes
mediaTypes用来确定再picker里显示那些类型的多媒体文件,图片?视频?
+ (NSArray *)availableMediaTypesForSourceType:(UIImagePickerControllerSourceType)sourceType
二:选取动作处理
UIImagePickerControllerDelegate 
通过代理来完成用户在选中图片,或者choose视频时的处理方式:

共有三个可选的代理方法
– imagePickerController:didFinishPickingMediaWithInfo:  
– imagePickerControllerDidCancel:  
– imagePickerController:didFinishPickingImage:editingInfo:    Deprecated in iPhone OS 3.0

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
info中包括选取的照片,视频的主要信息
NSString *const UIImagePickerControllerMediaType;         选取的类型 public.image  public.movie
NSString *const UIImagePickerControllerOriginalImage;    修改前的UIImage object.
NSString *const UIImagePickerControllerEditedImage;      修改后的UIImage object.
NSString *const UIImagePickerControllerCropRect; 原始图片的尺寸NSValue object containing a CGRect da ta type
NSString *const UIImagePickerControllerMediaURL;          视频在文件系统中 的 NSURL地址
保存视频主要时通过获取其NSURL 然后转换成NSData
实例代码如下:

- (void) pickImage: (id) sender

{

UIImagePickerController *ipc = [[UIImagePickerController alloc] init];

        if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]){

     ipc.sourceType =  UIImagePickerControllerSourceTypePhotoLibrary;

      ipc.mediaTypes =[UIImagePickerController availableMediaTypesForSourceType:ipc.sourceType];   

        } 

ipc.delegate = self;

ipc.allowsImageEditing = NO;

[self presentModalViewController:ipc animated:YES];

}

 

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{

NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];

if ([mediaType isEqualToString:@"public.image"]){

// UIImage *selectedImage = [info objectForKey:UIImagePickerControllerOriginalImage];

UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];

    NSLog(@"found an image");

[UIImageJPEGRepresentation(image, 1.0f) writeToFile:[self findUniqueSavePath] atomically:YES];

    SETIMAGE(image);

CFShow([[NSFileManager defaultManager] directoryContentsAtPath:[NSHomeDirectory() stringByAppendingString:@"/Documents"]]);

}

else if ([mediaType isEqualToString:@"public.movie"]){

NSURL *videoURL = [info objectForKey:UIImagePickerControllerMediaURL];

NSLog(@"found a video");

        NSData *webData = [NSData dataWithContentsOfURL:videoURL];

//NSData *video = [[NSString alloc] initWithContentsOfURL:videoURL];

[webData writeToFile:[self findUniqueMoviePath] atomically:YES];

CFShow([[NSFileManager defaultManager] directoryContentsAtPath:[NSHomeDirectory() stringByAppendingString:@"/Documents"]]);

// NSLog(videoURL);

}

[picker dismissModalViewControllerAnimated:YES];

}


UITextInputTraits属性


  autocapitalizationType            设置键盘自动大小写的属性     UITextAutocapitalizationTypeNone 
autocorrectionType  property  设置是否有自动修改提示   UITextAutocorrectionTypeNo
enablesReturnKeyAutomatically   Boolean值-设置在用户没有输入是returnKey禁用,默认值NO
keyboardAppearance  设置键盘显示方式  除了默认模式  还有一个UIKeyboardAppearanceAlert模式
keyboardType               设置键盘类型   UIKeyboardTypePhonePad 等
returnKeyType              设置renturnKey按键上的提示文字     UIReturnKeyGo   UIReturnKeyNext
secureTextEntry           
BOOL值  -- 设置是否是密码保护模式输入

如下:
设置登录用的 输入框 UITextField
用户名输入框:
m_TF_username = [[UITextField alloc] initWithFrame:my_frame];
m_TF_username.borderStyle = UITextBorderStyleNone;
m_TF_username.clearButtonMode = UITextFieldViewModeWhileEditing;
m_TF_username.delegate = self;
m_TF_username. returnKeyType  = UIReturnKeyNext;
m_TF_username. autocapitalizationType  = UITextAutocapitalizationTypeNone;
[m_TF_username becomeFirstResponder];
密码输入框:
m_TF_password = [[UITextField alloc] initWithFrame:my_frame];
m_TF_password.borderStyle = UITextBorderStyleNone;
m_TF_password.clearButtonMode = UITextFieldViewModeWhileEditing;
m_TF_password.delegate = self;
m_TF_password. returnKeyType  = UIReturnKeyGo;
m_TF_password. secureTextEntry  =YES;

键盘透明
textField.keyboardAppearance = UIKeyboardAppearanceAlert;

状态栏的网络活动风火轮是否旋转
[UIApplication sharedApplication].networkActivityIndicatorVisible,默认值是NO。

截取屏幕图片
//创建一个基于位图的图形上下文并指定大小为CGSizeMake(200,400)
UIGraphicsBeginImageContext(CGSizeMake(200,400)); 

//renderInContext 呈现接受者及其子范围到指定的上下文
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
   
 //返回一个基于当前图形上下文的图片
 UIImage *aImage = UIGraphicsGetImageFromCurrentImageContext();
 
 //移除栈顶的基于当前位图的图形上下文
UIGraphicsEndImageContext();

//以png格式返回指定图片的数据
imageData = UIImagePNGRepresentation(aImage);


更改cell选中的背景
    UIView *myview = [[UIView alloc] init];
    myview.frame = CGRectMake(0, 0, 320, 47);
    myview.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"0006.png"]];
    cell.selectedBackgroundView = myview; 

在数字键盘上添加button:
//定义一个消息中心
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; //addObserver:注册一个观察员 name:消息名称
- (void)keyboardWillShow:(NSNotification *)note {
    // create custom button
    UIButton *doneButton = [UIButton buttonWithType:UIButtonTypeCustom];
    doneButton.frame = CGRectMake(0, 163, 106, 53);
    [doneButton setImage:[UIImage imageNamed:@"5.png"] forState:UIControlStateNormal];
    [doneButton addTarget:self act ion:@selector(addRadixPoint) forControlEvents:UIControlEventTouchUpInside];
    
    // locate keyboard view
    UIWindow* tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:1];//返回应用程序window
    UIView* keyboard;
    for(int i=0; i<[tempWindow.subviews count]; i++) //遍历window上的所有subview
    {
        keyboard = [tempWindow.subviews objectAtIndex:i];
        // keyboard view found; add the custom button to it
        if([[keyboard description] hasPrefix:@"<UIKeyboard"] == YES)
        [keyboard addSubview:doneButton];
    }
}

正则表达式使用:
被用于正则表达式的字串必须是可变长的,不然会出问题

将一个空间放在视图之上
[scrollView insertSubview:searchButton aboveSubview:scrollView];

从本地加载图片
NSString *boundle = [[NSBundle mainBundle] resourcePath];
[web1 loadHTMLString:[NSString stringWithFormat:@"<img src='http://fei263.blog.163.com/blog/0001.png'/>"] baseURL:[NSURL fileURLWithPath:boundle]];

从网页加载图片并让图片在规定长宽中缩小
[cell.img loadHTMLString:[NSString stringWithFormat:@"<html><body><img src='http://fei263.blog.163.com/blog/%@' height='90px' width='90px'></body></html>",goodsInfo.GoodsImg] baseURL:nil];
将网页加载到webview上通过javas cript获取里面的数据,如果只是发送了一个连接请求获取到源码以后可以用正则表达式进行获取数据
NSString *javaS cript1 = @"document.getElementsByName('.u').item(0).value";
NSString *javaS cript2 = @"document.getElementsByName('.challenge').item(0).value";
NSString *strResult1 = [NSString stringWithString:[theWebView stringByEvaluatingJavaScriptFromString:javaS cript1]];
NSString *strResult2 = [NSString stringWithString:[theWebView stringByEvaluatingJavaScriptFromString:javaS cript2]];

用NSString怎么把UTF8转换成unicode
utf8Str //
NSString *unicodeStr = [NSString stringWithCString:[utf8Str UTF8String] encoding:NSUnicodeStringEncoding];

View自己调用自己的方法:
[self performSelector:@selector(loginToNext) withObject:nil afterDelay:2];//黄色段为方法名,和延迟几秒执行.

显示图像:
CGRect myImageRect = CGRectMake(0.0f, 0.0f, 320.0f, 109.0f); 
UIImageView *myImage = [[UIImageView alloc] initWithFrame:myImageRect];
[myImage setImage:[UIImage imageNamed:@"myImage.png"]]; 
myImage.opaque = YES; //opaque是否透明
[self.view addSubview:myImage]; 
[myImage release]; 

WebView:
CGRect webFrame = CGRectMake(0.0, 0.0, 320.0, 460.0); 
UIWebView *webView = [[UIWebView alloc] initWithFrame:webFrame]; 
[webView setBackgroundColor:[UIColor whiteColor]]; 
NSString *urlAddress = @"http://www.google.com"; 
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; 
[webView loadRequest:requestObj];
[self addSubview:webView]; 
[webView release];

显示网络活动状态指示符
这是在iPhone左上部的状态栏显示的转动的图标指示有背景发生网络的活动。
UIApplication* app = [UIApplication sharedApplication]; 
app.networkActivityIndicatorVisible = YES; 

动画:一个接一个地显示一系列的图象
NSArray *myImages = [NSArray arrayWithObjects: [UIImage imageNamed:@"myImage1.png"], [UIImage imageNamed:@"myImage2.png"], [UIImage imageNamed:@"myImage3.png"], [UIImage imageNamed:@"myImage4.gif"], nil];
UIImageView *myAnimatedView = [UIImageView alloc]; 
[myAnimatedView initWithFrame:[self bounds]]; 
myAnimatedView.animationImages = myImages; //animationImages属性返回一个存放动画图片的数组
myAnimatedView.animationDuration = 0.25; //浏览整个图片一次所用的时间
myAnimatedView.animationRepeatCount = 0; // 0 = loops forever 动画重复次数
[myAnimatedView startAnimating]; 
[self addSubview:myAnimatedView]; 
[myAnimatedView release]; 

动画:显示了something在屏幕上移动。注:这种类型的动画是“开始后不处理” -你不能获取任何有关物体在动画中的信息(如当前的位置) 。如果您需要此信息,您会手动使用定时器去调整动画的X和Y坐标
这个需要导入QuartzCore.framework
CABasicAnimation *theAnimation; 
theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.translation.x"]; 
//Creates and returns an CAPropertyAnimation instance for the specified key path.
//parameter:the key path of the property to be animated
theAnimation.duration=1; 
theAnimation.repeatCount=2; 
theAnimation.autoreverses=YES; 
theAnimation.fromValue=[NSNumber numberWithFloat:0]; 
theAnimation.toValue=[NSNumber numberWithFloat:-60]; 
[view.layer addAnimation:theAnimation forKey:@"animateLayer"];

Draggable items//拖动项目
Here's how to create a simple draggable image.//这是如何生成一个简单的拖动图象
1. Create a new class that inherits from UIImageView 
@interface myDraggableImage : UIImageView { } 
2. In the implementation for this new class, add the 2 methods: 
- (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event 
{ 
// Retrieve the touch point 检索接触点
CGPoint pt = [[touches anyObject] locationInView:self]; 
startLocation = pt; 
[[self superview] bringSubviewToFront:self]; 
}
- (void) touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event
{ 
// Move relative to the original touch point 相对以前的触摸点进行移动
CGPoint pt = [[touches anyObject] locationInView:self]; 
CGRect frame = [self frame]; 
frame.origin.x += pt.x - startLocation.x; 
frame.origin.y += pt.y - startLocation.y; 
[self setFrame:frame]; 
} 
3. Now instantiate the new class as you would any other new image and add it to your view 
//实例这个新的类,放到你需要新的图片放到你的视图上
dragger = [[myDraggableImage alloc] initWithFrame:myDragRect]; 
[dragger setImage:[UIImage imageNamed:@"myImage.png"]]; 
[dragger setUserInteractionEnabled:YES];

线程:
1. Create the new thread: 
[NSThread detachNewThreadSelector:@selector(myMethod) toTarget:self withObject:nil]; 
2. Create the method that is called by the new thread: 
- (void)myMethod
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 
*** co de that should be run in the new thread goes here ***
[pool release]; 
} 
//What if you need to do something to the main thread from inside your new thread (for example, show a loading //symbol)? Use performSelectorOnMainThread.
[self performSelectorOnMainThread:@selector(myMethod) withObject:nil waitUntilDone:false];

Plist files
Application-specific plist files can be stored in the Resources folder of the app bundle. When the app first launches, it should check if there is an existing plist in the user's Documents folder, and if not it should copy the plist from the app bundle. 
// Look in Documents for an existing plist file
NSArray *paths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES); 
NSString *documentsDirectory = [paths objectAtIndex:0]; 
myPlistPath = [documentsDirectory stringByAppendingPathComponent: 
[NSString stringWithFormat: @"%@.plist", plistName] ]; 
[myPlistPath retain]; 
// If it's not there, copy it from the bundle 
NSFileManager *fileManger = [NSFileManager defaultManager]; 
if ( ![fileManger fileExistsAtPath:myPlistPath] ) 
{ 
NSString *pathToSettingsInBundle = [[NSBundle mainBundle] pathForResource:plistName ofType:@"plist"]; 
} 
//Now read the plist file from Documents 
NSArray *paths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES); 
NSString *documentsDirectoryPath = [paths objectAtIndex:0]; 
NSString *path = [documentsDirectoryPath stringByAppendingPathComponent:@"myApp.plist"]; 
NSMutableDictionary *plist = [NSDictionary dictionaryWithContentsOfFile: path];
//Now read and set key/values 
myKey = (int)[[plist valueForKey:@"myKey"] intValue]; 
myKey2 = (bool)[[plist valueForKey:@"myKey2"] boolValue]; 
[plist setValue:myKey forKey:@"myKey"]; 
[plist writeToFile:path atomically:YES];

Alerts
Show a simple alert with OK button. 
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:
@"An Alert!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; 
[alert show]; 
[alert release]; 

Info button
Increase the touchable area on the Info button, so it's easier to press. 
CGRect newInfoButtonRect = CGRectMake(infoButton.frame.origin.x-25, infoButton.frame.origin.y-25, infoButton.frame.size.width+50, infoButton.frame.size.height+50); 
[infoButton setFrame:newInfoButtonRect]; 

Detecting Subviews
You can loop through subviews of an existing view. This works especially well if you use the "tag" property on your views.
for (UIImageView *anImage in [self.view subviews])
{
if (anImage.tag == 1) 
        { // do something } 
}
http://fei263.blog.163.com/blog/static/927937242009526112420548/

node-nonce:生成具有指定长度的随机字母数字字符串 节点现值 生成具有指定长度的随机字母数字字符串。 安装 npm install @rdcl/nonce 用法 const nonce = require ( '@rdcl/nonce' ) nonce ( 27 ) . then ( function ( nonce ) { // ... } ) 测验 npm test 立即下载

相关推荐

完整解析与实现:Java生成CSDN博客x-ca-nonce与x-ca-signature全过程.zip

前端核心js分析,Java代码生成x-ca-nonce与x-ca-signature

iOS 开发过程中的问题与解决方法

iOS 开发过程中的问题与解决方法

XL_OnTheWay的博客 356

Java实现CSDN博客安全头x-ca-nonce与x-ca-signature的生成与测试.zip

前端核心js分析,Java代码生成x-ca-nonce与x-ca-signature

java中nonce,java – 如何在ANDROID中生成NONCE并在客户端打印

我现在正在研究一个与IMS有关的Android程序.我希望服务器将一个随机数发送回客户端作为字符串并在客户端打印.为了生成nonce,我尝试使用此站点的代码.部分代码如下public static String generateNonce() {try {// Create a secure random number generatorSecureRandom sr = SecureRandom...

weixin_33037313的博客 1270

机器学习 -- 信用卡评分模型 -- 互联网金融风控

互联网金融主要分为资金类和资产类。资金类主要是理财产品,吸储,主要指标是用户转化、留存和复投,重在客户运营。资产类主要是贷款,包括消费金融和现金贷,小额贷款属于此类,主要目的是用户转化,还款和风险控制,信用卡评分模型就属于风险控制。 信用评分作用是对贷款申请人(信用卡申请人)做风险评估分值的方法。 信用卡评分是以大量数据的统计结果为基础,根据客户提供的资料和历史数据对客户的信用进行评估,评分卡模型...

XiaoMaEr66的博客 2426

从法律文档到知识图谱

这里我们定义了两个 Pydantic 模型:Location 用于捕捉结构化的地址信息,包含可选的国家、州和地址字段;Party 用于表示合同参与方,包含必填的名称和可选的位置详情。字段描述通过告知 LLM 每个字段具体需要查找哪些信息,来辅助提取过程。"""包含结构化地址组件的位置信息。"""country: Optional[str] = Field(None, description="国家")

Anspire的博客 3048

iphone开发常用代码

<br />iPhone键盘改变颜色<br />只有这2种数字键盘才有效果:UIKeyboardTypeNumberPad,UIKeyboardTypePhonePad<br />keyboardAppearance = UIKeyboardAppearanceAlert <br />代码如下:   NSArray *ws = [[UIApplication sharedApplication] windows];    for(UIView *w in ws){        NSArray *vs =

qingming52591的专栏 1352

Halcon 3D视觉实战:5步将线激光高度数据转为可分析的深度图与点云

本文详细介绍了如何利用Halcon平台将线激光高度数据转换为深度图与点云的5步实战方法。通过具体代码示例和工业检测案例(如锂电池胶水测量),帮助工程师高效处理3D视觉数据,实现从原始数据到三维可视化的完整技术链路。

weixin_29039773的博客 367

[IOS]iphone开发之常用代码:不断更新

1,获取翻转事件,并开启翻转: 只要在viewcontroller的类中加入 -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{//翻转后要执行的代码return YES;} 2,-(void)viewWillAppear:(BO...

abv10122的博客 392

2.数字芯片时序正确的前提—Max-transition

芯片物理设计中最基本的Max-transition检查

weixin_43868998的博客 5434

ImportError: DLL load failed while importing _rust: 找不到指定的程序的解决方案

 本文主要介绍了ImportError: DLL load failed while importing _rust: 找不到指定的程序的解决方案,希望能对使用Python的同学们有所帮助。 文章目录 1. 问题描述 2. 解决方案

weixin_43178406的博客 19万+

iphone开发之常用代码:不断更新

1,获取翻转事件,并开启翻转: 只要在viewcontroller的类中加入   -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{//翻转后要执行的代码return YES;} 2,-(void)vie

1500

[dprecated]第五章:TTM分析: 5.1 TTM设计目标和核心概念

TTM是Linux DRM框架下的通用显存管理模块,其复杂性源于需要满足多样化的显存管理需求。该文解析了TTM的核心结构体及其关系:ttm_device作为顶层管理者,包含多个ttm_resource_manager处理不同类型内存;ttm_buffer_object为核心对象,通过ttm_resource关联物理资源;其他组件如ttm_tt管理页表、ttm_pool优化分配效率。文章强调理解这些结构体关系是掌握TTM机制的基础,并建议国产芯片开发者参考这些功能需求。

图形/计算GPU的驱动与虚拟化技术分享园地 2175

【引用】iphone开发常用代码(不断更新)

原文地址:http://fei263.blog.163.com/blog/static/927937242009526112420548/ - (NSString *)URLEncodedString:(NSString *)string{ NSString *result = (NSString *)CFURLCreateStringByAddingPercentEscapes(kCF

Just Do It 943

SAP 消息号T-CODE

SAP消息号修改汇总 确实有很多消息是可以修改的 FI: oBA5|oFMG|oFPM MM: oMRM|oKZZ|oMT4|oMCQ|o04C| SD: oVAH(V4)|oVM1(VL) CO:  oPR4_ACT|oPR4_CK|oPR4_CKML|oPR4_CKPF|oPR4_KKA|oPR4_KKP|oPR4_KKS| oPR4_KKS1|oPR4_P

heng0757的专栏 1万+

YOLOv11改进 | Conv篇 | 图像去雾卷积DEConv助力yolov11有效涨点(部署零额外开销)

本文介绍了一种最新改进机制用于低层视觉任务的细节增强卷积(DEConv)机制。DEConv在训练阶段采用"普通卷积+差分卷积"的多分支并联结构,增强网络对边缘、纹理等细节特征的学习能力;在推理阶段可折叠为标准3×3卷积,保持与普通卷积相同的计算效率。文中详细阐述了DEConv的工作原理、实现方法以及在YOLOv11中的应用步骤,包括核心代码解析、模型修改方法和训练配置。实验表明,该机制在去雾、去噪、超分等强调细节重建的任务中具有显著优势。文章还提供了完整的代码实现和训练指导.

Snu77的博客 2456

【转载】iphone开发之常用代码:不断更新

转自:http://www.cnblogs.com/iphone520/archive/2012/01/09/2225160.html 1,获取翻转事件,并开启翻转: 只要在viewcontroller的类中加入   -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInt

shang1219178163的专栏 985

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

开发之常用代码

[IOS]iphone开发之常用代码:不断更新 转载于:https://www.cnblogs.com/hl666/p/3687406.html

weixin_30835923的博客 74

深度学习工具包 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")

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

webkit移动开发笔记之兼容iPhone4和iPhone5的方法(转)

[iPhone 4带来的革新,retina display绝对是最吸引眼球的一项。正是依赖这视网膜显示屏,iPhone 4的分辨率达到了640×960 pixels,不过为了保持向下兼容性,它采用的仍然是320×480 points。也就是说,在不进行缩放的情况下,显示普通图片时,它会用4个像素来显示图片中的1个像素;而在显示retina图片时,每个像素都对应图片中的1个像素。 如此一来,老的应用无需修改就可以在iPhone 4上运行了——虽然显示效果差了点,但是不会出现只有左上角那1/4的区域有内容的情

夜梦星尘的专栏 1062

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

iPhone开发 - 内存泄露(不断更新)

我是做应用程序的iphone程序员,主做应用程序,偶尔客串个把cocos2d有戏,入行刚刚满一年,在这下半年,越来越发现程序测试到最后,一般会留 下两个问题:1、内存泄露     2、用户体验差 。 而后者,我在之前的文章中也曾经表态过我的态度,但是很多时候,这些受策划的影响会更

一样的世界,不一样的时间 1110

IPhone

此條目介紹的是蘋果公司推出的iPhone系列。关于发售于2007年的该系列的第一代产品,请见「关于iPhone的其他意思,请见「是研发及销售的系列,搭載該公司研發的。於2007年1月9日由前蘋果公司發表,並在同年6月29日正式發售。最新發表的iPhone手机是iPhone 14系列,包括,该系列于2022年9月7日正式对外发布。暗紫色的正面iPhone运行由蘋果公司研發的iOS操作系统(原名iPhone OS),其自带由苹果公司开发的应用程序,并支持通过来下载第三方程序。

weixin_40191861的博客 1850

iphone程序崩溃原因总结(不断更新中。。。)

<br />看到一篇文章专门总结iphone程序崩溃原因,感觉总结的很好,也很方便当出现崩溃情况时有针对的检查,贴出来,以后会持续更新可能出现的情况。<br />1.访问某个对象不存在的属性。<br /> <br />2.访问已经被dealloc的对象。<br /> <br />3.在一个线程里快速遍历某个数组,但在另一个线程里往数组里添加对象。<br /> <br />4.往字典里用setObject 方法添加一个值为nil的键值对。<br /> <br />5.UITableView 对象调用方法scr

安迪·潘 的专栏 3807

iphone开发常用代码(不断更…

好多实用功能 期待慢慢更新我也会有时间完善一些这样的东西原文地址:iphone开发常用代码(不断更新)作者:暗夜函数名称  : checkStringSize 函数描述  : string 字数限制 输入参数  :    string:要判断的string ;minSize:最小字数限制;maxSize:最大字数限制 输出参数  : N/A 返回值      : BOOL:是否超出限制 备注   

Saick的专栏 490
上一篇: iPhone App Display Name Localizable method
下一篇: 如何让你的iphone程序支援ipad.
nitghost
博客等级 码龄19年 32粉丝 111原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址