I want to remove duplicate domains in a large list of URLs in c#, For example if the list was: https://example.com/example.php/login/ https://2example2.com/example/ https://example.com/register.php/ https://example.com/info/ https://example.com/example.php/login/ https://2example2.com/register/  I need to remove all of the duplicate domains except the first one so this would be the end result: https://example.com/example.php/login/ https://2example2.com/example/  Can anyone help me? I know how to separate the domain from the rest of the URL but I'm not sure how to keep the first one.
I am playing with LINQ to learn about it, but I can't figure out how to use Distinct when I do not have a simple list (a simple list of integers is pretty easy to do, this is not the question). What I if want to use  on a list of an Object on one or more properties of the object?  Example: If an object is Person, with Property Id. How can I get all Person and use Distinct on them with the property Id of the object?  Person1: Id=1, Name="Test1" Person2: Id=1, Name="Test1" Person3: Id=2, Name="Test2"   How can I get just Person1 and Person3? Is that possible?  If it's not possible with LINQ, what would be the best way to have a list of Person depending on some of its properties in .NET 3.5?
How do I get my PCs to not be a bunch of murderous cretins? Most RPGs teach you that casual violence is the best solution to all your in-game problems. This is so well established a part of the vast majority of RPGs that there are entire satire RPGs like Greg Costikyan's  and John Tynes'  dedicated to showcasing the issue. Even now that the '80's anti-RPG hysteria is past, you see more sober critiques of endemic violence in RPGs in places like . In most RPGs, PCs become inured to murder and other antisocial activities very quickly, and enter the depths of depravity that wouldn't be appropriate in the worst parts of the world. Armed robbery, mass murder, and genocide become routine parts of an adventurer's day, something only stick-in-the-mud characters with the most extremely stated ethics object to. , even though it is not properly applied to just any conflict, is a PC's friend and they generally escalate any conflict in that direction. The sophistication of the gamer mindset towards introspection on this issue can be demonstrated in that the most meaningful question usually debated about in-game violence is some variant on &quot;but should we kill the noncombatant children&quot; or &quot;can we just murder people out of hand as long as they're from a typically evil race?&quot; In the real world, we generally a priori regard anyone having to have this discussion as a monster already. (P.S. The &quot;wipe out a given evil race&quot; thing isn't the point of this question; it is only mentioned to indicate that it's only &quot;that far&quot; that usually causes ethical handwringing from players, when that is a really quite extreme case and we should be uncomfortable with casual violence a lot sooner. ) What I'd like to have is a more realistic in-game treatment of conflict.  People getting wounded and giving up, taking and ransoming of prisoners, not always escalating a fistfight to weapons, not always escalating weapon combat to killing, etc.  Heck, as I write this, I'm watching an episode of Adventure Time with my daughter and the protagonists snuck in and rescued a princess kidnapped by the Ice King and then exit right next to his sleeping form. I thought, &quot;If this were D&amp;D they'd all be carefully coordinating a coup de grace to kill him in his sleep on the grounds that he inconvenienced them.&quot;  The problem isn't limited to D&amp;D of course, sci-fi PCs are happy to neutron bomb planets for convenience too, for example. I'm not part of the &quot;D&amp;D is Satanic&quot; crowd obviously, but I frankly do have compunctions about continually playing in games where the taught behavior is uncomfortably equivalent to the worst examples of human behavior we see on the nightly news. How can I give my PCs a newfound respect for human life? Proof that all abelian simple groups are cyclic groups of prime order How do I get the form id of my form? I've just begun to make my modules and I'm at a standstill. I got this code from someone else and am trying to customize it:  function hook_form_alter(&amp;$form, &amp;$form_state, $form_id) {   if ($form_id == 'the form id for the node form') {     $form['#submit'][] = 'my_custom_submit_handler';   } } Firstly my main goal is to try and get FTP files recursively in Centos.  However the actual FTP login contains an @ which ruins the syntax.  Is there some way to place the username in "double quotes" or some such equivalent such that I can use @in the username? What are the differences between Factor Analysis and Principal Component Analysis? It seems that a number of the statistical packages that I use wrap these two concepts together. However, I'm wondering if there are different assumptions or data 'formalities' that must be true to use one over the other. A real example would be incredibly useful. I'd like to use JavaScript to calculate the width of a string. Is this possible without having to use a monospace typeface?  If it's not built-in, my only idea is to create a table of widths for each character, but this is pretty unreasonable especially supporting  and different type sizes (and all browsers for that matter). I'm learning C#, so I made a little C# program that says Hello, World!, then compiled it with mono-csc and ran it with mono:  $ mono-csc Hello.cs $ mono Hello.exe Hello, World!   I noticed that when I hit TAB in bash, Hello.exe was marked executable. Indeed, it runs by just a shell loading the filename!   Hello.exe is not an ELF file with a funny file extension:  $ readelf -a Hello.exe readelf: Error: Not an ELF file - it has the wrong magic bytes at the start $ xxd Hello.exe | head -n1 00000000: 4d5a 9000 0300 0000 0400 0000 ffff 0000  MZ..............   MZ means it's a Microsoft Windows statically linked executable. Drop it onto a Windows box, and it will (should) run.  I have wine installed, but wine, being a compatibility layer for Windows apps, takes about 5x as long to run Hello.exe as mono and executing it directly do, so it's not wine that runs it.  I'm assuming there's some mono kernel module installed with mono that intercepts the exec syscall/s, or catches binaries that begin with 4D 5A, but lsmod | grep mono and friends return an error.   What's going on here, and how does the kernel know that this executable is special?    Just for proof it's not my shell working magic, I used  (aka sh) to run it and it still runs natively.    Here's the program in full, since a commenter was curious:  using System;  class Hello {   /// &lt;summary&gt;   ///   The main entry point for the application   /// &lt;/summary&gt;   [STAThread]   public static void Main(string[] args) {     System.Console.Write("Hello, World!\n");   } } Proof: $\cos^p (\theta) \le \cos(p\theta)$ I came across this problem when I was at a book store inside of a book made to prepare Berkeley graduates to pass a mandatory exam. I wanted to buy the book, but, alas, I didn't have the money (forty bucks is a lot of money when you don't have a job). So I took my phone out and started taking as many pictures as I could. Unfortunately, I didn't take any pictures of the solutions!  Enough backstory. Time for math. The problem is as follows:  Prove that $\cos^p( \theta) \le \cos(p \theta)$ if $0\le\theta\le\frac\pi2$ and $0\le p\le 1$.  I tried using the series expansion for cosine, but that seemed to be a dead end. Then I tried using Euler's theorem, but I got stuck. Then I got distracted and started to think about other cosine identities. For example, $$\cos\left(\frac\theta2\right)=\pm\sqrt{\frac{1+\cos(\theta)}{2}}.$$ Then what is $\cos(\frac\theta3)$ equal to? I tried to figure it out then I realized that I needed to find the root of a cubic polynomial. Then I realized that I'm better at staying focused than finding the roots of cubic polynomials.  Anyways, a proof would be nice here. I really appreciate any hints or answers. I apologize for my digressions! Can I charge a computer through its USB port? Is any quotient of a Euclidean domain by a prime ideal a Euclidean domain? Let $R$ be a Euclidean domain, i.e., a ring with a norm $N : R \rightarrow \mathbb N$ such that for any $a,b\in R$ with $b\not=0$, we may write $a = qb + r$ for some $q,r \in R$ with $N(r) &lt; N(b)$. Let $I$ be a prime ideal of $R$, so $R/I$ is a domain. Must $R/I$ in fact be a Euclidean domain?   I know that this is true if we replace "Euclidean domain" with "PID", and false if we replace it with "UFD", so there is no clear intuition to be gained from similar concepts. My first attempts at a proof was to borrow a construction from analysis and define a norm on $R/I$ by  $N(a + I) = \inf\{N(a+i) : i\in I\}$  but this didn't really get me anywhere.   So, this fact true? If so, how can I prove it? If not, whats a counterexample? Inequality similar to the Schwarz-Pick theorem Creating Inky-looking characters in Blender UNetbootin is stuck in an "Automatic boot in 10 seconds" countdown loop I made a bootable Windows 7 USB using UNetbootin, and when I try to boot from the bootable USB and select the Default boot menu entry, it gets stuck at the UNetbootin boot menu and it keeps repeating an Automatic boot in 10 seconds... message in an endless countdown loop. Selecting Press [Tab] to edit options and editing the options has no effect. When I go back to the boot menu, it keeps repeating the same countdown loop.   I've tried redoing the UNetbootin extraction, but I still have the same issue. How can I start to learn web development? I'm very interested in learning web development and have learned some basics regarding HTML and CSS a few years back from W3Schools, but I never learned how to develop websites that are up to today's standards, i.e. free-flowing sites without the use of tables to govern the design of the site.  What are some good resources that I can start with? Given Newton's third law, why are things capable of moving? Here is my proof, I would appreciate it if someone could critique it for me:  To prove this statement true, we must proof that the two conditional statements ("If $\mathcal{P}(A)⊆ \mathcal{P}(B)$, then $A⊆B$," and, If $A⊆B$, then $\mathcal{P}(A)⊆ \mathcal{P}(B)$) are true.    Contrapositive of the first statement: If $A \nsubseteq B$, then $\mathcal{P}(A) \nsubseteq \mathcal{P}(B)$  If $A \nsubseteq B$, then there must be some element in $A$, call it $x$, that is not in $B$: $x \in A$, and $x \notin B$. Since $x \in A$, then $\{x\} \in \mathcal{P}(A)$; moreover, since $x \notin B$, then $\{x\} \notin \mathcal{P}(B)$, which proves that, if $A \nsubseteq B$, then $\mathcal{P}(A) \nsubseteq \mathcal{P}(B)$. By proving the contrapositive true, the original proposition must be true.    To prove the second statement true, I would implement nearly the same argument, so that isn't necessary to write. So, does this proof seem correct? Also, was the contrapositive necessary? Or is there another way to prove the initial statement? What's the difference between an Application, a Process, and a Service? Getting "'file' is different from the same file on the system" when I attempt to update through synaptic Encountered an error while updating through Synaptic Manager. Subsequent updates gave the error at the bottom of the output. I'm a noob so any help is appreciated.  al@al:~$ sudo apt-get -f upgrade Reading package lists... Done Building dependency tree        Reading state information... Done Correcting dependencies... Done The following NEW packages will be installed:   libjack-jackd2-0:i386 The following packages have been kept back:   linux-headers-generic skype 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. Need to get 0 B/202 kB of archives. After this operation, 493 kB of additional disk space will be used. Do you want to continue [Y/n]? y (Reading database ... 310056 files and directories currently installed.) Unpacking libjack-jackd2-0:i386 (from .../libjack-jackd2-0_1.9.8~dfsg.2-1precise1_i386.deb) ... dpkg: error processing /var/cache/apt/archives/libjack-jackd2-0_1.9.8~dfsg.2-1precise1_i386.deb (--unpack):  './usr/share/doc/libjack-jackd2-0/buildinfo.gz' is different from the same file on the system dpkg-deb: error: subprocess paste was killed by signal (Broken pipe) Errors were encountered while processing:  /var/cache/apt/archives/libjack-jackd2-0_1.9.8~dfsg.2-1precise1_i386.deb E: Sub-process /usr/bin/dpkg returned an error code (1) Replace unknown reference (?) with the tag from \ref or \cite Summer in Saint Helena The Winter Bash site is located at http://winterba.sh/.  Only one problem:   . Saint Helena is in the Southern Hemisphere. It's Summer in Saint Helena.   So shouldn't it be the Summer Bash? Don't forget our Aussie/Kiwi/South African/Southern Brazilian/Argentine/Uruguayan/Zimbabwean/Swazi/Tokelauan/Tuvaluan/Pitcairn Islander/ friends!