I'm trying to write a regular expression for parsing address.   My address strings have next format: AddressLine (City) SomeFixedText  The only problem that (City) part is optional. For example:  Abingdon Road (Oxford) Water Network Pumping Adderbury Water Network Pumping   Without capturing optional group I've come up with following expression:  (?&lt;Line&gt;.*) \((?&lt;City&gt;.*)\) Water Network Pumping   But of course it doesn't not handle the second case. I tried to use an optional group:  (?&lt;Line&gt;.*)( \((?&lt;City&gt;.*)\))? Water Network Pumping   But in this case Line and City are captured incorrectly for the first case.  Here is the fiddle:   How can I handle this situation?
I have this gigantic ugly string: J0000000: Transaction A0001401 started on 8/22/2008 9:49:29 AM J0000010: Project name: E:\foo.pf J0000011: Job name: MBiek Direct Mail Test J0000020: Document 1 - Completed successfully  I'm trying to extract pieces from it using regex. In this case, I want to grab everything after Project Name up to the part where it says J0000011: (the 11 is going to be a different number every time). Here's the regex I've been playing with: Project name:\s+(.*)\s+J[0-9]{7}:  The problem is that it doesn't stop until it hits the J0000020: at the end. How do I make the regex stop at the first occurrence of J[0-9]{7}?
Equation of a line maintaining equal ratio distance between two points. Say I have two points. One at $A = (0, 0)$ and another at $B = (0, 10)$. I wish to derive an equation for a line that, for any point $P$ on the line, would equal a set ratio for the distance $P$ to $A$ and $P$ to $B$.  This is easy if the predetermined ratio for $A:B$ is $1:1$. I would create a line from $A$ to $B$, find its midpoint, then create an orthogonal line at the midpoint. Then at any $P$ on the line I know that the ratio distances from $P$ to $A$ and $B$ will be $1:1$.  But what if the ratio for $A:B$ is something like $11:18$?  This is for a positioning algorithm I am implementing - not for homework :)  EDIT: Note - If an exact formula is not possible, an approximation of the line out to $\pm 200$ from $A$ or $B$ is acceptable as values further from $A$ and $B$ will not be utilized anyway. A linear equation for the final result/approximation is ideal for speed in running multiple computations. Why are my textures pink? Basically, I applied my textures by taking each individual object, unwrapping it in the uv editor, then opening up an image in the uv editor and it would apply the texture in the 3D editor. However, when I render my project none of the textures appear and everything looks odd. I don't know how to set up the images properly with the bee.  For example, here's the uv layout image for the bee's Cube.001:     How do I get that applied properly to the Cube.001 in my project?  Here is   Everything appears purple if the images aren't there and I don't know how to fix that either. Short story ID: Bouncing-Ball Time Travel A little help please. The story I'm looking for is probably late-50's to mid-60's, and may well have occurred in an SF magazine.  A professor is demonstrating his new time machine to a scientific audience. The machine looks like two large spheres touching each other. In operation, one is sent back into deep time (let's say, although my memory has dropped this particular datum, 10 billion years). It will then return to the present, then bounce off its twin and jump back half that temporal distance (5 billion years), return, bounce half again (2.5 billion years), etc. Each trip will take half the time (in present-day units) as the previous, so the whole thing will be over in a finite time.  Before anyone can stop him, he activates it. He begins lecturing the audience, asserting that whatever has happened has always happened. At decreasing intervals the sphere reappears and bounces with a resonant "Boing!". At each jump, the narrative establishes that the appearance of the sphere did change history, and these changes are reflected in the professor's speech.  So it becomes something like "(Boing!) And those who say that this is dangerous might as well be claiming that the day is not 26 hours long (Boing!) or that there are three moons, not seven (Boing!)", etc. And when the final (Boi-Bo-B-B-Boing!) fades away he raises his tentacles in triumph and cries, "See? Nothing has changed!" If I said, &quot;I will run, not if it is snowing, if I my shoes are comfortable.&quot; Does the &quot;if my shoes are comfortable&quot; modify the &quot;I will run&quot; clause? I agree the sentence would be clearer with the addition of &quot;and&quot; in place of the comma. However, without the &quot;and&quot; is it still clear that the &quot;if my shoes are comfortable&quot; clause modifies the &quot;I will run&quot; clause? What is the cardinality of the set of the empty set? Given set $ A = \{  \emptyset   \}$ what is $|A|$? I just learned about sets today in class and I'm unsure how to answer this. Difference between ' and " on command line (bash)? Sorting list based on values from another list This looks a little bit like a variation on  but specific to the tags view.  Reproduction (app version 1.0.71):   Select any site (say Meta) from the sidebar Switch to the tags view using the top bar Choose a tag, any tag ( is nice)   optionaly refine your search with more terms  Go to any question found, go back   you end on the unfiltered tags view  Go back again   lucky you, your search is here Read MIME data using PHP When running 'screen ls' the screen stops with the text [screen is terminating]. I would like screen to keep the session alive and reattach to it to see the output of ls.  Of course the real thing is that I don't run screen ls, but rather a screen fsck ..., so I would like to ensure that the screen is not terminating when this command is finished.  I would love to have an answer that is useful for an already existing running screen session, so some interactive keys like C-a ... or C-a : (Enter command line mode) How do we delete subscribers (emails) from Auto suppression list using SSJS. Also, Auto suppression list maintain at SF end or application level. I had a question about interpreting the graphs generated by plot(lm) in R.  I was wondering if you guys could tell me how to interpret the scale-location and leverage-residual plots?  Any comments would be appreciated.  Assume basic knowledge of statistics, regression and econometrics. Using File Geodatabase coded domain with ArcGIS Online? I created a File GDB and set up a domain, and the domain was assigned to a field in a feature class. The domain behaves as expected on ArcGIS Desktop (dropdown list when editing the content of that field).  But if I zip up the FGDB and upload to ArcGIS Online to created a feature layer and edit the layer online, there is no dropdown when editing.  I don't see any additional step in this tutorial, other than a different mechanism of getting data to ArcGIS Online. I don't think I can do it the same way in ArcGIS 10.0:   Anyone has any idea what's going on? How do I execute a command-line program from C# and get back the STD OUT results? Specifically, I want to execute DIFF on two files that are programmatically selected and write the results to a text box. How to show that $\mathbb{Q}$ is not $G_\delta$ I read a section of a book and it made mention of the set of rationals not being a $G_\delta$. However, it gave no proof. I read on  about using contradiction, but it made use of the Baire category theorem, which is unfamiliar to me. I was wondering if anyone could offer me a different proof; perhaps using the fact that the complement of $G_\delta$ is $F_\sigma$.  Thanks. I've just bought my first Mac, a Macbook pro(with an hdd), and I'm thinking in buying an ssd and replace the hdd. But the computer came with no dvd of the OS. I know that in the hdd there is a restore partition, but if I remove the hdd, how can I install the OS? Stop inserting hard line-wraps in blockquotes! When you use the markdown editor's blockquote feature (the quote button / Ctrl+Q), it inserts hard line-wraps in the markdown source automatically for you. That is, it transforms text like this:  Hindus regard it as an earthly manifestation of the goddess Tulsi, a consort of the god Vishnu.   The offering of its leaves is mandatory in ritualistic worship of Vishnu and his forms like Krishna and Vithoba.   Into text like this:  &gt; Hindus regard it as an earthly manifestation of the goddess Tulsi, a &gt; consort of the god Vishnu.  &gt;  &gt; The offering of its leaves is mandatory in ritualistic worship of &gt; Vishnu and his forms like Krishna and Vithoba.   The editor should instead transform it into this:  &gt; Hindus regard it as an earthly manifestation of the goddess Tulsi, a consort of the god Vishnu.  &gt;  &gt; The offering of its leaves is mandatory in ritualistic worship of Vishnu and his forms like Krishna and Vithoba.   That is, without adding any newlines.   Why on earth does it insert hard line-wraps!? Both these forms look the same when rendered, but the current way makes it more difficult for us to go back and edit the blockquoted text later if need be.   This is particularly objectionable functionality for sites that use MathJax - while the hard line-wraps don't impact the rendered output, the additional &gt; that are inserted do (they manifest as greater-than signs if they get inserted within MathJax $$...$$). See this post on Meta.Math.SE for more details: .    I found  that this behavior is apparently :      The "reflow the text when you click blockquote" is a deliberate feature, intended to improve the readability on quoted text.   Seriously? Are there any browsers that don't soft-linewrap textareas anymore? How is hard-wrapping at 70(?) characters better than soft-wrapping at $textareawidth? If readability is the concern here, then why not hard-wrap all non-code upon post submission? Remember all opened files with split windows and their positions in Emacs In a linear program, I have a variable $y$ that must obey $y=\max(x-a,0)$ where $x$ is a linear combination of the other variables and $a$ is a constant. $x$ and $y$ and $a$ are always non-negative. If the objective function decreases w.r.t. $y$, then adding the constraint $y\geq x-a$ makes it work. Are there any way to add dummy varibles and contraints such that $y=\max(x-a,0)$ when the objective function increases w.r.t. $y$? I can't say $y\leq x-a$ because if $x-a&lt;0$ it contradicts the non-negativity of $y$ whereby the solution might no longer be in the feasible region or the problem might even be infeasible. Is there any short way to save the pipe output to the same file that it's processed. For example, this is what I am actually doing  $ cat filename | sort | uniq &gt; result $ rm -f filename $ mv result filename   I was wondering if there was a way to do it in just one line (not appending those commands using &amp;&amp;)  This is not the way, but to get an idea  $ cat filename | sort | uniq &gt; filename