Why is Finn's designation FN-xxxx?
Does "FN" stand for or mean anything?
Java ReentrantReadWriteLocks - how to safely acquire write lock? I am using in my code at the moment a  to synchronize access over a tree-like structure.  This structure is large, and read by many threads at once with occasional modifications to small parts of it - so it seems to fit the read-write idiom well.  I understand that with this particular class, one cannot elevate a read lock to a write lock, so as per the Javadocs one must release the read lock before obtaining the write lock.  I've used this pattern successfully in non-reentrant contexts before.  What I'm finding however is that I cannot reliably acquire the write lock without blocking forever.  Since the read lock is reentrant and I am actually using it as such, the simple code  lock.getReadLock().unlock(); lock.getWriteLock().lock()  can block if I have acquired the readlock reentrantly.  Each call to unlock just reduces the hold count, and the lock is only actually released when the hold count hits zero.    EDIT to clarify this, as I don't think I explained it too well initially - I am aware that there is no built-in lock escalation in this class, and that I have to simply release the read lock and obtain the write lock.  My problem is/was that regardless of what other threads are doing, calling getReadLock().unlock() may not actually release this thread's hold on the lock if it acquired it reentrantly, in which case the call to getWriteLock().lock() will block forever as this thread still has a hold on the read lock and thus blocks itself.  For example, this code snippet will never reach the println statement, even when run singlethreaded with no other threads accessing the lock:  final ReadWriteLock lock = new ReentrantReadWriteLock(); lock.getReadLock().lock();  // In real code we would go call other methods that end up calling back and // thus locking again lock.getReadLock().lock();  // Now we do some stuff and realise we need to write so try to escalate the // lock as per the Javadocs and the above description lock.getReadLock().unlock(); // Does not actually release the lock lock.getWriteLock().lock();  // Blocks as some thread (this one!) holds read lock  System.out.println("Will never get here");   So I ask, is there a nice idiom to handle this situation?  Specifically, when a thread that holds a read lock (possibly reentrantly) discovers that it needs to do some writing, and thus wants to "suspend" its own read lock in order to pick up the write lock (blocking as required on other threads to release their holds on the read lock), and then "pick up" its hold on the read lock in the same state afterwards?  Since this ReadWriteLock implementation was specifically designed to be reentrant, surely there is some sensible way to elevate a read lock to a write lock when the locks may be acquired reentrantly?  This is the critical part that means the naive approach does not work. Get OS-level system information I'm currently building a Java app that could end up being run on many different platforms, but primarily variants of Solaris, Linux and Windows.  Has anyone been able to successfully extract information such as the current disk space used, CPU utilisation and memory used in the underlying OS? What about just what the Java app itself is consuming?  Preferrably I'd like to get this information without using JNI. How to set the monitor to its native resolution which is not listed in the resolutions list? After installing Ubuntu 10.04 with my Samsung SyncMaster B2030, native resolution (1600X900) is not found in the list of resolutions. How can we get rid of misspelled and unused (or "zombie") tags? During the re-tagging of questions, tags sometimes become orphaned from existing questions.  Are these zombie tags ever removed from the ?  What if a tag is misspelled and needs to be removed? How do we get rid of it? How can I recover my account? I tried to log into Minecraft today to find that my password isn't working. I tried to change it, but I can't login to my email because I forgot the answer to my security question. I tried changing the email to a different one, but that didn't work for some reason (it kept saying "invalid email"). I don't have my transation ID because I forgot which credit card I used.  Does this mean that I have to buy a new Minecraft account? Prove that subsequence converges to limsup Given a sequence of real numbers, $\{ x_n \}_{n=1}^{\infty}$, let $\alpha =$ limsup$x_n$ and $\beta = $ liminf$x_n$.   Prove that there exists a subsequence $\{ x_{n_k}\}$ that converges to $\alpha$ as $k \rightarrow \infty$.   Not sure how to start this without since I'm not given that the subsequence is bounded.. Travelling from India to canada via Dubai and London. Do I need a transit visa I am travelling to Calgary from Delhi. I have an Air India flight from Delhi to Dubai then British Airways flight from Dubai to London and Air Canada flight from London to Calgary. My query is "Do I require a transit visa." Plz help as I am travelling in four days What are underfull hboxes and vboxes and how can I get rid of them? Often, TeX outputs underfull hbox and vbox warnings when running and in the generated log file. What are these and how can I get rid of them? Where and why do I have to put the "template" and "typename" keywords? If I have multiple objects selected can I use scaling to make the objects closer together (without rescaling the objects)? How to calculate the summation $(\sum_{p = k}^{n} \binom{n}{p}) / 2^n$ quickly? I was solving a question which technically reduces to the following     Given $N$ items, it is equiprobable for each item to be good or bad, what is the probability that number of good items in the set are greater than or equal to $K$.   This can be reduced to $\dfrac{x}{2^n}$ where $\displaystyle x = \sum_{p = k}^{n} \binom{n}{p}$. Is there a more simplified form which is easier to calculate for large values of $N, K$?  Note: It may be safe to assume that we do not require extremely high precision while calculating(first 5-10 digits only).  Thanks! Denote by $M_{n \times n}(k)$ the ring of $n$ by $n$ matrices with coefficients in the field $k$.  Then why does this ring not contain any two-sided ideal?    Thanks for any clarification, and this is an exercise from the notes of Commutative Algebra by Pete L Clark, of which I thought as simple but I cannot figure it out now. How to find web hosting that meets my requirements? This is a "catch-all" question designed to serve as an answer for all questions about choosing web hosting.  Pro Webmasters no longer accepts new questions about how to choose hosting.  All future questions pertaining to finding web hosting should be closed as a duplicate of this question. For more information about this policy please see .    How to find web hosting that meets my requirements?  What we're looking for in answers to this question are the basics about web hosting:   What is web hosting? What is the difference between shared, VPS, and dedicated hosting? How does a content delivery network relate to web hosting? Anything else you feel is helpful in finding a web host.   What we do not want is:   Endorsements or recommendations for specific web hosts We do not want your experience or other subjective information (just the facts please) USB flash drive not working or is appearing as an empty disk drive, Disk Management reports "No Media" with 0 bytes size I have a USB flash drive which is no longer recognized by my computer. Windows Disk Management and DiskPart report No Media with no storage space (0 bytes) on the drive and I cannot partition or format the drive:     If the drive appears in Windows Explorer, trying to access it returns an error message indicating that there is no disk inserted, such as the following:     Please insert a disk into drive X:.   Various disk partitioning and data recovery utilities don't recognize the drive or only give a generic name for the drive and cannot access the contents of the drive.  What can I do? How do I recover data from the drive?     This question comes up often and the answers are usually the same. This post is meant to provide a definitive, canonical answer for this problem. Feel free to edit the answer to add additional details. I was just wondering whether the following statement is correct.  Let R be a ring and M a noetherian R module. Then M is finitely generated. Norman Window Optimization How to load JAR files dynamically at Runtime? Why is it so hard to do this in Java? If you want to have any kind of module system you need to be able to load JAR files dynamically. I'm told there's a way of doing it by writing your own ClassLoader, but that's a lot of work for something that should (in my mind at least) be as easy as calling a method with a JAR file as its argument.  Any suggestions for simple code that does this? Left-pad printf with spaces How can I pad a string with spaces on the left when using printf?  For example, I want to print "Hello" with 40 spaces preceding it.  Also, the string I want to print consists of multiple lines.  Do I need to print each line separately?  EDIT: Just to be clear, I want exactly 40 spaces printed before every line. How can I prevent system clipboard image data being pasted into a WPF RichTextBox Is it OK to ask on SO for help in explaining someone else's working piece of code, from Open Source projects or library examples etc.? Or does this belong somewhere else?