angularjs 上传文件

需求:传文件

实现:http://www.tutorialspoint.com/angularjs/angularjs_upload_file.htm

注意请求头的设置

http://stackoverflow.com/questions/21115771/angularjs-upload-files-using-resource-solution

目前请求发出去了,但是结果还是哈皮


更新:

问题解决了,是后台的问题

关键:

在浏览器调试network里看发出去的请求是什么样的,上述方式发出去的请求和直接的form表单提交时一样的,所以说明前台没问题,是后台的问题,这里的主要影响因素是header里面的contenttype,用formdata

另外在调试中发现了神器postman 链接,专门做请求调试的,强无敌

css position absolute

图解

父元素在默认情况下是position: static;就是静态定位,这时候如果子元素使用position: absolute;,那么子元素就会跳出父元素的范围,进入父元素的父元素范围,如果父元素的父元素依然是position: static;,那么就会继续跳出这个范围,一直到遇到一个position: absolute;或者position: relative;的祖先元素,才会在这个祖先元素的范围内进行定位布局。
如果子元素是position: absolute;,子元素的祖先元素都是position: static;,那么子元素就会不停往上跳出祖先元素的范围,直到body,然后在body内进行定位布局。
https://zhidao.baidu.com/question/1881998502829437508.html

temp

temp里的内容保证能随时删除

[{"createdUser":null,"createdApp":null,"createdDate":"2016-10-22T03:07:48.647+0000","lastUpdatedUser":null,"lastUpdatedApp":null,"lastUpdatedDate":"2016-12-05T09:39:04.000+0000","createdUserInfo":null,"lastUpdatedUserInfo":null,"customerID":null,"customer":null,"mapID":17,"name":"vip_map.csv","mapversion":"64.1","description":"vip 64.1map","content":null,"contentHashcode":"90faf8e94dd26be513799d487402dc85","screenLength":84000,"screenWidth":57000,"mapLongDistance":null,"ceilSize":null,"actived":false,"enabled":true,"published":true,"publishedDate":"2016-10-22T03:30:03.000+0000"},{"createdUser":null,"createdApp":null,"createdDate":"2016-10-22T05:23:16.470+0000","lastUpdatedUser":null,"lastUpdatedApp":null,"lastUpdatedDate":"2016-12-05T09:39:04.000+0000","createdUserInfo":null,"lastUpdatedUserInfo":null,"customerID":null,"customer":null,"mapID":19,"name":"vip_map.csv","mapversion":"66","description":"sprint66","content":null,"contentHashcode":"5485f63716a6cb267a37c25fe409ee24","screenLength":84000,"screenWidth":57000,"mapLongDistance":null,"ceilSize":null,"actived":false,"enabled":true,"published":true,"publishedDate":null},{"createdUser":null,"createdApp":null,"createdDate":"2016-10-26T02:57:37.819+0000","lastUpdatedUser":null,"lastUpdatedApp":null,"lastUpdatedDate":"2017-01-17T09:08:00.000+0000","createdUserInfo":null,"lastUpdatedUserInfo":null,"customerID":null,"customer":null,"mapID":21,"name":"vip_map.csv","mapversion":"66.1026","description":"66 for 11","content":null,"contentHashcode":"34ed1a436848583e7ee55d01d3db63a6","screenLength":84000,"screenWidth":57000,"mapLongDistance":null,"ceilSize":null,"actived":false,"enabled":true,"published":true,"publishedDate":"2016-10-26T03:13:54.000+0000"},{"createdUser":null,"createdApp":null,"createdDate":"2016-11-02T04:03:36.430+0000","lastUpdatedUser":null,"lastUpdatedApp":null,"lastUpdatedDate":"2017-01-17T09:12:14.000+0000","createdUserInfo":null,"lastUpdatedUserInfo":null,"customerID":null,"customer":null,"mapID":23,"name":"vip_map.csv","mapversion":"66.110201","description":"66 for 1111","content":null,"contentHashcode":"7c151d3d2a6080c7892290dd5c6a35f3","screenLength":84000,"screenWidth":57000,"mapLongDistance":null,"ceilSize":null,"actived":false,"enabled":true,"published":true,"publishedDate":"2016-11-14T04:10:14.000+0000"},{"createdUser":null,"createdApp":null,"createdDate":"2016-11-07T03:30:48.420+0000","lastUpdatedUser":null,"lastUpdatedApp":null,"lastUpdatedDate":"2016-12-05T09:39:04.000+0000","createdUserInfo":null,"lastUpdatedUserInfo":null,"customerID":null,"customer":null,"mapID":27,"name":"vip_wave_map.csv","mapversion":"66.110701","description":"vip wave map 1107 add stationIDs:10x","content":null,"contentHashcode":"939f1eeb05701c95bd6a307415ae141a","screenLength":84000,"screenWidth":57000,"mapLongDistance":null,"ceilSize":null,"actived":false,"enabled":true,"published":true,"publishedDate":"2016-11-07T03:45:36.000+0000"},{"createdUser":null,"createdApp":null,"createdDate":"2016-11-10T03:39:56.012+0000","lastUpdatedUser":null,"lastUpdatedApp":null,"lastUpdatedDate":"2016-12-05T09:39:04.000+0000","createdUserInfo":null,"lastUpdatedUserInfo":null,"customerID":null,"customer":null,"mapID":29,"name":"vip_wave_map.csv","mapversion":"66.111001","description":"66.111001","content":null,"contentHashcode":"872564cf8f7bf8d67dd464fccaa51899","screenLength":84000,"screenWidth":57000,"mapLongDistance":null,"ceilSize":null,"actived":false,"enabled":true,"published":true,"publishedDate":"2016-11-10T03:48:05.000+0000"},{"createdUser":null,"createdApp":null,"createdDate":"2016-11-10T05:27:59.348+0000","lastUpdatedUser":null,"lastUpdatedApp":null,"lastUpdatedDate":"2016-12-05T09:39:04.000+0000","createdUserInfo":null,"lastUpdatedUserInfo":null,"customerID":null,"customer":null,"mapID":31,"name":"vip_wave_map.csv","mapversion":"66.111002","description":"66.111002","content":null,"contentHashcode":"946744a6db9ff55aff2b63b339d1cedb","screenLength":84000,"screenWidth":57000,"mapLongDistance":null,"ceilSize":null,"actived":false,"enabled":true,"published":true,"publishedDate":"2016-11-10T05:36:41.000+0000"},{"createdUser":null,"createdApp":null,"createdDate":"2016-11-14T09:50:43.705+0000","lastUpdatedUser":null,"lastUpdatedApp":null,"lastUpdatedDate":"2017-01-17T09:12:23.000+0000","createdUserInfo":null,"lastUpdatedUserInfo":null,"customerID":null,"customer":null,"mapID":33,"name":"vip_map.csv","mapversion":"66.111401","description":"66.111401","content":null,"contentHashcode":"00dcf0defaefa8d655c11073495fee20","screenLength":84000,"screenWidth":57000,"mapLongDistance":null,"ceilSize":null,"actived":false,"enabled":false,"published":true,"publishedDate":"2016-11-15T10:20:26.000+0000"},{"createdUser":null,"createdApp":null,"createdDate":"2016-12-05T09:28:50.661+0000","lastUpdatedUser":null,"lastUpdatedApp":null,"lastUpdatedDate":"2016-12-05T09:39:04.000+0000","createdUserInfo":null,"lastUpdatedUserInfo":null,"customerID":null,"customer":null,"mapID":35,"name":"vip_map.csv","mapversion":"67.120501","description":"67 for 1212","content":null,"contentHashcode":"b4f91ee2b91c7b4a6d7e81622fc6494e","screenLength":84000,"screenWidth":57000,"mapLongDistance":null,"ceilSize":null,"actived":true,"enabled":true,"published":true,"publishedDate":"2016-12-05T09:39:04.000+0000"}]

