我有一个Java类,有很多Fields
.
我想循环al alhe字段并为那些为null的那些做一些事情.
例如,如果我的班级是:
public class ClassWithStuff {
public int inty;
public stringy;
public Stuff;
//many more fields
}
Run Code Online (Sandbox Code Playgroud)
In another location, I'd make a ClassWithStuff
object and I would like to go though all the fields in the class. Kind of like this:
for (int i = 0; i < ClassWithStuff.getFields().size(); i++) {
//do stuff with each one
}
Run Code Online (Sandbox Code Playgroud)
Is there any way for me to achieve this?
我创建了一个小提琴来演示这个问题(也可以在下面这个问题中运行).
我有一个侧边栏的扑克牌图片,我想拖到一个主要区域.侧边栏包含很多卡片,因此我希望它可以滚动.但是,当我给它一个滚动功能时,当我拖动一张卡片时,当我将它拖出侧边栏时它会被隐藏起来.
var app = angular.module('myApp', ['ngDraggable']);
app.controller('ctrl', function ($scope) {
});
Run Code Online (Sandbox Code Playgroud)
#gallery-container {
overflow-y: scroll;
}
.card {
width: 100%;
}
Run Code Online (Sandbox Code Playgroud)
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular.min.js"></script>
<script src="https://rawgit.com/fatlinesofcode/ngDraggable/master/ngDraggable.js"></script>
<div ng-app="myApp">
<div ng-controller="ctrl">
<div class="row">
<div class="col-xs-3">
<div id="gallery-container">
<div class="row">
<div class="col-sm-12">
<img ng-drag="true" ng-drag-data="hi" ng-drag-success="onDragComplete($data,$event)" ng-center-anchor="true" class="card" src="http://www.download32.com/images/screen/vector_playing_cards-467278.png" alt="">
</div>
</div>
<div class="row">
<div class="col-sm-12">
<img ng-drag="true" ng-drag-data="hi" ng-drag-success="onDragComplete($data,$event)" ng-center-anchor="true" class="card" src="http://www.download32.com/images/screen/vector_playing_cards-467278.png" alt="">
</div>
</div>
<div class="row">
<div class="col-sm-12">
<img ng-drag="true" ng-drag-data="hi" ng-drag-success="onDragComplete($data,$event)" ng-center-anchor="true" class="card" src="http://www.download32.com/images/screen/vector_playing_cards-467278.png" …
Run Code Online (Sandbox Code Playgroud)我正在使用一些婴儿NASM程序来帮助我学习语言.
根据我的阅读,NASM程序可以有三个部分; .data,.bss和.text是必需的.然而,我经常发现,有时候这些部门的名称是,而有时候也是section
如此segment
.
例如,我在网上发现了这个"Hello World":
; hello.asm a first program for nasm for Linux, Intel, gcc
;
; assemble: nasm -f elf -l hello.lst hello.asm
; link: gcc -o hello hello.o
; run: hello
; output is: Hello World
SECTION .data ; data section
msg: db "Hello World",10 ; the string to print, 10=cr
len: equ $-msg ; "$" means "here"
; len is a value, not an address
SECTION .text ; code section
global main …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用SourceTree作为工具来学习git.
我将本地存储库添加到BitBucket存储库,然后在本地进行了一些更改.我犯了他们,然后推了他们.然后我登录到BitBucket并手动更改了文档的一部分(项目"已添加4").然后我回到我的本地副本并再次更改并承诺.当我试图推它时,它告诉我,我首先必须拉动并合并.所以我做了.
然后我又推了一下.有效.
现在,主人(最重要的一个.为什么还有两个?)带有标题说2 ahead
.这究竟是什么意思?它前面是什么?
UPDATE
git status给了我:
JustMe@IMRAY ~/Projects/BlaBlaUser/gitPractice (master)
$ git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
(use "git push" to publish your local commits)
nothing to commit, working directory clean
Run Code Online (Sandbox Code Playgroud) 当我尝试签出另一个分支时,我收到此错误:
error: Your local changes to the following files would be overwritten by checkout:
.idea/workspace.xml
Please, commit your changes or stash them before you can switch branches.
Aborting
Run Code Online (Sandbox Code Playgroud)
我做了一些研究,似乎有些人通过添加前面提到的文件来避免这个问题gitignore
.
这是明智的做法吗?如果git
忽略了你的workspace.xml
文件,它会不会搞乱你在IDE中的经验(在我的例子中,Jetbrains Webstorm)?
我正在尝试编写一个需要import语句的小程序import org.eclipse.swt.*;
.(我正在练习本教程).
但是,Eclipse不会编译程序并且给我错误" The import org.eclipse cannot be resolved
"
这次谷歌找到答案并不是一个好朋友.
我正在为约会应用程序构建一个Mongoose架构.
我希望每个person
文档都包含对它们所访问的所有事件的引用,其中events
是另一个在系统中具有自己的模型的模式.我怎样才能在架构中描述这个?
var personSchema = mongoose.Schema({
firstname: String,
lastname: String,
email: String,
gender: {type: String, enum: ["Male", "Female"]}
dob: Date,
city: String,
interests: [interestsSchema],
eventsAttended: ???
});
Run Code Online (Sandbox Code Playgroud) 我已经在Java程序中看到了方法调用中使用的管道字符.
例如:
public class Testing1 {
public int print(int i1, int i2){
return i1 + i2;
}
public static void main(String[] args){
Testing1 t1 = new Testing1();
int t3 = t1.print(4, 3 | 2);
System.out.println(t3);
}
}
Run Code Online (Sandbox Code Playgroud)
当我跑这个时,我就得到了7
.
有人可以解释管道在方法调用中的作用以及如何正确使用它吗?
我想有两个顶级路径用于登录和注册.
我宁愿没有做auth/log-in
和auth/register
.
但是,auth组件位于一个单独的模块中,这很好,因为除非特别要求,否则不应加载它.
export const routes: Route[] = [
{ path: 'log-in', loadChildren: './auth-module/auth.module#AuthModule'},
{ path: 'register', loadChildren: './auth-module/auth.module#AuthModule'}
];
Run Code Online (Sandbox Code Playgroud)
我如何指定何时定义我希望log-in
路径转到延迟加载的AuthModule 内部路径的log-in
路径,以及转到延迟加载模块内部路径的路径?register
register