队头阻塞 - 维基百科,自由的百科全书



队头阻塞 - 维基百科,自由的百科全书

一个交换机有可能由缓存式输入端口、交换架构以及缓存式的输出端口所组成。如果在输入端口处使用了先进先出(FIFO)的策略,那么就只有最先进入的数据包可以被处理。而此时如果最先进入的数据包由于目标输出端口正忙而无法被处理的话,那么更晚到达的数据包就没有办法被处理(即便是更晚到达的数据包的目标输出端口并没有处于忙碌的状态)。输出正忙的情况有:

  • 存在输出的竞态关系;
  • 或者更常见的情况是输出缓存已满,从而导致了阻塞现象(例如多个输入的数据传输速率超过了输出的传输速率)。

如果没有队头阻塞的话,新到达的数据包就有可能绕开被阻碍的数据包而被导向它们各自的(没有处于阻塞状态的)目标输出端口了。这种现象有可能在缓存式输入的系统中对性能造成极大的影响。

解决队头阻塞[编辑]

解决这个问题的其中一个方法是使用虚拟输出队列[1]。只有在缓存式输入的交换机中才会出现队头阻塞的情况。如果交换机内部的带宽足够的话,缓存输入就是没有必要的了——所有的缓存都可以在输出处被处理,从而也避免了队头阻塞。这样的无缓存式输入架构在中小型规模的以太网交换机中非常常见。


Read full article from 队头阻塞 - 维基百科,自由的百科全书


Did you mean "Galene"? | LinkedIn Engineering



Did you mean "Galene"? | LinkedIn Engineering

Search is one of the most intensely studied problems in software engineering.  It brings together information retrieval, machine learning, distributed systems, and other fundamental areas of computer science.  And search is core to LinkedIn.  Our 300M+ members use our search product to find people, jobs, companies, groups and other professional content. Our goal is to provide deeply personalized search results based on each member's identity and relationships.

LinkedIn built our early search engines on Lucene.  As we grew, we evolved the search stack by adding layers on top of Lucene.  Our approach to scaling the system was reactive, often narrowly focused, and led to stacking new components to our architecture, each to solve a particular problem without thinking holistically about the overall system needs.  This incremental evolution eventually hit a wall requiring us to spend a lot of time keeping systems running, and performing scalability hacks to stretch the limits of the system.  

Around a year ago, we decided to completely redesign our platform given our growth needs and our direction towards realizing the world's first economic graph. The result was Galene, our new search architecture, which has since been implemented and successfully powering multiple search products at LinkedIn. Galene has helped us improve our development culture and forced us to incorporate new development processes.  For example, the ability to build new indices every week with changes in the offline algorithms requires us to adopt a more agile testing and release process.  Galene has also helped us clearly separate infrastructure tasks from relevance tasks.  For example, relevance engineers no longer have to worry about writing multi-threaded code, perform RPCs, or worry about scaling the system.


Read full article from Did you mean "Galene"? | LinkedIn Engineering


Jeff Jonas: There Is No Such Thing As A Single Version of Truth



Jeff Jonas: There Is No Such Thing As A Single Version of Truth

If you are not interested in a technical peculiarity that occurs in aggregated data sets, just ignore this post.

I am often asked what my thoughts are about selecting the single best attributes (e.g., best name and best address) when multiple attributes are known. I always respond with, "truth is in the eye of the beholder."

This came as a hard lesson. In the mid-1990's, I built a data warehouse that was being fed daily by over 4,000 disparate operational systems belonging to handful of widely recognized consumer brands. The goal was to better understand the customer by recognizing when the same person was transacting across different brands all held by the same holding company. The underlying motivation: the more fully the customer is understood the more you can sell to the customer.

There I sat with a number of marketing VP's, each representing their brand's interests. And while everyone worked for the same parent company, there was one question no one could agreed upon: When a consumer has transacted with all of the brands, each time using a slightly different name or new address, which name and address should be considered the enterprise-wide GOLD standard? As it turns out, there is no such thing as a single version of truth.


Read full article from Jeff Jonas: There Is No Such Thing As A Single Version of Truth


一种出票算法 - 没事瞎思考



一种出票算法 - 没事瞎思考

12306 一度处在风口上, 2013 年之前听到的多是骂声,幸好之后有大牛正名。正名之后渐渐的就有人开始写关于 12306 相关的技术文章了,看的多了之后,也渐渐开始思考。

其中有一篇文章从电商的角度分析了 12306,认为 12306 的票是一种商品,每种可能的票都是一个 SKU ,假设有 ABCD 四个站,就分别有 AD,AC,BD,AB,BC,CD 这 6 种 SKU。假设有 10 个站, 那么就有 45 个 SKU 了,SO,结论是 12306 是一个相当复杂的系统……

我个人认为,并不能把票看做一种简单的 SKUSKU 真正的含义是库存单位,就是一个买卖的最小单位。同样假设有 ABCD 4 个站,列车共有 10 个座位,一开始,任何种类的票都有 10 张,我买了 1 张 AD 的票之后, 任何票种都只剩下 9 张票了,AD 作为一个 SKU 明显影响了其他的 SKU 的数量,所以这样看是不对的。

现在我们知道, 不能把票看做一种 SKU 来处理, 但是这个类比却引发我一个思考,这个类比错误之处在于没有试图找出票的最小单位 —— 1 站 × 1 座位。以最小单位来当做 SKU 结果会如何了,仍然行不通,假如我买了 BC 区间 6 号座位票,那么 AD 区间的 6 号座位的票是卖不出去的, 尽管在 AB 和 CD 区间我并没有占有 6 号座位,这就导致了,AB 和 CD 可以单独卖 6 号座位的票,但就是不能卖跨越 BC 的 6 号座位的票。

上述例子实际是基于一个规则,就是不能要求乘客中途换座位,假如可以的话,我明显可以让乘客 AB 和 CD 的时候坐 6 号座位,BC 坐其他座位了,那么 6 号座位全程是满的,这对于列车来说倒是再好不过了。

1 几个小结论

  1. 票的最小单位是 1 站 × 1 座位
  2. 一张票必须是连续站区间的,不能 AB,CD 绑在一张票上,如果有人有这个需求,那他就买 2 张票吧
  3. 不能要求乘客中途换座位
  4. 没有站票(好像没有这个规定😁 , 这是我简化问题引入的)

2 模拟卖票

12306 sell ticket 如上图所示,甲买了 cd 2 个站 1 号座位的票,现在如果乙需要买 abc 3 个站的票,那他只能买 2 号座位了,现在我们来看看丙,丙需要买 de 2 个站的票,分配 3 号座位给丙并不是不可以,但是不合理,因为这使得 3 号座位可以组合的票种变少了,卖出去的可能降低,期望利润降低了,丙分配到 2 号位置是最合理的。

