Function that takes a list and returns a list with only unique elements from the original?
How do you remove duplicates from a list whilst preserving order?
Is there a way to format a UTC time into any arbitrary string format I want in java?  Basically I was thinking of having some class take the timestamp and I pass it is string telling it how I want it formated, and it returns the formatted string for me.  Is there a way to do this? Regular expression: match start or whitespace Can a regular expression match whitespace or the start of a string?  I'm trying to replace currency the abbreviation GBP with a £ symbol. I could just match anything starting GBP, but I'd like to be a bit more conservative, and look for certain delimiters around it.  &gt;&gt;&gt; import re &gt;&gt;&gt; text = u'GBP 5 Off when you spend GBP75.00'  &gt;&gt;&gt; re.sub(ur'GBP([\W\d])', ur'£\g&lt;1&gt;', text) # matches GBP with any prefix u'\xa3 5 Off when you spend \xa375.00'  &gt;&gt;&gt; re.sub(ur'^GBP([\W\d])', ur'£\g&lt;1&gt;', text) # matches at start only u'\xa3 5 Off when you spend GBP75.00'  &gt;&gt;&gt; re.sub(ur'(\W)GBP([\W\d])', ur'\g&lt;1&gt;£\g&lt;2&gt;', text) # matches whitespace prefix only u'GBP 5 Off when you spend \xa375.00'   Can I do both of the latter examples at the same time? Android and getting a view with id cast as a string A game called  is making rounds on social media. I am trying to determine the maximum score attainable for this game.  Let's assume WLOG that only 2s are returned (if 4s are possible the max score is doubled).  First, I'll relax some of the rules to create a game, $\mathcal{G}$, that can achieve a score at least as high as the original, 2048 game.  A run $R$  of $\mathcal{G}_n$ consists of a sequence of moves $m_1,\ldots,m_k$ which manipulate a multiset, $\mathcal{S}$ of maximum size n.  Each $m_i$ is either:   a put $p$, which inserts a 2 into $\mathcal{S}$, or a merge, $\alpha_i$, which replaces two $2^i$ elements from $\mathcal{S}$ with a single $2^{i+1}$ elt.   I allow sequential moves of the same type because 2048 allows multiple merges or no-merge turns.  The score of a position is the sum of $\mathcal{S}$.  What is the maximum score possible on a game of order n?  Note: The final position must have only unique values, else a merge and put would be possible in increase score.  I claim it is $\sum_{i=1}^{n} 2^i$, but couldn't come up with any good induction arguments.  It's pretty easy to prove that an element $2^k$ is producible in a game $\mathcal{G}_k$, but proving an upper bound for production got a bit hairy, and also doesn't cover the full space. Flag counter is missing sporadically I noticed that on both sites where I am a moderator the flag counter is occasionally not showing any flags even when there are flags in the queue. A refresh of the page leads to the correct flag count to be displayed. I noticed this happening when I visited the site for the first time in a few hours, when I was recently active on the site the counter seems to stay accurate. Can I set up a Mac for a multi head / multi user environment? Is there some special case where a fermion can mediate a force? My laptop has a function key which turns F keys into keys which change volume or brightness. I would like to swap a number of them so that they perform that function under normal operation and are an Fx key while the function key is being held.  I assumed that the function keys were just normal keys codes with the set of keys being large enough to include all the possible speical keys. I tried to so as this tutorial suggests () and use xev to obtain the key codes and then would use xmodmap to swap their value.  This does not seem to work though. The F12 key gives the xev output:  KeyPress event, serial 41, synthetic NO, window 0x4a00001,     root 0xb1, subw 0x0, time 468005, (23,-15), root:(89,37),     state 0x10, keycode 96 (keysym 0xffc9, F12), same_screen YES,     XLookupString gives 0 bytes:      XmbLookupString gives 0 bytes:      XFilterEvent returns: False   Which I think is to be expected. However, the Increase Volume button give this response:  KeymapNotify event, serial 41, synthetic NO, window 0x0,     keys:  65  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0               0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0    And so does the Decrease Volume key. How can I perform the swapping of the keys that I would like?  Thank you How do Natures work? In at least some Pokemon games there are modifiers called "Natures" which affect pokemon stats. What do they do and how do it work? Also, what specific games possess it? How do I get an iball 3.5G modem working on Ubuntu? I purchased iball 3.5G  connect wireless modem 1 month before. I am trying to connect it with my laptop which is having ubuntu Operating System. After plug-in it to the ubuntu system it is not connecting with net.   This modem is plug and play but after plugging it nothing is displaying to the system.  I am expecting step-by-step method to connect this modem with my ubuntu 12.04 LTS sysetm from your expert's advice. Convert /etc/network/interfaces to netplan for floating IP I am new to the netplan on Ubuntu 18.04, just discovered it exists today. I have an interface that I am trying to add to create a floating IP on google cloud. It is based on this example:   I tested the example, and it works, but now I try to do the same on ubuntu, and I don't know how to convert this:  cat &lt;&lt; EOF &gt;&gt; /etc/network/interfaces auto eth0:0 iface eth0:0 inet static     address 10.190.1.1     netmask 255.255.255.255 EOF   to netplan.  The output for ls /etc/netplan is '50-cloud-init.yaml'. and the output for cat /etc/netplan/*.yaml is:  network:     version: 2     ethernets:         ens4:             dhcp4: true             match:                 macaddress: 42:01:0a:8e:00:3e             set-name: ens4   my ifconfig:  # ifconfig  ens4 ens4: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  mtu 1460     inet 10.142.0.62  netmask 255.255.255.255  broadcast 0.0.0.0     inet6 fe80::4001:aff:fe8e:3e  prefixlen 64  scopeid 0x20&lt;link&gt;     ether 42:01:0a:8e:00:3e  txqueuelen 1000  (Ethernet)     RX packets 9430  bytes 1635180 (1.6 MB)     RX errors 0  dropped 0  overruns 0  frame 0     TX packets 13383  bytes 1513428 (1.5 MB)     TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0   What is the equivalent of what he said to put in the file, for netplan? If it was possible to dig a hole that went from one side of the Earth to the other... ...And you jumped in.  What would happen when you got to the middle of the Earth? Would you gradually slow down, until you got to the middle and once you were in middle would every direction feel like it was up? Why are there two sets of the Ctrl, Alt, and Shift modifier keys when only one of each is necessary? Changing CSS Values with Javascript Set limit to one author when using "et al." in biblatex Suppose that I would like to record some video sessions of Angry Birds on my phone.   Are there any apps that I can use? I have root permissions. What does it mean when Git says 'rewrite' or 'rename' in a commit message? Frobenius element in cyclotomic extension Let $K=\mathbb{Q}(\zeta_m)$. Then if $p\nmid m$ is any odd prime, how i can show that Frobenius map is $(p,K/\mathbb{Q})(\zeta_m)=\zeta_m^p$.  We know, if $P$ is a prime above $p$   $$(p,K/\mathbb{Q})(x) \equiv x^p (\mbox{mod } P) \quad\forall x \in \mathbb{Z}_K$$  Thanks! How to say that you have plans to go to the movies tonight? How to say that you have plans to go to the movies tonight (but you are not sure yet, maybe you will have a pizza)? I mean there are options:     I am going to the cinema tonight.   Way too much certainty in this. For me it means that you have already bought tickets, the least.     I am going to go to the cinema tonight.   Sounds a bit awkward.     I will go to the cinema tonight.   Sounds too formal to me. If $M$ isn't Noetherian, $M$ has a submodule maximal with respect to being not finitely generated. I'm answering this question:     Let $M$  be a module. Show that if  $M$ is not Noetherian then $M$ has a submodule $N$ such that $N$ is not finitely generated but $A$ is finitely generated whenever $N &lt; A ≤ M$.   The solution starts as follows (I'm following a given solution): Let $Y$ be the set of non-finitely-generated submodules of $M$. If $(N_α)$ is a chain in $Y$ then $Q= \bigcup_αN_α $ is in $Y$, else $Q$ is f.g., which implies $Q=N_α$ for some $α$, whence $N_α$  is f.g., contradiction.  I don't understand why if $Q$ is f.g., then $Q=N_α$ for some $α$? Am I missing some fact?  Thanks!