游客2q7uranxketok_个人页

个人头像照片 游客2q7uranxketok
0
1521
0

个人介绍

暂无个人介绍

擅长的技术

获得更多能力
通用技术能力:

暂时未有相关通用技术能力~

云产品技术能力:

暂时未有相关云产品技术能力~

阿里云技能认证

详细说明
暂无更多信息

2021年02月

正在加载, 请稍后...
暂无更多信息
  • 回答了问题 2021-02-26

    滑动视图时NavigationBarItem重叠

    置导航条上可视元素背景颜色方法:

        /// 1.1 设置Bar背景颜色 以及默认BarItem的颜色

        [self.navigationBar setBarTintColor:RGBCOLOR_HEX(0xf95900)];

        [self.navigationBar setTintColor:[UIColor whiteColor]];

        /// 1.2全局设置

        UINavigationBar.appearance().barTintColor = UIColor(red: 242.0/255.0, green: 116.0/255.0, blue: 119.0/255.0, alpha: 1.0)

        UINavigationBar.appearance().tintColor = UIColor.whiteColor()

    1. 设置导航条上的 字体颜色方法

        /// 2.1 设置导航条上的字体颜色

        NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,[UIFont systemFontOfSize:24],NSFontAttributeName, nil];

        [self.navigationBar setTitleTextAttributes:attributes];

        /// 2.2 全局设置方法

        if let barFont = UIFont(name: "Avenir-Light", size: 24.0) {

        UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName:UIColor.whiteColor(), NSFontAttributeName:barFont]

        

    1. iOS 7 之后,导航条默认的半透明状态设置

        /// 如果是YES, 默认状态是YES VC的子视图的y_0点将默认可视区域上移44,改为NO之后,VC的姿势图的y_0点将是导航条的y_0点。

        [self.navigationBar setTranslucent:YES];

            

            

    1. 取消Push子视图默认返回导航BackItem的文字

            ///注意:VC_A.nav pushTo VC_B  那么代码需要写在VC_A中。

            navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .Plain, target: nil, action: nil)

            self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];

            

            

    1. iOS 8 之后,导航控制器之间,在滑动导航时候隐藏导航条(“Hiding a Navigation Bar on Swipe)

            override func viewWillAppear(animated: Bool) {

                super.viewWillAppear(animated)

                

                navigationController?.hidesBarsOnSwipe = false

                navigationController?.setNavigationBarHidden(false, animated: true)

            }

            

            

    1. iOS 7,可以为每一个VC 单独更改状态栏样式

            /// 只需要在VC.m 中实现方法

            override func preferredStatusBarStyle() -> UIStatusBarStyle {

                return .LightContent

            }

            /// 也可以全局的设置 两种方法  首先是代码

            UIApplication.sharedApplication().statusBarStyle = .LightContent

            /// 然后是plist文件修改:

            Under the Info tab of the OBJect target, insert a new key named View controller-based status bar appearance and set the value to NO

            

    1. 自己添加一个UIBarButtomItem

            ///直接上代码

            @class CNBarButtonItem;

            

            typedef void(^BBIBlock)(CNBarButtonItem *barBItem);

            

            @interface CNBarButtonItem : UIBarButtonItem

            

            

            - (instancetype)barMenuButtomItem;

            - (instancetype)barButtomItem:(NSString *)title;

            

            - (void)barBlock:(BBIBlock )thisBlock;

            

            ========.h   下面是实现文件 -->.m

            @implementation CNBarButtonItem{

                BBIBlock _bbiBlock;

            }

            

            

            - (instancetype)barButtomItem:(NSString *)title {

                UIButton *itemButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 60, 40)];

                [itemButton addTarget:self action:@selector(barItemEvent:) forControlEvents:UIControlEventTouchUpInside];

                [itemButton setTitle:title forState:UIControlStateNormal];

                [itemButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];

                itemButton.size = [self sizeOfBtn:itemButton];

                return  [self initWithCustomView:itemButton];

            }

            

            

            - (CGSize)sizeOfBtn:(UIButton *)btn

            {

                CGSize sizeBtn = [btn.titleLabel sizeThatFits:CGSizeMake(100,30)];

                CGSize sizeReal    = CGSizeMake(sizeBtn.width + 10, 40);

                CGSize minSize     = CGSizeMake(40, 40);

                CGSize lastSize    = sizeBtn.width + 10  > 40 ? sizeReal : minSize;

                return lastSize;

            }

            

            

            - (void)barItemEvent:(UIButton *)btn {

                if (_bbiBlock) {

                    _bbiBlock(self);

                }

            }

            

            - (void)barBlock:(BBIBlock)thisBlock {

                _bbiBlock = thisBlock;

            }

            

            =================DestVC_中使用如下

            CNBarButtonItem *editItem = [[CNBarButtonItem alloc] barButtomItem:@"Edit"];

            [editItem barBlock:^(CNBarButtonItem *barBItem) {

                NSLog(@"Edit Click");

                //        [self showChannelSetView];

                self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];

                CNNewsDetailViewController *_newsDetail = [[CNNewsDetailViewController alloc] init];

                [self.navigationController pushViewController:_newsDetail animated:YES];

            }];

            UIBarButtonItem *rightSpaceItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];

            rightSpaceItem.width =  iPhone6Plus? -15:-8;

            self.navigationItem.rightBarButtonItems = @[rightSpaceItem,editItem];

    踩0 评论0
  • 回答了问题 2021-02-26

    小程序request不能自定义超时时间了嘛

    在小程序项目根目录里边的app.json可以指定request的超时时间,app.json指定wx.requset超时时间为3000毫秒{

    "networkTimeout": {

    "request": 3000

    }

    }

    踩0 评论0
  • 回答了问题 2021-02-26

    web端上传oss文件 safari下载文件乱码

    /** * 浏览器下载文件时需要在服务端给出下载的文件名,当文件名是ASCII字符时没有问题当文件名有非ASCII字符时就有可能出现乱码 * 最终设置的response header是这样: * Content-Disposition: attachment; * filename="encoded_text"; * filename*=utf-8''encoded_text * 其中encoded_text是经过RFC 3986的“百分号URL编码”规则处理过的文件名 / public static void setFileDownloadHeader(HttpServletResponse response, String filename) { String headerValue = "attachment;"; headerValue += " filename="" + encodeURIComponent(filename) +"";"; headerValue += " filename=utf-8''" + encodeURIComponent(filename); response.setHeader("Content-Disposition", headerValue); }

    /** * 符合 RFC 3986 标准的“百分号URL编码”在这个方法里,空格会被编码成%20,而不是+和浏览器的encodeURIComponent行为一致 */ public static String encodeURIComponent(String value) { try { return URLEncoder.encode(value, "UTF-8").replaceAll("\+", "%20"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return null; }

    踩0 评论0
  • 回答了问题 2021-02-26

    flink从checkpoint中恢复任务失败

    块大小不是集群属性,是文件属性,客户端可以设置的,flink这时候每个taskmanager和jobmanager都是hdfs的"客户端",根据flink文档,我们可以做如下配置 1、在conf/flink-conf.yaml中指定一个hdfs的配置文件路径

    fs.hdfs.hadoopconf: /home/xxxx/flink/conf 1 这里跟flink的配置文件路径选择同一个目录

    2、放进去2个配置文件,一个core-site.xml一个是hdfs-site.xml

    core-site.xml可以不放,如果checkpoint和savepoint指定了具体的hdfs地址的话,

    hdfs-site.xml里加上blockSize配置即可,比如这里我们给它设置为1M

    具体块大小如何设置,需要观察自己的作业状态文件大小自己灵活调整。

    重启flink集群,提交作业即可,运行时可以观察下hdfs的fsimage大小,注意不要因为块太小,小文件太多导致元数据过大。

    踩0 评论0
  • 回答了问题 2021-02-26

    收缩以缩放Xcode中的异常行为

    然后添加一个软断点 Run->Manage Breakpoints -> Add symbolic breakpoint, 并输入objc_exception_throw

    重新运行调试:

    踩0 评论0
  • 回答了问题 2021-02-26

    如何从FacebookLogin抓取图片

    private class SessionStatusCallback implements Session.StatusCallback { private String fbAccessToken;

    @Override
    public void call(Session session, SessionState state, Exception exception) {
        updateView();
        if (session.isOpened()) {
            fbAccessToken = session.getAccessToken();
            // make request to get facebook user info
            Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {
                @Override
                public void onCompleted(GraphUser user, Response response) {
                    Log.i("fb", "fb user: "+ user.toString());
    
                    String fbId = user.getId();
                    String fbAccessToken = fbAccessToken;
                    String fbName = user.getName();
                    String gender = user.asMap().get("gender").toString();
                    String email = user.asMap().get("email").toString();
    
                    Log.i("fb", userProfile.getEmail());
                }
            });
        }
    }
    

    }

    踩0 评论0
  • 回答了问题 2021-02-26

    函数计算 上传java包后提示找不入口类

    eclipse装个fat-jar插件,然后用它打包就可以了

    踩0 评论0
  • 回答了问题 2021-02-26

    创建Windows用户受限的Windows服务登录

    创建个用户你肯定懂啦?如果你盘是NTFS格式的,先点工具-文件夹选项-查看,把使用简单文件共享(推辞)点掉,然后点C盘右键-属性-安全,把Users去掉,或是点只能读取等。权限就由你设置啦。

    踩0 评论0
  • 回答了问题 2021-02-26

    Xcode-使用MobileVLCKit时如何修复此重复符号错误

    lipo是管理Fat File的工具, 可以查看平台列表, 提取特定平台, 重新打包。

    nm nm用来显示一个程序包的符号表, 默认会显示入口地址, 符号类型, 符号名。

    strip strip用来删除程序里的符号表。-R 用来指定一个要删除的符号列表, 使用上述生成的symbols文件.。添加 -S 选项来保留其他符号。

    ar ar可以查看一个程序包里的对象文件列表, 解压出其中的对象文件并重新打包。

    ld ld苹果系统下的链接器, 可以更精确的控制符号表的导出。

    具体步骤 因为担心修改MobileVLCKit对已上线的视频播放造成不可估计的影响,因此,此次修改MAMapKit,出现任何bug也可以尽快发现并解决。 下面将进行十分小白式的记录(PS:主要是我太小白了。)

    cd path(framework的路径) lipo -info MAMapKit

    lipo info MAMapKit 查看MAMapKit的适用平台,可以发现arm7,i386,x86_64,arm64均可用。并且前面bug只是存在于x86_64平台上,那么就先修改这个平台的内容。

    lipo -thin x86_64 MAMapKit -output MAMapKit.x86_64 文件瘦身,提取x86_64平台的MAMapKit到新的文件MAMapKit.x86_64,发现该文件只有3M而已(源文件20.2M),该文件位置与MAMapKit相同,发现确实单个平台的文件比较小。

    踩0 评论0
  • 回答了问题 2021-02-26

    框架工程项目-前端项目监控怎么做的

    Script Error

    当我们采集前端报错的时候,第一个遇到的问题就是 Script Error。Script Error 不是一种具体的错误,而是浏览器对跨域错误出于安全机制考虑的一种处理方式。

    一个前端错误为什么涉及到了「安全」问题呢?2006 年一位安全研究人员发现第三方脚本可以通过页面中报错信息的不同判断当前用户是否登录了指定的网站,并向 Webkit 项目提出了相关的 issue。7 年之后,各大浏览器厂商基本都支持了这一安全设定。

    Webkit 源码中对 Script Error 的处理

    简单的说,如果你的页面和页面中引用的 JavaScript 文件不同源(协议、域名、端口不一致),那么这些脚本抛出的错误都属于跨域错误。那么我们在做前端监控捕获这些错误的时候,应该怎么避免采集到 Script Error 呢?

    答案是 crossorigin 属性。这是一个应用在

    踩0 评论0
  • 回答了问题 2021-02-26

    Popen上的C segfaults [关闭]

    import os import time import subprocess import signal

    try: mProcess = subprocess.Popen('monkeyrunner test.py emulator-5554') except: print 'error'

    time.sleep(3)

    try: #mProcess.send_signal(signal.CTRL_C_EVENT) #mProcess.send_signal(signal.CTRL_BREAK_EVENT ) mProcess.terminate() pass except: print 'error'

    print 'you are finished'

    time.sleep(4)

    踩0 评论0
  • 回答了问题 2021-02-26

    C代码仅在一个项目中起作用,在任何新项目中不起作用(不会写入txt文件)

    函数调用的方式有多种,在函数调用中还应该注意的一个问题是求值顺序。所谓求值顺序是指对实参列表中各个参数是自左向右使用,还是自右向左使用。对此,各系统的规定不一定相同。

    __cdecl调用规则就是C调用规则。按从右至左的顺序压参数入栈,由调用者把参数弹出栈。

    踩0 评论0
  • 回答了问题 2021-02-26

    ARView和ARSCNView是否可以共存?

    使用SceneKit添加3D对象到AR体验

    var session: ARSession AR session为视图内容管理运动跟踪和相机图像处理

    var scene: SCNScene SceneKit场景显示在视图中

    响应AR更新 var delegate: ARSCNViewDelegate? 提供了调节视图的AR场景信息同步的方法

    protocol ARSCNViewDelegate 你可以实现ARSCNViewDelegate的方法来调节视图的AR场景信息同步

    映射内容到现实世界的位置 func anchor(for: SCNNode) 返回关联了特定场景节点的AR锚点

    func node(for: ARAnchor) 返回关联了特定场景锚点的AR节点

    管理场景灯光 var automaticallyUpdatesLighting: Bool 一个布尔值,表示是否创建和更新视图场景中的灯光

    调试AR显示 struct ARSCNDebugOptions 选项值,绘制覆盖内容帮助调试场景视图中AR轨迹

    关系 继承自 SCNView

    遵循

    CVarArg

    Equatable

    Hashable

    UIAccessibility Identification

    UIPaste Configuration Supporting

    踩0 评论0
  • 回答了问题 2021-02-26

    如何在matplotlib中获得多行x轴标签?

    .x——表示x刻度的取值范围 2.xlabels——表示与x每个值相对应的标签

    例如(x取值范围与xs不相同时): import matplotlib.pyplot as plt xs=range(36) y=xs plt.plot(xs,y) x=range(6) labels=['i','is','the','labels','for','x'] plt.xticks(x,labels) plt.show()

    因为xs取值范围为0到35,而x取值范围为0到5,所以标签只会在x轴的前六个上显示,那么将x范围变为xs会什么样呢 image.png 再如,x与xs取值范围相同时,但labels的值仍然不变时会出现以下效果

    import matplotlib.pyplot as plt xs=range(36) y=xs plt.plot(xs,y) x=xs labels=['i','is','the','labels','for','x'] plt.xticks(x,labels) plt.show()

    踩0 评论0
  • 回答了问题 2021-02-26

    使用python ctypes调用dll函数时参数无效

    import ctypes ll=ctypes.CDLL("pythontest3.dll") path= ctypes.c_char_p("C:\Users\Public\Pictures\Sample Pictures\a.jpg") path2= ctypes.c_char_p("C:\Users\Public\Pictures\Sample Pictures\b.jpg") ll.MSE.restype = ctypes.c_double#指定MSE的返回类型为double ll.PSNR.restype=ctypes.c_double#指定PSNR的返回值为double

    指定返回值类型很重要,否则得到的结果会有错误

    ll.abc.argtypes =[ctypes.c_char_p,ctypes.c_char_p]#指定参数类型 print ll.MSE(path.value,path.value)

    踩0 评论0
  • 回答了问题 2021-02-26

    如何使用路径文件在MongoDB数据库上添加图像

    dic = { "owner_name" : "samssmilin", "photo_id" : "602880671", "tags" : "", "longitude" : "-121.106479", "height" : "766", "datetaken" : "2004-01-17 21:05:35", "width" : "1024", "length" : 38141, "photo_title" : "Dad and Elijah", "latitude" : "35.565222", "photo_url" : "https://farm2.staticflickr.com/1063/602880671_c2f4511ef4_b.jpg", "dateupload" : "1075355967", "owner_id" : "45365637@N00" }123456789101112131415 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 一、GridFS GridFS将图片数据与图片属性数据分开保存,用chunks来保存图片数据,files保存属性数据,一个图片file可能对应多个chunks,每个chunk的内存大小固定(16M),若图片数据大于chunk,则分为多个chunk保存,用同一个ObjectID关联,下载时自动将多个chunk合并为图片数据。 上传

    from pymongo import MongoClient from gridfs import * import requests

    client = MongoClient('127.0.0.1', 27017) #连接mongodb db = client.photo #连接对应数据库 #db.authenticate("username","passowd") fs = GridFS(db, collection="images") #连接collection data = requests.get(dic["photo_url"], timeout=10).content

    确认数据库中不存在此图片之后再保存

    if not fs.find_one({"photo_url":dic["photo_url"]}): fs.put(data, **dic)

    上传成功后,photo数据库下出现两个collection,分别为: images.files, images.chunks12345678910111213

    1 2 3 4 5 6 7 8 9 10 11 12 13 下载

    from pymongo import MongoClient from gridfs import * client = MongoClient('127.0.0.1', 27017) #连接mongodb db = client.photo #连接对应数据库 #db.authenticate("username","passowd") fs = GridFS(db, collection="images") #连接collection num = 1 for grid_out in fs.find(no_cursor_timeout=True): data = grid_out.read() # 获取图片数据 outf = open('/home/%d.jpg'%num,'wb') outf.write(data) #存储图片 outf.close() if num%100000 == 0 metadata_file = open("/home/metadata%d.csv"%(num/100000+1), "ab") csv_writer = csv.writer(metadata_file,delimiter='\t') row = [grid_out.photo_title.encode('utf-8'), grid_out.uploadDate, grid_out.upload_date,
    grid_out.longitude, grid_out.latitude, grid_out.width, grid_out.height,
    grid_out.owner_name.encode('utf-8'), grid_out.photo_id, grid_out._id, grid_out.photo_url] csv_writer.writerow(row)12345678910111213141516171819 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 bson二进制 这种方法将图片数据作为键值对放入字典与属性数据作为整体存入数据库中。 上传代码如下:

    from bson import binary from pymongo import MongoClient

    client = MongoClient('127.0.0.1', 27017) #连接mongodb db = client.photo #连接对应数据库 image_collection = db.images data = requests.get(dic["photo_url"], timeout=10).content

    确认数据库中不存在此图片之后再保存

    if not image_collection.find_one({"photo_url":dic["photo_url"]}) dic["imagecontent"] = binary.Binary(data) image_collection.insert(dic)1234567891011

    踩0 评论0
  • 回答了问题 2021-02-26

    Pytorch中的LSTM:如何添加/更改序列长度维度?

    class torch.nn.LSTM(*args, **kwargs) -- 参数列表: -- input_size: x 的特征维度 -- hidden_size: 隐层的特征维度 -- num_layers: LSTM 层数,默认为1 -- bias: 是否采用 bias, 如果为False,则不采用。默认为True -- batch_first: True, 则输入输出的数据格式为 [batch_size, seq_len, feature_dim],默认为False -- dropout: dropout会在除最后一层外都进行dropout, 默认为0 -- bidirectional: 是否采用双向,默认为False -- 输入数据: -- input: [seq_len, batch_size, input_size], 输入的特征矩阵 -- h_0: [num_layers * num_directions, batch_size, hidden_size], 初始时 h 状态, 默认为0 -- c_0: [num_layers * num_directions, batch_size, hidden_size], 初始时 cell 状态, 默认为0 -- 输出数据: -- output: [seq_len, batch_size, num_directions * hidden_size], 最后一层的所有隐层输出 -- h_n : [num_layers * num_directions, batch, hidden_size], 所有层的最后一个时刻隐层状态 -- c_n : [num_layers * num_directions, batch, hidden_size], 所有层的最后一格时刻的 cell 状态 -- W,b参数: -- weight_ih_l[k]: 与输入x相关的第k层权重 W 参数, W_ii, W_if, W_ig, W_io -- weight_hh_l[k]: 与上一时刻 h 相关的第k层权重参数, W_hi, W_hf, W_hg, W_ho -- bias_ih_l[k]: 与输入x相关的第k层 b 参数, b_ii, b_if, b_ig, b_io -- bias_hh_l[k]: 与上一时刻 h 相关的第k层 b 参数, b_hi, b_hf, b_hg, b_ho

    踩0 评论0
  • 回答了问题 2021-02-26

    alipay.fund.trans.uni.transfer(统一转账接口)访问 超时

    调用接口时设置超时时间,当接口超过9秒未返回结果,自动将改订单设置为处理中,然后后由定时任务调用查询接口。 这样就把,一个实时返回结果的接口,当成一个异步的接口来用了,总比一大堆失败订单等着财务来找好。

    踩0 评论0
  • 回答了问题 2021-02-26

    关于"Code":"InvalidParameter"错误的问题。

    “无效参数内容”

    踩1 评论0
  • 回答了问题 2021-02-26

    我java sts连接oss 出现了Error code: NoSuchBucket

    public static OSSObject downLoadImage(String fileName, OSS ossClient) throws UnsupportedEncodingException { // url过期时间为一小时 ms Date expiration = new Date(new Date().getTime() + 3600 * 1000); GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucketName, fileName, HttpMethod.GET); request.setExpiration(expiration);// 设置过期时间。 // ResponseHeaderOverrides header = new ResponseHeaderOverrides(); // header.setContentDisposition("attachment;filename="+new String("fileName".getBytes(), "ISO-8859-1")); // request.setResponseHeaders(header);

        // 生成签名URL(HTTP GET请求)。
        URL signedUrl = ossClient.generatePresignedUrl(request);
        log.info("url签名{}", signedUrl);
        OSSObject object = ossClient.getObject(signedUrl, new HashMap<>());
        return object;
    
    踩0 评论0
正在加载, 请稍后...
滑动查看更多
正在加载, 请稍后...
暂无更多信息