GOGOGO

//
//  ViewController.m
//  GCD
//
//  Created by 朱逸 on 16/7/5.
//  Copyright © 2016年 朱逸. All rights reserved.
//
/*
 * 同步 : 你叫我去吃饭,如果我没有听到,你就会一直叫我去吃饭
 * 异步 : 你叫我去吃饭,而不管我是否有没有听到,就自己去了
 * 如果你叫我去吃饭,就用异步,这样你就比较省钱
 */

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

#pragma mark--创建串行队列,并执行操作
- (void)serialQueueOfAsync{
    /*
     * 串行队列下的异步操作
     */
    dispatch_queue_t serial = dispatch_queue_create("xiaozhu", DISPATCH_QUEUE_SERIAL);
    dispatch_async(serial, ^{
        /*
         * 执行所需要的操作
         */
        [self doSomeThings];
    });
}
#pragma mark--需要执行的代码
- (void)doSomeThings{
    dispatch_queue_t mainQueue = dispatch_get_main_queue();
    dispatch_async(mainQueue, ^{
        /*
         * 刷新UI
         */
    });
}
#pragma mark--并行队列的创建方式
- (void)queue{
    /*
     * 全局队列
     * 第一个参数表示队列优先级
     * 第二个参数没有用
     */
    dispatch_queue_t global = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
    dispatch_async(global, ^{

    });
    /*
     * 并行队列
     * 执行无顺序
     */
    dispatch_queue_t concurrent = dispatch_queue_create("zy", DISPATCH_QUEUE_CONCURRENT);
    dispatch_async(concurrent, ^{

    });
}
#pragma mark--dispatch_group_t
- (void)group{
    dispatch_queue_t queue = dispatch_queue_create("", DISPATCH_QUEUE_SERIAL);
    dispatch_group_t group = dispatch_group_create();
    dispatch_group_async(group, queue, ^{
        NSLog(@"1");
    });
    dispatch_group_async(group, queue, ^{
        NSLog(@"2");
    });
    dispatch_group_notify(group, dispatch_get_main_queue(), ^{
        NSLog(@"end");
    });
}
@end
//
//  ViewController.m
//  NSOperation
//
//  Created by 朱逸 on 16/7/5.
//  Copyright © 2016年 朱逸. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

#pragma mark--NSInvocaionOperation
- (void)queueWithInvocationOpration{
    NSOperationQueue *queue = [[NSOperationQueue alloc] init];
    for (int i = 0; i < 8; i++) {
        NSInvocationOperation *invocation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(doSomeThings) object:nil];
        [queue addOperation:invocation];
    }
}
#pragma mark--NSBlockOperation
- (void)queueWithBlockOperation{
    NSOperationQueue *queue = [[NSOperationQueue alloc] init];
    for (int i = 0; i < 9; i++) {
        NSBlockOperation *blockOperation = [NSBlockOperation blockOperationWithBlock:^{
            [self doSomeThings];
        }];
        [queue addOperation:blockOperation];
    }
}
#pragma mark--queue
- (void)queue{
    NSOperationQueue *queue = [[NSOperationQueue alloc] init];
    for (int i = 0; i < 8; i++) {
        [queue addOperationWithBlock:^{
            [self doSomeThings];
        }];
    }
}
#pragma mark--优先级
- (void)praority{
    NSOperationQueue *queue = [[NSOperationQueue alloc] init];
    NSBlockOperation *highBlockOperation = [NSBlockOperation blockOperationWithBlock:^{
        [self praorityHigh];
    }];
    NSBlockOperation *lowBlockOperation = [NSBlockOperation blockOperationWithBlock:^{
        [self praorityLow];
    }];
    [lowBlockOperation addDependency:highBlockOperation];
    NSArray *operationArr = [NSArray arrayWithObjects:highBlockOperation, lowBlockOperation, nil];
    [queue addOperations:operationArr waitUntilFinished:YES];
}
- (void)doSomeThings{

}
- (void)praorityHigh{

}
- (void)praorityLow{

}
@end
//
//  ViewController.m
//  JavaScript-OC
//
//  Created by 朱逸 on 16/7/4.
//  Copyright © 2016年 朱逸. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()<WKScriptMessageHandler,WKUIDelegate>

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.wk.UIDelegate = self;
    [self.view addSubview:self.wk];
    [self loadHtml:@"JSWKWebView"];
}

