我最近读了一本关于设计模式的书:我在每个页面中多次遇到过Artifacts这个词!它们实际上是什么?应该在哪里使用?
在UP中,工件非常重要,它们在面向对象分析中发挥着重要作用....
我有一个像这样的上传表单(form.gsp):
<html>
<head>
<title>Upload Image</title>
<meta name="layout" content="main" />
</head>
<body>
<g:uploadForm action ="upload">
Photo: <input name="photos" type="file" />
<g:submitButton name="upload" value="Upload" />
</g:uploadForm>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我希望用户上传任何图片,当他点击upload按钮时,我需要一些方法来获取控制器操作中的图像并将其传递给视图:
def upload = {
byte[] photo = params.photos
//other code goes here . . . .
}
Run Code Online (Sandbox Code Playgroud)
这会引发错误:
Cannot cast object 'org.springframework.web.multipart.commons.CommonsMultipartFile@1b40272' with class 'org.springframework.web.multipart.commons.CommonsMultipartFile' to class 'byte'
Run Code Online (Sandbox Code Playgroud)
请注意,我不希望这些照片保存在我的数据库中.实际上,一旦upload动作完成,我将处理该图像并在upload视图中显示输出.如果我有解决方案,那将会很好.
提前致谢.
在常规,有两种方法即any和find方法,其可以在地图中使用.
这两种方法将"搜索"为我们所感兴趣的内容(即,既any和find方法返回元素是否在地图与否,这是他们需要搜索).
但在这个搜索中他们有什么不同?
Google Talk如何运作?当我与朋友联系进行谈话时,是什么作为转移我的声音的中间人?它背后是谷歌服务器(作为中间人?还是提供点对点协议?
我对baseC#中的关键字感到困惑.说我有这样的代码:
?class A
{
?// member declaration....
A(int s, int t, int x)
{
?// assign the values of members
}
}
class B : A
{
// member declaration....
?B(int a, int b, int c, int d) : base(a,b,c)
{
// does the base keyword play a role in
// this constructor?
}
}
?
Run Code Online (Sandbox Code Playgroud)
现在,构造函数中base关键字的确切用法是B什么?我有几个问题需要澄清:
base关键字将调用基类A构造函数(在我们的示例中)?它是否正确?base在派生类中提供关键字会改变派生类构造函数的行为吗?基本上当base关键字应该在构造函数中使用时(一些例子会很好)?
我有另一个问题.如何通过关键字告知base班级我们的derived班级base …
我在Angular 2中定义了这样的服务:
import { Inject } from 'angular2/angular2';
import { Http ,Headers , HTTP_PROVIDERS } from 'angular2/http';
export interface CourseInterface {
courseId: number,
coursePrice: number,
authorName: string
}
export class CourseDetailsService {
http: Http;
constructor(@Inject(Http) Http) {
console.log(Http)
this.http = Http;
}
load() {
console.log("came here in service")
var headers = new Headers();
headers.append('Authorization', <my username password>);
this.http.get('https://some.api',{
headers : headers
}).map(res => console.log("Response came!!!"))
console.log("done . . .")
}
}
Run Code Online (Sandbox Code Playgroud)
在另一个组件中,我使用这样的服务:
import {CourseInterface, CourseDetailsService} from '../services/course';
@Component({
selector: 'dashboard', …Run Code Online (Sandbox Code Playgroud) 我有两节课:
用户
class User {
//relationships. . . .
static belongsTo = [ company : Company, role : Role ]
static hasMany = [ holidays : Holiday ]
String login
String password
static constraints = {
login(unique:true,size:6..15)
}
String toString() {
this.login
}
}
Run Code Online (Sandbox Code Playgroud)
而另一个类是这样的:
作用:
class Role {
String roleName
String privilege
static hasMany = [ user : User ]
static constraints = {
privilege(nullable:true)
roleName(unique:true)
}
String toString() {
this.roleName
}
}
Run Code Online (Sandbox Code Playgroud)
我写了一个像这样的集成测试:
def user1 = new …Run Code Online (Sandbox Code Playgroud) groovy ×3
grails ×2
angular ×1
artifact ×1
c ×1
c# ×1
constructor ×1
exception ×1
file-upload ×1
google-talk ×1
hibernate ×1
include ×1
installation ×1
java ×1
javascript ×1
wicket ×1