我想为调查创建一个Google差异图。这将显示用户总数和调查给定的用户。我的JavaScript代码是:-
google.charts.load('current', {packages: ['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var overallData = [];
var givenData = [];
overallData.push(['Department', 'Total Users']);
givenData.push(['Department', 'Given feedback']);
for (var i in data) {
overallData.push([data[i].department_name, data[i].emp_count]);
givenData.push([data[i].department_name, data[i].upward_done]);
}
var oldData = google.visualization.arrayToDataTable(overallData);
var newData = google.visualization.arrayToDataTable(givenData);
var colChartDiff = new google.visualization.ColumnChart(document.getElementById('feedback_dept_chart'));
var options = {
fontName: 'Calibri',
legend: 'none',
height: 200,
width: 960,
vAxis: {title: 'No of employee'},
tooltip: {isHtml: false}
};
var diffData = colChartDiff.computeDiff(oldData, newData);
colChartDiff.draw(diffData, options);
Run Code Online (Sandbox Code Playgroud)
数据是:-
[{"department_name":"Design","emp_count":1,"upward_done":1},
{"department_name":"Management","emp_count":1,"upward_done":0},
{"department_name":"Technology","emp_count":3,"upward_done":2}]
Run Code Online (Sandbox Code Playgroud)
差异图的问题在于它显示了名为“当前”和“上一个”的工具提示。我想通过“总用户数”和“调查给定用户数”来更改它。
任何帮助将不胜感激。谢谢
我正在运行Ubuntu 17.04
节点版本:8.0.0
npm版本:5.3.0
node-gyp版本:3.6.2
csaba@titan:~/GitRepos/valleydevfest2017$ sudo npm install -g iltorb
> iltorb@1.3.5 install /usr/local/lib/node_modules/iltorb
> node-pre-gyp install --fallback-to-build
node-pre-gyp ERR! Tried to download(undefined): https://github.com /MayhemYDG/iltorb/releases/download/1.3.5/node-v57-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for iltorb@1.3.5 and node@8.0.0 (node-v57 ABI) (falling back to source compile with node-gyp)
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local /lib/node_modules/iltorb/build'
gyp ERR! System Linux 4.10.0-28-lowlatency
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/local/lib/node_modules/iltorb/build/bindings/iltorb.node" "--module_name=iltorb" "--module_path=/usr/local/lib/node_modules/iltorb/build/bindings"
gyp ERR! cwd /usr/local/lib/node_modules/iltorb
gyp ERR! …Run Code Online (Sandbox Code Playgroud) 我必须要消耗一些xlsx文件.我读过使用open xml sdk和http://www.dotnetperls.com/fromoadate 从xlsx读取日期.我的大多数列都是文本(共享字符串),但有一些数字(整数),我还有一些日期和日期时间.我正在使用OpenXML SDK 2.5.
我的问题是我不知道如何区分实际数字和日期.他们都具有DataType的null,和文本数表示是在Text小区的物业.
一些代码:
using (var xlsxStream = assembly.GetManifestResourceStream("Checklist.xlsx"))
using (var spreadsheetDocument = SpreadsheetDocument.Open(xlsxStream, false))
{
var workbookPart = spreadsheetDocument.WorkbookPart;
var sharedStringTable = workbookPart.SharedStringTablePart.SharedStringTable;
var worksheetPart = workbookPart.WorksheetParts.First();
var sheetData = worksheetPart.Worksheet.Elements<SheetData>().First();
string text;
foreach (Row r in sheetData.Elements<Row>())
{
foreach (Cell c in r.Elements<Cell>())
{
if (c.CellValue != null)
{
text = c.CellValue.Text;
if (c.DataType != null)
{
if (c.DataType.Value == CellValues.SharedString)
{ …Run Code Online (Sandbox Code Playgroud) 现在重定向只是简单地说
window.location = "/relative_path/";
Run Code Online (Sandbox Code Playgroud)
我想要做的是添加一个查询参数以及此重定向,因此目标页面可以查看它,并且在采取某些操作后,它可以进一步重定向到该页面.
该用途的示例是登录系统.当用户的令牌过期时,他将被重定向到登录页面.在重定向时,我想将确切的URL(包括URL中的查询参数)传递给登录页面,因此在成功登录后,用户可以被重定向回到他/她所在的位置.
我试图将路径作为URL参数传递,但由于转义问题,这不起作用:重定向url使用相同的字符(?,=,...),这会混淆系统,并且参数会被截断.
所以类似的东西,但这显然不起作用:
window.location = "/login?redirect=/original_location?p1=vl1&p2=v2
Run Code Online (Sandbox Code Playgroud)
任何建议表示赞赏.
我定义了一个抽象类,它有一个ForeignKey. 我有多个派生模型类,但是当我尝试生成架构迁移脚本时,south 向我显示错误。
class BlogEntryBase(models.Model):
author = models.CharField(null=True, blank=True, max_length=100)
title = models.CharField(null=True, blank=True, max_length=255)
created_by = models.ForeignKey("main.UserProfile", verbose_name="Created By", related_name="%(class)s_set", blank=False, null=False)
class CatBlogEntry(BlogEntryBase):
pass
class DogBlogEntry(BlogEntryBase):
pass
Run Code Online (Sandbox Code Playgroud)
错误信息:
animal.catblogentry: Accessor for field 'created_by' clashes with related field 'UserProfile.catblogentry_set'. Add a related_name argument to the definition for 'created_by'.
animal.catblogentry: Reverse query name for field 'created_by' clashes with related field 'UserProfile.catblogentry_set'. Add a related_name argument to the definition for 'created_by'.
animal.dogblogentry: Accessor for field 'created_by' clashes with related …Run Code Online (Sandbox Code Playgroud) python django abstract-class foreign-key-relationship django-south
我正在努力实施react-grid-layout.所有示例都通过_griddiv属性传递网格项配置:
createElement(el) {
...
return (
<div key={i} _grid={el}>
...
</div>
);
},
Run Code Online (Sandbox Code Playgroud)
在我的实施中:
return (
<div key={i} _grid={el}>
<DashboardTestWidget widgetName={el.name} menuName={this.props.menuName}/>
<span className="remove" style={removeStyle} onClick={this.onRemoveItem.bind(this, i)}>x</span>
</div>
)
Run Code Online (Sandbox Code Playgroud)
我收到一个错误:
dashboard_view.browserify.browserified.js:1216 Warning: Unknown prop `_grid` on <div> tag. Remove this prop from the element. For details, see <URL ommitted because SO complained about URL shorteners>
in div (created by DashboardLayout)
in Resizable (created by GridItem)
in DraggableCore (created by GridItem)
in GridItem (created by ReactGridLayout)
in …Run Code Online (Sandbox Code Playgroud) 我有一个ASP.NET MVC应用程序,该应用程序在上次NuGet软件包更新后开始出现异常。该Web应用程序使用.NET Framework 4.6.1,而开发人员计算机是Windows Server 2012 R2 Essentials。我使用的一个软件包是Stripe.NET,用于付款处理。仅需要其早期版本<package id="System.Net.Http" version="4.0.0" targetFramework="net461" />。Visual Studio标记有一个较新的版本(当时是4.3.0),但是当我更新它时,它引入了大量的软件包。因此,我只是将该依赖关系还原为4.0.0,Stripe不需要更新。
然后我最近介绍Nager.Date了处理工作日和假期的方法。该1.5.0软件包的最新更新(v )需要"NETStandard.Library" version="1.6.1"。就像升级System.Net.Http到一样4.3.0,升级到该功能会引入Nager.Date大量我提到的软件包。总结:迟早我必须了解并更新。
引入的软件包:
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net461" />
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net461" />
<package id="System.AppContext" version="4.3.0" targetFramework="net461" />
<package id="System.Collections" version="4.3.0" targetFramework="net461" />
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net461" />
<package id="System.Console" version="4.3.0" targetFramework="net461" />
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net461" />
<package id="System.Diagnostics.DiagnosticSource" version="4.3.0" targetFramework="net461" />
<package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net461" /> …Run Code Online (Sandbox Code Playgroud) asp.net-mvc nuget-package asp.net-core-mvc visual-studio-2017
我正在尝试为辅助 Firebase 应用订阅 FCM(Firebase 云消息传递)主题,根据文档,这可以通过getInstance将辅助 FirebaseApp 实例作为参数的重载来完成:
public static synchronized FirebaseMessaging getInstance (FirebaseApp app)
Run Code Online (Sandbox Code Playgroud)
获取指定 FirebaseApp 的 FirebaseMessaging 实例。
我正在使用 Kotlin,我正在build.gradle像这样拉入包:
implementation "com.google.firebase:firebase-messaging:20.2.0"
Run Code Online (Sandbox Code Playgroud)
但是当我尝试FirebaseMessaging使用重载的实例化 时getInstance,我收到一个错误,指出它不可访问。当我查看包源时,反编译表明重载的构造函数不像无参数的那样是公开的getInstance:
implementation "com.google.firebase:firebase-messaging:20.2.0"
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
我正在使用1.10.2 DataTables,并且我想利用columnFilter插件而不是手动添加一些东西。我正在使用带有数据表,jQuery 1.10.2,jQuery UI 1.10.3和bootstrap 3.1.1的bootstrap渲染器。这个特定的表不使用任何花哨的东西(没有固定的标题,没有固定的列,没有ColVis或ColReorder)。分页功能已开启。
<link rel="stylesheet" type="text/css" href="~/CSS/dataTables.bootstrap.css" />
<!-- stuff -->
<table id="reportTable" class="table table-condensed table-striped table-bordered">
<thead>
</thead>
<tbody>
</tbody>
</table>
<!-- stuff -->
<script type='text/javascript' src='~/Scripts/jquery.dataTables.js'></script>
<script type='text/javascript' src='~/Scripts/dataTables.bootstrap.js'></script>
<script type="text/javascript" src="~/Scripts/jquery.dataTables.columnFilter.js"></script>
Run Code Online (Sandbox Code Playgroud)
JavaScript:
vm.table = $('#reportTable').DataTable({
dom: 'rtipfl',
autoWidth: false,
info: true,
lengthChange: true,
lengthMenu: [ 10, 15, 20 ],
displayLength: 10,
pageLength: 10,
ordering: true,
orderMulti: true,
orderClasses: true,
order: [[ 2, "asc" ]],
paging: true,
pagingType: "full_numbers",
renderer: "bootstrap",
deferRender: true,
processing: true, …Run Code Online (Sandbox Code Playgroud) 所以我正在阅读以下的两列数据txt文件:
20 0.15
30 0.10
40 0.05
50 0.20
60 0.10
70 0.10
80 0.30
我想把第二列放入一个数组({0.15,0.10,0.05,0.2,0.1,0.1,0.3}),但我不知道如何解析大于1的浮点数.我试过在扫描仪中读取文件并使用分隔符,但我不知道如何获取进行令牌的整数.请帮我.
这是我的代码供参考:
import java.io.PrintWriter;
import java.util.Scanner;
import java.io.*;
class OneStandard {
public static void main(String[] args) throws IOException {
Scanner input1 = new Scanner(new File("ClaimProportion.txt"));//reads in claim dataset txt file
Scanner input2 = new Scanner(new File("ClaimProportion.txt"));
Scanner input3 = new Scanner(new File("ClaimProportion.txt"));
//this while loop counts the number of lines in the file
while (input1.hasNextLine()) {
NumClaim++;
input1.nextLine();
}
System.out.println("There are "+NumClaim+" different claim sizes …Run Code Online (Sandbox Code Playgroud) javascript ×2
jquery ×2
android ×1
asp.net-mvc ×1
c#-4.0 ×1
datatables ×1
datetime ×1
delimiter ×1
django ×1
django-south ×1
firebase ×1
html ×1
java ×1
kotlin ×1
linux ×1
node.js ×1
npm ×1
openxml ×1
openxml-sdk ×1
python ×1
reactjs ×1