- (WKWebView *)wk{
    if (_wk != nil) {
        return _wk;
    }
    /*
     * 初始化WKWebView
     */
    _wk = [[WKWebView alloc] initWithFrame:self.view.bounds configuration:self.config];
    return _wk;
}
- (WKWebViewConfiguration *)config{
    if (_config != nil) {
        return _config;
    }
    /*
     * 初始化WKWebViewConfiguration,配置WKWebView
     */
    _config = [[WKWebViewConfiguration alloc] init];
    _config.userContentController = self.content;
    _config.websiteDataStore = self.store;
    return _config;
}
- (WKUserContentController *)content{
    if (_content != nil) {
        return _content;
    }
    /*
     * 初始化WKUserContentController,用于做native与JavaScript的交互管理
     */
    _content = [[WKUserContentController alloc] init];
    [_content addScriptMessageHandler:self name:@"Native"];
    return _content;
}
-(WKWebsiteDataStore *)store{
    if (_store != nil) {
        return _store;
    }
    _store = [WKWebsiteDataStore defaultDataStore];
    return _store;
}

#pragma mark--加载网页
- (void)loadHtml:(NSString *)name{
    NSString *path = [[NSBundle mainBundle] pathForResource:name ofType:@"html"];
    NSURL *url = [NSURL fileURLWithPath:path];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [self.wk loadRequest:request];
}

#pragma mark--WKScriptMessageHandler协议,用于接收并处理JavaScript调用Native的方法
- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message{
    NSLog(@"body--%@",message.body);
    NSMutableDictionary *dict = [self qureyStringToDictionary:message.body];
    NSLog(@"dict--%@",dict);

    NSString *func = [dict objectForKey:@"func"];
    NSLog(@"func--%@",func);

    if ([func isEqualToString:@"alert"]) {
        [self sayHello:[dict objectForKey:@"message"]];
    } else if ([func isEqualToString:@"addSubView"]) {

    }else if ([func isEqualToString:@"addSubView"]) {

    } else {

    }
}

#pragma mark--参数转字典
- (NSMutableDictionary *)qureyStringToDictionary:(NSString *)body{
    NSArray *element = [body componentsSeparatedByString:@"&"];
    NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity:[element count]];
    for (NSString *str in element) {
        NSArray *array = [str componentsSeparatedByString:@"="];
        [dict setObject:[array objectAtIndex:1] forKey:[array objectAtIndex:0]];
    }
    return dict;
}

#pragma mark--JavaScript调用的Native方法
- (void)sayHello:(NSString *)message{
    UIAlertView *aleart = [[UIAlertView alloc] initWithTitle:@"来自网页的提示"
                                                     message:message
                                                    delegate:nil
                                           cancelButtonTitle:@"确定"
                                           otherButtonTitles:nil, nil];
    [aleart show];
}

#pragma mark--OC调用JavaScript方法
- (void)JavaScriptCallOC{
    [self.wk evaluateJavaScript:@"showAlert(‘hahahha‘)"  completionHandler:^(id item, NSError * _Nullable error) {

    }];
}
@end
static AccountManager *DefaultManager = nil;  

+ (AccountManager *)defaultManager {
    if (!DefaultManager) DefaultManager = [[self allocWithZone:NULL] init];
    return DefaultManager;
}  

