CodeDictionary

[python code]get Coordinate by image

get Coordinate by image pyautogui started left-top side of monster. If there are multiple images on screen, only return the coordinate of most left-top side image. If there is no same image, return FileNotFoundError import pyautogui def getCoordinateByImg(imgAddress): imgLocatedCoordinate = pyautogui.locateOnScreen(imgAddress) # get image from the address if (imgLocatedCoordinate): return pyautogui.center(imgLocatedCoordinate) # return the center coordinate. else: print("image never found") raise FileNotFoundError 에러 pyscreeze.PyScreezeException: The Pillow package is required to use this function: type “pip install Pillow –upgrade” in terminal

[python code] keyboard and mouse control

how to install pip install pyautogui Finding Coordinate It will display current mouse coordinate every second. import pyautogui import time while True: print("Current Mouse Position : ", pyautogui.position()) time.sleep(1) mouse control import pyautogui pyautogui.moveTo(300, 300) # move (x=300, y=300) pyautogui.moveRel(x, y, t) # move (from current pos, move x and y with time. If t is 2, it will take 2 second to move) pyautogui.click() # click pyautogui.doubleClick() # double click pyautogui.

[Android_Kotlin code]Creade Button

Steps create button in layout/activity_main.xml create strings on button in values/strings.xml connect button and set event in MainActivity.kt padding and margin 1. create button in layout/activity_main.xml <Button android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="10dp" android:padding="10dp" android:text="@string/btn" android:textColor="@color/black" app:backgroundTint="@color/white" /> 2. create strings on button in values/strings.xml <string name="btn">Button</string> 3. connect button and set event in MainActivity.kt import android.widget.Button class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) // set id from activity_main.

[JavaException]IllegalArgumentException

Reason Thrown to indicate that a method has been passed an illegal or inappropriate argument. argument is actual values that are passed to variables If you put any actual values that is not correct for the variable, it will cause IllegalArgumentException Example int a = 2147483649; // value is too big int a = -2147483649; // value is too small String date="08-07-1990"; // format is dd-MM-yyyy Date format=new SimpleDateFormat("dd/MM/yyyy").parse(date);// format is different Solution check input value range check calculation that can be over the variable limitation use try-catch block

[JAVA code]Alphabetical Order

Alphabetical Order According to ASCII rules [numbers][capital letters][lowercase letters] 0 ~ 9, A ~ Z, a ~ z Time complexity : $O(n\ log\ n)$ Space complexity : $O(1)$ For List Collections.sort(List<String>_values); For Array Arrays.sort(String[]array); Time complexity : $O(n^2)$ Space complexity : $O(1)$ public static String[] LexicalOrder(String[] words) { int n = words.length; for (int i = 0; i < n - 1; ++i) { for (int j = i + 1; j < n; ++j) { if (words[i].