john's tech blog

hope is coming


  • 首页

  • 标签

  • 归档

linux下ls命令学习资料

发表于 2017-06-06 | 更新于 2019-05-18

linux ls命令

### ls -l

可以显示文件大小
total 44092 文件总数
dr-xr-xr-x. 2 root root 40960 Apr 27 03:37 bin
drwxr-xr-x. 2 root root 4096 Sep 23 2011 etc
drwxr-xr-x. 2 root root 4096 Sep 23 2011 games

通配符

2>/dev/null

参考资料:

  1. Linux “ls -l”文件列表权限详解
  2. ls命令的20个实用范例
  3. ls -l 权限后面有个点
  4. Linux Shell高级技巧(二)
  5. linux 中 >跟 >> 区别 ,2>&1 是什么 ?
  6. Shell中 2>/dev/null
  7. 如何运用LINUX下ls的星号和问号通配符
  8. ls命令详解+通配符

面试题收集

发表于 2017-06-06 | 更新于 2019-05-09

面试题收集

1.结合金融业务,实现转账过程,从账户A转到账户B,注意金额不能为负数
2.回文数问题
3.统计句子中每个单词出现的次数。比如如下句子中
Java this is a Java Hello World Thank you
4.将阿拉伯字母转为汉字。比如123转为一百二十三

集合框架了解么?HashMap和Hashtable的区别?
HashMap实现原理?Hashtable线程安全是怎么现实的?
能讲讲HashMap的put()操作过程么?
Spring中Bean的生命周期
Spring如何管理事务的?
Service层是单例还是多例的?是线程安全的么?如果要做成多例的如何实现?
事务的传播性,数据库的隔离级别?
static可以被继承么?static在哪里地方会用到?
ArrayList和LinkedList的区别,为什么说ArrayList是线程安全的?
如何配置服务器(tomcat)的内存大小?
说一说Servlet实现的接口?
项目中常用的设计模式有哪些?写一个单例模式

参考资料:
人人网面试经历

angular_interpolate1

发表于 2017-05-29 | 更新于 2019-05-07

agnular 1.5.8 interpolate插值

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

