This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def remove_duplicates(numbers): | |
| duplicates = [] | |
| for num in numbers: | |
| if(num not in duplicates): | |
| duplicates.append(num) | |
| return duplicates | |
| remove_duplicates([1, 1, 2, 2]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def median(numbers): | |
| sorted_numbers= sorted(numbers) | |
| size = len(sorted_numbers) | |
| median = 0 | |
| if(size % 2 == 0): | |
| index_1 = size/2 | |
| print index_1 | |
| index_2 = index_1 -1 | |
| print index_2 | |
| sum =(sorted_numbers[index_1] + sorted_numbers[index_2]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| garbled = "IXXX aXXmX aXXXnXoXXXXXtXhXeXXXXrX sXXXXeXcXXXrXeXt mXXeXsXXXsXaXXXXXXgXeX!XX" | |
| message = filter(lambda x: x != 'X' , garbled) | |
| print message | |
| garbled = "!XeXgXaXsXsXeXmX XtXeXrXcXeXsX XeXhXtX XmXaX XI" | |
| message = garbled[::-1][::2] | |
| print message |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- https://mvnrepository.com/artifact/org.apache.poi/poi --> | |
| <dependency> | |
| <groupId>org.apache.poi</groupId> | |
| <artifactId>poi</artifactId> | |
| <version>4.0.0</version> | |
| </dependency> | |
| <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml --> | |
| <dependency> | |
| <groupId>org.apache.poi</groupId> | |
| <artifactId>poi-ooxml</artifactId> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Configuration class for Internationalization | |
| */ | |
| @Configuration | |
| public class LocaleConfiguration implements WebMvcConfigurer { | |
| /** | |
| * * @return default Locale set by the user | |
| */ | |
| @Bean(name = "localeResolver") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Autowired | |
| MessageSource messageSource; | |
| @RequestMapping(value = "/get-greeting", method = RequestMethod.GET) | |
| public String greeting() { | |
| /** | |
| * @LocaleContextHolder.getLocale() | |
| * Return the Locale associated with the given user context,if any, or the system default Locale otherwise. | |
| * This is effectively a replacement for Locale.getDefault(), able to optionally respect a user-level Locale setting. | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| messageSource.getMessage(String key, @Nullable Object[] params, Locale locale) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Autowired | |
| MessageSource messageSource; | |
| @RequestMapping(value = "/get-greeting-name", method = RequestMethod.GET) | |
| public String greetingWithName() { | |
| String[] params = new String[]{"Ikhiloya", "today"}; | |
| return messageSource.getMessage("good.morning.name", params, LocaleContextHolder.getLocale()); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async loadAllFindingsByDate(fromDate, toDate) { | |
| const link = loadAllFindingsByDate.apiUrl; | |
| const data = { | |
| fromDate: fromDate, | |
| toDate: toDate | |
| }; | |
| const resp = await this.dataService.funcPost(link, data); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.support.annotation.NonNull; | |
| import android.support.annotation.Nullable; | |
| import android.support.v4.util.ArrayMap; | |
| import java.io.IOException; | |
| import java.util.Collections; | |
| import java.util.Map; | |
| import java.util.regex.Matcher; | |
| import java.util.regex.Pattern; |