How to return part of the string in c#?
What method in the String class returns only the first N characters?
I'm new to Linux and am trying to set up Python / Django on my machine!  I installed Python 3.3 from the source file and it was compiled into /usr/local/bin. Then I created a symbolic link between /usr/bin/python and /usr/local/bin/python3, so that whenever I invoke python from the command line it uses the latest version.  Now I am trying to install MySQL Python and I got the following output:  apt-get install python-mysqldb  Reading package lists... Done Building dependency tree Reading state information... Done python-mysqldb is already the newest version. The following extra packages will be installed:   apt-listchanges python-apt Suggested packages:   python-glade2 python-gtk2 python-apt-dbg python-vte python-apt-doc The following packages will be upgraded:   apt-listchanges python-apt 2 upgraded, 0 newly installed, 0 to remove and 142 not upgraded. 3 not fully installed or removed. Need to get 0 B/394 kB of archives. After this operation, 250 kB of additional disk space will be used. Do you want to continue [Y/n]? Y Traceback (most recent call last):   File "/usr/bin/apt-listchanges", line 28, in &lt;module&gt;     import apt_pkg ImportError: No module named 'apt_pkg'   Any ideas on how to fix this?  Or any tips on how to clean up this install (if this one is too broken)? Replace and Association How much time until an unused hard drive loses its data? Do you guys know how much time needs to pass until the data stored on a hard drive starts to degrade?   To keep the data intact for long periods of time, I heard you need to periodically rewrite it on the hard drive, like every 5 years or so. Is it true? How to upgrade only core with drush? Is “ ’s ” ever correct for pluralization? How can I prevent someone from resetting my password with a Live CD? Recently one of my friends came over to my place, within 15 minutes he hacked my account using a Live CD and reset the password in front of me. I was baffled to see such a thing. Please guide me to prevent such a future attempt using a Live CD. Bash history search, partial + up-arrow I have searched, but not found anything on this. I am looking for a functionality in bash, using a terminal.  Way back when, I had a user on a debian system, and a friend set me up with a convenient history search feature (I believe I used tcsh then), where I would type the beginning of a previous command, hit up-arrow, and it would do a search, based on the partial string.  E.g. if my history is:  ./script.pl ./script.pl arg1 cat output cat output | grep yada   And I type ., and press up-arrow, it would show me: ./script.pl arg1. Press it again and it would show ./script.pl, etc.  Very much like it would perform a grep on .bash_history. Is there a way to get this functionality? Does the new guidance on duplicate questions suggest closing a question as duplicate, if the original answers the OP's question? In other words, should we now look at the content of the answers when we are evaluating questions for possible duplication?  Is it sufficient to say "Your answer can be found in this question over here, therefore your question is a duplicate?"  The new guidance is here:    Among other things, it describes the new close banner:     This question already has an answer here:   Link to the Duplicate Question   ... which seems to suggest that, if some other question in the system answers the OP's question, then the OP's question can be closed as a duplicate on that basis (even if the question itself is not necessarily duplicated).  Example Here:    Note the comments below the question, where I dispute the assertion made there that it is a duplicate question.  The original question doesn't mention unit testing. Error: 'else' without 'if' How to install Hp laser jet 1020 plus printer? As a(n) noun vs as only Add Point to Plot3D Removing non numeric characters from a string SPSite and SPWeb object dispose inside foreach loop I just wrote an answer to , which was trying to find numeric strings with or without commas (e.g. 1,234,567.89). I wanted to be thorough because I've seen this problem a lot, both on SO and in real-world code.   When I finished, I found 7 other new answers waiting for me, mostly variations on each other. Which would be fine, except for one thing: They're garbage answers. Unless I'm severely mistaken, every answer but mine (so far) is deeply flawed, and I want to downvote all of them. Yeah, I'm a stickler on regex, but IMHO if your pattern lets stuff like  ...,.,,.,,..9 or even ... pass as "numeric input," then you've failed to meet even the bare minimum requirements.  Enough venting. The reason I'm whining to Meta about this is that I'm about to do something that'll REALLY look like tactical downvoting, and I'm mildly concerned about the consequences. If I answer a question and then rain downvotes on every competing answer, will I get flagged for abuse? That would certainly seem like suspicious behavior to me.  More of an opinion question: At what point does a semi-correct answer deserve a downvote? Obviously, if it were just a typo, I'd edit it myself. Where's the line between "close enough" and "this answer sucks?"  Basically, is it just me? You've seen the question; am I right that these answers deserve downvotes? Seven people thought that [0-9,.]+ was good enough to declare something a number, so why am I the only one who doesn't?    Note: I found some related questions, but nothing that seemed like a duplicate:    - More of an etiquette question, plus the voter hadn't posted his own answer.  - I guess this pretty much covers my second question.   Also, as some have noted, my answer ended up pretty long and thorough. I put in a lot of effort because, with all this talk about how the other answers sucked, I wanted to be extra sure mine didn't. I don't expect pages of detail in a normal SO answer. GIS Point or discrete longitude and latitude columns? Recently a few friends and I came up with an idea for an app. To facilitate the creation of it, we set up LAMP on an Ubuntu Server 12.04. This box is running from my home. We've set up 3 user accounts. I'm still pretty new to Linux, but I have a bit of experience from using Ubuntu on my own box.  Today I was playing around with SSH and looking at the logs (I need to learn how to read that information to know how the server is performing, right?) and I saw the strangest thing.  In /var/log/auth.log and /var/log/auth.log.1 I saw a bunch of failed login attempts for 'root' and a few usernames I'm not familiar with. I looked over them and for as far as I can see no user has been authenticated except for the actual users on the system. A lot of the IP-addresses listed seem to be from Russia.  As of now this server contains nothing but a vanilla Ubuntu Server with LAMP, but even so, with the following command:  sudo grep -i fail /var/log/auth.log | wc -l   I get 3412 as a result. This seems very excessive for a server that has been up since April 8th. It gets worse, because running the above command on auth.log.1 returns 23075 (!!!!) results.  It seems obvious that people are trying to break into the server. Not that it contains anything of value, but once we start making progress on the app we wouldn't want our intellectual property stolen.  Should I be worried? And what can I do about it?  EDIT:  I found some very useful information  and this allowed me to run a script that splits and sorts all the invalid passwords and invalid users that tried to log in. May come in handy to someone who ended up here through Google! Show that  $$t(n) = 1 + \sum_{ j=0}^{n-1} t(j)$$  is the same as  $$t(n) = 2^n$$  Initial condition $t(0) = 1$ I’m a big fan of ampersands (possibly too much …) and I’d like to replace all mentions of “et al.” (included in citations) by \&amp; al. – both in the main text (I use natbib citations of the form [Author1 et al., 1999]), and in the actual bibliography?  How can I do that, considering that BibTeX is inserting the words for me, and I have no control over the text? Preferably, I’d like to do this without creating my own bibliography style sheet (since I want to make this work regardless of the actual BibTeX style that is used), but if anyone can tell me how I need to edit the style sheet file, that would be fine as well (makebst doesn’t seem to offer an option for this …). How does one prove that if $n \mid (a^{n}-b^{n}) \ \Longrightarrow$ $ \displaystyle n \mid \frac{a^{n}-b^{n}}{a-b}$ where $a,b, n \in \mathbb{N}$.  What i thought of is to consider $$(a-b)^{n} \equiv a^{n} + (-1)^{n}b^{n} \ (\text{mod} \ n)$$ and if we suppose that $n$ is odd then we have, $$(a-b)^{n} \equiv a^{n} -b^{n} \ (\text{mod} \ n)$$ and since $n \mid (a^{n} - b^{n})$ we have $$(a-b)^{n} \equiv 0 \ (\text{mod} \ n) $$  I think i am far away from the conclusion of the problem, but this is what i could work on regarding the problem.