源代码是在linux上编写的,但是在Windows10上拉取代码却出现了问题。根据提示可以看出代码clone是成功的,但是checkout的时候出现了错误。那么问题很可能是不通系统下文件属性或策略导致的。
然后在Git文档上找到一个关于NTFS保护机制的配置,core.protectNTFS:
If set to true, do not allow checkout of paths that would cause problems with the NTFS filesystem, e.g. conflict with 8.3 “short” names. Defaults to true on Windows, and false elsewhere.
Windows系统下默认值是true,也就是说不符合NTFS策略的文件不会被签出,设置为false后可以关闭保护机制。
git config core.protectNTFS false
重新执行clone或checkout
在配置文件中查看是否有取消存在绑定ip地址,没有则加上,如下方:
bind 127.0.0.1
解决方法同上
]]>Caused by: java.lang.IllegalStateException: Unmapped relationship: 7 at com.sun.jna.platform.win32.WinNT$SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX.fromPointer(WinNT.java:3033).......
jna
依赖较旧,换用新版jna
依赖。下载地址:jna githubWindows
新增了新的逻辑处理器映射关系(LOGICAL_PROCESSOR_RELATIONSHIP
),其值为5
、6
、7
。有issue提到:issue。体现在升级到windows11后,可能抛出错误问题中的异常。jna
新版本被处理,故升级依赖就能解决。public static WinNT.SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX fromPointer(Pointer memory) { int relationship = memory.getInt(0L); Object result; switch(relationship) { case 0: case 3: result = new WinNT.PROCESSOR_RELATIONSHIP(memory); break; case 1: result = new WinNT.NUMA_NODE_RELATIONSHIP(memory); break; case 2: result = new WinNT.CACHE_RELATIONSHIP(memory); break; case 4: result = new WinNT.GROUP_RELATIONSHIP(memory); break; default: throw new IllegalStateException("Unmapped relationship: " + relationship); } ((WinNT.SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX)result).read(); return (WinNT.SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX)result; }
]]>
git
字符集为uft-8
git config --global core.quotepath falsegit config --global gui.encoding utf-8git config --global i18n.commit.encoding utf-8git config --global i18n.logoutputencoding utf-8
powershell
字符集notepad $profile# 使用记事本编辑profile文件,使得每次启动自动设置字符集
$env:LESSCHARSET='utf-8'# 写入该行,设置字符集
启动新PowerShell
窗口,查看结果
Uncaught TypeError VM28:5348 Uncaught TypeError: document.getElementById is not a function
PowerShell
的profile
profile主要用于个性化常用的函数、别名等等。每次加载powershell的时候,都会执行profile中的内容。
profile
$profile
false
,则需要创建一个(–Force是强制创建,即使存在,也创建。)New-Item –Path $Profile –Type File –Force
banner
文件C:\Users\lzjyz\Documents\WindowsPowerShell\banner.txt
。 ___ ________ ___ ___ ___ ________ ________ _______ |\ \ |\_____ \ |\ \ |\ \ / /|\_____ \|\ __ \ / ___ \ \ \ \ \|___/ /| \ \ \ \ \ \/ / /\|___/ /\ \ \|\ \/__/|_/ /| \ \ \ / / / __ \ \ \ \ \ / / / / /\ \ \\\ \__|// / / \ \ \____ / /_/__ |\ \\_\ \ \/ / / / /_/__\ \ \\\ \ / /_/__ \ \_______\\________\ \________\__/ / / |\________\ \_____ \|\________\ \|_______|\|_______|\|________|\___/ / \|_______|\|___| \__\\|_______| \|___|/ \|__|
profile
文件
profile
文件路径一般为C:\Users\{username}\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
notepad $Profile
profile
文件中写入如下内容# Get-Content C:\Users\lzjyz\Documents\WindowsPowerShell\banner.txtGet-Content 你的banner路径
]]>
vue-cli
中less-loader的版本过高导致。
less-loader
npm uninstall less-loader
npm i less-loader@6.1.1
less-loader
版本,不同版本在vue.config.js
中配置可能有所不同。substr()
找不到方法substring()
等进行替换,ECMAscript 没有对substr()
进行标准化。]]>重要事项:ECMAscript 没有对该方法进行标准化,因此反对使用它。
重要事项:在 IE 4 中,参数 start 的值无效。在这个 BUG 中,start 规定的是第 0 个字符的位置。在之后的版本中,此 BUG 已被修正。
该错误有多种出错原因,下方可能并没有您所遇到的问题的解决方法。此文章会持续补充。
wx:if
与wx:else
应成对出现,请检查if
与else
的层级与数量是否对应wx:if
与wx:for
书写在同一元素上。如:<view class="licence" wx:if="{{licenceList.length>0}}" wx:for="{{licenceList}}" wx:for-item="licence" wx:key="index"> <view class="name">{{licence.name}}</view></view><van-empty wx:else image="https://img.yzcdn.cn/vant/custom-empty-image.png" description="没有有效的许可证" />
可使用<block></block>
标签包裹for
,在外层做逻辑判断。如:
<block wx:if="{{licenceList.length>0}}"> <view class="licence" wx:for="{{licenceList}}" wx:for-item="licence" wx:key="rowno"> <view class="name">{{licence.xkz_name}}</view> </view></block><van-empty wx:else image="https://img.yzcdn.cn/vant/custom-empty-image.png" description="没有有效的许可证" />
]]>
sun.misc.BASE64Decoder
无法被找到。1.8
,检查IDEA模块或项目配置JDK版本是否与本地一致。IDEA
新导入项目或模块会使用自带JDK
。JDK
版本非1.8
。则可使用java.util.Base64.Decoder
与java.util.Base64.Encoder
进行替换。for...in - MDN
for...in语句以任意顺序遍历一个对象的除Symbol以外的可枚举属性。
for (variable in object) statement
for...in不应该用于迭代一个关注索引顺序的 Array。
let arr = ['a','b','c'];for(let i in arr){ console.log(`index typeof:`,typeof i); //> index typeof: string}
对于数组使用for...in进行迭代时,其索引类型i
为String
。
若要使用数组索引,应使用for。
计算机\HKEY_CLASSES_ROOT
目录下存放了所有的已注册COM
组件信息。以Word
为例,其COM
组件名称为Word.Application
,其注册表路径为:计算机\HKEY_CLASSES_ROOT\Word.Application
Word.Application
的子Key中存在CLSID
,其默认信息为该COM
组件的唯一ID。以Word.Application
为例:CLSID:{000209FF-0000-0000-C000-000000000046}
计算机\HKEY_CLASSES_ROOT\CLSID
中存在,其路径如下:计算机\HKEY_CLASSES_ROOT\CLSID\{000209FF-0000-0000-C000-000000000046}
key
下存在若干值:InprocHandler32:DLL文件文件名词LocalServer32:本地程序全名称路径ProgID:Com组件名称VersionIndependentProgID:Com组件名称//https://docs.microsoft.com/en-us/previous-versions/ms679755(v=vs.85)
allprojects { repositories { maven { url 'https://maven.aliyun.com/repository/public/' } mavenCentral() }}
maven { url 'https://maven.aliyun.com/repository/public/' } maven { url 'https://maven.aliyun.com/repository/spring/'}
]]>
ViewPager2
中,其并未在onInterceptTouchEvent
中处理滑动冲突,且其修饰符为final
,则不可通过继承ViewPager2
来重写onInterceptTouchEvent
方法来处理滑动冲突。则可通过包裹滑动冲突的子组件来决定事件的分发。<!-- 外层为ViewPager2 --><cn.settile.lightmusic.widget.fragment.NestedScrollableHost android:id="@+id/barContainer" android:layout_width="match_parent" android:layout_height="wrap_content"> <androidx.viewpager2.widget.ViewPager2 android:layout_width="match_parent" android:layout_height="wrap_content" /></cn.settile.lightmusic.widget.fragment.NestedScrollableHost>
import android.content.Context;import android.util.AttributeSet;import android.view.MotionEvent;import android.view.View;import android.view.ViewConfiguration;import android.view.ViewParent;import android.widget.FrameLayout;import androidx.annotation.Nullable;import androidx.viewpager2.widget.ViewPager2;import java.util.HashMap;public class NestedScrollableHost extends FrameLayout { private int touchSlop; private float initialX; private float initialY; private HashMap<Integer,View> findViewCache; public NestedScrollableHost(Context context) { super(context); ViewConfiguration configuration = ViewConfiguration.get(this.getContext()); this.touchSlop = configuration.getScaledTouchSlop(); } public NestedScrollableHost(Context context, @Nullable AttributeSet attrs) { super(context, attrs); ViewConfiguration configuration = ViewConfiguration.get(this.getContext()); this.touchSlop = configuration.getScaledTouchSlop(); } private ViewPager2 getParentViewPager() { ViewParent parent = this.getParent(); if (!(parent instanceof View)) { parent = null; } View v; for (v = (View) parent; v != null && !(v instanceof ViewPager2); v = (View) parent) { parent = v.getParent(); if (!(parent instanceof View)) { parent = null; } } View var2 = v; if (!(v instanceof ViewPager2)) { var2 = null; } return (ViewPager2) var2; } private View getChild() { return this.getChildCount() > 0 ? this.getChildAt(0) : null; } private boolean canChildScroll(int orientation, float delta) { int direction = -((int) Math.signum(delta)); View child; boolean var6 = false; switch (orientation) { case 0: child = this.getChild(); var6 = child != null && child.canScrollHorizontally(direction); break; case 1: child = this.getChild(); var6 = child != null && child.canScrollVertically(direction); break; default: // throw (Throwable)(new IllegalArgumentException()); } return var6; } @Override public boolean onInterceptTouchEvent(MotionEvent e) { this.handleInterceptTouchEvent(e); return super.onInterceptTouchEvent(e); } private void handleInterceptTouchEvent(MotionEvent e) { ViewPager2 parentViewPager = this.getParentViewPager(); if (parentViewPager != null) { int orientation = parentViewPager.getOrientation(); if (this.canChildScroll(orientation, -1.0F) || this.canChildScroll(orientation, 1.0F)) { if (e.getAction() == 0) { this.initialX = e.getX(); this.initialY = e.getY(); this.getParent().requestDisallowInterceptTouchEvent(true); } else if (e.getAction() == 2) { float dx = e.getX() - this.initialX; float dy = e.getY() - this.initialY; boolean isVpHorizontal = orientation == 0; float scaledDx = Math.abs(dx) * (isVpHorizontal ? 0.5F : 1.0F); float scaledDy = Math.abs(dy) * (isVpHorizontal ? 1.0F : 0.5F); if (scaledDx > (float) this.touchSlop || scaledDy > (float) this.touchSlop) { if (isVpHorizontal == scaledDy > scaledDx) { this.getParent().requestDisallowInterceptTouchEvent(false); } else if (this.canChildScroll(orientation, isVpHorizontal ? dx : dy)) { this.getParent().requestDisallowInterceptTouchEvent(true); } else { this.getParent().requestDisallowInterceptTouchEvent(false); } } } } } } public View findCachedViewById(int var1) { if (this.findViewCache == null) { this.findViewCache = new HashMap<>(); } View var2 = (View) this.findViewCache.get(var1); if (var2 == null) { var2 = this.findViewById(var1); this.findViewCache.put(var1, var2); } return var2; } public void clearFindViewByIdCache() { if (this.findViewCache != null) { this.findViewCache.clear(); } }}
]]>
/** * 开启Shiro的注解(如@RequiresRoles,@RequiresPermissions),需借助SpringAOP扫描使用Shiro注解的类,并在必要时进行安全逻辑验证 * 配置以下两个bean(DefaultAdvisorAutoProxyCreator和AuthorizationAttributeSourceAdvisor)即可实现此功能 * @return */ @Bean public DefaultAdvisorAutoProxyCreator advisorAutoProxyCreator(){ DefaultAdvisorAutoProxyCreator advisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator(); advisorAutoProxyCreator.setProxyTargetClass(true); return advisorAutoProxyCreator; } /** * 开启aop注解支持 * @param securityManager * @return */ @Bean public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(SecurityManager securityManager) { AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = new AuthorizationAttributeSourceAdvisor(); authorizationAttributeSourceAdvisor.setSecurityManager(securityManager); return authorizationAttributeSourceAdvisor; }
若使用JwtFilter
进行鉴权,则isAccessAllowed
返回值要为true,此时可由注解控制权限。
@Override protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) { if(isLoginAttempt(request,response)) { try { return executeLogin(request, response); } catch (Exception e) { log.error(((HttpServletRequest)request).getRequestURI()+"验证失败"); throw new UnAuthenticationException(Result.AUTHENTICATION_FAIL); } } return true; }
]]>
NetstedScrollView
与RecyclerView
嵌套使用,会导致RecyclerView控件在创建时一次性创建所有ViewHolder
,若数据集小时,影响不明显,数据集大时导致内存使用增加,会有明显卡顿。应避免使用ScrollView
与RecyclerView
嵌套。]]>
<include>
标签再使用设置点击事件时应使用<include>
标签的id
,如下的布局设置:<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:descendantFocusability="blocksDescendants"> <include android:id="@+id/musicItem" layout="@layout/music_list_item" android:visibility="gone" /> <include android:id="@+id/loadingLayout" layout="@layout/music_list_loading_item_layout" /></FrameLayout>
在代码中设置点击事件:
......\\ binding为上方布局文件对应的ViewBinding\\ binding.musicItem.item 为引入的第一个布局文件的根布局binding.musicItem.item.setOnClickListener(this);.......
则在onClick
中判断应写为:
@Override public void onClick(View v) { switch (v.getId()) { case R.id.musicItem://此处musicItem为<include>标签ID Log.e(TAG,"item"); break; } }
]]>
大部分代码来自于博客:https://blog.csdn.net/qq_26287435/article/details/79162186
CustomRoundAngleImageView
values\attrs.xml
中自定义如下属性:<declare-styleable name="CustomRoundAngleImageView"> <attr name="radius" format="dimension"/> <attr name="left_top_radius" format="dimension"/> <attr name="right_top_radius" format="dimension"/> <attr name="right_bottom_radius" format="dimension"/> <attr name="left_bottom_radius" format="dimension"/></declare-styleable>
CustomRoundAngleImageView
类,其代码如下:public class CustomRoundAngleImageView extends AppCompatImageView { private int defaultRadius = 0; private int radius; private int leftTopRadius; private int rightTopRadius; private int rightBottomRadius; private int leftBottomRadius; float width, height; public CustomRoundAngleImageView(Context context) { this(context, null); init(context, null); } public CustomRoundAngleImageView(Context context, AttributeSet attrs) { this(context, attrs, 0); init(context, attrs); } public CustomRoundAngleImageView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(context, attrs); } /** * 使高度等于宽度 * @param widthMeasureSpec * @param heightMeasureSpec */ @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, widthMeasureSpec); } @SuppressLint("ObsoleteSdkInt") private void init(Context context, AttributeSet attrs) { if (Build.VERSION.SDK_INT < 18) { setLayerType(View.LAYER_TYPE_SOFTWARE, null); } // 读取配置 TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.CustomRoundAngleImageView); radius = array.getDimensionPixelOffset(R.styleable.CustomRoundAngleImageView_radius, defaultRadius); leftTopRadius = array.getDimensionPixelOffset(R.styleable.CustomRoundAngleImageView_left_top_radius, defaultRadius); rightTopRadius = array.getDimensionPixelOffset(R.styleable.CustomRoundAngleImageView_right_top_radius, defaultRadius); rightBottomRadius = array.getDimensionPixelOffset(R.styleable.CustomRoundAngleImageView_right_bottom_radius, defaultRadius); leftBottomRadius = array.getDimensionPixelOffset(R.styleable.CustomRoundAngleImageView_left_bottom_radius, defaultRadius); //如果四个角的值没有设置,那么就使用通用的radius的值。 if (defaultRadius == leftTopRadius) { leftTopRadius = radius; } if (defaultRadius == rightTopRadius) { rightTopRadius = radius; } if (defaultRadius == rightBottomRadius) { rightBottomRadius = radius; } if (defaultRadius == leftBottomRadius) { leftBottomRadius = radius; } array.recycle(); } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); width = getWidth(); height = getHeight(); } @Override protected void onDraw(Canvas canvas) { //这里做下判断,只有图片的宽高大于设置的圆角距离的时候才进行裁剪 int maxLeft = Math.max(leftTopRadius, leftBottomRadius); int maxRight = Math.max(rightTopRadius, rightBottomRadius); int minWidth = maxLeft + maxRight; int maxTop = Math.max(leftTopRadius, rightTopRadius); int maxBottom = Math.max(leftBottomRadius, rightBottomRadius); int minHeight = maxTop + maxBottom; if (width >= minWidth && height > minHeight) { Path path = new Path(); //四个角:右上,右下,左下,左上 path.moveTo(leftTopRadius, 0); path.lineTo(width - rightTopRadius, 0); path.quadTo(width, 0, width, rightTopRadius); path.lineTo(width, height - rightBottomRadius); path.quadTo(width, height, width - rightBottomRadius, height); path.lineTo(leftBottomRadius, height); path.quadTo(0, height, 0, height - leftBottomRadius); path.lineTo(0, leftTopRadius); path.quadTo(0, 0, leftTopRadius, 0); canvas.clipPath(path); } super.onDraw(canvas); }}
<cn.settile.lightmusic.widget.view.CustomRoundAngleImageView android:id="@+id/albumImageView" android:layout_width="match_parent" android:layout_height="wrap_content"...... app:radius="20dp" />
在处理异常的过程中,发现Shiro在验证Token的Filter中抛出的异常无法被@ControllerAdvice处理,多番查找后 找到了如下处理方法(来源于:https://stackoverflow.com/questions/34595605/how-to-manage-exceptions-thrown-in-filters-in-spring)
@Slf4j@RestControllerAdvice@Controllerpublic class ServiceExceptionHandler implements ErrorController { private static final String PATH_DEFAULT = "/error"; // UnAuthenticationException为自定义异常 @ExceptionHandler(UnAuthenticationException.class) public Result handleUnAuthorize(UnAuthenticationException e){ log.error("验证失败"); return e.getResult(); } @RequestMapping(PATH_DEFAULT) public void handleError(HttpServletRequest request) throws Throwable { if (request.getAttribute("javax.servlet.error.exception") != null) { throw (Throwable) request.getAttribute("javax.servlet.error.exception"); } } @Override public String getErrorPath() { return PATH_DEFAULT; }}
/error
进行处理,重写/error的Cotroller后再将异常抛出,由对应的@ExceptionHandler
处理