首页 文章 精选 留言 我的

精选列表

搜索[端侧AI],共10011篇文章
优秀的个人博客,低调大师

xtools-boot一款基于JDK25,SpringBoot4的通用Spring工具库

MethodArgumentTypeMismatchExceptionHandlerMethodValidationExceptionMethodArgumentNotValidExceptionHttpMessageNotReadableExceptionBizErrorBizWarningBizPublicKeyErrorUnauthorizedErrorHttpRequestMethodNotSupportedExceptionNoResourceFoundExceptionClientAbortExceptionExceptionController抛出异常异常类型参数类型不匹配参数校验异常参数校验异常请求参数格式错误业务异常业务警告公钥错误认证异常请求方法不支持资源未找到客户端断开默认异常处理返回

优秀的个人博客,低调大师

ARM Mbed Edge物联网网关边缘侧管理

在物联网应用中,我们看到商务楼宇、精准农业和互联厂址、智能家居等应用有很大的发展机遇。与此对应的,边缘计算逐渐走入人们视野。边缘计算是管理云计算系统的更新方式,数据处理在更接近于数据源的网络“边缘”完成。使用本地处理器和存储作为应用的主要计算设备,减少了从中央远程数据中心来回传递所有信息的时间。随着计算越来越复杂并且需要处理更多数据,使用本地计算能力可以帮助降低延迟。例如,人工智能程序中,算法可以在一秒内作出数百个决策。在工业生产中,多个处理器同时接收输入并协调响应。在AR系统中,程序实时合成高清图形和地理空间数据。工业主板 物联网网关获得本地计算资源有两大好处。首先,它使得网关无需接收云端的指令就可以驱动简单的应用程序。例如一条监控生产线上压力水平的简单规则,如果气压达到某个阈值,它可以切断整条生产线,无论云端是否可用,这条规则都应该处于工作状态。其次,在很多情况下,原始数据流如果运行正常,就不必都通过云端,而可以在边缘被处理,尤其是当通过按流量计费的网络 (比如蜂窝网络) 连接到云端时。 为此,arm将Mbed Cloud的物联网设备管理功能扩展,支持配置 Mbed Edge的物联网网关实现设备的接入、控制和管理。Mbed Edge具备三大重要功能:支持非IP网络协议,边缘计算和网关管理。 协议转换:许多传统连网设备使用的通信协议与IP网络协议不兼容,比如 Modbus和BACnet,Mbed Edge可以转换这些协议,使得这些设备与基于IP网络协议的设备一样由Mbed Cloud管理起来。 网关管理:Mbed Edge的一系列新特性可以提升物联网网关的持续服务能力,最大程度缩短代价高昂的停机时间。关键性能包括预警通知,流程、资源和接口管理,还有详细本地诊断能力。 边缘计算:Mbed Edge将提供本地应用执行环境以及相关的计算资源,从而在网关上即可进行规则运算和数据处理。如此,即使本地网络与外网断开连接,本地业务仍然可以持续进行,降低对生产力的影响。 arm表示Mbed Edge主要计划实现两块能力发展,一个就是涉及设备,另一个是涉及云端,尤其针对身份识别,访问路径管理,以及其他相关能力,arm将再添一个管理层到设备之上,实现设备的网关管理和通信。

优秀的个人博客,低调大师

Android第四期 - 单侧滑动效果