2.1 出票规则

基于上述例子,我们来设计一个合理的出票规则:确定票的站区间,从上至下找到一个不和其他票冲突的座位(也就是图形中的色块不重叠)。

这里有 2 个关键点:

  • 「从上至下」保证了座位利用率最高
  • 「不冲突(色块不重叠)」代表改座位在该区间可用

12306 best ticket 丙 de 2 个站的票从上到下找到 2 号座位,最终得到上图结果。我们把卖出去的票(着色区域)标记为数字 0,没卖出的标记为数字 1,那么我们就得到了一张内存图。1 站 × 1 座位就是一个 bit 位,我们每一行(每 1 个座位)用一个 unsiged long 数字代表,就可以代表 64 个站区间,一条线路 65 个站应该满足我们国家需求了😁 。

2.2 判断座位在某站点区间是否可用

拿丙来说,丙买了 de 2 个站点的票,根据我们内存图模型,他买了一张这样的票

0000000000000000000000000000000000000000000000000000000000011000「= 24」

应该倒过来看这一串数字,后面 3 个「0」 代表 abc 3 个站区间,2 个「1」 代表 de 2 个站区间。这张票一串二进制数字就代表 「24」,为了方便,我们称 「24」 为这张票的 ticket value (t-site);同样,座位占用了的区间标为「0」,可使用的区间标为 「1」, 得到座位的 ticket value (t-seat)。那么判断座位是否可用的方法就是:

t-site & t-seat = t-site

确定座位的可用性之后,如果决定出票,只需要用 t-seat 减去 t-site 作为新的 t-seat

3 出票算法

现在我们来确定一下出票步骤:

  1. 计算客户要购买的票的 ticket value t-site
  2. 找到一个座位满足 t-site & t-seat = t-site
  3. 出票,更新该座位的 t-seat = t-seat - t-site

需要注意的是:2、3 步骤得是一个原子操作。

4 总结

我相信,采用这种出票算法,对于 12306 尖峰日 PV 值 297 亿下可每秒出票 1032 张, 不采用内存计算进行优化,直接采用 PostgreSQL 就可以搞定了,每辆列车一个 table 保存所有座位的 ticket value, 不过 😝 , 当然只是指出票而已,车票系统还有很多其他问题需要考虑。不过貌似看这文章,12306 的票是预先分配好的,然后每 2 分钟更新一次。


Read full article from 一种出票算法 - 没事瞎思考


Finding The Shortest Path, With A Little Help From Dijkstra



Finding The Shortest Path, With A Little Help From Dijkstra

you spend enough time reading about programming or computer science, there's a good chance that you'll encounter the same ideas, terms, concepts, and names, time and again. Some of them start to become more familiar with time. Naturally, organically, and sometimes without too much effort on your part, you start to learn what all of these things mean. This happens because either you've slowly begun to grasp the concept, or you've read about a phrase enough times that you start to truly understand its meaning.


Read full article from Finding The Shortest Path, With A Little Help From Dijkstra


Crack the System Design interview: tips from a Twitter software engineer



Crack the System Design interview: tips from a Twitter software engineer

I recently wrote about how I landed offers from multiple top-tier tech companies. During my interview preparation process, I read up on a lot of material and prepared a set of notes on how to tackle system design problems. In this article, I'd like to share those tips with you all.

If you're a fresh graduate with no experience in large-scale distributed systems, or even a seasoned engineer with years of experience under your belt, this article will be useful for you.


Read full article from Crack the System Design interview: tips from a Twitter software engineer


Java极客技术



Java极客技术

6、Redis 为什么这么高效,使用的场景是什么?

回答了一下我们使用 redis 做缓存和登录 session 存在的场景,以及 redis 是单线程的。


Read full article from Java极客技术


阿飞的博客



阿飞的博客

这段内容还说到:当hashCode离散性很好的时候,树型bin用到的概率非常小,因为数据均匀分布在每个bin中,几乎不会有bin中链表长度会达到阈值。但是在随机hashCode下,离散性可能会变差,然而JDK又不能阻止用户实现这种不好的hash算法,因此就可能导致不均匀的数据分布。不过理想情况下随机hashCode算法下所有bin中节点的分布频率会遵循泊松分布,我们可以看到,一个bin中链表长度达到8个元素的概率为0.00000006,几乎是不可能事件。所以,之所以选择8,不是拍拍屁股决定的,而是根据概率统计决定的。由此可见,发展30年的Java每一项改动和优化都是非常严谨和科学的。


Read full article from 阿飞的博客


Testing Apache Cassandra 4.0



Testing Apache Cassandra 4.0

With the goal of ensuring reliability and stability in Apache Cassandra 4.0, the project's committers have voted to freeze new features on September 1 to concentrate on testing and validation before cutting a stable beta. Towards that goal, the community is investing in methodologies that can be performed at scale to exercise edge cases in the largest Cassandra clusters. The result, we hope, is to make Apache Cassandra 4.0 the best-tested and most reliable major release right out of the gate.


Read full article from Testing Apache Cassandra 4.0


(12) Linux: What is the difference between advisory lock and mandatory lock? - Quora



(12) Linux: What is the difference between advisory lock and mandatory lock? - Quora

Advisory Locking is a cooperative locking scheme where the participating processes need to follow/obey a locking protocol. As long as the processes follow the locking protocol/API and respect its return values, the underlying API takes care that file locking semantics work correctly.

In other words, this is not an enforced locking scheme. Let's say a process P1 has taken an advisory file read lock on file F, there is absolutely nothing done by operating system or the file locking facility to prevent any other process P2 from going ahead and concurrently modifying the file F through write system call even though it is already read locked by a different process.


Read full article from (12) Linux: What is the difference between advisory lock and mandatory lock? - Quora


Borg: The Predecessor to Kubernetes - Kubernetes



Borg: The Predecessor to Kubernetes - Kubernetes

Google has been running containerized workloads in production for more than a decade. Whether it's service jobs like web front-ends and stateful servers, infrastructure systems like Bigtable and Spanner, or batch frameworks like MapReduce and Millwheel, virtually everything at Google runs as a container. Today, we took the wraps off of Borg, Google's long-rumored internal container-oriented cluster-management system, publishing details at the academic computer systems conference Eurosys. You can find the paper here.


Read full article from Borg: The Predecessor to Kubernetes - Kubernetes


Why I Have 2 Discover It Cards — AskSebby



Why I Have 2 Discover It Cards — AskSebby

If you're trying to get multiple Discover cards, there are a few rules:

  1. You can only have up to 2 Discover It cards at one time
  2. You can only have 1 student card at one time
  3. You can only have 1 new card every membership year — after you receive the cashback match check. Even though the rules say 12 months, it's really 13 months because you have to wait for the cashback match check.


