runtime

iOS 编码复习(二)—— runtime

半世苍凉 提交于 2020-02-04 00:15:33
最近特意看了很多篇关于runtime的文章。所以自己也想把了解的东西总结一下,以便以后大家一起学习。首先必须要诚实地说一句,这里都是看了别人的文章后,用自己的话总结出来的,而没有像其他额大牛样去用c语言去写一个swizzle method之类的。 首先要说,OC是一门运行时语言,因为它不像c++在编译的时候就会检查所有函数调用,而是运行时才会检查。 先来看看[target dosomething:varl];编译器会把它编译成什么:objc_msgsend(target,@selector(dosomething:),varl);你会发现这是一个c方法。那什么是runtime呢?runtime其实就是一个运势时的c语言写成的基础库,oc的程序必须得到runtime的的运行才能正常work。 下面我们来介绍一下对象和类。它们其实就是用c语言封装的结构体。(感受下面向对象与面向过程语言的区别) oc里的class实际上就是一个 objc_class 结构体的指针: typedef struct objc_class *Class; struct objc_class { Class isa OBJC_ISA_AVAILABILITY; #if !__OBJC2__ Class super_class OBJC2_UNAVAILABLE; // 父类 const char *name

Java注解

淺唱寂寞╮ 提交于 2020-02-03 14:47:08
注解作用:每当你创建描述符性质的类或者接口时,一旦其中包含重复性的工作,就可以考虑使用注解来简化与自动化该过程。 Java提供了四种元注解,专门负责新注解的创建工作。 元注解   元注解的作用就是负责注解其他注解。Java5.0定义了4个标准的meta-annotation类型,它们被用来提供对其它 annotation类型作说明。Java5.0定义的元注解:     1. @Target     2. @Retention     3. @Documented     4. @Inherited   这些类型和它们所支持的类在java.lang.annotation包中可以找到。下面我们看一下每个元注解的作用和相应分参数的使用说明。 @Target   @Target说明了Annotation所修饰的对象范围:Annotation可被用于 packages、types(类、接口、枚举、Annotation类型)、类型成员(方法、构造方法、成员变量、枚举值)、方法参数和本地变量(如循环变量、catch参数)。在Annotation类型的声明中使用了target可更加明晰其修饰的目标。   作用:用于描述注解的使用范围(即:被描述的注解可以用在什么地方,取值(ElementType)有:     1. CONSTRUCTOR:用于描述构造器     2. FIELD:用于描述域   

Runtime error when trying to logout django

瘦欲@ 提交于 2020-02-03 07:20:46
问题 When I try to logout from my django project, I get the following error: "maximum recursion depth exceeded while calling a Python object" Here is the url for the logout button: url(r'^logout', 'users.views.logout', name='logout'), And here is the view: from django.shortcuts import render from deck1.models import Card from django.template import RequestContext from django.shortcuts import render_to_response from django.http import HttpResponseRedirect, HttpResponse from django.contrib.auth

Acumatica dynamic dropdown

这一生的挚爱 提交于 2020-02-02 15:23:16
问题 I have a dropdown in a Grid and I want to fill it in runtime. I tried it in a RowSelected event but it doesn't work. Then I tried it to assign the attribute PXStringList in the field definition on the DAC, but it doesn't work either. This is the event protected virtual void HIASetupDetail_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { List<string> values = new List<string>(); values.AddRange(new string[] { "A", "B" }); if (e.Row == null) { return; } HIASetupDetail HIASetupDetailRow =

Acumatica dynamic dropdown

北城余情 提交于 2020-02-02 15:22:27
问题 I have a dropdown in a Grid and I want to fill it in runtime. I tried it in a RowSelected event but it doesn't work. Then I tried it to assign the attribute PXStringList in the field definition on the DAC, but it doesn't work either. This is the event protected virtual void HIASetupDetail_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { List<string> values = new List<string>(); values.AddRange(new string[] { "A", "B" }); if (e.Row == null) { return; } HIASetupDetail HIASetupDetailRow =

CentOS在线安装JDK

送分小仙女□ 提交于 2020-02-02 07:55:38
一、通过yum命令在线安装jdk 1.查看云端目前支持安装的jdk版本 [root@localhost ~]# yum search java|grep jdk ldapjdk-javadoc.noarch : Javadoc for ldapjdk java-1.6.0-openjdk.x86_64 : OpenJDK Runtime Environment java-1.6.0-openjdk-demo.x86_64 : OpenJDK Demos java-1.6.0-openjdk-devel.x86_64 : OpenJDK Development Environment java-1.6.0-openjdk-javadoc.x86_64 : OpenJDK API Documentation java-1.6.0-openjdk-src.x86_64 : OpenJDK Source Bundle java-1.7.0-openjdk.x86_64 : OpenJDK Runtime Environment java-1.7.0-openjdk-accessibility.x86_64 : OpenJDK accessibility connector java-1.7.0-openjdk-demo.x86_64 : OpenJDK Demos java-1.7.0

三分钟让你秒懂.Net生态系统

泄露秘密 提交于 2020-02-02 02:40:14
提到.Net的时候,大多数人的第一反应可能就是.Net Framework和Visual Studio。.Net Framework的第一个版本发布与2002年2月13日,这对于科技发展日新月异的时代,这差不多已经可以看做是史前文明了。 .Net Framework发布之后,微软就一直致力于让它成为现代Web、移动和云时代的可用性开发平台。这也促成了.Net Core 2和.Net Standard 2.0的发展,但是这种快速发展也往往让人们开始对庞大的.Net 生态系统感到困惑。 .Net生态系统混乱 我们都知道.Net框架,但是它是如何在基类库中工作的呢?什么是便携式类库?什么时候使用?.Net Core又是什么呢?与.Net Framework有什么不同呢?什么又是.Net Standard?如何安装?如何建立一个可重用的库呢? 上面的所有因素都会在你为项目选择的时候造成困扰。什么是.NET标准类库,.NET Core或.NET Framework?什么是共享项目和可移植类库?你应该在哪里集中精力?是否应该学习一切,放弃旧知识?如何选用runtime?……这些都是在开始下个项目或者学习新技术之前都需要了解的关键问题,所以本文将尽力在文中回答这些问题。 .NET生态系统解释 为了满足现代应用的需求,.Net生态系统正在经历不断的升级改造,下图是.Net生态系统的现状:

How to detect the OS from a silverlight application?

与世无争的帅哥 提交于 2020-02-01 03:08:53
问题 I have a Silverlight3 application that is meant to run on both Windows and Mac OS environments. I would like to know in runtime if my application is running on a Windows or Mac so I can tweak a few things to the way users are accustomed to in their operating system of choice. For example, in Windows it is the norm to use "OK" "Cancel" buttons, while in Mac OS the norm is "Cancel" "OK" buttons (reverse order). Any ideas? 回答1: There are two ways. From Silverlight: string os = Environment

How to detect the OS from a silverlight application?

£可爱£侵袭症+ 提交于 2020-02-01 03:08:07
问题 I have a Silverlight3 application that is meant to run on both Windows and Mac OS environments. I would like to know in runtime if my application is running on a Windows or Mac so I can tweak a few things to the way users are accustomed to in their operating system of choice. For example, in Windows it is the norm to use "OK" "Cancel" buttons, while in Mac OS the norm is "Cancel" "OK" buttons (reverse order). Any ideas? 回答1: There are two ways. From Silverlight: string os = Environment

Aspect weaving at runtime

依然范特西╮ 提交于 2020-01-31 09:38:33
问题 I'm looking for a Java solution that would allow me to use AOP to weave new code on top of already running code at runtime. The key is not to require the restart of the JVM. Also, I'd like to remove the woven at runtime, leaving the old code running the way it was before weaving. I'm thinking AspectJ load time weaving + runtime class loading/unloading would do it. Has anyone tried it? Any recommendations? Thank you. 回答1: A few things to consider: True, you can do LTW during class loading, but