Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
"trivially parallel" would mean "sequential".

Adbot
ADBOT LOVES YOU

Ari
Jun 18, 2002

Ask me about who Jewish girls should not marry!

rjmccall posted:

"trivially parallel" would mean "sequential".

How about "utterly pointlessly parallel"?

yatagan
Aug 31, 2009

by Ozma
Piquantly Parallel

BizarroAzrael
Apr 6, 2006

"That must weigh heavily on your soul. Let me purge it for you."
Hey guys, want to talk about programming?

I want my C# project to schedule a task, specifically running a .bat file. Is there a way for C# to do this, or will I need to make it issue the command line instruction to do it. In either case, can I tell it to run every day without listing every day of the week?

ErIog
Jul 11, 2001

:nsacloud:

BizarroAzrael posted:

Hey guys, want to talk about programming?

I want my C# project to schedule a task, specifically running a .bat file. Is there a way for C# to do this, or will I need to make it issue the command line instruction to do it. In either case, can I tell it to run every day without listing every day of the week?

Why not write your batch file, and then schedule it like you would any other process? If you need this to be easy for an end user, I'm certain you can set up a scheduled process automatically as part of the install procedure. There's no need for you to really be writing scheduling into something like that unless it's an all-in-one solution like backups or something. Even then...

ErIog fucked around with this message at 15:41 on Sep 22, 2009

BizarroAzrael
Apr 6, 2006

"That must weigh heavily on your soul. Let me purge it for you."

ErIog posted:

Why not write your batch file, and then schedule it like you would any other process? If you need this to be easy for an end user, I'm certain you can set up a scheduled process automatically as part of the install procedure. There's no need for you to really be writing scheduling into something like that unless it's an all-in-one solution like backups or something. Even then...

No, that's what we have now, I wrote a batch script that calls other batch scripts to perform the overnight update of the project (backup, update, build). User needs vary so right now people have to comment and uncomment stuff in my script if they want anything but the standard update. What I'm making is a GUI so they no longer need to fiddle with my code. Creating a .bat through the front-end and having the user manually schedule it is an okay solution, but removing that extra step and including everything in the one application might save a few accidents.

Jethro
Jun 1, 2000

I was raised on the dairy, Bitch!

BizarroAzrael posted:

No, that's what we have now, I wrote a batch script that calls other batch scripts to perform the overnight update of the project (backup, update, build). User needs vary so right now people have to comment and uncomment stuff in my script if they want anything but the standard update. What I'm making is a GUI so they no longer need to fiddle with my code. Creating a .bat through the front-end and having the user manually schedule it is an okay solution, but removing that extra step and including everything in the one application might save a few accidents.
There's no managed library for interacting with scheduled tasks. You can use P/Invoke with NetScheduleJobAdd to do it if you really want.

ErIog
Jul 11, 2001

:nsacloud:

BizarroAzrael posted:

No, that's what we have now, I wrote a batch script that calls other batch scripts to perform the overnight update of the project (backup, update, build). User needs vary so right now people have to comment and uncomment stuff in my script if they want anything but the standard update. What I'm making is a GUI so they no longer need to fiddle with my code. Creating a .bat through the front-end and having the user manually schedule it is an okay solution, but removing that extra step and including everything in the one application might save a few accidents.

Here's a solution from MS to schedule jobs from the command line. I'm not championing it as the best solution, but it's a solution if you can't get a C# solution going. Be sure to check for and remove the old scheduled job when the user updates the time/date.

http://technet.microsoft.com/en-us/library/cc738335%28WS.10%29.aspx

fake edit:

This may be of use:
http://msdn.microsoft.com/en-us/library/aa394399%28VS.85%29.aspx

ErIog fucked around with this message at 16:43 on Sep 22, 2009

BizarroAzrael
Apr 6, 2006

"That must weigh heavily on your soul. Let me purge it for you."

ErIog posted:

Here's a solution from MS to schedule jobs from the command line. I'm not championing it as the best solution, but it's a solution if you can't get a C# solution going. Be sure to check for and remove the old scheduled job when the user updates the time/date.

http://technet.microsoft.com/en-us/library/cc738335%28WS.10%29.aspx

fake edit:

This may be of use:
http://msdn.microsoft.com/en-us/library/aa394399%28VS.85%29.aspx

Yeah, I was going to set a suitably long and random identifier for the scheduled process, probably delete and remake it every time a change is made in the UI. I was looking at at, is schtasks significantly different? If I understand right, schtasks is better for periodic tasks at regular intervals,, rather than for specific days and dates.

Jethro
Jun 1, 2000

I was raised on the dairy, Bitch!

BizarroAzrael posted:

