我正在使用D3 Cloud构建一个词云.以下是示例代码:
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="../lib/d3/d3.js"></script>
<script src="../d3.layout.cloud.js"></script>
<script>
var fill = d3.scale.category20();
d3.layout.cloud().size([300, 300])
.words(["This", "is", "some", "random", "text"].map(function(d) {
return {text: d, size: 10 + Math.random() * 90};
}))
.padding(5)
.rotate(function() { return ~~(Math.random() * 2) * 90; })
.font("Impact")
.fontSize(function(d) { return d.size; })
.on("end", draw)
.start();
function draw(words) {
d3.select("body").append("svg")
.attr("width", 300)
.attr("height", 300)
.append("g")
.attr("transform", "translate(150,150)")
.selectAll("text")
.data(words)
.enter().append("text")
.style("font-size", function(d) { return d.size + "px"; })
.style("font-family", "Impact")
.style("fill", …
Run Code Online (Sandbox Code Playgroud) 我的应用允许用户使用Google Plus登录,并获取他们的姓名和电子邮件地址.我试图访问令牌.
访问令牌的代码:
Toast.makeText(this, "User is connected!", Toast.LENGTH_LONG).show();
GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());
AccountManager am = AccountManager.get(this);
final Account[] accounts = am.getAccountsByType(GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE);
AsyncTask<Void, Void, String> task2 = new AsyncTask<Void, Void, String>() {
public static final int REQUEST_CODE_TOKEN_AUTH = 100;
@Override
protected String doInBackground(Void... params) {
String mScope="audience:server:client_id:899555500747-38rpnq51of946grhdvofck7r8u5p09cd.apps.googleusercontent.com:api_scope:https://www.googleapis.com/auth/plus.login";
// Get the token for the current user
String token = null;
try {
token = GoogleAuthUtil.getToken(getApplicationContext(), Plus.AccountApi.getAccountName(mGoogleApiClient), mScope);
Log.i("G token", token);
} catch (IOException transientEx) {
// Network or server error, try later
Log.e(TAG, transientEx.toString());
} …
Run Code Online (Sandbox Code Playgroud) android google-authentication clientid google-plus google-play-services
我在我的drupal网站上使用Apache Solr.安装了Tomcat 6,我用模块安装目录中的新文件替换了schema.xml,solr-config.xml和protwords.txt文件.
当我运行localhost:8983时,我收到此错误.
Log4j (org.slf4j.impl.Log4jLoggerFactory)
2528 [coreLoadExecutor-3-thread-1] ERROR org.apache.solr.core.CoreContainer – Failed to load file /opt/solr-4.5.1/example/solr/collection1/conf/solrconfig.xml
2529 [coreLoadExecutor-3-thread-1] ERROR org.apache.solr.core.CoreContainer – Unable to create core: egitraining-dev.esc.rl.ac.uk
org.apache.solr.common.SolrException: Could not load config file /opt/solr-4.5.1/example/solr/collection1/conf/solrconfig.xml
at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:490)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:557)
at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:247)
at org.apache.solr.core.CoreContainer$1.call(CoreContainer.java:239)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:679)
Caused by: java.io.IOException: Can't find resource 'solrconfig.xml' in classpath or 'solr/collection1/conf/conf/', cwd=/opt/solr-4.5.1/example
at org.apache.solr.core.SolrResourceLoader.openResource(SolrResourceLoader.java:322)
at org.apache.solr.core.SolrResourceLoader.openConfig(SolrResourceLoader.java:287)
at org.apache.solr.core.Config.<init>(Config.java:116)
at org.apache.solr.core.Config.<init>(Config.java:86)
at org.apache.solr.core.SolrConfig.<init>(SolrConfig.java:129)
at …
Run Code Online (Sandbox Code Playgroud) 如问题所问:我可以创建不会保存在数据库中的django模型(models.Model)吗?
原因是我想在我的 django 管理员中使用它来构建基于 forms.ModelForm 的自定义表单
我有一个JSON文件,我从中提取数据并将其显示在html表中.
有60个表,每个表有3个单元格,每个单元格都有一些值.
现在我想在单元格中显示颜色而不是数字.因此,如果数字是29673.4,那么它应该用绿色填充该特定单元格直到该单元格的29%,并且剩余71%的单元格应该留下白色,如果数字是90881.13333那么它应该填充特定的绿色细胞直到该细胞的90%.
它不允许我添加屏幕截图,因为我是Stack Overflow的新手,并且没有10个声誉.
我希望你理解我的问题.
我有一串单词,有一些像
"Cloud", "Clouds", "Application", "Applications", "Event", "Events"
Run Code Online (Sandbox Code Playgroud)
还有一些像
"Access"
Run Code Online (Sandbox Code Playgroud)
它们是单数但最后有的"s"
.我想删除复数单词,但我不能写一个代码从末尾删除s,因为它将"s"
从所有单词中删除.我在互联网上搜索,找不到任何相关内容.任何人都可以帮助我做到这一点的最好方法吗?
编辑:如何在我的程序中使用CakePHP?我之前从未使用它,所以没有经验.我在函数中有String变量.它说我需要安装Cake PHP,谁能告诉我如何在函数中使用它?
谢谢
我编写了代码来获取JSON文件并对其进行处理.但该文件每5分钟更新一次.所以我希望我的代码能够在不引起刷新的情况下获取新数据.
这是我如何获取JSON文件.
$.getJSON("new_json_file.json", function (data) {
$.each(data, function (i, item) {
//Here I am working on the data
});
});
Run Code Online (Sandbox Code Playgroud)
有人可以帮忙吗?
jquery ×2
ajax ×1
android ×1
cakephp ×1
clientid ×1
css ×1
d3.js ×1
dashboard ×1
django ×1
django-admin ×1
django-forms ×1
drupal-7 ×1
google-plus ×1
html ×1
html-table ×1
javascript ×1
json ×1
php ×1
pluralize ×1
preg-replace ×1
refresh ×1
regex ×1
solr ×1
tag-cloud ×1
tomcat6 ×1