Android的设置或者登陆或者其他的一些主窗体要展示的功能需要用到sliding的效果,下面就叫大家怎么做。直接上代码!! MainActivity部分: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 package net.ting.sliding; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageView; public class MainActivity extends Activity implements OnClickListener{ private SlideMenuslideMenu; @Override protected void onCreate(BundlesavedInstanceState){ super .onCreate(savedInstanceState); setContentView(R.layout.activity_main); slideMenu=(SlideMenu)findViewById(R.id.slide_menu); ImageViewmenuImg=(ImageView)findViewById(R.id.title_bar_menu_btn); menuImg.setOnClickListener( this ); } @Override public void onClick(Viewv){ switch (v.getId()){ case R.id.title_bar_menu_btn: if (slideMenu.isMainScreenShowing()){ slideMenu.openMenu(); } else { slideMenu.closeMenu(); } break ; } } } SlideMenu部分: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 package net.ting.sliding; import android.content.Context; import android.graphics.Canvas; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.View; import android.view.ViewConfiguration; import android.view.ViewGroup; import android.widget.Scroller; public class SlideMenu extends ViewGroup{ public static final int SCREEN_MENU= 0 ; public static final int SCREEN_MAIN= 1 ; private static final int SCREEN_INVALID=- 1 ; private int mCurrentScreen; private int mNextScreen=SCREEN_INVALID; private ScrollermScroller; private VelocityTrackermVelocityTracker; private int mTouchSlop; private float mLastMotionX; private float mLastMotionY; private final static int TOUCH_STATE_REST= 0 ; private final static int TOUCH_STATE_SCROLLING= 1 ; private static final int SNAP_VELOCITY= 1000 ; public int mTouchState=TOUCH_STATE_REST; private boolean mLocked; private boolean mAllowLongPress; public SlideMenu(Contextcontext){ this (context, null , 0 ); } public SlideMenu(Contextcontext,AttributeSetattrs){ this (context,attrs, 0 ); } public SlideMenu(Contextcontext,AttributeSetattrs, int defStyle){ super (context,attrs,defStyle); mScroller= new Scroller(getContext()); mCurrentScreen=SCREEN_MAIN; mTouchSlop=ViewConfiguration.get(getContext()).getScaledTouchSlop(); } @Override protected void onMeasure( int widthMeasureSpec, int heightMeasureSpec){ super .onMeasure(widthMeasureSpec,heightMeasureSpec); measureViews(widthMeasureSpec,heightMeasureSpec); } public void measureViews( int widthMeasureSpec, int heightMeasureSpec){ ViewmenuView=getChildAt( 0 ); menuView.measure(menuView.getLayoutParams().width+menuView.getLeft() +menuView.getRight(),heightMeasureSpec); ViewcontentView=getChildAt( 1 ); contentView.measure(widthMeasureSpec,heightMeasureSpec); } @Override protected void onLayout( boolean changed, int l, int t, int r, int b){ int childCount=getChildCount(); if (childCount!= 2 ){ throw new IllegalStateException( "ThechildCountofSlidingMenumustbe2" ); } ViewmenuView=getChildAt( 0 ); final int width=menuView.getMeasuredWidth(); menuView.layout(-width, 0 , 0 ,menuView.getMeasuredHeight()); ViewcontentView=getChildAt( 1 ); contentView.layout( 0 , 0 ,contentView.getMeasuredWidth(), contentView.getMeasuredHeight()); } @Override protected void onFinishInflate(){ super .onFinishInflate(); Viewchild; for ( int i= 0 ;i<getChildCount();i++){ child=getChildAt(i); child.setFocusable( true ); child.setClickable( true ); } } @Override public boolean onInterceptTouchEvent(MotionEventev){ if (mLocked){ return true ; } final int action=ev.getAction(); if ((action==MotionEvent.ACTION_MOVE) &&(mTouchState!=TOUCH_STATE_REST)){ return true ; } final float x=ev.getX(); final float y=ev.getY(); switch (action){ case MotionEvent.ACTION_MOVE: final int xDiff=( int )Math.abs(x-mLastMotionX); final int yDiff=( int )Math.abs(y-mLastMotionY); final int touchSlop=mTouchSlop; boolean xMoved=xDiff>touchSlop; boolean yMoved=yDiff>touchSlop; if (xMoved||yMoved){ if (xMoved&&(yDiff<xDiff)){ //ScrolliftheusermovedfarenoughalongtheXaxis mTouchState=TOUCH_STATE_SCROLLING; enableChildrenCache(); } //Eitherway,cancelanypendinglongpress if (mAllowLongPress){ mAllowLongPress= false ; //Trycancelingthelongpress.Itcouldalsohavebeen //scheduled //byadistantdescendant,sousethemAllowLongPressflag //toblock //everything final ViewcurrentScreen=getChildAt(mCurrentScreen); currentScreen.cancelLongPress(); } } break ; case MotionEvent.ACTION_DOWN: //Rememberlocationofdowntouch mLastMotionX=x; mLastMotionY=y; mAllowLongPress= true ; mTouchState=mScroller.isFinished()?TOUCH_STATE_REST :TOUCH_STATE_SCROLLING; break ; case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: //Releasethedrag clearChildrenCache(); mTouchState=TOUCH_STATE_REST; mAllowLongPress= false ; break ; } /* *Theonlytimewewanttointerceptmotioneventsisifweareinthe *dragmode. */ returnmTouchState!=TOUCH_STATE_REST; } voidenableChildrenCache(){ finalintcount=getChildCount(); for(inti=0;i<count;i++){ finalViewlayout=(View)getChildAt(i); layout.setDrawingCacheEnabled(true); } } voidclearChildrenCache(){ finalintcount=getChildCount(); for(inti=0;i<count;i++){ finalViewlayout=(View)getChildAt(i); layout.setDrawingCacheEnabled(false); } } @Override publicbooleanonTouchEvent(MotionEventev){ if(mLocked){ returntrue; } if(mVelocityTracker==null){ mVelocityTracker=VelocityTracker.obtain(); } mVelocityTracker.addMovement(ev); finalintaction=ev.getAction(); finalfloatx=ev.getX(); switch(action){ caseMotionEvent.ACTION_DOWN: /* *Ifbeingflingedandusertouches,stopthefling.isFinished *willbefalseifbeingflinged. */ if (!mScroller.isFinished()){ mScroller.abortAnimation(); } //Rememberwherethemotioneventstarted mLastMotionX=x; break ; case MotionEvent.ACTION_MOVE: if (mTouchState==TOUCH_STATE_SCROLLING){ //Scrolltofollowthemotionevent final int deltaX=( int )(mLastMotionX-x); mLastMotionX=x; if (deltaX< 0 ){ if (deltaX+getScrollX()>=-getChildAt( 0 ).getWidth()){ scrollBy(deltaX, 0 ); } } else if (deltaX> 0 ){ final int availableToScroll=getChildAt( getChildCount()- 1 ).getRight() -getScrollX()-getWidth(); if (availableToScroll> 0 ){ scrollBy(Math.min(availableToScroll,deltaX), 0 ); } } } break ; case MotionEvent.ACTION_UP: if (mTouchState==TOUCH_STATE_SCROLLING){ final VelocityTrackervelocityTracker=mVelocityTracker; velocityTracker.computeCurrentVelocity( 1000 ); int velocityX=( int )velocityTracker.getXVelocity(); if (velocityX>SNAP_VELOCITY&&mCurrentScreen==SCREEN_MAIN){ //Flinghardenoughtomoveleft snapToScreen(SCREEN_MENU); } else if (velocityX<-SNAP_VELOCITY &&mCurrentScreen==SCREEN_MENU){ //Flinghardenoughtomoveright snapToScreen(SCREEN_MAIN); } else { snapToDestination(); } if (mVelocityTracker!= null ){ mVelocityTracker.recycle(); mVelocityTracker= null ; } } mTouchState=TOUCH_STATE_REST; break ; case MotionEvent.ACTION_CANCEL: mTouchState=TOUCH_STATE_REST; } return true ; } @Override public void computeScroll(){ if (mScroller.computeScrollOffset()){ scrollTo(mScroller.getCurrX(),mScroller.getCurrY()); } else if (mNextScreen!=SCREEN_INVALID){ mCurrentScreen=Math.max( 0 , Math.min(mNextScreen,getChildCount()- 1 )); mNextScreen=SCREEN_INVALID; clearChildrenCache(); } } @Override public void scrollTo( int x, int y){ super .scrollTo(x,y); postInvalidate(); } @Override protected void dispatchDraw(Canvascanvas){ final int scrollX=getScrollX(); super .dispatchDraw(canvas); canvas.translate(scrollX, 0 ); } @Override public boolean dispatchUnhandledMove(Viewfocused, int direction){ if (direction==View.FOCUS_LEFT){ if (getCurrentScreen()> 0 ){ snapToScreen(getCurrentScreen()- 1 ); return true ; } } else if (direction==View.FOCUS_RIGHT){ if (getCurrentScreen()<getChildCount()- 1 ){ snapToScreen(getCurrentScreen()+ 1 ); return true ; } } return super .dispatchUnhandledMove(focused,direction); } protected void snapToScreen( int whichScreen){ enableChildrenCache(); whichScreen=Math.max( 0 ,Math.min(whichScreen,getChildCount()- 1 )); boolean changingScreens=whichScreen!=mCurrentScreen; mNextScreen=whichScreen; ViewfocusedChild=getFocusedChild(); if (focusedChild!= null &&changingScreens &&focusedChild==getChildAt(mCurrentScreen)){ focusedChild.clearFocus(); } final int newX=(whichScreen- 1 )*getChildAt( 0 ).getWidth(); final int delta=newX-getScrollX(); mScroller.startScroll(getScrollX(), 0 ,delta, 0 ,Math.abs(delta)* 2 ); invalidate(); } protected void snapToDestination(){ if (getScrollX()== 0 ){ return ; } final int screenWidth=getChildAt( 0 ).getWidth(); final int whichScreen=(screenWidth+getScrollX()+(screenWidth/ 2 )) /screenWidth; snapToScreen(whichScreen); } public int getCurrentScreen(){ return mCurrentScreen; } public boolean isMainScreenShowing(){ return mCurrentScreen==SCREEN_MAIN; } public void openMenu(){ mCurrentScreen=SCREEN_MENU; snapToScreen(mCurrentScreen); } public void closeMenu(){ mCurrentScreen=SCREEN_MAIN; snapToScreen(mCurrentScreen); } public void unlock(){ mLocked= false ; } public void lock(){ mLocked= true ; } } activity_main.xml部分: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 < RelativeLayout xmlns:android = "http://schemas.android.com/apk/res/android" android:layout_width = "match_parent" android:layout_height = "match_parent" > < net.ting.sliding.SlideMenu android:id = "@+id/slide_menu" android:layout_width = "fill_parent" android:layout_height = "fill_parent" > < include layout = "@layout/layout_menu" /> < RelativeLayout android:layout_width = "fill_parent" android:layout_height = "fill_parent" android:background = "@color/color_2" android:orientation = "vertical" > < include layout = "@layout/layout_title_bar" /> < TextView android:layout_width = "wrap_content" android:layout_height = "wrap_content" android:layout_centerInParent = "true" android:text = "HelloWorld" android:textSize = "22sp" /> </ RelativeLayout > </ net.ting.sliding.SlideMenu > </ RelativeLayout > layout_menu.xml部分: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 <? xml version = "1.0" encoding = "utf-8" ?> < LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android" android:layout_width = "240dip" android:layout_height = "fill_parent" android:background = "@drawable/bitmap_book_read_chapterlist_repeat" android:orientation = "vertical" > < TextView android:layout_width = "240dip" android:layout_height = "28.0dip" android:background = "#ff313131" android:gravity = "center_vertical" android:paddingLeft = "15.0dip" android:text = "分类" android:textColor = "#ff959595" android:textSize = "14.0sp" /> < TextView android:layout_width = "240dip" android:layout_height = "50.0dip" android:background = "@drawable/selector_category_item" android:clickable = "true" android:drawableLeft = "@drawable/ic_category_mark" android:drawablePadding = "1.0dip" android:gravity = "center_vertical" android:paddingLeft = "15.0dip" android:paddingRight = "10.0dip" android:text = "侧边栏选项-1" android:textColor = "#ff959595" android:textSize = "16.0sp" /> < View android:layout_width = "240dip" android:layout_height = "2.0dip" android:background = "@drawable/ic_shelf_category_divider" /> < TextView android:layout_width = "240dip" android:layout_height = "50.0dip" android:background = "@drawable/selector_category_item" android:clickable = "true" android:drawableLeft = "@drawable/ic_category_mark" android:drawablePadding = "1.0dip" android:gravity = "center_vertical" android:paddingLeft = "15.0dip" android:paddingRight = "10.0dip" android:text = "侧边栏选项-2" android:textColor = "#ff959595" android:textSize = "16.0sp" /> < View android:layout_width = "240dip" android:layout_height = "2.0dip" android:background = "@drawable/ic_shelf_category_divider" /> < TextView android:layout_width = "240dip" android:layout_height = "50.0dip" android:background = "@drawable/selector_category_item" android:clickable = "true" android:drawableLeft = "@drawable/ic_category_mark" android:drawablePadding = "1.0dip" android:gravity = "center_vertical" android:paddingLeft = "15.0dip" android:paddingRight = "10.0dip" android:text = "侧边栏选项-3" android:textColor = "#ff959595" android:textSize = "16.0sp" /> < View android:layout_width = "240dip" android:layout_height = "2.0dip" android:background = "@drawable/ic_shelf_category_divider" /> </ LinearLayout > layout_title_bar.xml部分: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 <? xml version = "1.0" encoding = "utf-8" ?> < RelativeLayout xmlns:android = "http://schemas.android.com/apk/res/android" android:layout_width = "fill_parent" android:layout_height = "45.0dip" android:background = "@drawable/bg_title_bar" android:gravity = "center_vertical" > < ImageView android:id = "@+id/title_bar_menu_btn" android:layout_width = "wrap_content" android:layout_height = "wrap_content" android:layout_centerVertical = "true" android:layout_marginLeft = "3.0dip" android:layout_marginRight = "3.0dip" android:layout_marginTop = "3.0dip" android:gravity = "center" android:src = "@drawable/ic_top_bar_category" /> < ImageView android:layout_width = "wrap_content" android:layout_height = "fill_parent" android:layout_toRightOf = "@id/title_bar_menu_btn" android:background = "@drawable/ic_top_divider" /> < TextView android:id = "@+id/title_bar_name" android:layout_width = "wrap_content" android:layout_height = "wrap_content" android:layout_centerInParent = "true" android:ellipsize = "end" android:gravity = "center" android:paddingLeft = "75.0dip" android:paddingRight = "75.0dip" android:singleLine = "true" android:text = "Title" android:textColor = "#ffffff" android:textSize = "22sp" /> </ RelativeLayout > 按钮效果布局部分: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 bitmap_page_category_bg.xml: <? xml version = "1.0" encoding = "utf-8" ?> < bitmap android:src = "@drawable/ic_item_normal_bg" android:tileMode = "repeat" xmlns:android = "http://schemas.android.com/apk/res/android" /> selector_category_item.xml <? xml version = "1.0" encoding = "utf-8" ?> < selector xmlns:android = "http://schemas.android.com/apk/res/android" > < item android:state_pressed = "true" android:drawable = "@drawable/ic_item_selected_bg" /> < item android:state_focused = "true" android:drawable = "@drawable/ic_item_selected_bg" /> < item android:drawable = "@drawable/ic_item_normal_bg" /> </ selector > 附效果图: 附件:http://down.51cto.com/data/2364559 本文转自 吴雨声 51CTO博客,原文链接:http://blog.51cto.com/liangxiao/1429339,如需转载请自行联系原作者

资源下载

更多资源
Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

用户登录
用户注册