Say I want to create a new module to provide encryption/decryption for MySQL. In my module, I might simply have something like this:  import mysqlib import cryptolib  class SqlEncryption:      def encrypt(foo):         cryptolib.encrypt(foo)      def decrypt(bar)         cryptolib.decrypt(bar)   but of course I could inherit from the crypto and/or sql libs:  class SqliteEncryption(mysqlib, cryptolib):   of course using super and everything. I usually inherit but this is the first time I've had to wonder if I should inherit from the sql lib, the crypto lib, or both. How should one decide or does it not matter since I'm not actually needing to access anything in those two modules that isn't already exposed in their APIs?
Why prefer composition over inheritance?  What trade-offs are there for each approach?  When should you choose inheritance over composition?
Why isn't an infinite direct product of copies of $\Bbb Z$ a free module?   Actually I was asked to show that it's not projective, but as $\Bbb{Z}$ is a PID, so it suffices to show it's not free.   I am stuck here. I saw some questions in SE, but there is no satisfactory answer at all. I'm working in a C++ unmanaged project.  I need to know how can I take a string like this "some data to encrypt" and get a byte[] array which I'm gonna use as the source for Encrypt.  In C# I do    for (int i = 0; i &lt; text.Length; i++)     buffer[i] = (byte)text[i];   What I need to know is how to do the same but using unmanaged C++.  Thanks! Why are most of the main characters White/English in Game Of Thrones? Okay, I was thinking about the series of Game of Thrones and all the battles and stuff, and I thought why aren't there any characters beside White/English characters that have main/important roles? Can you name any that are alive that are anything else beside White/English?   This is a short list of some of the main characters (all White/English):   Cersei - Queen and important political Lannister. Jaime - Guy who is father to the late king and is King slayer. Tyrion - Short guy in politics who is currently on the run(that's what the wikia told me). Daenerys - Queen who is freeing people and dragon owner.   And the list goes on and on, why aren't there any characters other than Caucasian characters that are in the series?  I've read a lot of articles on the internet about this after Googling around, and none of the articles I read had any scientific evidence or research - it was just conjecture.  So, are there any actors/characters from racially diverse backgrounds? I'm hoping for canon evidence (pictures, links, quotes) from the book and/or TV show. In the case of actors, can you also list their role?    This is not intended as a racist question. I just want to know why, since the story takes place over a large area, there doesn't seem to be any diversity. Better HTTPS support for Stack Exchange sites So it looks like Stack Exchange now supports HTTPS (to some extent). Which is awesome! But there are a few problems, the main one being that some content is delivered over the CDN, which is plain HTTP. This causes browsers to complain about "unsecured content": How do I use filenames that start with a dash "-" as command arguments? This may be a simple question, but how do I use files starting with "-" with command line programs?   For example,  I am trying to use pdfgrep on a file named -2013-01-01.pdf but it complains that there are no options defined for 2, 0, 1, 3 and so on.  Changing the filename to something that does not start with "-" solves it, but this is not an option since the files aren't created by me. I simply want to check for a specific change I know is coming. How do I take great HDR photos of moving objects? By moving objects, I mean cities with cars, ocean with moving water, malls with people moving by.  I tried it on moving people and had noticeable ghosting, using bracketed shots at + and - 2ev.  What's the basic technique on getting sharp looking HDR photos in areas that are moving? I'm assuming it's not bracketed shots but a single shot with exposure editing? Unable to use built in events (Event Reference) Salesforce has functions that do a lot of basic web app functionality for you, called Event Reference. They can be found here   On the editRecord Event Reference, found here   essentaily, I create a   &lt;ui:button label="Edit" press="{!c.editRecord}"/&gt;   on my component, reference the attribute on the page and add the function from the docs in the controller  editRecord : function(component, event, helper) {     var editRecordEvent = $A.get("e.force:editRecord");      console.log("record id is: " + component.get("v.item.Id"));     console.log("editRecordEvent value is: " + editRecordEvent);      editRecordEvent.setParams({         "recordId": component.get("v.item.Id")     });      editRecordEvent.fire(); }   correct?  Here is the odd thing. From the console.logs, I get the record id, but the editRecordEvent returns undefined. What is going on? Is there something I need to reference in my component to use Event Reference? I'm using Maverick with Compiz enabled.  I've searched AskUbuntu and Google. AskUbuntu doesn't have anything on this topic and everything Google turns up is a couple years old.  I'm doing browser tests and my tests are constantly spawning new Firefox windows. The problem is, when the window is spawned it takes focus. This is incredibly annoying as I'm usually in the middle of typing somewhere else. This doesn't only happen with my tests, but is the most common example I run into. Sometimes my IDE decides it wants focus when something special happens (like when something is done compiling) and then later I'll find fragments of IM messages I've typed in my code. This is driving me crazy. I've looked in both Gnome settings and Compiz settings and can't find a way to prevent that from happening.  Does anyone know of a way to prevent an app from stealing focus when it is opened? I'd rather have the taskbar flash at me or something to get my attention. Which resources are available to self-study GAP? Background: This year I'll do another Group Theory course ( Open University M336 ). In the past I have used Mathematica's AbstractAlgebra package but (although visually appealing ) this is no longer sufficient (i.e. listing subgroups of $S_4$ takes ages). So, I want to learn more about GAP. I worked through beginner tutorials that I found via the . Currently, I am not making much progress with GAP. The  does not help me much at this stage.  Question: Which resources are available to self-study GAP? How does one become proficient in GAP? What ( books, tutorials ) should you study? Let $K$ be a field and $f \in K[x]$ a polynomial of degree $n&gt;0$. Assume that $E$ is an extension of $K$ such that $f$ can be expressed as a product of linear factors over $E$:  $$f(x)=\gamma (x-\alpha_1)(x-\alpha_2)\dots(x-\alpha_n).$$  I want to show that $\lvert K(\alpha_1,\dots,\alpha_2) : K \rvert$ is a divisor of $n!$. I also want to show that if $\lvert K(\alpha_1,\dots,\alpha_n): K \geq (n-1)!$ then $f$ is irreducible over $K$ or $f$ already has a root in $K$.  The problem has a hint. It says: "Use induction on $n=\deg f$. If $f=gh$ in $K[x]$ with $\deg g =r$ and $\deg h=n-r$, then $r!(n-r)!$ is a divisor of $n!$.  Any idea for solving this problem would be appreciated. Adding Basemaps from Google or Bing in QGIS ArcGIS Desktop has the option of using basemaps from ArcGIS Online. Does QGIS have any such options? Show that $X^2$ and $X^3$ are irreducible but not prime in $K[X^2,X^3]$.   My reasoning is as follows:  Since the only ways $X^2$ and $X^3$ can be factored in $K[X^2,X^3]$ are $X^2 = X^2 * 1$ and $X^3=X^3*1$ it follows that $X^2$ and $X^3$ are irreducible.  To show that they are not prime in $K[X^2,X^3]$ I argue that $X^2\mid X^3*X^3$ but $X^2\nmid X^3$ and $X^3\mid X^4*X^2$ but $X^3\nmid X^4$ or $X^3\nmid X^2$.  Is that correct? How do you sort du output by size? How do you sort du -sh /dir/* by size? I read one site that said use | sort -n but that's obviously not right. Here's an example that is wrong.  [~]# du -sh /var/* | sort -n 0       /var/mail 1.2M    /var/www 1.8M    /var/tmp 1.9G    /var/named 2.9M    /var/run 4.1G    /var/log 8.0K    /var/account 8.0K    /var/crash 8.0K    /var/cvs 8.0K    /var/games 8.0K    /var/local 8.0K    /var/nis 8.0K    /var/opt 8.0K    /var/preserve 8.0K    /var/racoon 12K     /var/aquota.user 12K     /var/portsentry 16K     /var/ftp 16K     /var/quota.user 20K     /var/yp 24K     /var/db 28K     /var/empty 32K     /var/lock 84K     /var/profiles 224M    /var/netenberg 235M    /var/cpanel 245M    /var/cache 620M    /var/lib 748K    /var/spool How do suggested edits work? When clicking &quot;edit&quot; I see:  Your edit will be placed in a queue until it is peer reviewed. We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.  Like:     Likewise, when I am not logged in, clicking &quot;improve this question&quot; or &quot;improve this answer&quot; shows:  You are not . Your edit will be placed in a queue until it is .  And when I click 'Save', I get:  Thanks for submitting an edit. It is only visible to you until it's been approved by trusted community members  Like:     Who can suggest an edit? Where do suggested edits go? Who can vote on a suggested edit? How do suggested edits get reviewed? Can I earn reputation? What about abuse or bad edits? Sometimes the Community user approves or rejects my edit. Why is that? When can I not suggest an edit? Is there a minimum change requirement for a suggested edit? How do I check my suggested edit history? I disagree with the reasons why my suggested edit was rejected. What can I do? How do I know whether there are edits waiting for review? Someone suggested an edit to my own post, and the reviewers took the wrong action. What can I do? Are tag wikis included in this scheme? What do the &quot;Improve Edit&quot; and &quot;Reject and Edit&quot; buttons do? Why are apparently valid links to rejected edits resulting in 404 errors?   For more information about editing, see &quot;&quot; in the . Simple UV Mesh Unwrapping Scale issue I'm having problems using the UV mapping in blender 2.67. Specifically, I am trying to unwrap a really simple mesh, but the UV map is still giving me a net where some of the boxes are completely out of proportion to the others, which causes the texture to stretch horribly. Here is a picture to illustrate:    The mesh only has those three faces you can see in the picture, and the single seam on the front corner. It's a trivially simple mesh, so I really don't understand why the two side faces are being stretched in the UV map to be the same size as the top face. I've tried clicking the average islands scale button as suggested by some of the answers to other questions but that has no effect. It's frustrating because it seems so simple.  Hopefully someone can show me the presumably simple mistake I am making!  Edit: Just to make this clearer, I have already added a seam as the first answer suggests i do. Hopefully this picture will make that clearer, the yellow arrow is pointing to the edge i seamed. The mesh is only three faces so should only need this single seam. The image shows the mesh from infront and behind/underneath so it should make more sense.    Double Edit: One more picture for clarity on the seam issue. The mesh is unfolding correctly, it is just the scale of the unfolded map that is incorrect (in relation to one another) Cannot change backlight brightness Ubuntu 14.04 Would Gravitational Time Dilation still apply between two gravitational sources? As explained on , when an object is experiencing strong gravitational forces, time passes slower for it. If, in theory, you had two objects exerting the same amount of gravitational pressure on an object in opposite directions, effectively cancelling each other out, would they cancel out the time dilation, or would they compound, making the time dilation more prevalant? What causes yogurt in sauces to split? How to prevent it? A lot of my favorite curry recipes have a yogurt based sauce in them, but on a pretty regular basis when I make them, the yogurt ends up splitting into basically curds and whey. What causes that, and how can I prevent it?  As an illustrative example, last night I made a simple tofu curry as follows:   warm evoo in a pan add chopped onion, saute briefly add curry seasonings, allow to warm/season the oil add cubed tofu, toss to coat cook for a while, tossing periodically to lightly brown the cubes turn heat off add plain greek yogurt stir to combine   In the few minutes it took to finish the rest of the meal and start plating, the yogurt had separated so I had a clumpy, lumpy, yogurt soup instead of a smooth creamy sauce. How do you deserialize json properties that are reserved words in apex? Is there any way to deserialize JSON into an object using JSON.deserialize if some of the property names in the JSON are reserved words in apex? I want to do something like this:  string jsonString = '{"currency" : "ABC"}'; public class JSONResult {     public string currency; } JSONResult res = (JSONResult) JSON.deserialize(jsonString, JSONResult.class); system.debug(res);   but of course I get an error that the identifier name is reserved. Image in a cell with a hyperlink