Skip to content

Instantly share code, notes, and snippets.

View gulbalasalamov's full-sized avatar
🎯
Focusing

Gulbala Salamov gulbalasalamov

🎯
Focusing
View GitHub Profile
@gulbalasalamov
gulbalasalamov / RegexUtil.java
Last active November 13, 2024 17:47
Изучить следующий кусочек кода, подробно расписать какие проблемы Вы видите в нем при их наличии и предложить пути решения, модифицировав код программы.
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
/**
* Изучить следующий кусочек кода, подробно расписать какие проблемы Вы видите в нем при их наличии и предложить пути решения, модифицировав код программы.
* https://docs.google.com/document/d/11ZFJLrqlHYwr1Ply20ej8yqKmNxdf09FMY-MkVFhZJM/edit?tab=t.0
* https://spb.hh.ru/vacancy/109822869?hhtmFrom=vacancy_response
*/
@gulbalasalamov
gulbalasalamov / ElementCounter.java
Created November 10, 2024 16:29
Необходимо подсчитать количество всех элементов списка/массива и вернуть ассоциативных массив, где ключ – элемент списка, значение – количество этих элементов в списке. Порядок не имеет значения. Пример: [1, 3, 4, 5, 1, 5, 4] -> {1 : 2, 3 : 1, 4 : 2, 5 : 2}
import java.util.HashMap;
import java.util.Map;
public class ElementCounter {
public static Map<Integer, Integer> countElements(int[] array) {
Map<Integer, Integer> elementCount = new HashMap<>();
for (int element : array) {
elementCount.put(element, elementCount.getOrDefault(element, 0) + 1);
@gulbalasalamov
gulbalasalamov / __init__.py
Last active April 5, 2020 14:16
GeoKey export __init__.py
VERSION = (0, 4, 3)
__version__ = '.'.join(map(str, VERSION))
try:
from geokey.extensions.base import register
register(
'geokey_export',
@gulbalasalamov
gulbalasalamov / __init__.py
Last active April 5, 2020 13:30
GeoKey epicollect __init__.py
VERSION = (1, 0, 4)
__version__ = '.'.join(map(str, VERSION))
try:
from geokey.extensions.base import register
register(
'geokey_epicollect',
@gulbalasalamov
gulbalasalamov / __init__.py
Last active April 5, 2020 13:25
geokey cartodb __init__.py
VERSION = (0, 1, 4)
__version__ = '.'.join(map(str, VERSION))
try:
from geokey.extensions.base import register
register(
@gulbalasalamov
gulbalasalamov / install_checks.py
Last active April 5, 2020 07:28
install_checks.py
import commands
import re
from django.conf import settings
from geokey.applications.models import Application
from .sapelli_exceptions import SapelliException
from .sapelli_loader import get_sapelli_dir_path, get_sapelli_jar_path
@gulbalasalamov
gulbalasalamov / RealPathUtil.java
Created January 8, 2018 07:20 — forked from tatocaster/RealPathUtil.java
Real Path Utility class for Android, works for all API
public class RealPathUtil {
public static String getRealPath(Context context, Uri fileUri) {
String realPath;
// SDK < API11
if (Build.VERSION.SDK_INT < 11) {
realPath = RealPathUtil.getRealPathFromURI_BelowAPI11(context, fileUri);
}
// SDK >= 11 && SDK < 19
else if (Build.VERSION.SDK_INT < 19) {