插值,数据拟合和迭代

前言

大多数原理不懂,只管输入输出和实现

插值

http://www.docin.com/p-256261745.html

输入输出:

得到一个函数,函数符合插值条件

一次插值:

interpr1(x0,y0,x,’method’)

栗子:

一段数据,不同方法插值

clear
x0 = [8,12,16,24,30,44,48,56,60]
y0 = [36,54,78,92,101,35,25,16,13]
x = [14,20]
xx = [8:0.1:60]
yl = interp1(x0,y0,x,’linear’) %分段线性
yc = interp1(x0,y0,x,’cubic’) %分段三次埃尔米特
ys = interp1(x0,y0,x,’spline’) %三次样条
xyl = interp1(x0,y0,xx,’linear’) %分段线性
xyc = interp1(x0,y0,xx,’cubic’) %分段三次埃尔米特
xys = interp1(x0,y0,xx,’spline’) %三次样条
plot(x0,y0,’*’,xx,xyl,’r’,xx,xyc,’k’,xx,xys,’g’)

二次插值

在MATLAB中,二维插值命令常用的有两个,

 1、一个是网格节点插值:

z=interp2(x0,y0,z0,x,y,’method’)

其中,

n z:被插值点处的函数值;

n x0,y0,z0:插值节点, x0,y0为向量,z0是矩阵,其列数等于x0的长度,行数等于y0的长度;

n x,y:被插值点;

n程序设计:

nclear

nx0=[1200:400:4000];

ny0=[1200:400:3600];