Yeah, I was going to set a suitably long and random identifier for the scheduled process, probably delete and remake it every time a change is made in the UI. I was looking at at, is schtasks significantly different? If I understand right, schtasks is better for periodic tasks at regular intervals,, rather than for specific days and dates.
schtasks is the "replacement" for at. As far as I can tell, they both do the same thing, but schtasks is better and has more options.

cannibustacap
Jul 7, 2003

Brrrruuuuuiinnssss
I have a column in an excel file that is all dates, like

11/01/09

Or MM/DD/YY

How do I convert them to Unix Epoch Time? I literally can't find anything online that works.

I tried to use the Left() or Mid() functions to extract out the actual numbers, but when I use string functions, I just get The Ascii code out!

Is there any formula that will let me put a date into a function and out pops the Unix Time Stamp?

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh
Why not just export it as a CSV and do it in Perl/Python?

cannibustacap
Jul 7, 2003

Brrrruuuuuiinnssss

Avenging Dentist posted:

Why not just export it as a CSV and do it in Perl/Python?

I'm not sure how to work Perl or Python... Any guides online on how to do that?

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

cannibustacap posted:

I'm not sure how to work Perl or Python... Any guides online on how to do that?

Yes. I will leave it as an exercise to the reader to type "Python tutorial" into Google.

bitprophet
Jul 22, 2004
Taco Defender

Avenging Dentist posted:

Yes. I will leave it as an exercise to the reader to type "Python tutorial" into Google.
Oh, don't be a dick.

cannibustacap, while you should read the python.org tutorial and check the docs for the csv and datetime modules (i.e. the exact functions below may not be 100% accurate), this is roughly what it's going to look like in Python:
code:
import csv
from datetime import datetime
from time import mktime

reader = csv.reader(open('/path/to/my/file.csv'))

for line in reader:
    datetime_obj = datetime.strptime(line[<column index goes here>], "%m/%d/%y")
    timestamp = mktime(datetime_obj.timetuple())
    print(timestamp)
This would be less code if Python's datetime module wasn't a piece of poo poo. Please note that the rest of the language and stdlib is much better! :)

cannibustacap
Jul 7, 2003

Brrrruuuuuiinnssss

cannibustacap posted:

I have a column in an excel file that is all dates, like

11/01/09

Or MM/DD/YY

How do I convert them to Unix Epoch Time? I literally can't find anything online that works.

I tried to use the Left() or Mid() functions to extract out the actual numbers, but when I use string functions, I just get The Ascii code out!

Is there any formula that will let me put a date into a function and out pops the Unix Time Stamp?

I figured it out in excel.
With the date format being mm/dd/yy

First I converted the date cell into text using this:
=TEXT(D2,"mm/dd/yy")

Then I converted that to unix time stamp by using this:
=(MID(E2,7,2)+30)*31556926+MID(E2,4,2)*86400+MID(E2,1,2)*2629743-2629743

The final subtraction is weird, for some reason everything was exactly 1 month off...

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

bitprophet posted:

Oh, don't be a dick.

I'm not sure I understand the meaning of this sentence???

EDIT: holy poo poo, never use that date conversion formula ever.

Avenging Dentist fucked around with this message at 01:10 on Sep 23, 2009

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb
What regex pattern do you guys use to validate an email address?

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip
Two parter, the first part checks for (\w+@\w+) and the second part is (?{try_to_send_an_email($1);})

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

fletcher posted:

What regex pattern do you guys use to validate an email address?

code:
(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:
\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(
?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ 
\t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\0
31]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\
](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+
(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:
(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z
|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)
?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\
r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[
 \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)
?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t]
)*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[
 \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*
)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)
*:(?:(?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(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?[ \t]
)*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?
:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[
\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-
\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(
?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;
:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([
^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\"
.\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\
]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\
[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\
r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] 
\000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]
|\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\[\] \0
00-\031]+(?:(?:(?:\r\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".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|
\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:
[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\
]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)
?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["
()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)
?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>
@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[
 \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,
;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t]
)*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?
(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".
\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:
\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\[
"()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])
*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])
+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\
.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z
|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*\>(?:(
?:\r\n)?[ \t])*))*)?;\s*)

cannibustacap
Jul 7, 2003

Brrrruuuuuiinnssss

Avenging Dentist posted:

code:
(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:
\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(
?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ 
\t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\0
31]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\
](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+
(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:
(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z
|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)
?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\
r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[
 \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)
?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t]
)*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[
 \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*
)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)
*:(?:(?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+
|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r
\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:
\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t
]))*"(?:(?:\r\n)?[ \t])*))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r\n)?[ \t])*
(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".
\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[
^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]
]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*\>(?:(?:\r\n)?[ \t])*)(?:,\s*(
?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(
?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[
\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t
])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t
])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?
:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|
\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:
[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\
]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)
?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["
()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)
?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>
@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[
 \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,
;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t]
)*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?
(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".
\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:
\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\[
"()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])
*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])
+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\
.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z
|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*\>(?:(
?:\r\n)?[ \t])*))*)?;\s*)

