我正在用d3.js画一个散点图.借助此问题:
获取屏幕大小,当前网页和浏览器窗口
我正在使用这个答案:
var w = window,
d = document,
e = d.documentElement,
g = d.getElementsByTagName('body')[0],
x = w.innerWidth || e.clientWidth || g.clientWidth,
y = w.innerHeight|| e.clientHeight|| g.clientHeight;
Run Code Online (Sandbox Code Playgroud)
所以我能够将我的情节适合用户的窗口,如下所示:
var svg = d3.select("body").append("svg")
.attr("width", x)
.attr("height", y)
.append("g");
Run Code Online (Sandbox Code Playgroud)
现在我想在用户调整窗口大小时,需要注意调整绘图的大小.
PS:我的代码中没有使用jQuery.
当我用vi编辑文件时:
vi .bashrc
Run Code Online (Sandbox Code Playgroud)
我有颜色.
在python的脚本中我有:
os.system("vi .bashrc")
Run Code Online (Sandbox Code Playgroud)
我不.
为什么(我猜我打开一个不同的shell,但我无法弄清楚为什么设置不同)?以及如何解决这个问题?
我正在运行fedora,我的shell是bash.
vi --version
Run Code Online (Sandbox Code Playgroud)
给出:
VIM - Vi IMproved 7.3
Run Code Online (Sandbox Code Playgroud) 我主要使用three.js学习了一些webGL.我加载.obj文件,然后用3D绘制它们.
我已将我的项目放在网上,例如:www.mydomain.com
我不介意人们通过他们的浏览器查看我的源代码,但我展示的.obj文件来自不想放弃它们的人.
我是一个关于这一点的新手.
由于我的源代码可供所有人使用,我猜测.obj文件也可供所有人使用.那么是否可以隐藏或保护它们以便没有人可以下载它们?
我有一个Ubuntu 14.04服务器,并且有一个localhost:3000在此服务器上运行的流星应用程序。我的服务器的公共FQDN是sub.example.com。流星应用程序使用Google OAuth 2.0,我在Google API控制台中配置了以下内容:
URI REDIRECTION
http://sub.example.com/_oauth/google
http://sub.example.com/_oauth/google?close
ORIGINES JAVASCRIPT
http://sub.example.com
Run Code Online (Sandbox Code Playgroud)
我的Nginx配置文件如下所示:
server {
listen 80 default_server;
server_name sub.example.com www.sub.example.com;
location / {
proxy_set_header HOST $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:3000;
}
}
Run Code Online (Sandbox Code Playgroud)
The proxy works and I can access my meteor application when I go to sub.example.com. But when in this application I try to use Google OAuth 2.0, a pop up opens as it should and …
在app中我有一个Listactivity,它有一个带TextView和Button的适配器(标记为delete).现在我想删除相应的Button点击项目.请检查代码并建议???? `
public class MySimpleArrayAdapter extends ArrayAdapter<String> implements OnClickListener {
private final Activity context;
private final String[] names;
private Button deleteButton= null;
public MySimpleArrayAdapter(Activity context, String[] names) {
super (context, R.layout.imagelistlayout, names);
this.context = context;
this.names = names;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = context.getLayoutInflater();
View rowView = inflater.inflate(R.layout.imagelistlayout, null, true);
deleteButton= (Button)rowView.findViewById(R.id.delete_bn);
deleteButton.setTag(position);
TextView textView = (TextView) rowView.findViewById(R.id.label);
textView.setText(names[position]);
deleteButton.setOnClickListener(this);
return rowView;
}
@Override
public void onClick(View convertView) {
System.out.println(deleteButton.getTag());
} …Run Code Online (Sandbox Code Playgroud) 我知道内联,并且从我检查它不是由Python的编译器完成的.
我的问题是:python的编译器是否有任何优化转换:
print myList.__len__()
for i in range(0, myList.__len__()):
print i + myList.__len__()
Run Code Online (Sandbox Code Playgroud)
至
l = myList.__len__()
print l
for i in range(0, l):
print i + l
Run Code Online (Sandbox Code Playgroud)
它是由编译器完成的吗?
如果不是:我自己这样做是否值得?
奖金问题(不是那么相关):我喜欢有很多功能(更好的可读性恕我直言)...就像在Python中没有内联这是要避免的东西(很多功能)?