[Solved] Find RegEx for Pattern [closed]

Unless the text always comes in a very regular fashion, regex is not a suitable for parsing source code like this. You should write/use a parser instead. Assuming: There will be no DECLARE statements between CREATE FUNCTION and BEGIN There will not be any other statements in between the DECLARE statements There will always be … Read more

[Solved] How to declare and initialize multiple variables (with different names) within a for loop without using arrays?

You cannot create dynamically named variables in C# (and I am with those who are wondering why you want to do that). If you don’t want to use an array, consider a Dictionary — it would perform better than an array in some circumstances. Dictionary<string, int> values = new Dictionary<string, int>(); for (int i = … Read more

[Solved] Swift Nested If statements do not compile

It should be like this: func getWeight() -> String { if weightLabel.text == “Weight (lbs)” { if pickerView == heightPicker { let titleRow = height[row] return titleRow } else if pickerView == weightPicker { let titleRow = weight[row] return titleRow } return “” } else if weightLabel.text == “Weight (kgs)” { if pickerView == heightPicker … Read more

[Solved] How to order descending JSON content [closed]

Managed to get it working using JObject but it’s not pretty: var json = “{\r\n\”Threads\”: \r\n{\r\n \”Program1\” : \r\n {\r\n \”Filepath\”: \”C:\\\\ProgramFiles(x86)…\”,\r\n \”Priority\”: 0\r\n },\r\n \”Program2\” : \r\n {\r\n \”Filepath\”: \”C:\\\\ProgramFiles(x86)…\”,\r\n \”Priority\”: 1\r\n },\r\n \”Program3\” : \r\n {\r\n \”Filepath\”: \”C:\\\\ProgramFiles(x86)…\”,\r\n \”Priority\”: 3\r\n }\r\n}}”; var obj = JObject.Parse(json); var threads = (JObject)obj[“Threads”]; var sortedObj = new … Read more

[Solved] This question is asked in a coding test. I am unable to find the solution till now [closed]

You could first think about how many operations it would cost to get all values to the highest value in the list. In a second step you can think if there could be a better solution if you try to reach highest-value+1, highest-value+2, highest-value+3, highest-value+4 . solved This question is asked in a coding test. … Read more

[Solved] Browse directory recursively and get files name

Since I’ve had to create the same functionality for a website of mine too, I’ll post my function as reference. function recursiveFileSearch($path, $searchmask = “*”) { $path = rtrim($path, “https://stackoverflow.com/”); $files = array(); if(is_array($searchmask)) { for($i = 0; $i < count($searchmask); $i++) { $files = array_merge($files, glob($path.”https://stackoverflow.com/”.$searchmask[$i])); } sort($files); } else { $files = glob($path.”https://stackoverflow.com/”.$searchmask); … Read more

[Solved] How to remove the background of an object using OpenCV (Python) [closed]

You mean this? : import cv2 import numpy as np img = cv2.imread(“image.jpg”) hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) mask = cv2.inRange(hsv, (0, 0, 0), (75, 255, 255)) imask = mask > 0 green = np.zeros_like(img, np.uint8) green[imask] = img[imask] cv2.imwrite(“result.png”, green) Output 1 solved How to remove the background of an object using OpenCV (Python) [closed]

[Solved] merge list of nested list to a single list which has lakhs of data python [duplicate]

from itertools import chain l = [[‘password’, ‘_rev’, ‘_id’, ‘username’], [‘password’, ‘_rev’, ‘_id’, ‘username’, ‘name’], [‘password’, ‘_rev’, ‘_id’, ‘username’],[‘password’, ‘_rev’, ‘_id’, ‘username’,’country’]] list(set(chain(*l))) Output – [‘username’, ‘_rev’, ‘_id’, ‘name’, ‘password’, ‘country’] solved merge list of nested list to a single list which has lakhs of data python [duplicate]

[Solved] How I can Convert T-SQL to Linq C#

surecModel = Surecler.Select(s=> new { s.SurecId , s.Damga}) .Distinct() // .Join( db.WEB_SURECROL.DefaultIfEmpty(), SURECDAMGALAR => SURECDAMGALAR.SurecId, SURECROLLER => SURECROLLER.SurecID, (SURECDAMGALAR, SURECROLLER) => new { SURECDAMGALAR, SURECROLLER }) // .GroupJoin(Surecler.DefaultIfEmpty(), surecTanim => new { surecTanim.SURECDAMGALAR.Damga,surecTanim.SURECROLLER.RolId }, SUREC_LIST => new { SUREC_LIST.Damga,SUREC_LIST.RolId }, (surecTanim,SUREC_LIST) => new {surecTanim,SUREC_LIST } ) // .Select(x=> new { x.surecTanim.SURECROLLER.WEB_SURECTANIM.SurecAdi, x.surecTanim.SURECROLLER.WEB_SURECTANIM.SurecTip, x.SUREC_LIST.FirstOrDefault().Damga, x.SUREC_LIST.FirstOrDefault().OnayDurumu, x.surecTanim.SURECROLLER.WEB_ROL.RolAdi, … Read more

[Solved] Looking for a regex to validate Cuban identity card

Note: this is uses rough date validation via pure RegEx (ie. any month can have up to 31 days): [0-9]{2}(?:0[0-9]|1[0-2])(?:0[1-9]|[12][0-9]|3[01])[0-9]{5} You can test if a string matches via JavaScript like so: /[0-9]{2}(?:0[0-9]|1[0-2])(?:0[1-9]|[12][0-9]|3[01])[0-9]{5}/.test(‘82061512345’); // returns true because it is valid If you need true date validation I would do something like the following: var id1 = … Read more