I honestly wonder, with all my seriousness and heart, what person actually wrote that out?

Although I see 000-\031 repeated, so may that is a big copy and paste?

ErIog
Jul 11, 2001

:nsacloud:

cannibustacap posted:

I honestly wonder, with all my seriousness and heart, what person actually wrote that out?

Although I see 000-\031 repeated, so may that is a big copy and paste?

That never gets old. Someone needs to put that in ASCII art form spelling out "gently caress OFF." I know that string compiles as a valid regex, but gently caress if I know that it actually works.

It is real. It is apparently not a copy/paste. It's based on RFC822 as opposed to RFC2822 which means that it's checking for things like group and mailbox names being passed along with the username. That 000-\031 is telling it to do something with that part of the unicode group. 000 is obviously null, and then the next 31 characters comprise special unicode language codes. You can look them up if you search for Unicode Calculator.

The guy that constructed that monstrosity is named Paul Warren, and originally posted it here along with sample code implementing it:

http://ex-parrot.com/~pdw/Mail-RFC822-Address.html

ErIog fucked around with this message at 01:41 on Sep 23, 2009

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh
That regex doesn't even validate all emails (it assumes that comments in the email are stripped out and replaced with whitespace).

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip
Someone remind me whether comments in email addresses nest to arbitrary depth or not

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

bitprophet posted:

if Python's datetime module wasn't a piece of poo poo

I agree 100%, but I'm sorta curious: what does a good datetime module look like? Any library I've ever used for dates has some annoying thing or other. (Though dates and times are annoying as poo poo and I'm pretty sure no excellent library exists for them.)

bitprophet
Jul 22, 2004
Taco Defender

pokeyman posted:

I agree 100%, but I'm sorta curious: what does a good datetime module look like? Any library I've ever used for dates has some annoying thing or other. (Though dates and times are annoying as poo poo and I'm pretty sure no excellent library exists for them.)

That's actually a great question, I don't think I've ever seen one that didn't have at least one major wart. I'm sure this is in part due to timekeeping being messed up in general, but still...

In looking around for the "datetime object => Unix epoch timestamp" bit that I put in, I found a discussion (involving none other than Tim Peters, in fact) pointing out that part of the issue is that the datetime object can encapsulate a number of potential dates which cannot be correctly translated into epoch timestamps.

But I still don't get why there's no ".to_timestamp()" method that simply raises a TypeError or similar for those bad dates, and returns a useful value otherwise :saddowns:


Avenging Dentist posted:

I'm not sure I understand the meaning of this sentence???

RTFM is all good and well, but it's not like it was hard to throw together a quick example of how (comparatively) easy it is to whip up a "read CSV, do date math" snippet in Python, and it's more likely to have a good outcome (i.e. another Python user.) Note that I did still tell him to RTFM...I just did it nicely. (Perhaps if I'd given it in almost-Python pseudocode, so it couldn't be copy/pasted, that would've been better, but meh.)

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

pokeyman posted:

I agree 100%, but I'm sorta curious: what does a good datetime module look like? Any library I've ever used for dates has some annoying thing or other. (Though dates and times are annoying as poo poo and I'm pretty sure no excellent library exists for them.)

STAR has a very good datetime library - it leverages just one function to DWIW, which is pretty cool.

floWenoL
Oct 23, 2002

Otto Skorzeny posted:

Someone remind me whether comments in email addresses nest to arbitrary depth or not

They do, so even the 'full' e-mail regex doesn't parse all valid e-mail addresses.

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb

Avenging Dentist posted:

code:
(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:
\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(
?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ 
\t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\0
31]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\
](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+
(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:
(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z
|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)
?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\
r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[
 \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)
?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t]
)*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[
 \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*
)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?: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"
(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t]
)*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?
:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[
\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-
\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(
?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;
:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([
^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\"
.\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\
]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\
[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\
r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] 
\000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]
|\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\[\] \0
00-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\
.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,
;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?
:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*
(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".
\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[
^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]
]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*\>(?:(?:\r\n)?[ \t])*)(?:,\s*(
?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(
?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[
\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t
])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t
])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?
:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|
\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:
[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\
]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)
?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["
()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)
?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>
@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[
 \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,
;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t]
)*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?
(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".
\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:
\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\[
"()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])
*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])
+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\
.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z
|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*\>(?:(
?:\r\n)?[ \t])*))*)?;\s*)

hey thanks that worked great!

Necc0
Jun 30, 2005

by exmarx
Broken Cake
I'm learning some basic OS programming in C. How the hell do I get a child process to watch a specific memory location and print the variable stored there every time it changes?

ErIog
Jul 11, 2001

:nsacloud:

fletcher posted:

