diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2024-03-05 12:32:31 +0000 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2024-03-05 12:32:31 +0000 |
| commit | 9afcaea2974dfbb52662e6fc3802bef0c64e65be (patch) | |
| tree | 03a0bcb9ade10a975577e5003f2f98914f59ec13 | |
| parent | 7a8545402b45caae224420ec9811914daa1a06ec (diff) | |
| download | perlweeklychallenge-club-9afcaea2974dfbb52662e6fc3802bef0c64e65be.tar.gz perlweeklychallenge-club-9afcaea2974dfbb52662e6fc3802bef0c64e65be.tar.bz2 perlweeklychallenge-club-9afcaea2974dfbb52662e6fc3802bef0c64e65be.zip | |
- Added solutions by Peter Meszaros.
- Added solutions by Dave Jacoby.
- Added solutions by Mark Anderson.
- Added solutions by Roger Bell_West.
- Added solutions by Mariano Spadaccini.
| -rwxr-xr-x | challenge-259/eric-cheung/python/ch-1.py | 23 | ||||
| -rwxr-xr-x | challenge-259/eric-cheung/python/ch-2.py | 57 | ||||
| -rw-r--r-- | stats/pwc-current.json | 136 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown-summary.json | 32 | ||||
| -rw-r--r-- | stats/pwc-language-breakdown.json | 1620 | ||||
| -rw-r--r-- | stats/pwc-leaders.json | 432 | ||||
| -rw-r--r-- | stats/pwc-summary-1-30.json | 96 | ||||
| -rw-r--r-- | stats/pwc-summary-121-150.json | 54 | ||||
| -rw-r--r-- | stats/pwc-summary-151-180.json | 58 | ||||
| -rw-r--r-- | stats/pwc-summary-181-210.json | 86 | ||||
| -rw-r--r-- | stats/pwc-summary-211-240.json | 116 | ||||
| -rw-r--r-- | stats/pwc-summary-241-270.json | 116 | ||||
| -rw-r--r-- | stats/pwc-summary-271-300.json | 40 | ||||
| -rw-r--r-- | stats/pwc-summary-301-330.json | 54 | ||||
| -rw-r--r-- | stats/pwc-summary-31-60.json | 118 | ||||
| -rw-r--r-- | stats/pwc-summary-61-90.json | 108 | ||||
| -rw-r--r-- | stats/pwc-summary-91-120.json | 48 | ||||
| -rw-r--r-- | stats/pwc-summary.json | 62 |
18 files changed, 1700 insertions, 1556 deletions
diff --git a/challenge-259/eric-cheung/python/ch-1.py b/challenge-259/eric-cheung/python/ch-1.py new file mode 100755 index 0000000000..794b79e029 --- /dev/null +++ b/challenge-259/eric-cheung/python/ch-1.py @@ -0,0 +1,23 @@ +
+from datetime import datetime, timedelta
+
+strDateFormat = "%Y-%m-%d"
+
+## Example 1
+## strStartDate = "2018-06-28"
+## nOffset = 3
+## arrBankHoliday = ["2018-07-03"]
+
+## Example 2
+strStartDate = "2018-06-28"
+nOffset = 3
+arrBankHoliday = []
+
+objOutputDate = datetime.strptime(strStartDate, strDateFormat)
+
+while nOffset > 0:
+ objOutputDate = objOutputDate + timedelta(days = 1)
+ if objOutputDate.weekday() < 5 and not objOutputDate.strftime(strDateFormat) in arrBankHoliday:
+ nOffset = nOffset - 1
+
+print (objOutputDate.strftime(strDateFormat))
diff --git a/challenge-259/eric-cheung/python/ch-2.py b/challenge-259/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..271db58f8a --- /dev/null +++ b/challenge-259/eric-cheung/python/ch-2.py @@ -0,0 +1,57 @@ +
+## Remarks
+## https://stackoverflow.com/questions/74569246/replace-space-in-between-double-quote-to-underscore
+
+import json
+import re
+
+def GetDoubleQuote (strInput):
+ if strInput[0] == "\"":
+ return strInput
+ return "\"" + strInput + "\""
+
+def repl(strInput):
+ return strInput[0].replace(' ', '^')
+
+
+## strLineInput = '{% id field1="value1" field2="value2" field3=42 %}' ## Example 1
+## strLineInput = '{% youtube title="Title \"quoted\" done" %}' ## Example 2
+## strLineInput = '{% youtube title="Title quoted done" %}' ## Example 3
+## strLineInput = '{% youtube title="Title with escaped backslash \\" %}' ## Example 4
+## strLineInput = '{% id %}' ## Example 5
+strLineInput = '''
+{% id field1="value1" field2="value2" field3=42 %}
+LINES
+{% endid %}
+''' ## Example 6
+
+bMultipleLine = False
+arrMultipleLineSplit = strLineInput.split("\n")
+
+if len(arrMultipleLineSplit) > 1:
+ bMultipleLine = True
+ strLineInput = arrMultipleLineSplit[1]
+
+strReplacePattern = re.compile(r'\"[^\"]+\"')
+strLineInput = re.sub(strReplacePattern, repl, strLineInput)
+
+arrLineSplit = strLineInput.replace("%", "").split()
+arrLineSplit = [elemLoop.replace('^', ' ') for elemLoop in arrLineSplit]
+
+arrLineSplit[1] = GetDoubleQuote("name") + " : " + GetDoubleQuote(arrLineSplit[1])
+for nIndx in range(2, len(arrLineSplit) - 1):
+ arrLineSplit[nIndx] = " : ".join([GetDoubleQuote(elemLoop) if nIndx == 0 else elemLoop for nIndx, elemLoop in enumerate(arrLineSplit[nIndx].split("="))])
+
+strJsonOutput = "{" + arrLineSplit[1]
+if len(arrLineSplit) > 3:
+ strJsonOutput = strJsonOutput + ", " + GetDoubleQuote("fields") + " : " + "{" + ", ".join(arrLineSplit[2:-1]) + "}"
+
+if bMultipleLine:
+ strJsonOutput = strJsonOutput + ", " + GetDoubleQuote("text") + " : " + GetDoubleQuote(arrMultipleLineSplit[2])
+
+strJsonOutput = strJsonOutput + "}"
+
+## print (arrLineSplit)
+## print (strJsonOutput)
+print (json.loads(strJsonOutput))
+## print (json.loads(strJsonOutput)["name"])
diff --git a/stats/pwc-current.json b/stats/pwc-current.json index 8498152edf..0d00311865 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,21 +1,32 @@ { + "title" : { + "text" : "The Weekly Challenge - 259" + }, + "xAxis" : { + "type" : "category" + }, "series" : [ { "data" : [ { "y" : 2, - "drilldown" : "David Ferrone", - "name" : "David Ferrone" + "drilldown" : "Dave Jacoby", + "name" : "Dave Jacoby" }, { + "name" : "David Ferrone", "y" : 2, - "drilldown" : "E. Choroba", - "name" : "E. Choroba" + "drilldown" : "David Ferrone" }, { + "name" : "E. Choroba", "y" : 2, + "drilldown" : "E. Choroba" + }, + { + "name" : "Feng Chang", "drilldown" : "Feng Chang", - "name" : "Feng Chang" + "y" : 2 }, { "name" : "Luca Ferrari", @@ -23,29 +34,44 @@ "y" : 11 }, { - "name" : "Mark Anderson", "y" : 1, + "drilldown" : "Mariano Spadaccini", + "name" : "Mariano Spadaccini" + }, + { + "name" : "Mark Anderson", + "y" : 2, "drilldown" : "Mark Anderson" + }, + { + "name" : "Peter Meszaros", + "drilldown" : "Peter Meszaros", + "y" : 2 + }, + { + "name" : "Roger Bell_West", + "drilldown" : "Roger Bell_West", + "y" : 2 } ], "name" : "The Weekly Challenge - 259", "colorByPoint" : 1 } ], - "title" : { - "text" : "The Weekly Challenge - 259" + "legend" : { + "enabled" : 0 }, "drilldown" : { "series" : [ { - "id" : "David Ferrone", + "name" : "Dave Jacoby", + "id" : "Dave Jacoby", "data" : [ [ "Perl", 2 ] - ], - "name" : "David Ferrone" + ] }, { "data" : [ @@ -54,21 +80,30 @@ 2 ] ], + "id" : "David Ferrone", + "name" : "David Ferrone" + }, + { + "id" : "E. Choroba", "name" : "E. Choroba", - "id" : "E. Choroba" + "data" : [ + [ + "Perl", + 2 + ] + ] }, { - "id" : "Feng Chang", "data" : [ [ "Raku", 2 ] ], - "name" : "Feng Chang" + "name" : "Feng Chang", + "id" : "Feng Chang" }, { - "name" : "Luca Ferrari", "data" : [ [ "Raku", @@ -79,22 +114,67 @@ 9 ] ], - "id" : "Luca Ferrari" + "id" : "Luca Ferrari", + "name" : "Luca Ferrari" }, { - "id" : "Mark Anderson", + "name" : "Mariano Spadaccini", + "id" : "Mariano Spadaccini", + "data" : [ + [ + "Perl", + 1 + ] + ] + }, + { + "data" : [ + [ + "Raku", + 2 + ] + ], "name" : "Mark Anderson", + "id" : "Mark Anderson" + }, + { + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "Peter Meszaros", + "name" : "Peter Meszaros" + }, + { "data" : [ [ + "Perl", + 1 + ], + [ "Raku", 1 ] - ] + ], + "id" : "Roger Bell_West", + "name" : "Roger Bell_West" } ] }, - "legend" : { - "enabled" : 0 + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, + "subtitle" : { + "text" : "[Champions: 9] Last updated at 2024-03-05 12:27:05 GMT" + }, + "tooltip" : { + "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>", + "followPointer" : 1, + "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>" }, "plotOptions" : { "series" : { @@ -107,21 +187,5 @@ }, "chart" : { "type" : "column" - }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } - }, - "tooltip" : { - "followPointer" : 1, - "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>", - "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>" - }, - "subtitle" : { - "text" : "[Champions: 5] Last updated at 2024-03-04 19:05:07 GMT" - }, - "xAxis" : { - "type" : "category" } } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index 8c85378f64..b53458fd58 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -2,8 +2,11 @@ "tooltip" : { "pointFormat" : "<b>{point.y:.0f}</b>" }, + "chart" : { + "type" : "column" + }, "subtitle" : { - "text" : "Last updated at 2024-03-04 19:05:07 GMT" + "text" : "Last updated at 2024-03-05 12:27:05 GMT" }, "yAxis" : { "min" : 0, @@ -14,12 +17,8 @@ "legend" : { "enabled" : "false" }, - "chart" : { - "type" : "column" - }, "series" : [ { - "name" : "Contributions", "data" : [ [ "Blog", @@ -27,37 +26,38 @@ ], [ "Perl", - 13351 + 13357 ], [ "Raku", - 7766 + 7768 ] ], + "name" : "Contributions", "dataLabels" : { - "rotation" : -90, + "color" : "#FFFFFF", "style" : { "fontFamily" : "Verdana, sans-serif", "fontSize" : "13px" }, - "color" : "#FFFFFF", - "y" : 10, "align" : "right", "format" : "{point.y:.0f}", - "enabled" : "true" + "y" : 10, + "enabled" : "true", + "rotation" : -90 } } ], - "title" : { - "text" : "The Weekly Challenge Contributions [2019 - 2024]" - }, "xAxis" : { + "type" : "category", "labels" : { "style" : { "fontFamily" : "Verdana, sans-serif", "fontSize" : "13px" } - }, - "type" : "category" + } + }, + "title" : { + "text" : "The Weekly Challenge Contributions [2019 - 2024]" } } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index bff59a5891..cfb1582c16 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,6 +1,8 @@ { - "xAxis" : { - "type" : "category" + "tooltip" : { + "pointFormat" : "<span style=\"color:{point.color}\">Challenge {point.name}</span>: <b>{point.y:f}</b><br/>", + "followPointer" : "true", + "headerFormat" : "<span style=\"font-size:11px\"></span>" }, "chart" : { "type" : "column" @@ -14,13 +16,19 @@ } } }, - "legend" : { - "enabled" : "false" + "subtitle" : { + "text" : "Click the columns to drilldown the language breakdown. Last updated at 2024-03-05 12:27:05 GMT" + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } }, "drilldown" : { "series" : [ { "name" : "001", + "id" : "001", "data" : [ [ "Perl", @@ -34,10 +42,10 @@ "Blog", 12 ] - ], - "id" : "001" + ] }, { + "id" : "002", "name" : "002", "data" : [ [ @@ -52,11 +60,9 @@ "Blog", 10 ] - ], - "id" : "002" + ] }, { - "id" : "003", "data" : [ [ "Perl", @@ -71,9 +77,11 @@ 9 ] ], + "id" : "003", "name" : "003" }, { + "name" : "004", "id" : "004", "data" : [ [ @@ -88,12 +96,11 @@ "Blog", 10 ] - ], - "name" : "004" + ] }, { - "id" : "005", "name" : "005", + "id" : "005", "data" : [ [ "Perl", @@ -147,6 +154,7 @@ }, { "id" : "008", + "name" : "008", "data" : [ [ "Perl", @@ -160,11 +168,9 @@ "Blog", 12 ] - ], - "name" : "008" + ] }, { - "id" : "009", "data" : [ [ "Perl", @@ -179,9 +185,11 @@ 13 ] ], + "id" : "009", "name" : "009" }, { + "id" : "010", "name" : "010", "data" : [ [ @@ -196,12 +204,11 @@ "Blog", 11 ] - ], - "id" : "010" + ] }, { - "id" : "011", "name" : "011", + "id" : "011", "data" : [ [ "Perl", @@ -236,8 +243,6 @@ "id" : "012" }, { - "id" : "013", - "name" : "013", "data" : [ [ "Perl", @@ -251,9 +256,12 @@ "Blog", 13 ] - ] + ], + "name" : "013", + "id" : "013" }, { + "id" : "014", "name" : "014", "data" : [ [ @@ -268,10 +276,11 @@ "Blog", 15 ] - ], - "id" : "014" + ] }, { + "id" : "015", + "name" : "015", "data" : [ [ "Perl", @@ -285,12 +294,11 @@ "Blog", 15 ] - ], - "name" : "015", - "id" : "015" + ] }, { "name" : "016", + "id" : "016", "data" : [ [ "Perl", @@ -304,12 +312,11 @@ "Blog", 13 ] - ], - "id" : "016" + ] }, { - "id" : "017", "name" : "017", + "id" : "017", "data" : [ [ "Perl", @@ -327,6 +334,7 @@ }, { "id" : "018", + "name" : "018", "data" : [ [ "Perl", @@ -340,12 +348,9 @@ "Blog", 14 ] - ], - "name" : "018" + ] }, { - "id" : "019", - "name" : "019", "data" : [ [ "Perl", @@ -359,10 +364,13 @@ "Blog", 13 ] - ] + ], + "name" : "019", + "id" : "019" }, { "id" : "020", + "name" : "020", "data" : [ [ "Perl", @@ -376,11 +384,11 @@ "Blog", 13 ] - ], - "name" : "020" + ] }, { "name" : "021", + "id" : "021", "data" : [ [ "Perl", @@ -394,12 +402,9 @@ "Blog", 10 ] - ], - "id" : "021" + ] }, { - "id" : "022", - "name" : "022", "data" : [ [ "Perl", @@ -413,7 +418,9 @@ "Blog", 10 ] - ] + ], + "name" : "022", + "id" : "022" }, { "data" : [ @@ -434,8 +441,8 @@ "id" : "023" }, { - "id" : "024", "name" : "024", + "id" : "024", "data" : [ [ "Perl", @@ -452,8 +459,6 @@ ] }, { - "id" : "025", - "name" : "025", "data" : [ [ "Perl", @@ -467,10 +472,13 @@ "Blog", 12 ] - ] + ], + "id" : "025", + "name" : "025" }, { "name" : "026", + "id" : "026", "data" : [ [ "Perl", @@ -484,12 +492,9 @@ "Blog", 10 ] - ], - "id" : "026" + ] }, { - "id" : "027", - "name" : "027", "data" : [ [ "Perl", @@ -503,10 +508,11 @@ "Blog", 9 ] - ] + ], + "id" : "027", + "name" : "027" }, { - "name" : "028", "data" : [ [ "Perl", @@ -521,9 +527,12 @@ 9 ] ], + "name" : "028", "id" : "028" }, { + "name" : "029", + "id" : "029", "data" : [ [ "Perl", @@ -537,12 +546,9 @@ "Blog", 12 ] - ], - "name" : "029", - "id" : "029" + ] }, { - "id" : "030", "data" : [ [ "Perl", @@ -557,9 +563,12 @@ 10 ] ], - "name" : "030" + "name" : "030", + "id" : "030" }, { + "id" : "031", + "name" : "031", "data" : [ [ "Perl", @@ -573,9 +582,7 @@ "Blog", 9 ] - ], - "name" : "031", - "id" : "031" + ] }, { "id" : "032", @@ -596,7 +603,6 @@ ] }, { - "name" : "033", "data" : [ [ "Perl", @@ -611,7 +617,8 @@ 10 ] ], - "id" : "033" + "id" : "033", + "name" : "033" }, { "id" : "034", @@ -632,6 +639,8 @@ ] }, { + "id" : "035", + "name" : "035", "data" : [ [ "Perl", @@ -645,12 +654,9 @@ "Blog", 9 ] - ], - "name" : "035", - "id" : "035" + ] }, { - "id" : "036", "data" : [ [ "Perl", @@ -665,9 +671,11 @@ 11 ] ], + "id" : "036", "name" : "036" }, { + "id" : "037", "name" : "037", "data" : [ [ @@ -682,12 +690,9 @@ "Blog", 9 ] - ], - "id" : "037" + ] }, { - "id" : "038", - "name" : "038", "data" : [ [ "Perl", @@ -701,11 +706,11 @@ "Blog", 12 ] - ] + ], + "name" : "038", + "id" : "038" }, { - "id" : "039", - "name" : "039", "data" : [ [ "Perl", @@ -719,10 +724,13 @@ "Blog", 12 ] - ] + ], + "name" : "039", + "id" : "039" }, { "id" : "040", + "name" : "040", "data" : [ [ "Perl", @@ -736,11 +744,11 @@ "Blog", 10 ] - ], - "name" : "040" + ] }, { "id" : "041", + "name" : "041", "data" : [ [ "Perl", @@ -754,12 +762,9 @@ "Blog", 9 ] - ], - "name" : "041" + ] }, { - "id" : "042", - "name" : "042", "data" : [ [ "Perl", @@ -773,7 +778,9 @@ "Blog", 11 ] - ] + ], + "id" : "042", + "name" : "042" }, { "id" : "043", @@ -808,11 +815,12 @@ 11 ] ], - "name" : "044", - "id" : "044" + "id" : "044", + "name" : "044" }, { "name" : "045", + "id" : "045", "data" : [ [ "Perl", @@ -826,12 +834,9 @@ "Blog", 11 ] - ], - "id" : "045" + ] }, { - "id" : "046", - "name" : "046", "data" : [ [ "Perl", @@ -845,9 +850,13 @@ "Blog", 10 ] - ] + ], + "name" : "046", + "id" : "046" }, { + "id" : "047", + "name" : "047", "data" : [ [ "Perl", @@ -861,12 +870,9 @@ "Blog", 10 ] - ], - "name" : "047", - "id" : "047" + ] }, { - "name" : "048", "data" : [ [ "Perl", @@ -881,9 +887,11 @@ 12 ] ], - "id" : "048" + "id" : "048", + "name" : "048" }, { + "id" : "049", "name" : "049", "data" : [ [ @@ -898,11 +906,9 @@ "Blog", 12 ] - ], - "id" : "049" + ] }, { - "id" : "050", "data" : [ [ "Perl", @@ -917,10 +923,10 @@ 12 ] ], + "id" : "050", "name" : "050" }, { - "name" : "051", "data" : [ [ "Perl", @@ -935,10 +941,10 @@ 11 ] ], - "id" : "051" + "id" : "051", + "name" : "051" }, { - "id" : "052", "data" : [ [ "Perl", @@ -953,7 +959,8 @@ 14 ] ], - "name" : "052" + "name" : "052", + "id" : "052" }, { "id" : "053", @@ -974,8 +981,6 @@ ] }, { - "id" : "054", - "name" : "054", "data" : [ [ "Perl", @@ -989,7 +994,9 @@ "Blog", 18 ] - ] + ], + "id" : "054", + "name" : "054" }, { "data" : [ @@ -1010,8 +1017,6 @@ "id" : "055" }, { - "id" : "056", - "name" : "056", "data" : [ [ "Perl", @@ -1025,10 +1030,11 @@ "Blog", 17 ] - ] + ], + "id" : "056", + "name" : "056" }, { - "name" : "057", "data" : [ [ "Perl", @@ -1043,11 +1049,10 @@ 15 ] ], + "name" : "057", "id" : "057" }, { < |
