Monday, November 25, 2019

From Spring 3.2, no need to include spring-asm

java.lang.IncompatibleClassChangeError:
class org.springframework.core.type.classreading.ClassMetadataReadingVisitor has interface org.springframework.asm.ClassVisitor as super class.

https://stackoverflow.com/questions/15758151/class-conflict-when-starting-up-java-project-classmetadatareadingvisitor-has-in

https://docs.spring.io/spring-framework/docs/3.2.16.RELEASE/spring-framework-reference/htmlsingle/#migration-3.2-inline-asm

D.3 Inlining of spring-asm jar

In versions 3.0 and 3.1, we published a discrete spring-asm containing repackaged org.objectweb.asm 3.x sources. As of Spring Framework 3.2, we have upgraded to org.objectweb.asm 4.0 and done away with the separate module jar, favoring inlining these classes directly within spring-core. This should cause no migration issue for most users; but on the off chance that you have spring-asm declared directly within your project's build script, you'll want to remove it when upgrading to Spring Framework 3.2.

Sunday, November 24, 2019

league of legends math and programming for kids


For Math:
1. The red buff health is 2100, Lee Sin's attack will deduce it by 124 or 125 every time, how many times at least are required to kill the red buff for Lee Sin ( do not unlock any ability, do not use Smite)?
2. Lee Sin's attack speed is 1.5 seconds, how fast a perfect Lee Sin player can kill a red buff ( do not unlock any ability, do not use Smite)?
3. Lee Sin's passive:
      After Lee Sin uses an ability, his next 2 basic attacks Attack Speed increases 40%.
If Lee Sin unlock W which cool down is 11.7 seconds. Below is the description about his W ability:

Safeguard: Lee Sin rushes to target ally, shielding himself from damage. If the ally is a champion, they are also shielded. After using Safeguard, Lee Sin can cast Iron Will for the next 3 seconds.
Iron Will: Lee Sin's intense training allows him to thrive in battle. For 4 seconds, Lee Sin gains Life Steal and Spell Vamp.

How fast a perfect Lee Sin player can kill a red buff (without using Smite)?
Below is the link Tarzan Lee Sin:
https://www.youtube.com/watch?v=UZ3S7RsGO24

For Python/Java:
1. Get all champion's skin from the official LOL website:
https://na.leagueoflegends.com/en/game-info/champions/

2. Sort them by skin numbers and champion name

Ezreal: 14
...


For Python

getAllLOLSkins.py

import os
import requests
import urllib.request
from bs4 import BeautifulSoup
with open('/Users/yanfeng/python/lol.html','r',encoding='utf-8') as myFile:
       soup = BeautifulSoup(myFile.read(),'html.parser');
       div=soup.find_all('ul','champion-grid grid-list gs-container gs-no-gutter default-7-col content-center');
       for ul in div:
              for li in ul.find_all('li'):
                     a = li.find('a');
                     champ = a['href'][:-1];
                     print(champ);
                     os.makedirs("/Users/yanfeng/python/lol/" + champ);
                     os.chdir("/Users/yanfeng/python/lol/" + champ);
                     for k in range(30):
                            onechamp_link = 'https://ddragon.leagueoflegends.com/cdn/img/champion/splash/' + champ + '_' + str(k) + '.jpg';
                            im = requests.get(onechamp_link);
                            if im.status_code == 200:

                                   open(champ + '_' + str(k) + '.jpg', 'wb').write(im.content);


count.py

import os

path='/Users/yanfeng/python/lol'
champ_dir = os.listdir(path);
picture=[];
test_keys=[];
test_values=[];
for champ in champ_dir:
champfiles = os.listdir(os.path.join(path,champ));
number_files = len(champfiles);
test_keys.append(champ);
test_values.append(number_files);
myDict=dict(zip(test_keys, test_values));
for key, value in sorted(myDict.items(), key=lambda item: item[1]):
    print("%s: %s" % (key, value));