There are claims that OOP design patterns are irrelevant in functional languages. Are there code demos how each pattern can be implemented in Haskell? In particular, complete demo would also have to show how to represent objects, OO polymorphism etc.
Since I started learning  and  last year, I've read a huge number of articles which insist that design patterns (especially in Java) are workarounds for the missing features in imperative languages. One article I found :     Most people I've met have read     by the Gang of   Four (GoF). Any self respecting programmer   will tell you that the book is   language agnostic and the patterns   apply to software engineering in   general, regardless of which language   you use. This is a noble claim.   Unfortunately it is far removed from   the truth.      Functional languages are extremely   expressive. In a functional language   one does not need design patterns   because the language is likely so high   level, you end up programming in   concepts that eliminate design   patterns all together.   The main features of functional programming (FP) include functions as first-class values, currying, immutable values, etc. It doesn't seem obvious to me that OO design patterns are approximating any of those features.  Additionally, in functional languages which support OOP (such as F# and OCaml), it seems obvious to me that programmers using these languages would use the same design patterns found available to every other OOP language. In fact, right now I use F# and OCaml every day, and there are no striking differences between the patterns I use in these languages vs. the patterns I use when I write in Java.  Is there any truth to the claim that functional programming eliminates the need for OOP design patterns? If so, could you post or link to an example of a typical OOP design pattern and its functional equivalent?
Very strange error suddenly appeared running Biber Change default CSS of Google Chrome I would like to be able to change the default CSS used by chrome, such as removing the underlines for links, etc. However, I cannot find the default CSS file used by Chrome. Does anyone know where it is? xml serializing of saved game data LaTeXiT is cropping the pdf I am using LaTeXiT (pierre chachatelier, www.chachatelier.fr) - latex equation editor for Powerpoint for mac.  It's producing pdf that appear to be "cropped" on top (see attached) - I've tried already with changing the "margins" option (Preferences>General) but unsuccessfully - don't think that's the problem.   Any hint?   Thanks We were asked to prove the following:  Let $ A $ be an $n \times n$ matrix with $n$ distinct real eigenvalues. If $AB=BA$, show that $B$ is diagonalizable.   It was suggested I show that an eigenvector of $A$ is also an eigenvector of $B$. I am both having trouble doing this and failing to see how I would complete the proof after. Any help would be appreciated.  Thanks What is the 'molecular' origin of the viscosity? The molecular origin of elasticity is almost clear for me: at the very bottom the 'elasticity' comes from the attraction and repulsion between atoms when they are reasonably far from each other or very close (like Lennard-Jones potential). Is there a similar description for the viscosity as well? Where does it come from? Can you trade Pokemon from 7th gen (Sun/Moon) to 6th gen (XY, ORAS) and back? Title says it all, I don't see confirmation in  and a cursory google search seemed to say assume no and speculate about the pokemon bank. openSuse, new user cannot login I am using openSuse 12.3.  I have created a new user using:  linux-amvn:~ # useradd -m -G users,dev -s /bin/bash -p pass123 harbir-PC   The user harbir-PC is not able to login, when I try to log using ssh. I went ahead and looked into the /etc/passwd file and I see the following:  harbir:x:1000:100:harbir:/home/harbir:/bin/bash kdm:x:489:487:KDM Display Manager daemon:/var/lib/kdm:/bin/false harbir-PC:x:1001:100::/home/harbir-PC:/bin/bash   There is a difference between the user harbir and harbir-PC.  I have no problem with the user harbir (who I have created during installation), but I need to login using the user harbir-PC.  I also checked the /etc/shadow, and passwords are encrypted. Can I create a TIN from contours lines (shp) in QGIS? I need to do a slope analysis, and would like to make a TIN from 2m contours lines.  Or do a slope analysis directly from contours? The only DEM available is not precise enough.  I do not have any elevation raster files.  And how do I then make slope classes?  The TIN properties does not seem to be able to classify anything other than elevation. CASE WHEN with GROUP BY I have a table that looks like this (oversimplified case of the actual case to make my point)  CREATE TABLE sales (    id int,    currency VARCHAR(5),    price int    shop_id int );   Now I need to make a query that will give me something like this table, grouping by shops yet giving sum of sales per currency My problem is when I make currency column non aggregate it fails because my query becomes non standard. When I add currency to group by then each currency creates new row, something I don't want. I have run out of option and would appreciate any help or pointer to the right direction.  I use MySQL but would appreciate if I would get the solution that works with more databases (PostGreSQL being at the top of the list after MySQL)  Query that works with undesired results  SELECT   shop_id,           (CASE WHEN currency= "GBP" THEN SUM(price) ELSE 0 END) AS POUND,           (CASE WHEN currency= "USD" THEN SUM(price) ELSE 0 END) AS USDOLLAR GROUP BY shop_id, currency   The data that should be produced by the query  shop_id     |   POUND   |   USDOLLAR     -----------------------------------------     1       |   400     |   300 -----------------------------------------     2       |   250     |   100 -----------------------------------------     3       |   400     |   100 ----------------------------------------- How to edit / how to format box overlapping with footer when scrolling down I just edited an answer on Unix&amp;Linux and when scrolling down, the semi-transparent right sidebar boxes "How to edit" and "How to format" kept their fixed positioning and overlapped with the page footer.     While posting this, I have seen several (not) duplicate questions about this issue, and although from my personal taste, I would prefer the boxes to stop scrolling before the footer is reached, I can accept the development teams decision to let it overlap.   However, on all those other posts, the boxes had an opaque background, so that the footer was hidden and the box content was readable. Here the boxes are transparent though, so the texts get mixed and are no longer well readable. Evolution of the Redundancy of the Genetic Code I am using the following code to play a sound file using the java sound API.      Clip clip = AudioSystem.getClip();     AudioInputStream inputStream = AudioSystem.getAudioInputStream(stream);     clip.open(inputStream);     clip.start();   The method call to the Clip.start() method returns immediately, and the system playbacks the sound file in a background thread. I want my method to pause until the playback has completed.  Is there any nice way to do it?  EDIT: For everyone interested in my final solution, based on the answer from Uri, I used the code below:  private final BlockingQueue&lt;URL&gt; queue = new ArrayBlockingQueue&lt;URL&gt;(1);  public void playSoundStream(InputStream stream) {     Clip clip = AudioSystem.getClip();     AudioInputStream inputStream = AudioSystem.getAudioInputStream(stream);     clip.open(inputStream);     clip.start();     LineListener listener = new LineListener() {         public void update(LineEvent event) {                 if (event.getType() != Type.STOP) {                     return;                 }                  try {                     queue.take();                 } catch (InterruptedException e) {                     //ignore this                 }         }     }; clip.addLineListener(listener ); } Getting incorrect slope values from an ASTER DEM in QGIS? NEWID() In Joined Virtual Table Causes Unintended Cross Apply Behavior My actual work query was an inner join, but this simple example with cross join seems to nearly always reproduce the problem.  SELECT * FROM (     SELECT 1 UNION ALL     SELECT 2 ) AA ( A ) CROSS JOIN (     SELECT NEWID() TEST_ID ) BB ( B )   With my inner join I had many rows for which I added to each a GUID using the NEWID() function, and for about 9 out of 10 such rows the multiplication with the 2-row virtual table produced the expected results, just 2 copies of the same GUID, while 1 out of 10 would produce different results. This was unexpected to say the least and gave me a really hard time trying to find this bug in my test data generation script.  If you take a look at the following queries using as well non-deterministic getdate and sysdatetime functions, you won't see this, I don't anyway-I always see the same datetime value in both final result rows.  SELECT * FROM (     SELECT 1 UNION ALL     SELECT 2 ) AA ( A ) CROSS JOIN (     SELECT GETDATE() TEST_ID ) BB ( B )  SELECT * FROM (     SELECT 1 UNION ALL     SELECT 2 ) AA ( A ) CROSS JOIN (     SELECT SYSDATETIME() TEST_ID ) BB ( B )   I'm currently using SQL Server 2008 and my work around for now is to load my rows with GUIDs into a table variable before finishing out my random data generation script. Once I have them as values in a table as opposed to virtual table, the problem goes away.  I have a workaround, but I'm looking for the ways to workaround without actual tables or table variables.  While writing this I tried without success these possibilities: 1) placing the newid() into a nested virtual table:  SELECT * FROM (     SELECT 1 UNION ALL     SELECT 2 ) AA ( A ) CROSS JOIN (     SELECT TEST_ID     FROM (         SELECT NEWID() TEST_ID     ) TT ) BB ( B )   2) wrapping the newid() within a cast expression such as:  SELECT CAST(NEWID() AS VARCHAR(100)) TEST_ID   3) reversing the order of appearance of the virtual tables within the join expression  SELECT * FROM (     SELECT NEWID() TEST_ID ) BB ( B ) CROSS JOIN (     SELECT 1 UNION ALL     SELECT 2 ) AA ( A )   4) using uncorrelated cross apply  SELECT * FROM (     SELECT NEWID() TEST_ID ) BB ( B ) CROSS APPLY (     SELECT 1 UNION ALL     SELECT 2 ) AA ( A )   Just before finally posting this question, now I tried this with success it seems, a correlated cross apply:  SELECT * FROM (     SELECT NEWID() TEST_ID ) BB ( B ) CROSS APPLY (     SELECT A     FROM (         SELECT 1 UNION ALL         SELECT 2     ) TT ( A )     WHERE BB.B IS NOT NULL ) AA ( A )   Anyone have any other more elegant, simpler workaround? I really don't want to use cross apply or correlation for a simple row multiplication if I don't have to. Images for Area51 proposal community promotion on imgur.com? For each proposal on Area51, a promotional image is automatically generated and it shows the current state, e.g. number of followers/supporters or comitted. Example:    They’re obviously useful for  on existing sites. Alas, the current requirements for those say that the image needs to be hosted on imgur.com. I can easily provide the URL https://area51.stackexchange.com/ads/proposal/{proposal-number}.png in the image upload dialog, to get a cryptic imgur address back, but I’m afraid that it won’t update dynamically.  Please note that I was able to use the area51 URL on some sites until right now, when the poster generator seems to be broken or off-line, but on other sites the software stopped me from posting any image not hosted on imgur. Can we please have the dynamic posters working everywhere (and in “HiDPI”) or be assured that the external service will update them regularly? Why doesn't this C++0x code call the move constructor? How widespread is the practice of delegating LoR writing to the applicant? At least two questions (, ) on this site indicate that in more than a few isolated cases at least, letters of recommendation are in fact written by the applicant and only signed off (or perhaps rephrased somewhat) by the recommender, who would actually be responsible for writing the letter.  Is there any evidence about the prevalence of this practice that goes beyond anecdotes? I realize that cross-country (cultural) difference may play a role. What is the best way to iterate over a dictionary? How to invoke a system call via syscall or sysenter in inline assembly?