Leon's Blog Trouble is my friend.

Home

2020

July

  • July 28, 2020 » Optimize Induction For Dynamic Programming

    Recently I reviewed some dynamic programming problems and found I was still lack of the ability to come up with the most optimized solution or induction in some cases. So I tried to find out a generic method to optimize one simple basic induction so that I can use it...

    Read more...

May

  • May 26, 2020 » Tiny Url System

    TinyURL system design is a fairly classic interview question since it can test the abilities of one interviewee from many aspects. This post is to record the idea and tips what I learnt from websites to solve this problems. Idea This TinyURL system needs to provide two basic functions, return...

    Read more...

April

  • April 13, 2020 » Generative Classifier And Discriminative Classifier

    Recently I was learning the naive bayes classifier and learnt there are two categories of classifiers to estimate the distribution $P(Y|X)$ based on the given data, Generative Classifier and Discriminative Classifier. I am puzzled on the differences between these two classifiers at the beginning, since their goals are same and...

    Read more...

2019

November

  • November 3, 2019 » The Bias Variance Tradeoff

    The bais and variance tradeoff is an essential idea of machine learning to understand the generalization error of the classifier. By understanding the components of the generlization error, we can improve the classifier more intuitively instead of changing parameters somehow randomly. Background There is a dataset $D=\{(\mathbf{x_1},y_1),…,(\mathbf{x_n},y_n)\}$, drawn from one...

    Read more...

October

  • October 28, 2019 » Xss Vs. Csrf

    Recently I was working on some identity managment projects. During the investigation, I reviewed some security knowledge and found myself didn’t tell three basic concepts quite well. Sometimes, I felt hard to remeber the exact scenarios of them and would misuse one of them to describe the scenario which should...

    Read more...
  • October 15, 2019 » Sample Explain Isolation Level

    When using a database system, developers need to specify the isolation level to determine how transaction integrity is visible to other concurrent operations. I liked the way how [postgresql][1] define its isolation levels. Its isolation levels are defined in terms of phenomena, resulting from interaction, resulting from interaction between concurrent...

    Read more...

April

  • April 21, 2019 » S1 Reviews

    Recently, I found one of my previous classmate shared the S1-form of a company which is trying to begin it IPO. Actually, I am very interested in these kinds of information. I am courious about how can I find the S1-forms of some other companies which I care about. After...

    Read more...

2018

December

  • December 17, 2018 » Questions About Celluar Ip

    Recently, I am thinking about whether the cell phone has its own ip address and whether the ip address would be changed when moving to another location. The followings are some questions and answers I got when I am trying to track down this issue. How does the server know...

    Read more...
  • December 17, 2018 » Super Washing Machine

    Recently I read a post saying that many interviewees of Amazon have been stuck by a problem called Super Washing Machine. The following are some solutions for this problem. Problem description You have n super washing machines on a line. Initially, each washing machine has some dresses or is empty....

    Read more...

January

  • January 23, 2018 » Jvm Memory Management

    These days I meet some problems about the GC mechanism in JVM, and I found some good articles to learn the detail of JVM management. Java memory management white paper http://www.oracle.com/technetwork/java/javase/memorymanagement-whitepaper-150215.pdf Optimzie GC https://engineering.linkedin.com/garbage-collection/garbage-collection-optimization-high-throughput-and-low-latency-java-applications Understanding G1 garbage collector http://www.oracle.com/technetwork/tutorials/tutorials-1876574.html Full GC vs Major GC vs minor GC https://plumbr.io/blog/garbage-collection/minor-gc-vs-major-gc-vs-full-gc

    Read more...

2016

December

  • December 27, 2016 » Tips In Binary Search

    Sometimes, I feel the confused while dealing with the binary search problem, especially when facing the problem to find the first or last occurrence index to meet certain requirements and I felt so ashamed. After reading the post from canhazcode, I find we can use another way to solve the...

    Read more...

2014

February

  • February 23, 2014 » Mach O Executable

    I found an article about the Mach-O executable run on iOS and OS device. From that article, I picked up some interestings thing about what the compile does and what’s inside such an executable. What puzzled me most in this article is the section of ‘lazy load’ & ‘unlazy load’...

    Read more...

2013

November

  • November 13, 2013 » Update Uicollectionview Items And Sections

    I met some problem when inserting items & sections to a UICollectionView today, and I found something I missed when using UICollectionView whose layout is kind of flowlayout at first. Supplementary is required sometimes If you implemented the UICollectionViewDelegate method - (CGSize) collectionView:(UICollectionView *) collectionView layout:(UICollectionViewLayout *) collectionViewLayout referenceSizeForHeaderInSection:(NSInteger) section...

    Read more...

October

  • October 26, 2013 » Use Sharepoint On Ios Platform

    Request is to commuicate with SharePoint Server using iOS, the version of SharePoint is SharePoint 2013 SharePoint First, we need a SharePoint Server, the host of this server is http://www.mySharePoint.com, which is the root site of the whole SharePoint. You can add your own subsite under the root site, like...

    Read more...
  • October 10, 2013 » Concurrency With Coredata

    I get a crash log 'Error - null [reason] - Statement is still active' in today project, then I found it is about the problem caused when using the same NSManagedObject in two separate thread. The sample code @interface CustomViewController : UIViewController @property (nonatomic, assign) NSManagedObject *anObject; CustomViewController has a...

    Read more...
  • October 5, 2013 » Strong Autoreleasing

    Pass a pointer reference as argument By default, we pass a pointer reference using Objective-C like this: - (void) testReference:(NSObject **) object When compiling, the compiler will add the default key word __autoreleasing for us to inform how to deal with this pointer reference like this: - (void) testReference:(NSObject *...

    Read more...