[Solved] Python – How to replace adjacent list elements with a different value

And yes , you can just pass with if/else and for loops : a = [[0,0,0,0,0], [0,1,1,0,0], [0,1,0,1,0], [0,0,1,0,0], [0,0,0,0,0]] to_replace = 1 replacement = 9 for i in range(len(a)): for x in range(len(a[i])): if a[i][x] == to_replace: for pos_x in range(i-1,i+2): for pos_y in range(x-1,x+2): try: if a[pos_x][pos_y] != to_replace: a[pos_x][pos_y] = replacement except … Read more

[Solved] Split the string an get the text [duplicate]

NOTE: Actually technique fabian’s using with Pattern and Matcher is far more correct and elegant, but code provided there is not returning values required by OP . You can use String::split(String). It takes a regular expression to split, so use it, [] means containing one of… so putting | inside will match what you want: … Read more

[Solved] How to call a C++ function in a C++ Program [duplicate]

The function program is not known to the compiler since it’s declared after your main function. You must declare it before like so int program(); // Declares the function program int main() { program(); // function is declared, the compiler knows its return-type, name and parameters return 0; } // Here is the function definition … Read more

[Solved] Is it possible to reverse MD5? [duplicate]

MD5 is a cryptographic hash function. Cryptographic hashes are one way functions. You cannot reverse a cryptographic hash value, but you can brute force messages to find one. Brute forcing means trying all possible input strings and then checking if the hash value is correct. This is possible because cryptographic hashes are also computationally unique. … Read more

[Solved] Handling pairs of pattern matching in multiple excel files through VB macros

Your setup as best I could understand it: And… This is the code I wrote: Option Explicit Option Base 1 Sub CopyData() Dim XLout As Workbook ‘Excel_Out.xls Dim XLin1 As Workbook ‘Excel_In1.xls Dim XLin2 As Workbook ‘Excel_In2.xls Dim ProductList ‘Product/Company List from XLin1 Dim ProductListO() ‘Concatenated Version of above Dim DataList ‘Product/Company List from XLin2 … Read more

[Solved] Write a js script in a div

Don’t use document.write, it does not do what you think it does. What it does not do is write some data at the end of the document. What it does instead, is pipe data into the current write stream. And if there is no write stream, it will make a new one, resetting the document’s … Read more

[Solved] Compare keys of array in RUBY

I corrected your code also as per your need, and solved further, $ArrayX = [8349310431,8349314513] $ArrayY = [667984788,667987788] $ArrayZ = [148507632380,153294624079] $range_map = $ArrayX.zip([$ArrayY.map(&:to_i), $ArrayZ.map(&:to_i)].transpose).sort $ArrayX = [8349310431,8349314513] => [8349310431, 8349314513] $ArrayY = [667984788,667987788] => [667984788, 667987788] $ArrayZ = [148507632380,153294624079] => [148507632380, 153294624079] $range_map = Hash[$ArrayX.zip([$ArrayY.map(&:to_i), $ArrayZ.map(&:to_i)].transpose).sort] => {8349310431=>[667984788, 148507632380], 8349314513=>[667987788, 153294624079]} keys = $range_map.keys … Read more

[Solved] How can we evaluate a Gaussian in an intensity of an Image? [closed]

Not quite. Basically you are manually coding formula (9) from here. Then: … exponent = ((x-rho).^2 + (y-theta).^2)./(2*sigma^2); % sigma is also squared val = exp(-exponent); % superfluous bracket removed val = val./(2*pi*sigma^2); % you also forgot the denominator part end Of course you could write the whole thing a bit more efficient. But unless … Read more

[Solved] Time string to a different DateTime format in c# [closed]

Assuming timeDeparture.Text has Format h:mm tt like 9:10 pm, you have to parse it first into DateTime and use .ToString() to bring it into the desired 24h format. In .NET h is for 12h format and H represents 24h format. string timeDeparture = “10:30 PM”; DateTime parsedResult = DateTime.ParseExact(timeDeparture, “h:mm tt”, System.Globalization.CultureInfo.InvariantCulture); string result = … Read more

[Solved] Change the sequence of div an span in this Javascript

First you need to revert your js file to unminify: ! function(e) { “use strict”; var t = e, i = t.document, o = “cbinstance”; var n = { get: function(e) { return decodeURIComponent(i.cookie.replace(new RegExp(“(?:(?:^|.*;)\\s*” + encodeURIComponent(e).replace(/[\-\.\+\*]/g, “\\$&”) + “\\s*\\=\\s*([^;]*).*$)|^.*$”), “$1”)) || null }, set: function(e, t, o, n, s, r) { if (!e || … Read more

[Solved] error while taking String input in java [closed]

java.util.InputMismatchException-In order to deal with this exception you must verify that the input data of your application meet its specification. When this error is thrown, the format of the input data is incorrect and thus, you must fix it, in order for your application to proceed its execution. 11 solved error while taking String input … Read more