+ (AccountManager *)sharedManager
{
        static AccountManager *sharedAccountManagerInstance = nil;
        static dispatch_once_t predicate;
        dispatch_once(&predicate, ^{
                sharedAccountManagerInstance = [[self alloc] init];
        });
    return sharedAccountManagerInstance;
}  
//用来记录上一次创建的UILabel
    UILabel *lastLabel = nil;

    for (int i = 0; i < 9; i++) {

        UILabel *label = [UILabel new];
        label.textAlignment = NSTextAlignmentCenter;
        label.backgroundColor = [UIColor orangeColor];
        [self.view addSubview:label];

        [label mas_makeConstraints:^(MASConstraintMaker *make) {

            //设置高度
            make.height.offset(40.0f);

            //计算距离顶部的公式 60 = 上一个距离顶部的高度 + UIlabel的高度
            float colTop = (100 + i/3 * 60.0f);

            make.top.offset(colTop);

            //当是 左边一列的时候 都是 距离父视图 向左边 20的间隔
            if (i%3 == 0) {

                make.left.offset(20.0f);

            }else{

                //当时中间列的时候 在上一个UIlabel的右边 添加20个 距离 并且设置等高
                make.width.equalTo(lastLabel.mas_width);
                make.left.equalTo(lastLabel.mas_right).offset(20.0f);

            }
            //当是 最右边列的时候 距离右边父视图的 距离为20  因为是向左所以是-20  控制底部也是 负数!!
            if (i%3 == 2) {

                make.right.offset(-20.0f);

            }

        }];
        lastLabel = label;
    }
//
//  AppDBOperation.m
//  BigTiger
//
//  Created by zdf on 14-8-18.
//
//

#import "AppDBOperation.h"
#import "FMDatabaseQueue.h"

@implementation AppDBOperation

#pragma mark - 数据库 核心操作