Read full article from Why I Have 2 Discover It Cards — AskSebby


Don't Use Apache Kafka Consumer Groups the Wrong Way! - DZone Big Data



Don't Use Apache Kafka Consumer Groups the Wrong Way! - DZone Big Data

  • Having consumers as part of the same consumer group means providing the "competing consumers" pattern with whom the messages from topic partitions are spread across the members of the group. Each consumer receives messages from one or more partitions ("automatically" assigned to it) and the same messages won't be received by the other consumers (assigned to different partitions). In this way, we can scale the number of the consumers up to the number of the partitions (having one consumer reading only one partition); in this case, a new consumer joining the group will be in an idle state without being assigned to any partition.

  • Read full article from Don't Use Apache Kafka Consumer Groups the Wrong Way! - DZone Big Data


    GitHub - cer/event-sourcing-examples: Example code for my building and deploying microservices with event sourcing, CQRS and Docker presentation



    GitHub - cer/event-sourcing-examples: Example code for my building and deploying microservices with event sourcing, CQRS and Docker presentation

    The application is built using Eventuate, which is an application platform for writing transactional microservices. It provides a simple yet powerful event-driven programming model that is based on event sourcing and Command Query Responsibility Segregation (CQRS). Eventuate solves the distributed data management problems inherent in a microservice architecture. It consists of a scalable, distributed event store and client libraries for various languages and frameworks including Java, Scala, and the Spring framework.


    Read full article from GitHub - cer/event-sourcing-examples: Example code for my building and deploying microservices with event sourcing, CQRS and Docker presentation


    MySQL :: MySQL 5.7 Reference Manual :: 17 Group Replication



    MySQL :: MySQL 5.7 Reference Manual :: 17 Group Replication

    This chapter explains MySQL Group Replication and how to install, configure and monitor groups. MySQL Group Replication is a MySQL Server plugin that enables you to create elastic, highly-available, fault-tolerant replication topologies.

    Groups can operate in a single-primary mode with automatic primary election, where only one server accepts updates at a time. Alternatively, for more advanced users, groups can be deployed in multi-primary mode, where all servers can accept updates, even if they are issued concurrently.

    There is a built-in group membership service that keeps the view of the group consistent and available for all servers at any given point in time. Servers can leave and join the group and the view is updated accordingly. Sometimes servers can leave the group unexpectedly, in which case the failure detection mechanism detects this and notifies the group that the view has changed. This is all automatic.


    Read full article from MySQL :: MySQL 5.7 Reference Manual :: 17 Group Replication


    Valuing already-solved problems.



    Valuing already-solved problems.

    Product market fit for business-to-business products hinges on when your customer first encounters the problem you solve. If you're selling to a company that is newly encountering the problem, then you get to sell them on your product's value. However, a mature company likely already has a working solution, and you're stuck selling on reduced total cost of ownership, a much harder sale.

    This can make it difficult to determine if you have fit for larger customers: you can't validate against existing large businesses. Instead, you have to wait for early stage companies who adopted your product to solve their initial problem to become large companies.


    Read full article from Valuing already-solved problems.


    暴雪hash算法 - Stinky tofu - 博客园



    暴雪hash算法 - Stinky tofu - 博客园

    你有一个非常大的字符串数组A,现在又有一个字符串B,需要你去检测B是否存在于A中。最简单粗暴的方法是遍历整个A,但是这个方法投入到实际应用时的运行速度是难以接受的。在没有与其他所有字符串比较前怎么知道该字符串是否存在呢?

    解决方法是使用哈希表,即用较小的数据类型来代表较大的数据类型,例如:用数字来代表字符串。你可以存储哈希值与字符串一一对应,当需要检测一个字符串时,就用哈希算法计算其哈希值,然后与存储的哈希值比较级可以得出结果,使用这一方法根据数组的大小和字符串长度提升速度大约100倍。


    Read full article from 暴雪hash算法 - Stinky tofu - 博客园


    Sean: Quiz 9-- Princeton Algorithm



    Sean: Quiz 9-- Princeton Algorithm

    Red–black BST with no extra memory. Describe how to save the memory for storing the color information when implementing a red–black BST.

    Hint: modify the structure of the BST to encode the color information.



    Document search. Design an algorithm that takes a sequence of n document words and a sequence of m query words and find the shortest interval in which the m query words appear in the document in the order given. The length of an interval is the number of words in that interval.

    Hint: for each word, maintain a sorted list of the indices in the document in which that word appears. Scan through the sorted lists of the query words in a judicious manner.



    Generalized queue. Design a generalized queue data type that supports all of the following operations in logarithmic time (or better) in the worst case.
    • Create an empty data structure.
    • Append an item to the end of the queue.
    • Remove an item from the front of the queue.
    • Return the ith item in the queue.
    • Remove the ith item from the queue.

    Read full article from Sean: Quiz 9-- Princeton Algorithm


    Problem A. Farthest Point · GitBook



    Problem A. Farthest Point · GitBook

    Given a circle on a two-dimentional plane.

    Output the integral point in or on the boundary of the circle which has the largest distance from the center.

    输入

    One line with three floats which are all accurate to three decimal places, indicating the coordinates of the center x, y and the radius r.

    For 80% of the data: |x|,|y|<=1000, 1<=r<=1000

    For 100% of the data: |x|,|y|<=100000, 1<=r<=100000


    Read full article from Problem A. Farthest Point · GitBook


    Algorithm, Part I — Successor with delete – Steel Wings



    Algorithm, Part I — Successor with delete – Steel Wings

    Q: Successor with delete. Given a set of N integers S={0,1,…,N−1} and a sequence of requests of the following form:

    • Remove x from S
    • Find the successor of x: the smallest y in S such that y≥x.

    design a data type so that all operations (except construction) should take logarithmic time or better.

    (Java Code on github at the bottom of the post. )

    My thoughts and solutions:

    Well, I have experienced some frustration on this one. Since it is under the context of Union-Find, it is very likely that we need to use Union-Find algorithm. Unfortunately, I didn't figure out how to apply Union-Find. One step back, if there was no context at all, I probably would not think of using Union-Find at all…But we know now…Again, this suggests that we should practice more problems as the knowledge base, otherwise we won't have any previous experience to connect with when facing a new problem.


    Read full article from Algorithm, Part I — Successor with delete – Steel Wings


    Weihan's Coding Blog | Climbing Stairs



    Weihan's Coding Blog | Climbing Stairs

    You are climbing a stair case. It takes n steps to reach to the top.

    Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?

    Note: Given n will be a positive integer.


    Read full article from Weihan's Coding Blog | Climbing Stairs


    148. Sort List - YRB - 博客园



    148. Sort List - YRB - 博客园

    Sort List, 链表排序,一看到O(nlogn)就想到使用merge sort。 对于merge sort,还要研究一下bottom-up和top-down的区别,优劣点,如何继续优化等等,比如n较小时使用insertion sort, 了解Python的Tim-sort之类。也要研究一下链表的Quicksort,以及3-way Quicksort。 当时电面Amazon的时候写排序作死选择Quicksort,还尝试写了一个3-way Quicksort,由于理解不深同时当天也头昏脑胀没解释清楚,被面试官白大姐秒拒,如此浪费一年机会,甚是可惜。对于各种排序的stalability也要好好复习。熟能生巧,多练吧。另外,external sorting,B tree,A* tree,indexing,paging之类的也要复习。聊远了...

    这题使用Merge Sort的话,还是按照Divide-and-Conquer分治。 两个辅助方法是findMid找中点,以及merge合并。 merge的话完全可以使用"Merge Sorted List"的代码,找中点我们也使用过,所以可以直接写。


    Read full article from 148. Sort List - YRB - 博客园


    Should You Pay Your Taxes With a Rewards Credit Card?



    Should You Pay Your Taxes With a Rewards Credit Card?

    If you pay with a credit card, you'll face fees ranging from 1.87% to 3.93% depending on how you file and how you pay. That means your challenge is simple — if you want to justify paying your tax bill with credit, you're simply going to have to find a way to earn a greater net benefit than the amount you're spending on fees.


    Read full article from Should You Pay Your Taxes With a Rewards Credit Card?


    不写代码写什么



    不写代码写什么

    这个普通的例子已经很好的展现函数式编程的特性了,我不依赖外部的数据,我也不改变外部的数据,而是返回一个新的值给你。

    在《编写可读代码的艺术》一书中,谈到了变量影响代码可读性和复杂度的三种原因:

    • 变量越多,就越难全部跟踪它们的

    • 变量的作用域越大,就需要跟踪它的动向

    • 变量改变得越频繁,就越难以跟踪它的当前值


    Read full article from 不写代码写什么


    LeetCode All in One 题目讲解汇总(持续更新中...) - Grandyang - 博客园



    LeetCode All in One 题目讲解汇总(持续更新中...) - Grandyang - 博客园

    终于将LeetCode的大部分题刷完了,真是漫长的第一遍啊,估计很多题都忘的差不多了,这次开个题目汇总贴,并附上每道题目的解题连接,方便之后查阅吧~

    如果各位看官们,大神们发现了任何错误,或是代码无法通过OJ,或是有更好的解法,或是有任何疑问,意见和建议的话,请一定要在对应的帖子下面评论区留言告知博主啊(如果不方便注册博客园的话,可以下载下文提到的APP,在Feedback中给博主发邮件交流哈),同时也请大家踊跃地,大量地,盲目地提供各个题目的follow up一起讨论哈,多谢多谢,祝大家刷得愉快,刷得精彩,刷出美好未来~

    博主制作了一款iOS的应用"Leetcode Meet Me",里面有Leetcode上所有的题目,并且贴上了博主的解法,随时随地都能看啊,相当方便,而且无网状态下也能看哦~目前只支持iPhone和iPad,直接在App Store搜"Leetcode Meet Me"就可以找到,关于本app有任何的feedback请直接在本帖的评论区留言帮助博主改进,demo展示请参见帖子的底部~ (同时征安卓大神帮忙制作安卓版的应用)。


    Read full article from LeetCode All in One 题目讲解汇总(持续更新中...) - Grandyang - 博客园


    Can I deposit my tax refund into someone else's - TurboTax® Support



    Can I deposit my tax refund into someone else's - TurboTax® Support

    While there are no IRS rules that specifically forbid you from depositing your refund into someone else's account, we don't recommend it.

    Why not? Because most banks have fraud-prevention measures that won't allow a direct deposit into an account bearing a different name.

    If you decide to enter someone else's account information anyway, chances are the bank will reject the IRS's direct-deposit request because the name on the refund (yours) doesn't match the account holder's.

    The IRS will then have to re-process the refund, cut a check, and send it by mail. You will (eventually) get your refund, but it'll take longer than it would have taken had you requested a check refund in the first place.


    Read full article from Can I deposit my tax refund into someone else's - TurboTax® Support


    Can employees deduct commuting expenses like gas, - TurboTax® Support



    Can employees deduct commuting expenses like gas, - TurboTax® Support

    Commuting expenses between your home and main workplace have never been deductible on your federal return, even if your workplace is far away or you conduct business or haul work supplies during your commute.

    In 2017 and earlier tax years, employees could get a partial deduction for expenses incurred while commuting between multiple job sites during the same day, as well as commutes to temporary work locations. However, these expenses are no longer deductible in tax years 2018 through 2025 due to the Tax Cuts and Jobs Act (TCJA) that Congress signed into law on December 22, 2017.


    Read full article from Can employees deduct commuting expenses like gas, - TurboTax® Support


    [CareerCup] 18.6 Smallest One Million Numbers 最小的一百万个数字 - Grandyang - 博客园



    [CareerCup] 18.6 Smallest One Million Numbers 最小的一百万个数字 - Grandyang - 博客园

    18.6 Describe an algorithm to find the smallest one million numbers in one billion numbers. Assume that the computer memory can hold all one billion numbers.

     

    这道题让我们在十亿个数字中找到最小的一百万个数字,而且限定了计算机只有能存十亿个数字的内存。这题有三种解法,排序,最小堆,和选择排序。

    首先来看排序方法,这种方法简单明了,就是把这十亿个数字按升序排列,然后返回前一百万个即可,时间复杂度是O(nlgn)。

    然后来看最小堆做法,我们建立一个最大堆(大的数字在顶端),然后将前一百万个数字加进去。然后我们开始遍历剩下的数字,对于每一个数字,我们将其加入堆中,然后删掉堆中最大的数字。遍历接受后,我们就有了一百万个最小的数字,时间复杂度是O(nlgm),其中m是我们需要找的数字个数。

    最后我们来看选择排序的方法,这种方法可以在线性时间内找到第i个最大或最小的数,如果数字都不是不同的,那么我们可以在O(n)的时间内找到第i个最小的数字,算法如下:

    1. 随机选取数组中的一个数字当做pivot,然后以此来分割数组,记录分割处左边的数字的个数。

    2. 如果左边正好有i个数字,那么返回左边最大的数字。

    3. 如果左边数字个数大于i,那么继续在左边递归调用这个方法。

    4. 如果左边数字个数小于i,那么在右边递归调用这个方法,但是此时的rank变为i - left_size。


    Read full article from [CareerCup] 18.6 Smallest One Million Numbers 最小的一百万个数字 - Grandyang - 博客园


    [CareerCup] 16.2 Measure Time in a Context Switch 测量上下文转换的时间 - Grandyang - 博客园



    [CareerCup] 16.2 Measure Time in a Context Switch 测量上下文转换的时间 - Grandyang - 博客园

    16.2 How would you measure the time spent in a context switch?

     

    上下文转换发生在两个进程之间,比如让一个等待进程进入执行和让一个运行进程进入等待,这些在多任务中发生。操作系统需要把等待进程的信息放入内存和把当前运行的进程信息保存下来。为了解决这个问题,我们记录在切换进程时的最后和第一个指令的时间点,比如我们有两个进程P1和P2,P1在执行P2在等待,当我们切换P1和P2时,假设发生在P1的第N个指令,我们用tx,k来表示进程x的第k个指令的时间点,那么切换的时间为t2,1-t1,n

    那么问题是我们怎么知道什么时候转换发生,我们又不能记录进程的每个指令的时间点。另外还有转换是由操作系统的安排算法管理的,而且有很多核心线程也要用上下文转换。其他进程也可能竞争CPU或内核处理中断。用户不能控制外部的上下文转换,比如在时间t1,n,内核决定处理中断,那么上下文转换的时间就会延长。为了克服这些困难,我们需要建立一个上下文使得P1执行完,P2马上就能运行。我们可以建立一个数据通道Data Chanel,例如管道Pipe,在P1和P2之间,就像两个进程在打乒乓球,使用数据权标Data Token。

    我们让P1当发送者,P2当接受者。开始时,P2在等待,当P1执行了,它发送了数据权标给P2,然后等着读取一个回执。但是由于P2还没能执行,所以P1没有回执,进行被阻碍了,释放了CPU。上下文转换发生了,任务分配器必须选另一个进程执行,且P2处于准备执行状态。当P2运行了,P1和P2的角色互换了,P2现在是发送者而P1是接受者,当P2发回执给P1,整个过程就完成了:

    1. P2等待P1发送消息。

    2. P1记录时间点。

    3. P1给P2发送消息。

    4. P1试图读取回执,这包括了一个上下文转换。

    5. P2准备就绪并接到了消息。

    6. P2发送回执给P1。

    7. P2尝试读取P1的回执,这包括了一个上下文转换。

    8. P1准备就绪且接到了消息。

    9. P1记录时间点。

    那么步骤2到9之间的时间差T,表示为T = 2 * (Td + Tc + Tr),其中Td和Tr表示发送和接受消息时间,Tc表示状态转换的时间。那么现在问题是要求Td + Tr的值,即为P1发送信息给自己到接受到消息的时间,这不包括状态转换的时间因为是发给自己。由于可能存在的未知中断,所以我们需要重复多次,取最小的Tc当做结果。

    这也只是一个近似结果,因为我们这么做有个假设就是当P2接到消息后马上就开始运行,这得根据任务分配器的实现方法,所以只是个近似值。


    Read full article from [CareerCup] 16.2 Measure Time in a Context Switch 测量上下文转换的时间 - Grandyang - 博客园


    [CareerCup] 17.12 Sum to Specific Value 和为特定数 - Grandyang - 博客园



    [CareerCup] 17.12 Sum to Specific Value 和为特定数 - Grandyang - 博客园

    17.12 Design an algorithm to find all pairs of integers within an array which sum to a specified value.

     

    这道题实际上跟LeetCode上的Two Sum很类似,但是不同的是,那道题限定了只有一组解,而这道题说可以有很多组符合要求的解,那么我们先来看一种使用哈希表的解法,这种解法的时间复杂度是O(n),空间复杂度是O(1),思路是用哈希表建立每个数字和其下标之间的映射,遍历整个数字,如果target减去当前数字的值在哈希表中存在,那么返回这一对结果,然后更新当前数字在哈希表中的映射值,参见代码如下:


    Read full article from [CareerCup] 17.12 Sum to Specific Value 和为特定数 - Grandyang - 博客园


    CompThoughts - Algorithm Problems



    CompThoughts - Algorithm Problems

    Implement an algorithm to delete a node in the middle (i.e., any node but the first and last node, not necessarily the exact middle) of a singly linked list, given only access to that node (you are not given access to the head of the linked list). Example:

    Input: the node c from the linked list a -> b -> c -> d -> e

    Result: nothing is returned, but the new linked list looks like: a -> b -> d -> e-> f


    Read full article from CompThoughts - Algorithm Problems


    [CareerCup] 17.13 BiNode 双向节点 - Grandyang - 博客园



    [CareerCup] 17.13 BiNode 双向节点 - Grandyang - 博客园

    17.13 Consider a simple node-like data structure called BiNode, which has pointers to two other nodes. The data structure BiNode could be used to represent both a binary tree (where nodel is the left node and node2 is the right node) or a doubly linked list (where nodel is the previous node and node2 is the next node). Implement a
    method to convert a binary search tree (implemented with BiNode) into a doubly linked list. The values should be kept in order and the operation should be performed in place (that is, on the original data structure).

     

    这道题定义了一个双向节点BiNode的类,其既可以表示二叉树的结构,也可以表示为双向链表的结构,让我们把一个二叉树的结构转化为双向链表的结构。我们有很多种方法可以实现,首先来看一种建立一种新数据结构NodePair类,保存了链表的首节点和尾节点,用递归的方法来实现压平二叉树,参见代码如下:


    Read full article from [CareerCup] 17.13 BiNode 双向节点 - Grandyang - 博客园


    Cracking the Coding Interview 150题(二) | 神奕的博客



    Cracking the Coding Interview 150题(二) | 神奕的博客

    3.2 请设计一个栈,除poppush方法,还支持min方法,可返回栈元素中的最小值。poppushmin三个方法的时间复杂度必须为O(1)

    3.3 设想有一堆盘子,堆太高可能会倒下来。因此,在现实生活中,盘子堆到一定高度时,我们就会另外堆一堆盘子。请实现数据结构SetOfStacks,模拟这种行为。SetOfStacks应该由多个栈组成,并且在前一个栈填满时新建一个栈。此外,SetOfStacks.push()SetOfStacks.pop()应该与普通栈的操作方法相同(也就是说,pop()返回的值,应该跟只有一个栈时的情况一样)

    • 进阶:实现一个popAt(int index)方法,根据指定的子栈,执行 pop 操作。

    3.4 在经典问题汉诺塔中,有3根柱子及N个不同大小的穿孔圆盘,盘子可以滑入任意一根柱子。一开始,所有盘子自底向上从大到小依次套在第一根柱子上(即每一个盘子只能放在更大的盘子上面)。移动圆盘时有以下限制:

    • 每次只能移动一个盘子
    • 盘子只能从柱子顶端滑出移到下一根柱子
    • 盘子只能叠在比它大的盘子上

    请运用栈,编写程序将所有盘子从第一根柱子移到最后一根柱子。

    3.5 实现一个MyQueue类,该类用两个栈来实现一个队列。

    3.6 编写程序,按升序对栈进行排序(即最大元素位于栈顶)。最多只能使用一个额外的栈存放临时数据,但不得将元素复制到别的数据结构中(如数组)。该栈支持如下操作:pushpoppeekisEmpty

    3.7 有家动物收容所只收容狗与猫,且严格遵守"先进先出"的原则。在收养该收容所的动物时,收养人只能收养所有动物中"最老"(根据进入收容所的时间长短)的动物,或者,可以挑选猫或狗(同时必须收养此类动物中"最老"的)。换言之,收养人不能自由挑选想收养的对象。请创建适用于这个系统的数据结构,实现各种操作方法,比如enqueuedequeueAnydequeueDogdequeueCat等。


    Read full article from Cracking the Coding Interview 150题(二) | 神奕的博客


    How can I ignore some folder like 'node_modules‘ when I search in the directory? - support - Atom Discussion



    How can I ignore some folder like 'node_modules' when I search in the directory? - support - Atom Discussion

    Also to be noted that if you keep your code under git, hg or equivalent, atom will ignore by default all files that are ignored by your version control system (all files matching the patterns in your .gitignore). [ This typically include node_modules, build, dist, .git and others… ]


    Read full article from How can I ignore some folder like 'node_modules' when I search in the directory? - support - Atom Discussion


    SSL certificate doesn't match | DSE Troubleshooting guide



    SSL certificate doesn't match | DSE Troubleshooting guide

    This message shows that 10.236.136.55 is being resolved to node35.foo.com, then node node35.foo.com is being asked for it's certificate which is a generic certificate issued with a CN of clustercert.foo.com. For security reasons, SSL verifies that node35.foo.com and clustercert.foo.com match. If they don't match, a certificate mismatch error occurs. Do not use a generic certificate across multiple nodes, because each node has a different name that won't match. Do not copy a certificate that is issued to node35.foo.com over to another node.

    Nodes must be configured with correct names that match the certificate CN. You can use a wildcard in named certificates, like * in CN=*.foo.com, or any other matching mechanism allowed by SSL standards. All others configurations where names mismatch will result in an error.


    Read full article from SSL certificate doesn't match | DSE Troubleshooting guide


    【算法】LeetCode上一些经典好题(update@0617) - haolexiao的专栏 - CSDN博客



    【算法】LeetCode上一些经典好题(update@0617) - haolexiao的专栏 - CSDN博客

    13.数组中数全是1~n的范围内的题

    长度为n的数组,其中元素全部为1~n,则这种题有一个通用的解法,就是,循环替换 num[num[i]] = num[i]直到不能替换为止。然后再继续。具体操作上,可以不断的做swap(num[i],num[num[i]])这样写起来代码更短,更方便。


    Read full article from 【算法】LeetCode上一些经典好题(update@0617) - haolexiao的专栏 - CSDN博客


    一个线程罢工的诡异事件 | crossoverJie's Blog



    一个线程罢工的诡异事件 | crossoverJie's Blog

    1. 有一个生产线程一直源源不断的往队列写数据。
    2. 消费线程也一直不停的取出数据后写入后续的业务线程池。
    3. 业务线程池里的线程会对每个任务进行入库操作。


    Read full article from 一个线程罢工的诡异事件 | crossoverJie's Blog


    (99+) If worried about Time Limit Exceeded... [Contest Strategy] - LeetCode Discuss



    (99+) If worried about Time Limit Exceeded... [Contest Strategy] - LeetCode Discuss

    There are only 15 possible inputs, so if you're worried about your solution being too slow or if your solution is too slow, you can just precompute all answers and submit an O(1) solution. If your precomputation is so slow that it takes minutes, you can even let it run in the background while you're solving the next problem(s). Remember that your contest ranking doesn't depend on the sum of your problem times but on the largest one.


    Read full article from (99+) If worried about Time Limit Exceeded... [Contest Strategy] - LeetCode Discuss


    Weighted Union Find: a fascinating and elegant algorithm



    Weighted Union Find: a fascinating and elegant algorithm

    The Union find algorithm solves a huge problem in computing. In a system with many elements, where elements are connected via a path through other elements, how do we efficiently determine if two elements are connected?


    Read full article from Weighted Union Find: a fascinating and elegant algorithm


    不写代码写什么



    不写代码写什么

    解决线上问题的时候,心里总想着还没有写完的代码;看书的时候,还挂念着未追完的剧。一个想法总是翻来覆去,就像是大脑中的「隐藏进程」,时不时地发个消息提醒你一下。这些都是效率低下的原因。想要在处理事务的时候能达到心如止水的状态,就不得不提 GTD (Get Things Done) 。它其实就分为 5 个动作:收集、整理、组织、检查、做


    Read full article from 不写代码写什么


    Algorithm 题解目录 | Thinkwee's Blog



    Algorithm 题解目录 | Thinkwee's Blog

  • 75:给出一个只包含0,1,2的数列,排序形成[0,0,…,0,1,…,1,2,…,2]的形式,在原数列上修改。借鉴Lomuto partition algorithm,维护三个区间[0,i],[i,j],[j,k]为0,1,2的范围,按优先级,若当前数为2或1或0,先将nums[k]=2,k++,若当前数为1或0,则nums[j]=1,j++,若当前数为0,则nums[i]=0,i++,越往后能覆盖前面的,优先级越高。
  • 164:给出一个无序数列,请在O(n)时间复杂度内找到数列有序化后相隔元素差最大值。桶排序,设数列中最大值最小值分别为max,min,易得这个相邻元素差最大值肯定大于(max-min)/(n-1)并设这个值为gap,n是数列长度。将数列的取值区间[min,max]以(max-min)/(n-1)为间隔分成nums个桶,nums是int((max - min) / gap + 1),把数列各个元素分到桶中,每个桶只存对应区间内的最大元素和最小元素,把那么最大间隔肯定在相邻两个桶的边界处(前一个桶的最大值和后一个桶的最小值),因为桶内的最大间隔小于gap。最后遍历一遍桶就可以了。

  • Read full article from Algorithm 题解目录 | Thinkwee's Blog


    Community - Competitive Programming - Competitive Programming Tutorials - Dynamic Programming: From Novice to Advanced



    Community - Competitive Programming - Competitive Programming Tutorials - Dynamic Programming: From Novice to Advanced

    What is a dynamic programming, how can it be described? A DP is an algorithmic technique which is usually based on a recurrent formula and one (or some) starting states. A sub-solution of the problem is constructed from previously found ones. DP solutions have a polynomial complexity which assures a much faster running time than other techniques like backtracking, brute-force etc.

    Now let's see the base of DP with the help of an example:

    Given a list of N coins, their values (V1, V2, … , VN), and the total sum S. Find the minimum number of coins the sum of which is S (we can use as many coins of one type as we want), or report that it's not possible to select coins in such a way that they sum up to S.

    Now let's start constructing a DP solution:

    First of all we need to find a state for which an optimal solution is found and with the help of which we can find the optimal solution for the next state.

    What does a "state" stand for?

    It's a way to describe a situation, a sub-solution for the problem. For example a state would be the solution for sum i, where i≤S. A smaller state than state i would be the solution for any sum j, where j<i. For finding a state i, we need to first find all smaller states j (j<i) . Having found the minimum number of coins which sum up to i, we can easily find the next state – the solution for i+1.


    Read full article from Community - Competitive Programming - Competitive Programming Tutorials - Dynamic Programming: From Novice to Advanced


    [nowcoder]孩子们的游戏(圆圈中最后剩下的数) | Redtongue



    [nowcoder]孩子们的游戏(圆圈中最后剩下的数) | Redtongue

    每年六一儿童节,牛客都会准备一些小礼物去看望孤儿院的小朋友,今年亦是如此。HF作为牛客的资深元老,自然也准备了一些小游戏。其中,有个游戏是这样的:首先,让小朋友们围成一个大圈。然后,他随机指定一个数m,让编号为0的小朋友开始报数。每次喊到m-1的那个小朋友要出列唱首歌,然后可以在礼品箱中任意的挑选礼物,并且不再回到圈中,从他的下一个小朋友开始,继续0…m-1报数….这样下去….直到剩下最后一个小朋友,可以不用表演,并且拿到牛客名贵的"名侦探柯南"典藏版(名额有限哦!!^_^)。请你试着想下,哪个小朋友会得到这份礼品呢?(注:小朋友的编号是从0到n-1)

    题目链接: https://www.nowcoder.com/practice/f78a359491e64a50bce2d89cff857eb6

    分析

    1. 用list存储小朋友的编号;
    2. 模拟报数,每次将list中报数为m的小盆友的编号移出,同时记录当前位置;
    3. 直至剩下最后一个小朋友;
    4. 可能是程序的测试用例很小,最直接的办法竟然没有时间超限,应该有更pythonic的方法。

    Read full article from [nowcoder]孩子们的游戏(圆圈中最后剩下的数) | Redtongue


    502 Bad Gateway on icloud.com : applehelp



    502 Bad Gateway on icloud.com : applehelp

    So, I've never used iCloud.com for anything, but recently I wanted to check it out. It allows me to login, everything looks fine, except: the box where the loading icon is loads to a white page with the '502 Bad Gateway'. I've tried with Chrome and Firefox. My google fu has failed me -- I haven't been able to find anyone else with this issue. I have not been able to test with a different network as I live in an isolated area. Also, it logs me out after a few minutes or whenever I try to manually enter an iCloud address (like typing the URL for Notes). Don't know if the logging out thing is a security feature or part of whatever problem I'm experiencing.


    Read full article from 502 Bad Gateway on icloud.com : applehelp


    The Art of Test Driven Development: Logging JUnit Test Results | Gary Gregory



    The Art of Test Driven Development: Logging JUnit Test Results | Gary Gregory

    In an IDE like Eclipse, you can watch the JUnit view to see tests progress. Wouldn't it be nice to be able to do whatever you want with tests results on the fly?

    What we'll show you here as an alternative is logging your test results while JUnit runs your tests. This gives you all the power of Log4j to direct test results all over the place, from a simple console, to a database, a JMS queue, or any of the long list of appenders Log4j provides. You can provide your own Log4j appender as well for custom processing.


    Read full article from The Art of Test Driven Development: Logging JUnit Test Results | Gary Gregory


    I have an ESPPDD listed on my W2 but also received a 1099 for th... - TurboTax® Support - Get Help Using TurboTax



    I have an ESPPDD listed on my W2 but also received a 1099 for th... - TurboTax® Support - Get Help Using TurboTax

    With a Disqualifying Disposition the compensation income is already reported on your W-2.  Your issue is making sure you use the correct basis reporting the sale so you don't overstate your profit and report that income twice.

    On a Disqualifying Disposition the discount on the day you bought the stock becomes the compensation reported on your W-2, so you want to make sure your add that discount to the basis reported on the 1099-B which is only going to report your "out of pocket" costs.

    The very easiest way to do this is to simply report the sale of the stock on the default spreadsheet-like, "fill in the boxes", TurboTax 1099-B input form.  Enter the 1099-B exactly as it reads.  Tick the box next to "This sale involves an employee stock plan (including ESPP) or an uncommon situation."  Click the blue "Start Now" button that shows up and then click the radio button next to "My 1099-B has info I know isn't right, or it has extra info I need to add."  That will allow you to add the missing amount of basis and TurboTax will show all this correctly on Form 8949.


    Read full article from I have an ESPPDD listed on my W2 but also received a 1099 for th... - TurboTax® Support - Get Help Using TurboTax


    Learn What to Do With RSUs on Form W-2



    Learn What to Do With RSUs on Form W-2

    Basis in restricted stock is the amount paid for the stock plus the amount included as taxable income.

    In the example above, the taxpayer has at least $12,345 of basis in the restricted stock since that is the amount reported on Form W-2. (There may be out-of-pocket cash expenses for the shares also.)

    This basis information will be useful when the shares are sold. At that time, we will calculate the gain or loss on the investment by subtracting the basis from the sales proceeds.


    Read full article from Learn What to Do With RSUs on Form W-2


    赚钱笔记: 入市以来收获的几个教训 装死的事情我很在行,基本是满仓度过2018年的,低点的时候多只股票跌破30%,就这么拿过来了,有一只至今还有20%的亏损... - 雪球



    赚钱笔记: 入市以来收获的几个教训 装死的事情我很在行,基本是满仓度过2018年的,低点的时候多只股票跌破30%,就这么拿过来了,有一只至今还有20%的亏损... - 雪球

    装死的事情我很在行基本是满仓度过2018年的低点的时候多只股票跌破30%就这么拿过来了有一只至今还有20%的亏损为什么拿的住因为连续吃了几次亏有了下面这些教训后买入更谨慎了

    教训1刚入股市的时候自己意淫加戏幻想一些杂毛公司能够腾飞事实证明杂毛就是杂毛变不成金羽毛从此不信杂毛不再幻想

    教训2某大V说杭萧钢构转型卖技术是如何如何牛逼说自己就是学建筑设计的对此有很深认识被忽悠的买入小几万第二天大股东就出减持公告连续两天暴跌我自己挑选的股票都没这么赔过


    Read full article from 赚钱笔记: 入市以来收获的几个教训 装死的事情我很在行,基本是满仓度过2018年的,低点的时候多只股票跌破30%,就这么拿过来了,有一只至今还有20%的亏损... - 雪球


    架构师之路



    架构师之路

    在生产环境把rm -rf 命令替换为mv,再写个定时shell定期清理。

    画外音:模拟了回收站的功能。

     

    二、收拢权限

    帐号权限的分离,线上分配work帐号,只能够删除/home/work/logs/目录,无法删除根目录。

    画外音:大公司一般线上权限管理比较规范,小公司就未必了,搞不好所有的小伙伴都有权限在线上乱搞。


    Read full article from 架构师之路


    Programmer Coach: Coding Interview: The Game Plan



    Programmer Coach: Coding Interview: The Game Plan

    I am doing interviews few times a year, and it's probably not enough[1]. Opportunities aside, I learn a valuable lesson every time.
    Interview pressure uncovers weaknesses. Mine are overcomplication, impatience and panic:
    • I somehow expect the problem to be hard. So, I dismiss valuable cues and intuitions if they look too obvious.
    • If I feel a hunch, I dive in without full understanding. I keep stepping on this rake... and solving a wrong problem!
    • I the problem sounds intimidating, I panic and freeze, not knowing where to start.

    Brute-force

    To compensate for these weaknesses, I now start with a simplest solution that comes to mind. I work on a naïve solution first, clarifying my understanding, and then brainstorm ideas to improve it.
    Structuring your work this way reduces the cognitive load when you start working on an improved solution.
    This is an intuitive and well-recommended technique. However, I feel that candidates are afraid to look inexperienced and skip this step. As an interviewer, you may want to offer your candidate to start easy.

    Read full article from Programmer Coach: Coding Interview: The Game Plan


    经典算法和OJ网站(开发者必备) - 技术人生 - CSDN博客



    经典算法和OJ网站(开发者必备) - 技术人生 - CSDN博客

    Online Judge系统(简称OJ)是一个在线的判题系统。用户可以在线提交程序多种程序(如C、C++、Pascal)源代码,系统对源代码进行编译和执行,并通过预先设计的测试数据来检验程序源代码的正确性。


    一个用户提交的程序在Online Judge系统下执行时将受到比较严格的限制,包括运行时间限制,内存使用限制和安全限制等。用户程序执行的结果将被Online Judge系统捕捉并保存,然后再转交给一个裁判程序。该裁判程序或者比较用户程序的输出数据和标准输出样例的差别,或者检验用户程序的输出数据是否满足一定的逻辑条件。最后系统返回给用户一个状态:通过(Accepted,AC)、答案错误(Wrong Answer,WA)、超时(Time Limit Exceed,TLE)、超过输出限制(Output Limit Exceed,OLE)、超内存(Memory Limit Exceed,MLE)、运行时错误(Runtime Error,RE)、格式错误(Presentation Error,PE)、或是无法编译(Compile Error,CE),并返回程序使用的内存、运行时间等信息。


    目前有不少在线测试平台,这些平台提供了很多很好的编程题,当然著名的acm中会有很多难题,如果你想挑战自己的智力极限,如果你对编程很有兴趣,那么就可以去这些平台注册,然后编程提交,跟其他编程高手一较高下。在线测试平台往往提供多种语言的支持,对于一道题,你可以用自己喜欢的语言来编写,但是要想排名更前,就得考虑语言的效率问题,所以你会发现里面的高手多用c或c++。


    Read full article from 经典算法和OJ网站(开发者必备) - 技术人生 - CSDN博客


    Portable Logger Names with Java 7 Method Handles | JavaWorld



    Portable Logger Names with Java 7 Method Handles | JavaWorld

    The MethodHandes.lookup() method returns an instance of MethodHandles.Lookup, from which the lookupClass() method can be invoked. This latter method's return value can be used directly in naming the Log4j logger or can have that returned Class's getCanonicalName() method return its name as a String for naming the java.util.logging logger.


    Read full article from Portable Logger Names with Java 7 Method Handles | JavaWorld


    Eclipse debugging: truncated String values



    Eclipse debugging: truncated String values

    Being able to inspect variable values during debugging is probably one of the mostly used feature in Eclipse.

    With String variables, the default Eclipse configuration is to truncate big Strings after 10000 characters. This can be a problem with long text documents loaded in a String.


    Read full article from Eclipse debugging: truncated String values


    Labels

    Algorithm (219) Lucene (130) LeetCode (97) Database (36) Data Structure (33) text mining (28) Solr (27) java (27) Mathematical Algorithm (26) Difficult Algorithm (25) Logic Thinking (23) Puzzles (23) Bit Algorithms (22) Math (21) List (20) Dynamic Programming (19) Linux (19) Tree (18) Machine Learning (15) EPI (11) Queue (11) Smart Algorithm (11) Operating System (9) Java Basic (8) Recursive Algorithm (8) Stack (8) Eclipse (7) Scala (7) Tika (7) J2EE (6) Monitoring (6) Trie (6) Concurrency (5) Geometry Algorithm (5) Greedy Algorithm (5) Mahout (5) MySQL (5) xpost (5) C (4) Interview (4) Vi (4) regular expression (4) to-do (4) C++ (3) Chrome (3) Divide and Conquer (3) Graph Algorithm (3) Permutation (3) Powershell (3) Random (3) Segment Tree (3) UIMA (3) Union-Find (3) Video (3) Virtualization (3) Windows (3) XML (3) Advanced Data Structure (2) Android (2) Bash (2) Classic Algorithm (2) Debugging (2) Design Pattern (2) Google (2) Hadoop (2) Java Collections (2) Markov Chains (2) Probabilities (2) Shell (2) Site (2) Web Development (2) Workplace (2) angularjs (2) .Net (1) Amazon Interview (1) Android Studio (1) Array (1) Boilerpipe (1) Book Notes (1) ChromeOS (1) Chromebook (1) Codility (1) Desgin (1) Design (1) Divide and Conqure (1) GAE (1) Google Interview (1) Great Stuff (1) Hash (1) High Tech Companies (1) Improving (1) LifeTips (1) Maven (1) Network (1) Performance (1) Programming (1) Resources (1) Sampling (1) Sed (1) Smart Thinking (1) Sort (1) Spark (1) Stanford NLP (1) System Design (1) Trove (1) VIP (1) tools (1)

    Popular Posts