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...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...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...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...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...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...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...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...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...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...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...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...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...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...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...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...