Binary Search

二分查找初级:二分模板

  • 数组元素无重复
class Solution:
    def search(self, nums: List[int], target: int) -> int:
        if not nums or len(nums) == 0:
            return -1
        left, right = 0, len(nums) - 1
        while left + 1 < right …
more ...

Python email

Date Tags Python
content
    import smtplib
    from email.mime.text import MIMEText
    from email.mime.multipart import MIMEMultipart
    from email.mime.image import MIMEImage
    
    #设置登录及服务器信息
    mail_host = 'smtp.163.com'
    mail_user = 'jerrylsu'
    mail_pass = input('输入授权码102:')  # 授权 …
    more ...

    Python logging

    Date Tags Python
    content

      logging总结

      Logger:记录器,暴露函数给应用程序,基于日志记录器和过滤器级别决定哪些日志有效。

      Handler :处理器, 将(日志记录器产生 …

      more ...

      Spark SQL Join

      Date Tags Spark

      Join in Hive

      Common Join

      在Hive查询的性能调优期间,需要注意的一个方面是执行期间的join的类型。 Common Join是Hive中的默认join类型,也称为Shuffle …

      more ...

      Spark: Shuffling and Partitioning

      Date Tags Spark

      Shuffling

      org.apache.spark.rdd.RDD[(String, Int)]= ShuffledRDD[366]

      Think again what happens when you have to do a groupBy or a groupByKey. Remember our data is distributed! Did you notice anything odd?

      val pairs = sc.parallelize(List((1, "one"), (2, "two"), (3, "three")))
      pairs.groupByKey()
      
      // res2: org.apache …
      more ...


      Debugging Spark Application

      Date Tags Spark
      content
        select
            *
        from
            table1 as A
        join
            table as B
        on
            A.item_id = B.item_id
        where
            A.id in (1139426, 1139436)
            and A.date >= '2018-12-01'
        

        yarn logs -applicationId <app ID> > output_file

        2019-02-21 19:23:41 ERROR ApplicationMaster:91 - User class threw exception: org.apache.spark …
        more ...

        Linux

        Date Tags Linux

        1. Redirection of standard output >

        The default standard output is the screen. > is output redirection symbol and syntax is: $ command > output.file.name https://bash.cyberciti.biz/guide/Standard_output

        2. Redirected output >>

        Appending the output to the same file using >> operator.

        3. Pipes |

        https://bash.cyberciti.biz/guide/Chapter …

        more ...

        Scala

        Date Tags Scala

        前言

        Functional Programming

        Part-1: Elements of Functional Programming

        什么是函数式编程?(Functional Programming) 函数式编程是一种仅使用纯函数(pure functions)和不可变值(immutable values)编写软件应用程序 …

        more ...

        Spark RDD

        Date Tags Spark
        Spark RDD要点总结:
        Spark RDD弹性分布式数据集
        1. RDD简介
          - RDD的概述
          - RDD的属性
        2. RDD的创建方式
          - 从文件系统中加载数据创建RDD
          - 通过 …
        more ...