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
| // Filename: CachingProxy.cs | |
| using System; | |
| using System.Collections.Concurrent; | |
| using System.Reflection; | |
| using System.Text.Json; | |
| public class CachingProxy : DispatchProxy | |
| { | |
| private object _wrappedObject; | |
| private static readonly ConcurrentDictionary<string, (object Value, DateTime Expiration)> _cache = new(); |
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
| using System; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| public class Program | |
| { | |
| public static async Task Main(string[] args) | |
| { | |
| // Create a cache with a 5-second Time-To-Live. | |
| var weatherCache = new TTLCache(TimeSpan.FromSeconds(5)); |
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 time | |
| from functools import wraps | |
| class TTLCache: | |
| """ | |
| A decorator that caches the results of a function for a specified TTL. | |
| """ | |
| def __init__(self, ttl_seconds=300): | |
| """ | |
| Initializes the decorator with a TTL in seconds. |
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
| using System; | |
| public class Program | |
| { | |
| private static readonly Random _opRandom = new Random(); | |
| public static void Main(string[] args) | |
| { | |
| Console.WriteLine("--- Running Action (void method) Example ---"); | |
| var serviceRetryPolicy = new RetryHandler(retries: 4, baseDelaySeconds: 0.5); |
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 time | |
| import random | |
| import logging | |
| from functools import wraps | |
| # Set up basic logging | |
| logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') | |
| class Retry: | |
| """ |
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
| # The original list containing duplicate elements | |
| original_list = [1, 2, 2, 3, 4, 4, 4, 5, 6, 6] | |
| # Use set() to remove duplicates, then convert it back to a list | |
| unique_list = list(set(original_list)) | |
| # Print the new list | |
| print(f"Original List: {original_list}") | |
| print(f"Unique List: {unique_list}") |
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
| { | |
| AF: "Afghanistan", | |
| AX: "\xc5land Islands", | |
| AL: "Albania", | |
| DZ: "Algeria", | |
| AS: "American Samoa", | |
| AD: "Andorra", | |
| AO: "Angola", | |
| AI: "Anguilla", | |
| AQ: "Antarctica", |
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
| @echo off | |
| if "%1"=="" ( | |
| echo No arguments provided. | |
| exit /b | |
| ) | |
| set args=%* | |
| C:/tools/php72/php.exe %args% |
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
| 1 : Shutdown or Quit your XAMPP server from Xampp control panel. | |
| 2 : Download the ZIP version of MariaDB | |
| 3 : Rename the xampp/mysql folder to mysql_old. | |
| 4 : Unzip or Extract the contents of the MariaDB ZIP file into your XAMPP folder. | |
| 5 : Rename the MariaDB folder, called something like mariadb-5.5.37-win32, to mysql. | |
| 6 : Rename xampp/mysql/data to data_old. | |
| 7 : Copy the xampp/mysql_old/data folder to xampp/mysql/. | |
| 8 : Copy the xampp/mysql_old/backup folder to xampp/mysql/. | |
| 9 : Copy the xampp/mysql_old/scripts folder to xampp/mysql/. |
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
| # * Fine Tuning | |
| key_buffer = 64M | |
| max_allowed_packet = 128M | |
| thread_cache_size = 30 | |
| myisam-recover = BACKUP | |
| max_connections = 150 | |
| table_open_cache = 2048 | |
| thread_concurrency = 10 | |
| wait_timeout = 600 |
NewerOlder