+(AppDBOperation*)sharedDBOperation
{
    AppDBOperation *q = [[self alloc] init] ;
    return q;
}
+(void)insertIntoUserInfoWithUserDic:(NSDictionary *)dic
{
    /*
     *  @param AccessToken 认证令牌
     *  @param RefreshToken 刷新令牌
     */
    FMDatabaseQueue *queue = [FMDatabaseQueue databaseQueueWithPath:DLDBPath];
    [queue inDatabase:^(FMDatabase *db) {
        [db executeUpdate:@"delete from UserInfo"];
     BOOL result =  [db executeUpdate:@"INSERT INTO UserInfo (UserID,Ucard,UserType,UserName,PassWord,AccessToken,RefreshToken) VALUES (?,?,?,?,?,?,?)",[dic objectForKey:@"uid"],[dic objectForKey:@"uCard"],[dic objectForKey:@"uCardType"],[dic objectForKey:@"uTel"],[dic objectForKey:@"uPwd"],[dic objectForKey:@"AccessToken"],[dic objectForKey:@"RefreshToken"]];
        NSLog(@"result %d",result);
    }
    ];
}
+(void)deleteUserInfoDB{
    FMDatabaseQueue *queue = [FMDatabaseQueue databaseQueueWithPath:DLDBPath];
    [queue inDatabase:^(FMDatabase *db) {
        [db executeUpdate:@"delete from UserInfo "];
       }
     ];

}
+(void)updateUserNameWithuserId{
    FMDatabase *db = [FMDatabase databaseWithPath:DLDBPath];
    [db setShouldCacheStatements:YES];
    if ([db open])
    {
       BOOL result = [db executeUpdate:@"update UserInfo  set UserName=? where UserID = ?",userName,userID];
        NSLog(@"result %d",result);
    }
    [db close];
}
+(void)updateUserAccessTokenAndRefreshTokenWithUserId{
    FMDatabase *db = [FMDatabase databaseWithPath:DLDBPath];
    [db setShouldCacheStatements:YES];
    if ([db open])
    {
        BOOL result = [db executeUpdate:@"update UserInfo  set AccessToken=?,RefreshToken=? where UserID = ?",AccessToken,RefreshToken,userID];
        NSLog(@"result %d",result);
    }
    [db close];
}
+(UserObj *)selectUserInfoByUserId:(NSString *)userId{
    UserObj * obj=nil;
    FMDatabase *db = [FMDatabase databaseWithPath:DLDBPath];
    [db setShouldCacheStatements:YES];
    if ([db open])
    {
        FMResultSet *rs;
        rs = [db executeQuery:@"select * from UserInfo where UserID=?",userId];
        while ([rs next])
        {

            obj=[UserObj setUserObjWithLocalUserDic:rs.resultDictionary];

        }
        [rs close];
    }
    [db close];
    return obj;
}
+(void) insertintoSearchHistoryWithSearchStr:(NSString *)searchStr SearchDate:(NSString *)date{
    if (searchStr == nil || searchStr.length==0) {
        return;
    }
    FMDatabase *db = [FMDatabase databaseWithPath:DLDBPath];
    [db setShouldCacheStatements:YES];
    if ([db open])
    {
        bool isHave = NO;
        //去重
        FMResultSet *rs1 = [db executeQuery:@"select * from SearchHistory where SearchStr = ? and userID = ?",searchStr, [ShareMethod returnStringBy:userID]];
        if ([rs1 next])
        {
            isHave=YES;
        }
        [rs1 close];
        if (isHave) {
            return;
        }
        NSMutableArray *dataAry = [NSMutableArray array];
        FMResultSet *rs;
        rs = [db executeQuery:@"SELECT * FROM SearchHistory where userID = ? order by SearchDate desc", [ShareMethod returnStringBy:userID]];//
        while ([rs next])
        {
            if (dataAry.count==9) {
                [db executeUpdate:@"delete from SearchHistory where SearchDate = ? and userID = ?",[rs.resultDictionary objectForKey:@"SearchDate"], [ShareMethod returnStringBy:userID]];
            }
            else{
                [dataAry addObject:rs.resultDictionary];
            }
        }
        BOOL result =  [db executeUpdate:@"INSERT INTO SearchHistory (SearchDate,SearchStr,userID) VALUES (?,?,?)",date,searchStr,[ShareMethod returnStringBy:userID]];
        NSLog(@"result %d",result);
        [rs close];
    }
    [db close];
}
+(NSMutableArray *)selectAllSearchHistory{
    NSMutableArray *ary = [NSMutableArray array];
    FMDatabase *db = [FMDatabase databaseWithPath:DLDBPath];
    [db setShouldCacheStatements:YES];
    if ([db open])
    {
        FMResultSet *rs;
        rs = [db executeQuery:@"select * from SearchHistory where userID = ?", [ShareMethod returnStringBy:userID]];
        while ([rs next])
        {

            [ary addObject:rs.resultDictionary];

        }
        [rs close];
    }
    [db close];
    return ary;
}
+(void) insertMerchantSearchHistoryWithStr:(NSString *)searchStr{
    if (searchStr == nil || searchStr.length==0) {
        return;
    }
    //获取的系统时间
    NSString *dateStr = [ShareMethod dateToTimeString:[NSDate date] Formar:nil];
    FMDatabase *db = [FMDatabase databaseWithPath:DLDBPath];
    [db setShouldCacheStatements:YES];
    if ([db open])
    {
        bool isHave = NO;
        //去重
        FMResultSet *rs1 = [db executeQuery:@"select * from MerchantsSearchHistory where SearchStr = ? and userID = ?",searchStr, [ShareMethod returnStringBy:userID]];
        if ([rs1 next])
        {
            isHave=YES;
        }
        [rs1 close];
        if (isHave) {
            return;
        }

        NSMutableArray *dataAry = [NSMutableArray array];
        FMResultSet *rs;
        rs = [db executeQuery:@"SELECT * FROM MerchantsSearchHistory where userID = ? order by SearchDate desc", [ShareMethod returnStringBy:userID]];
            while ([rs next])
            {
                if (dataAry.count==9) {
                    [db executeUpdate:@"delete from MerchantsSearchHistory where SearchDate = ? and userID = ?",[rs.resultDictionary objectForKey:@"SearchDate"], [ShareMethod returnStringBy:userID]];
                }
                else{
                    [dataAry addObject:rs.resultDictionary];
                }
        }
        BOOL result =  [db executeUpdate:@"INSERT INTO MerchantsSearchHistory (SearchDate,SearchStr,userID) VALUES (?,?,?)",dateStr,searchStr,userID];
        NSLog(@"result %d",result);
        [rs close];
    [db close];

    }
}
+(NSMutableArray *)getAllMerchantSearchHistory{
    NSMutableArray *ary = [NSMutableArray array];
    FMDatabase *db = [FMDatabase databaseWithPath:DLDBPath];
    [db setShouldCacheStatements:YES];
    if ([db open])
    {
        FMResultSet *rs;
        rs = [db executeQuery:@"select * from MerchantsSearchHistory where userID = ?", [ShareMethod returnStringBy:userID]];
        while ([rs next])
        {

            [ary addObject:rs.resultDictionary];

        }
        [rs close];
    }
    [db close];
    return ary;

}

