首页 文章 精选 留言 我的

精选列表

搜索[sql文件加载],共10000篇文章
优秀的个人博客,低调大师

动态加载Js代码到Head标签中的脚本

我遇到了这样的问题,请教google,结果大多数只是介绍那个注册js的几个函数,而这几个函数插入的js都在body里面,幸而在老外那里看到了这个代码,其实比较简单,但够有用 1 HtmlGenericControlInclude2 = new HtmlGenericControl( " script " ); 2 Include2.Attributes.Add( " type " , " text/javascript " ); 3 Include2.InnerHtml = " alert('JavaScriptinPageHeader'); " ; 4 this .Page.Header.Controls.Add(Include2); 或 Literalli = new Literal(); li.Text = " <script</script> " ; this .Page.Header.Controls.Add(li); 或者 Code 欢迎加群互相学习,共同进步。QQ群:iOS: 58099570 | Android: 572064792 | Nodejs:329118122 做人要厚道,转载请注明出处! 本文转自张昺华-sky博客园博客,原文链接:http://www.cnblogs.com/sunshine-anycall/archive/2009/10/24/1589315.html ,如需转载请自行联系原作者

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

IOS 多于UIImageView 当加载较大的高清闪存管理

当我们是一家人View 多于UIImageView,和UIImageView表明一个更大的HD,可能存在的存储器的警告的问题。假设第一次走进这个view,无记忆出现预警。当重新进入view,在那曾经的记忆不及时释放的假设。这是蓄积的经时,它可以导致内存破坏。 1,UIImage 载入图片的方式。 假设是本地图片,尽量不要使用 [UIImage imageNamed:nil]; 这样的方式,假设使用这样的方式载入。仅仅要程序不退出,它便一直会在内存中。 我们能够使用 : NSString*path = [[NSBundlemainBundle]pathForResource:@'"图片的名字"ofType:@""]; UIImage*image = [UIImageimageWithContentsOfFile:path]; 那两者的优缺点就非常明显了,[UIImage imageNamed:nil]; 仅仅需载入一次,它便在内存中,所以第二次载入速度非常快。而另外一种载入方式因为我们将它释放掉了,会再次载入。 所以选用那种方式,依你情况而定。 2,上面说的另外一种方式。尽管能够释放掉,但我们要告诉人家什么时候释放。也就是说,当前显示页面不是这个view时,我们便将它释放掉: - (void)viewWillDisappear:(BOOL)animated{ [UIImageViewremoveFromSuperview]; UiImageView=nil; } 当然,当我们再次进入这个view时,便要将移除掉的view再次加入进来 - (void)viewDidAppear:(BOOL)animated{ [self addSubView:UIImageView]; } 3,上述两种方式。主要解决内存累加的问题。但假设第一次进入view。图片所有渲染在view上时。内存就崩溃了。 那我们仅仅能在图片上做文章了。我们载入的高清大图假设差点儿相同都是3000*2000,也可能比这个还大,就算我们的程序是iPad App,iPad 4 的分辨率才多少。这些图远远大于设备的分辨率,全然是资源浪费,所以我们通常的一个做法,便是将这种图以小尺寸渲染到view上。 推荐使用: UIImage+Resize.h, UIImage+Resize.m Extends the UIImage class to support resizing (optionally preserving the original aspect ratio), cropping, and generating thumbnails. UIImage+RoundedCorner.h, UIImage+RoundedCorner.m Extends the UIImage class to support adding rounded corners to an image. UIImage+Alpha.h, UIImage+Alpha.m Extends the UIImage class with helper methods for working with alpha layers (transparencies). 经常用法: UIImage*image UIImage*thumbImage = [imagethumbnailImage:140// This should the size of the view in collection view. example: myCell width is 20 and height is 20. transparentBorder:0 cornerRadius:0 interpolationQuality:kCGInterpolationMedium]; //生成缩略图 // this "resizedimage" image is what you want to pass to setImage UIImage* resizedImage = [imageresizedImage:imageview.frame.sizeinterpolationQuality:kCGInterpolationLow]; //生成你想要尺寸的图 造成的问题,要注意缩放的比例,不要导致图片变形,因为尺寸缩小,可能会导致图片模糊,注意缩小的尺寸。 综上可见。每种方法有长处,有缺点。主要根据自己的开发情况,用妥协。 版权声明:本文博客原创文章。博客,未经同意,不得转载。 本文转自mfrbuaa博客园博客,原文链接http://www.cnblogs.com/mfrbuaa/p/4731201.html,如需转载请自行联系原作者

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

android在service中使用AsyncHttpClient加载网络资源

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 package com.example.service; import org.apache.http.Header; import org.json.JSONObject; import com.loopj.android.http.AsyncHttpClient; import com.loopj.android.http.JsonHttpResponseHandler; import com.loopj.android.http.RequestParams; import android.annotation.SuppressLint; import android.app.Service; import android.content.Intent; import android.content.ServiceConnection; import android.os.Binder; import android.os.IBinder; import android.widget.Toast; public class GetDateService extends Service{ /* *请求队列*/ private MyBindmyBind= new MyBind(); @Override public void onCreate(){ //TODOAuto-generatedmethodstub super .onCreate(); System.out.println( "TestServiceoncreate()" ); } @SuppressLint ( "NewApi" ) @Override public int onStartCommand(Intentintent, int flags, int startId){ //TODOAuto-generatedmethodstub getDate( "http://www.lewei50.com/api/V1/Gateway/GetSensors/01" ); return super .onStartCommand(intent,flags,startId); } @Override public void onDestroy(){ //TODOAuto-generatedmethodstub super .onDestroy(); System.out.println( "TestServicedesory()" ); } @Override public IBinderonBind(Intentintent){ //TODOAuto-generatedmethodstub return myBind; } @Override public void unbindService(ServiceConnectionconn){ //TODOAuto-generatedmethodstub System.out.println( "TestUnbindService()" ); super .unbindService(conn); } public class MyBind extends Binder{ public void test(){ System.out.println( "test" ); } public GetDateServicegetDateService(){ return GetDateService. this ; } } public void getDate(Stringurl){ AsyncHttpClientclient= new AsyncHttpClient(); RequestParamsparams= new RequestParams(); //设置请求的参数名和参数值 params.put( "userKey" , "cc809cd707xxxxxa917xxxxxxc674d0" ); client.get(url,params, new JsonHttpResponseHandler(){ @Override public void onStart(){ //calledbeforerequestisstarted } @Override public void onSuccess( int statusCode,Header[]headers,JSONObjectresponse){ //TODOAuto-generatedmethodstub super .onSuccess(statusCode,headers,response); Toast.makeText(GetDateService. this ,response.toString(),Toast.LENGTH_SHORT).show(); } @Override public void onFailure( int arg0,Header[]headers, byte []arg2, Throwablearg3){ //TODOAuto-generatedmethodstub super .onFailure(arg0,headers,arg2,arg3); Toast.makeText(GetDateService. this ,arg3.toString(),Toast.LENGTH_SHORT).show(); } @Override public void onRetry(){ //TODOAuto-generatedmethodstub super .onRetry(); } }); System.out.println(url); } } public void getDate(String url){ AsyncHttpClient client = new AsyncHttpClient(); RequestParams params = new RequestParams(); // 设置请求的参数名和参数值 params.put("userKey", "cc809cd707cexxxxx9176xxxxxc674d0"); client.get(url,params, new JsonHttpResponseHandler() { @Override public void onStart() { // called before request is started } @Override public void onSuccess(int statusCode, Header[] headers,JSONObject response) { // TODO Auto-generated method stub super.onSuccess(statusCode, headers, response); Toast.makeText(GetDateService.this, response.toString(), Toast.LENGTH_SHORT).show(); } @Override public void onFailure(int arg0, Header[] headers, byte[] arg2, Throwable arg3) { // TODO Auto-generated method stub super.onFailure(arg0, headers, arg2, arg3); Toast.makeText(GetDateService.this, arg3.toString(), Toast.LENGTH_SHORT).show(); } @Override public void onRetry() { // TODO Auto-generated method stub super.onRetry(); } }); } 参数格式是String类型,得到的数据格式是json格式 本文转自 matengbing 51CTO博客,原文链接:http://blog.51cto.com/matengbing/1909711

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

android mediaplayer VideoPlayerManager 加载视频闪屏问题排查解决

Android VideoPlayer 在滚动列表实现item视频播放(ListView控件和RecyclerView),在列表滚动时点击屏幕列表暂停,在item视频播放区域,视频播放时会出现闪屏问题。 排查解决,VideoPlayerManager-》MediaPlayerWrapper.java->prepare() : { .prepareAsync().set(State.)(!=){ .post()} }(IllegalStateExceptionex){ RuntimeException(ex)} 改为prepareAsync()异步准备播放。可以解决闪屏问题。 相关参考文章: 1、http://blog.csdn.net/u012519664/article/details/41173381 Android开发之MediaPlayer详解 2、http://blog.csdn.net/qq_24223073/article/details/69315856Android关于MediaPlayer中的prepare方法和prepareAsync方法的区别 3、http://blog.csdn.net/wooder111/article/details/51513582 Android在滚动列表中实现视频的播放(ListView & RecyclerView) 本文转自ljianbing51CTO博客,原文链接:http://blog.51cto.com/ljianbing/1955474,如需转载请自行联系原作者

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Rocky Linux

Rocky Linux

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

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册