function $InterpolateProvider() {
var startSymbol = '{{';
var endSymbol = '}}';

this.startSymbol = function(value) {
if (value) {
startSymbol = value;
return this;
} else {
return startSymbol;
}
};

this.endSymbol = function(value) {
if (value) {
endSymbol = value;
return this;
} else {
return endSymbol;
}
};


this.$get = ['$parse', '$exceptionHandler', '$sce', function($parse, $exceptionHandler, $sce) {
var startSymbolLength = startSymbol.length,
endSymbolLength = endSymbol.length,
escapedStartRegexp = new RegExp(startSymbol.replace(/./g, escape), 'g'),
escapedEndRegexp = new RegExp(endSymbol.replace(/./g, escape), 'g');

function escape(ch) {
return '\\\\\\' + ch;
}

//替换\{ \} 为 {{}}
//摆脱插值标记的机制,
//那就是通过在嵌入标记的开始和结束符号前面加上反斜杠\,
//AngularJS将会把这部分渲染为普通的部分,所以也不会被解读为为表达式或者数据绑定
function unescapeText(text) {
return text.replace(escapedStartRegexp, startSymbol).
replace(escapedEndRegexp, endSymbol);
}

function stringify(value) {
//undefined == null 为true
if (value == null) { // null || undefined
return '';
}
switch (typeof value) {
case 'string':
break;
case 'number':
value = '' + value;
break;
default:
value = toJson(value);
}

return value;
}

//TODO: this is the same as the constantWatchDelegate in parse.js
function constantWatchDelegate(scope, listener, objectEquality, constantInterp) {
var unwatch;
return unwatch = scope.$watch(function constantInterpolateWatch(scope) {
unwatch();
return constantInterp(scope);
}, listener, objectEquality);
}


function $interpolate(text, mustHaveExpression, trustedContext, allOrNothing) {
// Provide a quick exit and simplified result function for text with no interpolation
if (!text.length || text.indexOf(startSymbol) === -1) {
var constantInterp;//常量
if (!mustHaveExpression) {
var unescapedText = unescapeText(text);
constantInterp = valueFn(unescapedText);
constantInterp.exp = text;
constantInterp.expressions = [];
constantInterp.$$watchDelegate = constantWatchDelegate;
}
return constantInterp;
}

allOrNothing = !!allOrNothing;
var startIndex,
endIndex,
index = 0,
expressions = [],
parseFns = [],
textLength = text.length,
exp,
concat = [],
expressionPositions = [];

while (index < textLength) {
if (((startIndex = text.indexOf(startSymbol, index)) != -1) &&
((endIndex = text.indexOf(endSymbol, startIndex + startSymbolLength)) != -1)) {
if (index !== startIndex) {
// 比如 hello {{name}}
concat.push(unescapeText(text.substring(index, startIndex)));
}
exp = text.substring(startIndex + startSymbolLength, endIndex);
expressions.push(exp);
//调用parseProvider
parseFns.push($parse(exp, parseStringifyInterceptor));
index = endIndex + endSymbolLength;
expressionPositions.push(concat.length);
concat.push('');
} else {
// we did not find an interpolation, so we have to add the remainder to the separators array
if (index !== textLength) {
concat.push(unescapeText(text.substring(index)));
}
break;
}
}

// Concatenating(连接) expressions makes it hard to reason about whether some combination of
// concatenated values are unsafe to use and could easily lead to XSS. By requiring that a
// single expression be used for iframe[src], object[src], etc., we ensure that the value
// that's used is assigned or constructed by some JS code somewhere that is more testable or
// make it obvious that you bound the value to some user controlled value. This helps reduce
// the load when auditing for XSS issues.
if (trustedContext && concat.length > 1) {
$interpolateMinErr.throwNoconcat(text);
}

if (!mustHaveExpression || expressions.length) {
var compute = function(values) {
for (var i = 0, ii = expressions.length; i < ii; i++) {
if (allOrNothing && isUndefined(values[i])) return;
concat[expressionPositions[i]] = values[i];
}
return concat.join('');
};

var getValue = function(value) {
return trustedContext ?
$sce.getTrusted(trustedContext, value) :
$sce.valueOf(value);
};

//返回interpolationFn方法
return extend(function interpolationFn(context) {
var i = 0;
var ii = expressions.length;
var values = new Array(ii);

try {
//根据表达式来解析
for (; i < ii; i++) {
values[i] = parseFns[i](context);
}

return compute(values);
} catch (err) {
$exceptionHandler($interpolateMinErr.interr(text, err));
}

}, {
// all of these properties are undocumented for now
exp: text, //just for compatibility with regular watchers created via $watch
expressions: expressions,
$$watchDelegate: function(scope, listener) {
var lastValue;
return scope.$watchGroup(parseFns, function interpolateFnWatcher(values, oldValues) {
var currValue = compute(values);
if (isFunction(listener)) {
listener.call(this, currValue, values !== oldValues ? lastValue : currValue, scope);
}
lastValue = currValue;
});
}
});
}

function parseStringifyInterceptor(value) {
try {
value = getValue(value);
return allOrNothing && !isDefined(value) ? value : stringify(value);
} catch (err) {
$exceptionHandler($interpolateMinErr.interr(text, err));
}
}
}


/**
* @ngdoc method
* @name $interpolate#startSymbol
* @description
* Symbol to denote the start of expression in the interpolated string. Defaults to `{{`.
*
* Use {@link ng.$interpolateProvider#startSymbol `$interpolateProvider.startSymbol`} to change
* the symbol.
*
* @returns {string} start symbol.
*/

$interpolate.startSymbol = function() {
return startSymbol;
};


/**
* @ngdoc method
* @name $interpolate#endSymbol
* @description
* Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
*
* Use {@link ng.$interpolateProvider#endSymbol `$interpolateProvider.endSymbol`} to change
* the symbol.
*
* @returns {string} end symbol.
*/

$interpolate.endSymbol = function() {
return endSymbol;
};

return $interpolate;
}];
}

scala_reference_function

发表于 2017-05-27 | 更新于 2019-05-07

scala 函数引用

1
2
3
4
5
6
def f(x:Int): Int => Int =  { n:Int => x + n }

val ff = f(2)

println(ff(3))//5
println(ff(5))//7

参考资料:
Scala: return reference to a function
小码农的碎碎念之Scala

slick_hlist

发表于 2017-05-27 | 更新于 2019-05-07

slick 使用hlist 用于超过22列

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
 slick.collection.heterogeneous.{HNil}
slick.collection.heterogeneous.syntax._

class Invoice(tag:Tag) extends Table[String :: String :: String :: HNil](tag,"INVOICELOG"){

def logId = column[String]("LOGID")
def createDate = column[String]("CREATEDATE")
def invoiceId = column[String]("INVOICEID")

def * = logId :: createDate :: invoiceId :: HNil

}

val i = db.run(invoices.filter((i) => i.logId === "0af9de5ab5a9457a950ecd9a97ddbe80").result)

val t = Await.result(i, Duration.Inf)

type MyRow = String::String :: String :: HNil

val ssss = t.asInstanceOf[Seq[MyRow]]

println(ssss.head(0))

t.foreach((i) => {

i match {
case a::b::c::rest =>
println(a)
}

})

参考资料:
How to read an element from a Scala HList?
Using shapeless HLists with Slick 3
细谈Slick(6)- Projection:ProvenShape,强类型的Query结果类型

1…232425…47

John

232 日志
43 标签
GitHub Twitter
欢迎关注我的公众号:沉迷Spring
© 2023 johnwonder
由 Hexo 强力驱动 v3.2.0
|
主题 – NexT.Pisces v7.1.1
|
0%