+(void)insertExceptSearchHistoryWithStr:(NSString *)searchStr
{
    if (searchStr == nil || searchStr.length==0) {
        return;
    }
    //获取的系统时间
    NSString *dateStr = [ShareMethod dateToTimeString:[NSDate date] Formar:nil];
    FMDatabase *db = [FMDatabase databaseWithPath:DLDBPath];
    [db setShouldCacheStatements:YES];
    if ([db open])
    {
        bool isHave = NO;
        //去重
        FMResultSet *rs1 = [db executeQuery:@"select * from ExceptSearchHistory where SearchStr = ? and userID = ?",searchStr, [ShareMethod returnStringBy:userID]];
        if ([rs1 next])
        {
            isHave=YES;
        }
        [rs1 close];
        if (isHave) {
            return;
        }

        NSMutableArray *dataAry = [NSMutableArray array];
        FMResultSet *rs;
        rs = [db executeQuery:@"SELECT * FROM ExceptSearchHistory where userID = ? order by SearchDate desc", [ShareMethod returnStringBy:userID]];
        while ([rs next])
        {
            if (dataAry.count==9) {
                [db executeUpdate:@"delete from ExceptSearchHistory where SearchDate = ? and userID = ?",[rs.resultDictionary objectForKey:@"SearchDate"], [ShareMethod returnStringBy:userID]];
            }
            else{
                [dataAry addObject:rs.resultDictionary];
            }
        }
        BOOL result =  [db executeUpdate:@"INSERT INTO ExceptSearchHistory (SearchDate,SearchStr,userID) VALUES (?,?,?)",dateStr,searchStr,userID];
        NSLog(@"result %d",result);
        [rs close];
        [db close];
    }
}

+(NSMutableArray *)getAllExceptSearchHistory
{
    NSMutableArray *ary = [NSMutableArray array];
    FMDatabase *db = [FMDatabase databaseWithPath:DLDBPath];
    [db setShouldCacheStatements:YES];
    if ([db open])
    {
        FMResultSet *rs;
        rs = [db executeQuery:@"select * from ExceptSearchHistory where userID = ?", [ShareMethod returnStringBy:userID]];
        while ([rs next])
        {

            [ary addObject:rs.resultDictionary];

        }
        [rs close];
    }
    [db close];
    return ary;
}
@end
//
//  FMDBObj.m
//  DuiDuiPeng3.0
//
//  Created by yangbin on 15/10/26.
//  Copyright © 2015年 bar. All rights reserved.
//

#import "FMDBObj.h"