hey thanks that worked great!

Wait, you actually used it? It was a joke. Seriously, you don't need to be that thorough.

.*@.* then try to send an e-mail is really the only good way to do that. Even that "full" giant regex won't actually catch all valid addresses. So there's no reason to even mess about with it. If it was a full solution, I'd say go for it. So it's not, so why bother when there's ways that are just as good.

RussianManiac
Dec 27, 2005

by Ozmaugh

Necc0 posted:

I'm learning some basic OS programming in C. How the hell do I get a child process to watch a specific memory location and print the variable stored there every time it changes?

Child processes can only see their own virtual address space. If you want them to access part of memory that is part of a different process then you need to set up some memory sharing. I am not that great at OS stuff myself, but you could do this with a kernel module pretty easy.

I am not sure how you would watch a region of memory for changes with anything other than polling, however. Best thing would do for something that might change that region to raise some sort of flag or signal.

Necc0
Jun 30, 2005

by exmarx
Broken Cake

RussianManiac posted:

Child processes can only see their own virtual address space. If you want them to access part of memory that is part of a different process then you need to set up some memory sharing. I am not that great at OS stuff myself, but you could do this with a kernel module pretty easy.

I am not sure how you would watch a region of memory for changes with anything other than polling, however. Best thing would do for something that might change that region to raise some sort of flag or signal.

This is exactly what I found out in the time you wrote this and I'm using a temporary value that will compare to the shared memory location

let's see if it works

edit: yep

Necc0 fucked around with this message at 07:33 on Sep 23, 2009

Meganiuma
Aug 26, 2003

Necc0 posted:

This is exactly what I found out in the time you wrote this and I'm using a temporary value that will compare to the shared memory location

let's see if it works

There are 2 ways to go about detecting if a memory location changed reliably.

1.) If the hardware supports arbitrary break/watch points, find out how to set them. For example on x86 you can set the debug registers to addresses you want to break on when read/written. If the address is read/written it'll cause a trap.

2.) If you don't have hardware support you'll have to break on every instruction and check the memory location for a change. Breaking after an instruction can be done through the FLAGS register on x86.

1.) should work from a child process (assuming it's a region of memory shared by both the parent and child). 2.) would need to be done in the parent process (and potentially any other process that could modify the memory location) or the kernel.

If you don't want to do it reliably, you can simply poll the location repeatedly, but this has the problem of potentially not catching all changes and not being threadsafe.

BizarroAzrael
Apr 6, 2006

"That must weigh heavily on your soul. Let me purge it for you."
Does C# have a problem with nested IF statements? I've tried to set one up but only the last statement seems to be applied:

code:
if (Checkbox1.Checked == true)
  if (Checkbox2.Checked == true)
    if (Checkbox3.Checked == true)
       script.WriteLine("Things");
Regardless of what happens to Checkbox 1 and 2, if 3 is ticked the line gets written and if it isn't it won't. I have experimented with removing the statements and they all work correctly on their own.

Edit: got it, need to use {} when nesting, though for individual ones you don't.

BizarroAzrael fucked around with this message at 15:03 on Sep 23, 2009

No Safe Word
Feb 26, 2005

BizarroAzrael posted:

Edit: got it, need to use {} when nesting, though for individual ones you don't.

Yes you do.

no you don't, but just do it

Dirty Frank
Jul 8, 2004

Not like it really matters but why not just:

code:
if (Checkbox1.Checked && Checkbox2.Checked && Checkbox3.Checked)
    script.WriteLine("Things");

tef
May 30, 2004

-> some l-system crap ->

BizarroAzrael posted:

code:
if (Checkbox1.Checked != false)
  if (Checkbox2.Checked != false)
    if (Checkbox3.Checked != false)
       script.WriteLine("Things");



Have you considered writing things like this it might make it clearer
:v:

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



bitprophet posted:

But I still don't get why there's no ".to_timestamp()" method that simply raises a TypeError or similar for those bad dates, and returns a useful value otherwise :saddowns:

Couldn't that be a problem for cross-platform compatibility? I could see the usefulness of a to_unix_timestamp(), but I'm guessing that a *nix timestamp isn't meaningful on at least one platform Python runs on and that might be a good enough argument for someone on the team to exclude it. Of course, they have all those things in os that don't work in Windows, so *shrug*

Adbot
ADBOT LOVES YOU

BizarroAzrael
Apr 6, 2006

"That must weigh heavily on your soul. Let me purge it for you."

Dirty Frank posted:

Not like it really matters but why not just:

code:
if (Checkbox1.Checked && Checkbox2.Checked && Checkbox3.Checked)
    script.WriteLine("Things");

Because its' actually a more complicated branching thing rather and three prerequisites for a single outcome. I didn't want to copy/paste so much and replace all the variables with generic ones.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply