On occasion our site will get hit with what looks like a series of attempted attacks. The comments on our blog posts will look like this:
"wddL" - 5057 said on Friday, March 4th at 10:42pm MST
"wddL" - ppGV,(),,,'(", said on Friday, March 4th at 10:42pm MST
"CAEj" - zOGH said on Friday, March 4th at 10:40pm MST
"CAEj" - zOGH said on Friday, March 4th at 10:40pm MST
"CAEj" - zOGH..)'.",)), said on Friday, March 4th at 10:40pm MST
"CAEj" - zOGH (,'.").),)() said on Friday, March 4th at 10:40pm MST
"CAEj" - zOGH ('NHgUTS<'">raLnrY) said on Friday, March 4th at 10:40pm MST
"CAEj,,).)')"(," - zOGH said on Friday, March 4th at 10:40pm MST
"CAEj'EHOtrR" - zOGH said on Friday, March 4th at 10:41pm MST
"CAEj" - zOGH said on Friday, March 4th at 10:41pm MST
"CAEj" - zOGH said on Friday, March 4th at 10:41pm MST
"LsBb" - iqfV,).)",'.,) on Friday, March 4th at 10:40pm MST
"LsBb" - 7635 on Friday, March 4th at 10:40pm MST
I'm just trying to understand what they're attempting, but I'm not familiar with the commands they're trying.
I think they're trying to talk to the hardware in our server?
My best efforts to learn on my own what "wddl", "CAEj" and "LsBb" are:
wddl = "Wave Dynamic Differential Logic"
CAEj = "Some kind or "R" argument?"
LsBb = "Something to do with assembly language programming?"
Can anyone tell me what it is they're attempting?
Related
I have the following chart which shows sick leave per person for July and August and on top of that is a card that shows the average of all the months, so in this case is average of July and August which gives 1.55.
Instead of the average, I want the card to show the latest value of the month, so in this case I want the card to show August value which is 0.79 and when September data is loaded, I want the card to show September data instead, unless someone clicks on a different month, then the card should update to show average of what they selected.
For the measure to show the latest months data you could do something like this
Latest Month Average =
VAR latest_month =
MONTH ( CALCULATE ( MAX ( 'Table'[SickDate] ) ) )
RETURN
CALCULATE (
AVERAGEX ( VALUES ( 'Table'[Person] ), COUNT ( 'Table'[SickDate] ) ),
FILTER ( 'Table', MONTH ( 'Table'[SickDate] ) = latest_month )
)
Im not sure what you're data looks like so im making assumptions based on your visual
So im assuming a table like this
Person
SickDate
Jim
Thursday, 1 September 2022
Jane
Thursday, 1 September 2022
John
Saturday, 1 October 2022
Jim
Thursday, 1 September 2022
Jane
Thursday, 1 September 2022
John
Saturday, 1 October 2022
Phil
Sunday, 2 October 2022
So the measure basically gets the latest month in the data
Counts the amount of dates (sick days) by person and takes an average
Note: if you're showing multiple years you would need to get the latest month and year to filter correctly and not just month
Need help debugging Regex
I have a string column in pandas data frame that contains dates formatted as follows. And there is only one such date in each string.
semicolons are only used to deliminate dates here and not present in actual strings
04/20/2009; 04/20/09; 4/20/09; 4/3/09; 011/14/83;
Mar-20-2009; Mar 20, 2009; March 20, 2009; Mar. 20, 2009; Mar 20 2009;
20 Mar 2009; 20 March 2009; 20 Mar. 2009; 20 March, 2009
Mar 20th, 2009; Mar 21st, 2009; Mar 22nd, 2009
Feb 2009; Sep 2009; Oct 2010
6/2008; 12/2009
2009; 2010
My job is to extract these using regex. Here is the pattern I came up with.
my_pattern = r"((?:(\d{0,2}\d)|(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*?)?[, -./]{0,2}(?:(\d{1,2})[dhnst]{0,2}|(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*?)[, -./]{1,2}(\d{2,4}))|(\d{4})"
sample_series.str.extract(my_pattern, expand=False)
regex_problem_image
So far, I see it work for every date except for the format "Jan 27, 1983", it matches the month name and the date. But the year isn't matched. I am relatively new to regex and I think my pattern design is quite bad too. I need help figuring out what's wrong with my regex expression and how I could debug or improve it. Thanks.
Here is the sample data to make the problem reproducible.
sample_list = ['.Got back to U.S. Jan 27, 1983.\n',
'.On 21 Oct 1983 patient was discharged from Scroder Hospital after EIGHT DAY ADMISSION\n',
'4-13-89 Communication with referring physician?: Not Done\n',
'7intake for follow up treatment at Anson General Hospital on 10 Feb 1983 # 12 AM\n',
'. Pt diagnosed in Apr 1976 after he presented with 2 month history of headaches and gait instability. MRI demonstrated 4 cm L cereballar mass in the paravermian region. He was admitted to PRM and underwent resection complicated by post-op delirium. Post-op sequelas include left palatal myoclonus and ataxia on the left upper and lower extremities which has progressively improved. Pt has not had any evidence of tumor recurrence.\n',
'1-14-81 Communication with referring physician?: Done\n',
'. Went to Emerson, in Newfane Alaska. Started in 2002 at CNM. Generally likes job, does not have time to do what she needs to do. Feels she is working more than should be.\n',
'09/14/2000 CPT Code: 90792: With medical services\n',
'. Sep 2015- Transferred to Memorial Hospital from above. Discharged to MH Partial Hospital on Zoloft, Trazadone and Neurontin but unclear if she followed up.\n',
'Born and raised in Fowlerville, IN. Parents divorced when she was young, states that it was a "bad" divorce. Received her college degree from Allegheny College in 2003. Past verbal, emotional, physical, sexual abuse: No\n']
sample_series = pd.Series(sample_list)
From your data :
>>> import pandas as pd
>>> sample_list = ['.Got back to U.S. Jan 27, 1983.\n',
'.On 21 Oct 1983 patient was discharged from Scroder Hospital after EIGHT DAY ADMISSION\n',
'4-13-89 Communication with referring physician?: Not Done\n',
'7intake for follow up treatment at Anson General Hospital on 10 Feb 1983 # 12 AM\n',
'. Pt diagnosed in Apr 1976 after he presented with 2 month history of headaches and gait instability. MRI demonstrated 4 cm L cereballar mass in the paravermian region. He was admitted to PRM and underwent resection complicated by post-op delirium. Post-op sequelas include left palatal myoclonus and ataxia on the left upper and lower extremities which has progressively improved. Pt has not had any evidence of tumor recurrence.\n',
'1-14-81 Communication with referring physician?: Done\n',
'. Went to Emerson, in Newfane Alaska. Started in 2002 at CNM. Generally likes job, does not have time to do what she needs to do. Feels she is working more than should be.\n',
'09/14/2000 CPT Code: 90792: With medical services\n',
'. Sep 2015- Transferred to Memorial Hospital from above. Discharged to MH Partial Hospital on Zoloft, Trazadone and Neurontin but unclear if she followed up.\n',
'Born and raised in Fowlerville, IN. Parents divorced when she was young, states that it was a "bad" divorce. Received her college degree from Allegheny College in 2003. Past verbal, emotional, physical, sexual abuse: No\n']
>>> sample_series = pd.Series(sample_list)
>>> df = sample_series.to_frame()
>>> df
0
0 .Got back to U.S. Jan 27, 1983.\n
1 .On 21 Oct 1983 patient was discharged from Sc...
2 4-13-89 Communication with referring physician...
3 7intake for follow up treatment at Anson Gener...
4 . Pt diagnosed in Apr 1976 after he presented...
5 1-14-81 Communication with referring physician...
6 . Went to Emerson, in Newfane Alaska. Started ...
7 09/14/2000 CPT Code: 90792: With medical servi...
8 . Sep 2015- Transferred to Memorial Hospital f...
9 Born and raised in Fowlerville, IN. Parents d...
We can use a tool called datefinder to find the date in each row :
>>> import datefinder
>>> def find_date(df):
... return [match for match in datefinder.find_dates(df[0])]
>>> df["Vals"] = df.apply(find_date, axis=1)
>>> df
0 Vals
0 .Got back to U.S. Jan 27, 1983.\n [1983-01-27 00:00:00]
1 .On 21 Oct 1983 patient was discharged from Sc... [1983-10-21 00:00:00]
2 4-13-89 Communication with referring physician... [1989-04-13 00:00:00]
3 7intake for follow up treatment at Anson Gener... []
4 . Pt diagnosed in Apr 1976 after he presented... [1976-04-30 00:00:00, 2021-09-02 00:00:00, 202...
5 1-14-81 Communication with referring physician... [1981-01-14 00:00:00]
6 . Went to Emerson, in Newfane Alaska. Started ... [2002-09-30 00:00:00]
7 09/14/2000 CPT Code: 90792: With medical servi... [2000-09-14 00:00:00]
8 . Sep 2015- Transferred to Memorial Hospital f... [2015-09-30 00:00:00]
9 Born and raised in Fowlerville, IN. Parents d... [2003-09-30 00:00:00]
I'm trying to create a list of dates between a start date and an end date (done). But now, I want to FILTER weekends out of that list.
The start date is defined, but the end date is based on a number of working days after the start date. The problem is, when I create the list using the following formula, all dates in between are included and I've made numerous attempts to FILTER said dates using WORKDAY.INTL and REGEXMATCH without success. Is it possible to modify this particular formula or do I need to start over with something different?
=ArrayFormula(TO_DATE(row(indirect("A"&A2):indirect("A"&B2))))
Here is an example of what I've done.
This is what I'm getting:
Friday, October 4, 2019
Saturday, October 5, 2019
Sunday, October 6, 2019
Monday, October 7, 2019
Tuesday, October 8, 2019
Wednesday, October 9, 2019
Thursday, October 10, 2019
Friday, October 11, 2019
Saturday, October 12, 2019
Sunday, October 13, 2019
This is what I'm after:
Friday, October 4, 2019
Monday, October 7, 2019
Tuesday, October 8, 2019
Wednesday, October 9, 2019
Thursday, October 10, 2019
Friday, October 11, 2019
Monday, October 14, 2019
Tuesday, October 15, 2019
Wednesday, October 16, 2019
Thursday, October 17, 2019
See if this works
=query(ArrayFormula(TO_DATE(row(indirect("A"&A2):indirect("A"&B2)))), "where dayOfWeek(Col1) <> 7 and dayOfWeek(Col1) <> 1")
you can do it like this:
=ARRAYFORMULA(FILTER(ROW(INDIRECT("A"&A2&":A"&B2)),
REGEXMATCH(TEXT(ROW(INDIRECT("A"&A2&":A"&B2)), "ddd"), "[^(Sat|Sun)]")))
I am trying yo learn quantlib (1.3) & python bindings using quantlib-swig (1.2) in ubuntu 13.04. As a starter I am trying to determine the payment dates for a very simple bond as given below using 30/360 European day counter
from QuantLib import *
faceValue = 100.0
doi = Date(31, August, 2000)
dom = Date(31, August, 2008)
coupons = [0.05]
dayCounter = Thirty360(Thirty360.European)
schedule = Schedule(doi, dom, Period(Semiannual),
India(),
Unadjusted, Unadjusted,
DateGeneration.Backward, False)
Following are my questions:
Which method of schedule object will give me the payment dates?
Where do I need to specify the dayCounter object so that the dates are appropriately calculated?
Using Dimitri Reiswich' Presentation, I tried mimicking C++ code, but schedule.dates() returns an error as no such method.
The payment dates for this Fixed Rate bond are, (obtained by using oocalc)
Feb 28, 2001; Aug 31, 2001
Feb 28, 2002; Aug 31, 2002
Feb 28, 2003; Aug 31, 2003
Feb 29, 2004; Aug 31, 2004
Feb 28, 2005; Aug 31, 2005
Feb 28, 2006; Aug 31, 2006
Feb 28, 2007; Aug 31, 2007
Feb 29, 2008; Aug 31, 2008
How do I get the payment dates for this simple bond using python & quantlib? Can someone please help?
regards
K
If you want to look at the schedule you just generated, you can iterate over it:
>>> for d in schedule: print d
...
August 31st, 2000
February 28th, 2001
August 31st, 2001
February 28th, 2002
August 31st, 2002
February 28th, 2003
August 31st, 2003
February 29th, 2004
August 31st, 2004
February 28th, 2005
August 31st, 2005
February 28th, 2006
August 31st, 2006
February 28th, 2007
August 31st, 2007
February 29th, 2008
August 31st, 2008
or call list(schedule) if you want to store them. However, are you sure that those are the payment dates? They are the start and end date for accrual calculation; but some of these fall on a Saturday or a Sunday, and the bond will be paying on the next business day. You can see the effect if you instantiate the bond and retrieve the coupons:
>>> settlement_days = 3
>>> bond = FixedRateBond(settlement_days, faceValue, schedule, coupons, dayCounter)
>>> for c in bond.cashflows():
... print c.date()
...
February 28th, 2001
August 31st, 2001
February 28th, 2002
September 2nd, 2002
February 28th, 2003
September 1st, 2003
March 1st, 2004
August 31st, 2004
February 28th, 2005
August 31st, 2005
February 28th, 2006
August 31st, 2006
February 28th, 2007
August 31st, 2007
February 29th, 2008
September 1st, 2008
September 1st, 2008
(that is, unless Saturdays and Sundays shouldn't be holidays for the Indian calendar. If you think they shouldn't, file a bug report with QuantLib).
I have an assignees that I've been working on and I'm stuck on the last function.
use the function void Increment(int numDays = 1)
This function should move the date forward by the number of calendar days given in the argument. Default value on the parameter is 1 day. Examples:
Date d1(10, 31, 1998); // Oct 31, 1998
Date d2(6, 29, 1950); // June 29, 1950
d1.Increment(); // d1 is now Nov 1, 1998
d2.Increment(5); // d2 is now July 4, 1950
I don not understand how to do this.
void Date::Increment(int numDays = 1)
I'm stuck, I know how to tell the function to increment, by the ++ operator but i get confuse when I have to get the function to increment the last day of the month to the the fist, or to end at the last date of that month for example. Oct 31 to Nov 1, or June 29 to July 4. I can do July 5 to July 8 but the changing months confuse me
You will need to store a list (or array) of how many days are in each month. If you add numDays to the current date and it becomes bigger than this, you need to increment the month as well.
For example, we have a date object representing 29 March 2010. We call Increment(4) and add 4 to the day variable, ending up with 33 March 2010. We now check how many days March has and find out it's 31 (eg. daysInMonth[3] == 31). Since 33 is greater than 31, we need subtract 31 from 33 and increase the month, ending up with 2 April 2010.
You will need special handling for February in leap years (any year divisible by 4 and not divisible by 100 unless it's also divisible by 400) and for incrementing past the end of December.
30 days has September, April, June, and November. The rest have 31 days, except for February, which has 28 days except on a leap year (every 4 years, and 2008 was the last one) when it has 29 days.
This should be plenty to get you going.
First, construct a function like
int numDaysSinceBeginning( Date );
which counts number of days elapsed from a well known date (e.g. Jan 1 1900) to the specific Date.
Next, construct another function which converts that day-delta to Date
Date createDateWithDelta( int );
From your example,
Date d2(6, 29, 1950); // June 29, 1950
int d2Delta = numDaysSinceBeginnning( d2 );
Date d2Incremented = createDateWithDelta( d2Delta + 5 ); // d2Incremented is July 4, 1950