@implementation FMDBObj
// 创建表
-(void)createDatabaseAndFiles
{
    NSString *rootFilePath=[FileFunction createFolderAtDocuments:@"APP"];//根目录
    [FileFunction createFolderAtPath:rootFilePath folderName:@"Temp"];//缓存
    [FileFunction createFolderAtPath:rootFilePath folderName:@"Data"];//本地存储数据
    FMDatabase *db = [FMDatabase databaseWithPath:DLDBPath];
    if ([db open])
    {
        [db setShouldCacheStatements:YES];
        /**
         *  个人信息表
         *
         *  @param UserID 用户ID
         *  @param Ucard  用户card
         *  @param UEmail 用户email
         *  @param UserType 用户身份
         *  @param UserName 用户名
         *  @param PassWord 密码
         *  @param AccessToken 认证令牌
         *  @param RefreshToken 刷新令牌
         *
         *  @return
         */
       [db executeUpdate:@"CREATE TABLE [UserInfo] (UserID text,Ucard text,UserType text,UserName text,PassWord text,AccessToken text,RefreshToken text)"];
        NSLog(@"执行语句失败 :%@",db.lastErrorMessage);
        /*
         *     搜索历史记录礼品
         *
         *  @param SearchDate   搜索时间
         *  @param userID 用户id
         *  @param SearchStr 搜索内容
         *
         *  @return
         */

        [db executeUpdate:@"CREATE TABLE [SearchHistory] (SearchDate text,SearchStr text, userID text)"];
        /*
         *  SearchHistory  搜索历史记录商家
         *
         *  @param SearchDate   搜索时间
         *  @param SearchStr 搜索内容
         *  @param userID 用户id
         *
         *  @return

         */
        [db executeUpdate:@"CREATE TABLE [MerchantsSearchHistory] (SearchDate text,SearchStr text, userID text)"];
        /*
         *  SearchHistory  搜索历史记录同城券
         *
         *  @param SearchDate   搜索时间
         *  @param userID 用户id
         *  @param SearchStr 搜索内容
         *
         *  @return

         */
        [db executeUpdate:@"CREATE TABLE [ExceptSearchHistory] (SearchDate text,SearchStr text, userID text)"];
    }
    [db close];
}
#pragma mark - 判断字段是否存在
+(BOOL)isExistRateColumn:(NSString*)column TableName:(NSString*)table
{
    BOOL isexist = NO;
    FMDatabase * db=[FMDatabase databaseWithPath:DLDBPath];
    [db setShouldCacheStatements:YES];
    NSString *str = nil;
    if ([db open])
    {
        NSString *selectSql = [NSString stringWithFormat:@"select sql from sqlite_master where tbl_name=‘%@‘ and type=‘table‘",table];
        FMResultSet  *rs = [db executeQuery:selectSql];
        if ([rs next])
        {
            str = [rs stringForColumnIndex:0];
            if (str && [str rangeOfString:column].location==NSNotFound) {
                isexist =NO;
            }else{
                isexist =YES;
            }
        }
        [rs close];
    }
    [db close];
    return isexist;
}
+(void)addColumn:(NSString*)column TableName:(NSString*)table DefaultValue:(id)defaultValue
{
    NSString *sqlStr;
    if ([defaultValue isKindOfClass:[NSNumber class]]) { // 插入数值
        sqlStr = [[NSString alloc] initWithFormat:@"ALTER TABLE %@ ADD COLUMN %@ DEFAULT %d",table,column,[(NSNumber *)defaultValue boolValue]];
    }else if ([defaultValue isKindOfClass:[NSDate class]]){
        sqlStr=[[NSString alloc] init];
    }

    else if ([defaultValue isKindOfClass:[NSString class]])  // 插入 字符
    {
        sqlStr = [[NSString alloc] initWithFormat:@"ALTER TABLE %@ ADD COLUMN %@ DEFAULT ‘%@‘",table,column,defaultValue];
    }
    else  // 插入默认值
    {
        sqlStr = [[NSString alloc] initWithFormat:@"ALTER TABLE %@ ADD COLUMN %@",table,column];
    }
    FMDatabase *db=[FMDatabase databaseWithPath:DLDBPath];
    [db setShouldCacheStatements:YES];
    if ([db open])
    {
        BOOL succe =   [db executeUpdate:sqlStr];
        printf("succ is %d",succe);
    }

    [db close];

}
@end
时间: 2024-11-10 03:34:00

GOGOGO的相关文章

android官方手册学习笔记

数据存储 在提交sharedpreference 修改的时候,用apply代替commit 避免UI线程阻塞 设备兼容 系统会自动根据当前屏幕的大小等,在相应的文件夹里去找资源,如large等等 可以使用Build中的常量 VERSION.SDK_INT来判断当前的系统版本

哪有出售蒙汗葯