nz0=[1130 1250 1280 1230 1040 900 500 700;

n    1320 1450 1420 1400 1300 700 900 850;

n    1390 1500 1500 1400 900 1100 1060 950;

n    1500 1200 1100 1350 1450 1200 1150 1010;

n    1500 1200 1100 1550 1600 1550 1180 1070;

n    1500 1550 1600 1550 1600 1600 1600 1550;

n    1480 1500 1550 1510 1430 1300 1200 980];

nxi=1200:1:4000;            %加密数据点

nyi=1200:1:3600;

nzil=interp2(x0,y0,z0,xi’,yi,’linear’); %线性插值

nzic=interp2(x0,y0,z0,xi’,yi,’cubic’); %三次插值

nzis=interp2(x0,y0,z0,xi’,yi,’spline’); %样条插值

nsubplot(2,2,1)

nmesh(x0,y0,z0)

nsubplot(2,2,2)

nmesh(xi,yi,zil)

nsubplot(2,2,3)

nmesh(xi,yi,zic)

nsubplot(2,2,4)

nmesh(xi,yi,zis)

2、另一个是离散数据节点的插值命令:
z=griddata(x0,y0,z0,x,y,’method’)
其中,
z:被插值点处的函数值;
x0,y0,z0:插值节点, x0,y0,z0均为向量;
x,y:被插值点;
method:插值方法,包括:
‘linear’——线性插值;
‘cubic’ ——三次插值;

clear
x0=[129 140 103.5 88 185.5 195 105 157.5 107.5 77 81 162 162 117.5];
y0=[7.5 141.5 23 147 22.5 137.5 85.5 -6.5 -81 3 56.5 -66.5 84 -33.5];
z0=[-4 -8 -6 -8 -6 -8 -8 -9 -9 -8 -8 -9 -4 -9];
subplot(2,2,1)
plot(x0,y0,’+’); %作出测量点的分布图;
x=75:1:200; %加密
y=-50:1:150;
[x,y]=meshgrid(x,y);
z=griddata(x0,y0,z0,x,y,’cubic’);
subplot(2,2,2)
mesh(x,y,z), %用插值方法求出网格节点处的z坐标矩阵,绘制出三维图形
subplot(2,2,3)
meshc(x,y,z), %绘制等高线
subplot(2,2,4)
contour(x,y,z,[-5 -5]); %水深5英尺处海底曲面的等高线
grid on

拟合

   有时所给数据点的分布并不一定近似地呈一条直线,这时仍用直线拟合显然是不合适的,可用多项式拟合。对于给定的一组数据                          寻求次数不超过m (m<<N ) 的多项式

来拟合所给定的数据,与线性拟合类似,使偏差的平方和最小

多项式曲线拟合函数polyfit( )

调用格式:  p=polyfit(x,y,n)

       [p,s]= polyfit(x,y,n)

说明:x,y为数据点,n为多项式阶数,返回p为幂次从高到低的多项式系数向量p。矩阵s用于生成预测值的误差估计。

x=0:.1:1;

y=[.3 .5 1 1.4 1.6 1.9 .6 .4 .8 1.5 2]

n=3;

p=polyfit(x,y,n)

xi=linspace(0,1,100);

z=polyval(p,xi);

plot(x,y,’o’,xi,z,’k:’,x,y,’b’)

迭代

猜测是解方程的

所以用solve方法替代

登录框css布局

背景

可以用background的图片

也可以用一个div,然后position:absolute,left和top都为0,如果为了避免滚动,在上级元素添加overflow

logo

位置选择:

  • 左上
    • position:absolute,top:10px,left:10px;
  • 右上
    • 同理
  • 登录框上
    • 和登录框放在同一个div中

主框

div包裹,为了实现居中位置

css{position:absolute,top:50%,left:50%,margin-top:-半个登录框高,margin-left:-半个登录框长}

图标的实现,使用span插入,或者div中插入background-image然后文字加margin-left

分割线

竖直:一个带background color的span

水平 hr或者同上

footer

1
2
3
4
5
.footer{
  position:absolute;
  bottom:10px;
  text-align:center;
}

 

angularjs

模式:mvvm

数据绑定:http://baike.baidu.com/view/159779.htm

问题

多个ng-app产生冲突,目前不知道怎么解决


笔记


AngularJS 表达式 与 JavaScript 表达式

类似于 JavaScript 表达式,AngularJS 表达式可以包含字母,操作符,变量。

与 JavaScript 表达式不同,AngularJS 表达式可以写在 HTML 中。

与 JavaScript 表达式不同,AngularJS 表达式不支持条件判断,循环及异常。

与 JavaScript 表达式不同,AngularJS 表达式支持过滤器。

 

ng-repeat

ng-repeat是动态生成的,所以可以使用filter

service

AngularJS 会一直监控应用,处理事件变化, AngularJS 使用 $location 服务比使用 window.location 对象更好。

html dom

disable show hidden