Сообщения

Сообщения за февраль, 2024

Code refinement

if (newPrimaryOfferId != null ) { if ( restrictedPrimaryOffersForSelectionSO .getOfferIds().contains(newPrimaryOfferId)) { PrimaryOfferCannotSelectSOException ex = PrimaryOfferCannotSelectSOException. builder () .offeringName(offerResponse.getPrimaryOffering().getOfferingName()) .build() ; log .error( "ActionLog.getMsisdnDetails.error ex" , ex) ; throw ex ; } } else { if ( restrictedPrimaryOffersForSelectionSO .getOfferIds().contains(primaryOfferId)) { PrimaryOfferCannotSelectSOException ex = PrimaryOfferCannotSelectSOException. builder () .offeringName(offerResponse.getPrimaryOffering().getOfferingName()) .build() ; log .error( "ActionLog.getMsisdnDetails.error ex" , ex) ; throw ex ; } } offersInfos = mnoProductClient .getOfferListByTypeForSalesApp( "az" , ProviderTypes. Azerfon .getKey() , OfferType. SO ).getData() ;   t

Network foundation Lesson1

1. ipconfig or ifconfig(in mac) 2. ifconfig | grep inet 3. traceroute day.az 4. ifconfig -a 5. ping 8.8.8.8 6. ping.eu 7. nslookup mail.ru 8. sudo ipconfig set en0 DHCP or sudo ifconfig en0 down  # Replace en0 with the appropriate interface (en0 for Wi-Fi, en1 for Ethernet, etc.) 9. sudo ifconfig en0 up

Thread

Изображение
 Process memory space = Heap Each application has its own memory space, also known as the heap.  The heap isn't shared between two applications or two processes, they each have their own. A thread is a single unit of execution, within a process. Each process can have multiple threads. Every application has at least one thread, and that is the main thread.  Threads are fundamental building blocks, to support concurrency, in a java application. They are essential, because they allow us to perform multiple tasks simultaneously, within a single process.  package org.example ; public class Main { public static void main (String[] args) { Thread currentThread = Thread. currentThread () ; System. out .println(currentThread.getClass().getName()) ; System. out .println(currentThread) ; printThreadState (currentThread) ; currentThread.setName( "MainGuy" ) ; currentThread.setPriority(Thread. MAX_PRIORITY ) ; printThreadStat

Reverse proxy

 1. docker-compose.yaml version : '3.5' services : db : hostname : mysql image : mysql restart : always environment : MYSQL_ROOT_PASSWORD : "parvin@" # volumes: # - db_data:/var/lib/mysql ports : - "1111:3306" # networks: # critical_network: docker2-1 : hostname : docker2 image : docker2-student1:v1 restart : always ports : - "1234:9090" environment : DB_CONNECTION_IP : "mysql" DB_CONNECTION_PORT : "3306" DB_CONNECTION_USERNAME : root DB_CONNECTION_PASSWORD : parvin@ # networks: # critical_network: depends_on : - db docker2-2 : hostname : docker2 image : docker2-student2:v1 restart : always ports : - "1235:9090" environment : DB_CONNECTION_IP : "mysql" DB_CONNECTION_PORT : "3306" DB_CONNECTION_USERNAME : root D

AOP

1. Dependency: // https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-aop implementation 'org.springframework.boot:spring-boot-starter-aop:3.2.2'   2. MyLogic: package com.luv2code.aopdemo.dao ; public interface AccountDao { void addAccount () ; } package com.luv2code.aopdemo.dao ; import org.springframework.stereotype. Repository ; @Repository public class AccountDaoImpl implements AccountDao { @Override public void addAccount () { System. out .println(getClass() + " : Doing my DB work: adding ac account" ) ; } } 3. Aspect itself: package com.luv2code.aopdemo.aspect ; import org.aspectj.lang.annotation. Aspect ; import org.aspectj.lang.annotation. Before ; import org.springframework.stereotype. Component ; @Aspect @Component public class MyDemoLoggingAspect { @Before ( " execution(public void addAccount()) " ) public void beforeAddAccountAdvice () { System. out .println( "======>>