哪有出售蒙汗葯[订货:186-02559101 联系QQ201558724 林先生]一直秉承以用户需求为核心,提供高效货品.我们做的是长期生意,靠的是老客户长期支持.销售的各种药品药效保证,诚信交易 , 非诚勿扰!梦里花开了又落,你来了又走,渐行渐远的是熟悉的身影.明日,是海鸟和鱼的距离,是天涯与海角的距离.逝水无痕,风轻云淡之际,再回首往事,只见灯火阑珊人影渺茫.[订货:186-02559101 联系QQ201558724 林先生]哪有出售蒙汗葯公司不仅仅提供专业的优质服务,同时还建立了完善的

Corepython第九章习题

9-6.文件比较.写一个比较两个文本文件的程序,如果不同,给出第一个不同处的行号和列号. 1 FA=raw_input("please input 1st file's path:") 2 FB=raw_input("please input 2nd file's path:") 3 file_a=open(FA,'r') 4 file_b=open(FB,'r') 5 a_rl=file_a.readlines() 6 b_rl=file_b.readlines(

iOS9开发GOGOGO:新特性

iOS9已经发布一段时间了,大家对iOS9的新特性了解多少呢?是否还停留在多任务(分屏,画中画).Swift2.HTTPS强制升级这几个大家转来转去的东东呢?今天我们来深入了解iOS9给我们带来的更广阔的技术革新吧! 目录: iOS9新特性概览 iPad应用的多任务处理加强 搜索 游戏开发 App Thinning 支持从右至左的语言RTL-Right To Left Language App传输加密 App 扩展 Contacts Contacts UI Watch Connectivity

Entity Framework基础-第三篇

查询的两种过滤方法: 1.linq to EF 数据库中过滤: 下图我们能看出来Linq表达式在执行的时候已经为我们生成高效的sql语句, DemoTestEntities dbContext = new DemoTestEntities(); var demoTest = from u in dbContext.UserInfo where u.UserId>0 select u; foreach (var item in demoTest) { Console.WriteLine(item.

Linux 线程模型的比较:LinuxThreads 和 NPTL

Linux 线程模型的比较:LinuxThreads 和 NPTL GNU_LIBPTHREAD_VERSION 宏 大部分现代 Linux 发行版都预装了 LinuxThreads 和 NPTL,因此它们提供了一种机制来在二者之间进行切换.要查看您的系统上正在使用的是哪个线程库,请运行下面的命令: $ getconf GNU_LIBPTHREAD_VERSION 这会产生类似于下面的输出结果: NPTL 0.34 或者: linuxthreads-0.10 Linux 发行版所使用的线程模型.

iOS9编程GOGOGO:XCode7新变化

做一个关于栈视图 UIStackView的Demo,先看看XCode7的变化 关于StoryBoard: 启动画面由xib变为Storyboard StoryBoard引用: 如今能够在一个StoryBoard中加入对另外一个StoryBoard的引用,在多个SB中进行切换不用再写代码了.如图: 曾经的方式(SWIFT): override func viewDidLoad() { super.viewDidLoad() var sb : UIStoryboard let del = UIApp

gogogo!操作DOM的练习

1.修改添加back to top的链接代码,一遍这些链接只从第四段后面才开始出现. 2.在单击back to top链接时,为每个链接后面添加一个新段落,其中包含(you were here)字样.确保链接仍然有效. 3.在单击作者名字的时,把文本修改为粗体(通过添加一个标签,而不是操作类或者css). 4.在随后单击粗体作者名字时,删除之前添加的<b>元素,(也就是在粗体文本与正常文本之间切换). 5.为正文的每个段落添加一个inhab类,但不能调用.addClass()方法.确保不影响现

自用工具类整理,加速开发GOGOGO

转载请注明出处:王亟亟的大牛之路 在大家写代码的过程中,一直有用一些SP,Log,Toast的操作,都有自己的一些小类,楼主我也有!然后今天,就把这部分的内容贡献给大家,部分方法来自于网上大牛,如有雷同仅供参考哈. 先上图,看下样例代码,和包结构 目录结构: 一个Demo包,一个类似于Lib包的项目包,我们所用到的一系列工具方法都在Utils目录下. 再来几张,测试功能的截图 Log类 APPUtils类 NetUtils类 因为是工具类,所以没有什么好解释的,看代码直接用就好,下面附上源码地址