开发过程中,某些变量可能需要被控制器中的其它方法所调用,这个变量改怎么设置呢? 其实可以用ci的$this->load->vars($array);和$this->load->get_var($key);来实现. 数组可以在构造函数中设置,在方法中可以用get_var($key)获取value. class User extends CI_Controller{ public function __construct() { parent::__construct(); $arr…
需要在其他JavaScript文件中调用AngularJS内部方法或改变$scope变量,同时还要保持双向数据绑定: 首先获取AngularJS application: 方法一:通过controller来获取app var appElement = document.querySelector('[ng-controller=mainController]'); 然后在获取$scope变量: var $scope = angular.element(appElement).scope(); 如…
Eclipse中设置编码的方式如果要使插件开发应用能有更好的国际化支持,能够最大程度的支持中文输出,则最好使 Java文件使用UTF-8编码.然而,Eclipse工作空间(workspace)的缺省字符编码是操作系统缺省的编码,简体中文操作系统 (Windows XP.Windows 2000简体中文)的缺省编码是GB18030,在此工作空间中建立的工程编码是GB18030,工程中建立的java文件也是GB18030.如果要使新建立工程.java文件直接使UTF-8则需要做以下工作: 1. wi…
我们知道高版本中的rails中的分页功能已经放在will_paginate这个gem中,我们在控制器方法中往往需要调用其paginate方法来实现分页数据集控制,举个例子:正常的情况我们想要每页显示10条记录可以这么写: Item.paginate(page:params[:page],per_page:10) 但是我们又想要降序排列记录呢?书上给出的例子如下: Item.paginate(page:params[:page],per_page:10,order:'created_at DESC…
场景: 子类化Cell中有button,拥有选中式样,点击第一个Cell中的button后,Cell一中的button获得选中式样.可是当点击Cell二中的button时.Cell一中的button选中式样依旧存在,即同一时候存在两个选中的button. 解决方法: 在子类化的Cell中,定义一个 static UIButton *selectedButton; 必须是 static 静态变量. 然后在点击方法中. - (void)headerButtonClickAction:(UIButto…
今天在维护公司的一个APP的时候,突然爆了空指针异常, Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.content.Intent.getBooleanExtra(java.lang.String, boolean)' on a null object reference 下面是报错的log. D/AndroidRuntime( 4721): Shuttin…
问题引子: ist<Student> students=new ArrayList<Student>(); students.add(new Student("20160800612")); System.out.println(students.contains(new Student("20160800612"))) 返回FALSE Student stu=new Student("123"); students.ad…
procedure TMainFrm.Timer1Timer(Sender: TObject); var   systemtime:Tsystemtime;   dt:TDateTime; begin   L_DateTime.Caption:=FormatDateTime('YYYY-MM-DD HH:SS',Now); //显示当前时间 MainFrm.Caption:=IntToStr(Timer1.Tag);   timer1.tag:=timer1.tag+1;   if Timer1…
class FileUpload { private $path = "./uploads"; //上传文件保存的路径 private $allowtype = array('jpg','gif','png'); //设置限制上传文件的类型 private $maxsize = 1000000; //限制文件上传大小(字节) private $israndname = true; //设置是否随机重命名文件, false不随机 /** * 用于设置成员属性($path, $allowt…
参考博文:idea生成类注释和方法注释的正确方法…