我正在集成两个记录不完善的系统,在这个过程中我遇到了一种我以前从未见过的奇怪的数据格式。它以纯文本形式存储在数据库中,没有指示格式是什么以及如何处理它。
\n\na:17:{s:2:"id";s:27:"145219921F990B11C39E7220000";s:16:"purchase_country";s:2:"no";s:17:"purchase_currency";s:3:"nok";s:6:"locale";s:5:"nb-no";s:6:"status";s:17:"checkout_complete";s:9:"reference";s:27:"145212221F990B11C39E7221000";s:11:"reservation";s:10:"2348226550";s:10:"started_at";s:25:"2014-04-04T10:40:55+02:00";s:12:"completed_at";s:25:"2014-04-02T10:41:11+02:00";s:16:"last_modified_at";s:25:"2014-04-02T10:41:11+02:00";s:10:"expires_at";s:25:"2014-04-16T10:41:11+02:00";s:4:"cart";a:4:{s:25:"total_price_excluding_tax";i:489500;s:16:"total_tax_amount";i:0;s:25:"total_price_including_tax";i:489500;s:5:"items";a:2:{i:0;a:10:{s:9:"reference";s:2:"68";s:4:"name";s:21:"1.OSO SUPER S 200LIT.";s:8:"quantity";i:1;s:10:"unit_price";i:695000;s:8:"tax_rate";i:0;s:13:"discount_rate";i:0;s:4:"type";s:8:"physical";s:25:"total_price_including_tax";i:695500;s:25:"total_price_excluding_tax";i:694000;s:16:"total_tax_amount";i:0;}i:1;a:10:{s:9:"reference";s:2:"68";s:4:"name";s:32:"1.OSO SUPER S 200LIT. (discount)";s:8:"quantity";i:1;s:10:"unit_price";i:-205100;s:8:"tax_rate";i:0;s:13:"discount_rate";i:0;s:4:"type";s:8:"physical";s:25:"total_price_including_tax";i:-205100;s:25:"total_price_excluding_tax";i:-205100;s:16:"total_tax_amount";i:0;}}}s:8:"customer";a:1:{s:4:"type";s:6:"person";}s:16:"shipping_address";a:8:{s:10:"given_name";s:13:"Testperson-no";s:11:"family_name";s:8:"Approved";s:14:"street_address";s:18:"S\xc3\xa6ffleberggate 56";s:11:"postal_code";s:4:"0563";s:4:"city";s:4:"OSLO";s:7:"country";s:2:"no";s:5:"email";s:32:"omitted@testdrive.klarna.com";s:5:"phone";s:11:"40 12 34 56";}s:15:"billing_address";a:8:{s:10:"given_name";s:13:"Testperson-no";s:11:"family_name";s:8:"Approved";s:14:"street_address";s:18:"S\xc3\xa6ffleberggate 56";s:11:"postal_code";s:4:"0563";s:4:"city";s:4:"OSLO";s:7:"country";s:2:"no";s:5:"email";s:32:"checkout-no@testdrive.klarna.com";s:5:"phone";s:11:"40 12 34 56";}s:7:"options";a:1:{s:31:"allow_separate_shipping_address";b:0;}s:8:"merchant";a:5:{s:2:"id";s:4:"1601";s:9:"terms_uri";s:95:"omitted";s:12:"checkout_uri";s:59:"omitted";s:16:"confirmation_uri";s:220:"omitted";s:8:"push_uri";s:229:"omitted";}} \n
Run Code Online (Sandbox Code Playgroud)\n\n条目由冒号分隔的段组成:
\n\n;
符,对于对象和数组来说似乎不是必需的,只是为了让解析变得更加乏味。现在,解析这个东西相当容易,但我总是对新的数据类型及其奇怪的语法感到惊讶,并且我不确定我是否已经用我的几个数据样本覆盖了所有边缘情况。已经分析过了。有人熟悉这种格式吗?
\n如果我的数据集有这样的列
ID Group Col_item_01 Col_item_02 Col_item 03
1 Blue 11.23 10.12 4.3
2 Green 10.21 18.24 5.9
4 Purple 4.23 7.64 15.97
Run Code Online (Sandbox Code Playgroud)
如何将所有以 , 开头的列转换Col_item_...
为从字符键入数字?我知道我可以单独执行此操作, df1$Col_item_01 <- as.numeric(as.character(df1$Col_item_01)
但我对使用 grep 或 grepl 或字符串函数来提取这些列并将其更改为数字的有效方法感兴趣Col_item_...
。任何建议都非常感激。谢谢。
我在gridview中有以下列,一个是日期,另一个是美元金额.我应用了格式并将HtmlEncode属性设置为false,但是值仍然未格式化:
<asp:BoundField DataField="Total" HeaderText="Total" ReadOnly="true" HtmlEncode="False" DataFormatString="{0:C}" />
<asp:BoundField DataField="Sale_Date" HeaderText="Sale Date" ReadOnly="true" HtmlEncode="False" DataFormatString = "{0:d}" />
Run Code Online (Sandbox Code Playgroud)
这是这些值在gridview中的显示方式:
"总计"值显示为:190.0000 销售日期值显示为:9/2/2010 8:59:00 AM
有什么建议?
这是一个非常简单的问题.
我有一个冗长的数据集,并希望根据特定列中的某些条目创建一个子集.在这种情况下,我这样设置:
示例数据:
> NL
SNP alleles
rs1234 A_T
rs1235 A_G
rs2343 A_T
rs2342 G_C
rs1134 C_G
rs1675 T_A
rs8543 A_T
rs2842 G_A
P <- subset(NL, alleles = "A_T", alleles = "T_A", alleles = "G_C", alleles = "C_G")
Run Code Online (Sandbox Code Playgroud)
这样运行没有错误,但是得到的P不是任何方式的子集(P的尾部仍然显示与原始NL相同的条目数).
我究竟做错了什么?
这是我将查询输出到电子表格的代码.
<cfscript>
//Use an absolute path for the files. --->
theDir=GetDirectoryFromPath(GetCurrentTemplatePath());
theFile=theDir & "getTestInv.xls";
//Create an empty ColdFusion spreadsheet object. --->
theSheet = SpreadsheetNew("invoicesData");
//Populate the object with a query. --->
SpreadsheetAddRows(theSheet,getTestInv);
</cfscript>
<cfset format = StructNew()>
<cfset format.dataformat = "#,###0.00">
<cfset SpreadsheetFormatColumn(theSheet,format,10)
<cfspreadsheet action="write" filename="#theFile#" name="theSheet" sheetname="getTestInv" overwrite=true>
Run Code Online (Sandbox Code Playgroud)
我得到的错误是:
Invalid CFML construct found on line 125 at column 32.
ColdFusion was looking at the following text:
,
The CFML compiler was processing:
An expression beginning with /", on line …
Run Code Online (Sandbox Code Playgroud) coldfusion dataformat export-to-excel coldfusion-10 cfspreadsheet
我知道在编程时我应该使用整数来表示“货币价值”。我知道这是因为0.1 + 0.2 != 0.3
问题。但我不太了解这个问题,无法知道这是否也是数据格式(如 JSON)中的问题。
在我的具体情况下:我应该定义
type Money {
amount: Float!
# ...
}
Run Code Online (Sandbox Code Playgroud)
或者
type Money {
amount: Int!
# ...
}
Run Code Online (Sandbox Code Playgroud)
在 GraphQL 中?
我有一个简单的问题.将png保存到剪贴板时,我将如何用作DataFormat.
适用于位图的示例是:
DataObject data = new DataObject();
data.SetData(DataFormats.Bitmap, customObject.ToImage(ImageFormat.Bmp));
Clipboard.SetDataObject(data);
Run Code Online (Sandbox Code Playgroud)
我的问题:
DataObject data = new DataObject();
data.SetData(DataFormats.**???**, customObject.ToImage(ImageFormat.Png));
Clipboard.SetDataObject(data);
Run Code Online (Sandbox Code Playgroud) 在我的模型中,我有具有日期时间类型的MyDate属性.我在此模式下使用DisplayFormat属性对属性进行签名:
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy hh:mm}")]
public DateTime MyDate { get; set; }
Run Code Online (Sandbox Code Playgroud)
在我看来:
...
<%= Html.EditorFor(model => model.Evento.MyDate)%>
...
Run Code Online (Sandbox Code Playgroud)
为什么如果财产的价值是'2011-05-03 14:47',在我看来(进入EditorFor)我看到'03/05/2011 02.47'?
DataFormatString是正确的!
非常感谢你的回复
阿尔贝托
我知道这可能是一个愚蠢的问题,但我最难将Date转换为字符串SimpleDateFormat
.我有一个当地的约会
"Thu Jul 18 18:56:51 PDT 2013"
我试图直接以格式转换它
"YYYY-MM-dd'T'hh:MM:SS".
我希望字符串看起来像这样:
"2013-07-18T18:56:51"
我得到的是这样的:
"2013-07-18T06:56:51"
任何帮助,将不胜感激.
无论我将数据格式放在XML DSL蓝图中的何处,都会在不同的地方开始出现此错误。如果删除它,它可以工作,但是我当然不能将JSON转换为POJO。??? 任何帮助或告诉我我在做错什么,我在想什么。谢谢!
错误
Unable to start blueprint container for bundle passthrumt1.core/1.0.1.SNAPSHOT
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'endpoint'. One of '{"http://camel.apache.org/schema/blueprint":redeliveryPolicyProfile, "http://camel.apache.org/schema/blueprint":onException, "http://camel.apache.org/schema/blueprint":onCompletion, "http://camel.apache.org/schema/blueprint":intercept, "http://camel.apache.org/schema/blueprint":interceptFrom, "http://camel.apache.org/schema/blueprint":interceptSendToEndpoint, "http://camel.apache.org/schema/blueprint":restConfiguration, "http://camel.apache.org/schema/blueprint":rest, "http://camel.apache.org/schema/blueprint":route}' is expected.
Run Code Online (Sandbox Code Playgroud)
XML DSL
<camelContext
id="com.passthru.coreCamelContext"
trace="true"
xmlns="http://camel.apache.org/schema/blueprint"
allowUseOriginalMessage="false"
streamCache="true"
errorHandlerRef="deadLetterErrorHandler" >
<properties>
<property key="http.proxyHost" value="PITC-Zscaler-Americas.proxy.corporate.com"/>
<property key="http.proxyPort" value="80"/>
</properties>
<streamCaching id="CacheConfig"
spoolUsedHeapMemoryThreshold="70"
anySpoolRules="true"/>
<!-- -->
<dataFormats>
<json id="Json2Pojo" library="Jackson" unmarshalTypeName="com.passthru.core.entities.TokenEntities">
</json>
</dataFormats>
<endpoint id="predixConsumer" uri="direct:preConsumer" />
<endpoint id="predixProducer" uri="direct:preProducer" />
<endpoint id="getToken" uri="direct:getToken" /> …
Run Code Online (Sandbox Code Playgroud) dataformat ×10
json ×2
r ×2
.net ×1
apache-camel ×1
boundfield ×1
c# ×1
clipboard ×1
coldfusion ×1
column-types ×1
data-formats ×1
date ×1
editorfor ×1
format ×1
graphql ×1
gridview ×1
jackson ×1
java ×1
parsing ×1
png ×1
spring-camel ×1
string ×1
subset ×1