Vote count: -2 I want to sort associative array with specified sequence of values $arr = [ {"company"=>"A", "revenue_range"=>"10-100M"}, {"company"=>"B", "revenue_range"=>"0-10M"}, {"company"=>"C", "revenue_range"=>"10-100M"}, {"company"=>"D", "revenue_range"=>"100M-1B"}, {"company"=>"E", "revenue_range"=>">1B"}, {"company"=>"F", "revenue_range"=>"0-10M"} ]; Result:- $arr = [ {"company"=>"B", "revenue_range"=>"0-10M"}, {"company"=>"F", "revenue_range"=>"0-10M"}, {"company"=>"A", "revenue_range"=...
ادامه مطلبVote count: 0 how to check if ComputerHKEY_CURRENT_USERSoftwareClassestg exists or not by Javascript (Supported by All Browsers). asked 1 min agoBottledTurtles Let's block ads!...
ادامه مطلبVote count: 0 I want to check if some files are unpacked whe they are part of an allowed array of extensions. This is the extensions which are allowed to be unpacked: $AllowedExts = array("gif", "jpeg", "jpg", "JPG", "png", "tif", "tiff", "bmp", "zip", "rar", "js", "css", "txt", "less", "pdf", "mp3"); // set allowed extensions For unzipping, i have this code so far: if(in_array($ext, $AllowedExts)) { // only files with allowed Exts can be extracted $zip->extractTo(diame($_POST['extractfile']), $...
ادامه مطلبVote count: 0 var array:[Int] = [] var index = 5 if array[index] == nil { array[index] = 1 } Currently Xcode states that an int can not take the value of nil. So this code doesn't work. Is there any way to produce the same effect or verifying if a specific index is empty? asked 2 mins agojaems Let's block ads!...
ادامه مطلبVote count: 0 I am trying to create a new array from existing array. Condition is that if element is duplicate then sum those elements. Please see below example for details as may be I am not able to explain clearly: Input: var arrayA = ["2", "1", "4", "2", "5", "1", "3", "2"]; Output: var arrayB = ["6", "2", "4", "5", "3"]; here arrayB[0] = sum of 2s (2+2+2), arrayB[1] = sum of 1s (1+1) I tried a lot but not able to figure out how I can achieve this. Please help! asked 41 secs agoVicJordan Let'...
ادامه مطلبVote count: 0 I'm working on a script that compares an AD user's group memberships to an existing list. One of the things I want to check for is if the user does not belong to any of the groups on the list and only to the default "Domain Users" group that all domain users are a part of, then it should output a message like, "TestUser01 is not a member of any of the groups" Is there an operator that can check to see if that is the only value that exists? My script may be a bit odd since it's not ...
ادامه مطلبVote count: -1 Let's say I have a string, could be '2016-01-01' or with a time '2016-01-01 10:23:56', how can I identify if I'm receiving a date or a datetime ? asked 8 mins agocarlosm Let's block ads!...
ادامه مطلبVote count: 0 How can I make a loop that loops 20 times and adds 20 different things to an array and an object? Please help, I know this is basic stuff I just can't figure it out for some reason. asked 1 min agoMichael M Let's block ads!...
ادامه مطلبVote count: -1 I have a file with information about sequences. Every sequence has some lines. The sequences are separated by five white lines. I want to change the file into a list, and split it by 5 newlines. So that I have a list, with every sequence as one element. Then I want to remove the sequences that not contain the regular expression. At the end, I want a list, with only the sequences that contain the regex. Now I have this. Can anyone help me further? import re def main(): ReadFile() f...
ادامه مطلبVote count: 0 I have a json array which looks like { [{ "name": "ABCDEF", "details": { "code": null, "description": null, "range": { "fromNo": "00174", "toNo": "99999" } } }, { "name": "ABCDEF", "details": { "code": null, "description": null, "range": { "fromSerialNo": "00001", "toSerialNo": "00060" }, { "name": "ABCDEF", "details": { "code": null, "description": null, "range": { "fromSerialNo": "00061", "toSerialNo": "00173" }] } and I want the output as { "name": "ABCDEF", "details": { "code":...
ادامه مطلبVote count: 0 I have this method on c# and want to write same code on java. how to do this? public static bool VerifyXMLSignatureV2(XmlElement ecKeyValue, XmlElement SignatureElement, ref X509Certificate2 Certificate) { var signedXml = new SignedXml(Xml); signedXml.LoadXml(SignatureElement); foreach (var keyInfo in signedXml.KeyInfo) { if (keyInfo is KeyInfoX509Data) { var ki = keyInfo as KeyInfoX509Data; if (ki.Certificates.Count > 0 && ki.Certificates[0] is X509Certificate2) { Certificate = ki...
ادامه مطلبVote count: 0 I know, TL;DR - please bear with me. This Javascript function is supposed to take in two strings inputted by the user (useame, password), guess both fields correctly using the random function to generate random character guesses (out 92 characters) that are stored in a "guess array," and also tell how many times (trials) it took to guess both your useame and password in the same instance by comparing the values of two sets of two arrays: the guess array for the useame vs the user i...
ادامه مطلبVote count: 0 Im not very skilled in javascript so please be bear with me. Safari 6 and below and older android mobile browsers and maybe more do not support the css value VH. My DIV#id or class is not the height of the viewport. Below is a link to a page i found some useful information, but im really not sure how to use it with a css value: Check whether a css value is supported Here is the code given as a shortcut for you: if('opacity' in document.body.style) { // do stuff } function isPropert...
ادامه مطلبVote count: 0 My PDF will only support two lines (I predefined the dimensions of the input box on the PDF). Is there a way to check if user input on the front end will only make up to two lines on the PDF side? I tried to see if I could find character width lengths and then adding up the lengths of the characters the user enters, but that didn't go anywhere. asked 3 mins agoimonlyacontractor Let's block ads!...
ادامه مطلبVote count: 0 I have the following code in a playground file: extension Dictionary { func test() { for key in self.keys { self[key] } } } var dict: [String: AnyObject?] = [ "test": nil ] dict.test() I will henceforth refer to the line within the for-each loop as the output since it is what's relevant. In this particular instance the output is nil. When I change the for-each loop to look like this: for key in self.keys { print(self[key]) } The output is "Optional(nil)n". What I really want to do ...
ادامه مطلبVote count: 0 For the life of me I don't understand why this doesn't work. It looks similar if not identical to many solutions i've seen. Clearly there is something i'm missing. If anyone would care to explain id appreciate it. var isEven = function(number) { if (isEven % 2 === 0) { retu true; } else { retu false; } }; asked 1 min agoDane Christian This entry passed through the Full-Text RSS service - if this is your content and you're reading it on someone else's site, please read the FAQ at fi...
ادامه مطلبVote count: 0 If a number is 2017 and I divide it by 4, I get 504.25. if the number is 2016 an I divide it by 4, I get 504. My question is, is there a way to use perl to check if a number that was divided, if the answer is a whole number and has NO decimal at all? Thanks, -Rich asked 2 mins agoRichard Jones This entry passed through the Full-Text RSS service - if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publish...
ادامه مطلبVote count: -1 I have an array which contains 4 different objects and looks like this: [ { a: 1, b: 12, c: 3 }, { a: 15, d: 1, e: 8 }, {b: 2, d:6 }, {a: 1} ] I want to retu one object with the sum of each object's values added together. I am looking to retu the following object: {a: 17, b: 14, c: 3, d: 7; e: 8} I have attempted many different solutions, and also checked here for which I surprisingly could not find a solution. This was as close as I found, but could still not solve the issue. ask...
ادامه مطلبVote count: -2 I have a int for example: 151515 1 1111111 4848484 111 888 I need to test/check if the number contains only 1s, valid examples:111111111111111111 Invalid examples:88888888888888555547477889Any suggestion?Probably any regex? or there is a fast solution without regex and keep the value as an int without parsing it to String. asked 1 min agoMiguel Reyes 1 Answer Vote count: 0 Convert int to string first. Then try this regex: "^[1]*$" answered 13 secs agoThisaru Guruge This entry pass...
ادامه مطلب