Arithmetic overflow on column sum in sql server

醉酒当歌 提交于 2019-12-08 14:35:58
问题 I'm trying to get a column total but when i run this query i get the following error. Any advice? SELECT SUM(Size) as total FROM AllDocs Where DirName LIKE 'sites/test/test%' ERROR: Msg 8115, Level 16, State 2, Line 1 Arithmetic overflow error converting expression to data type int. Warning: Null value is eliminated by an aggregate or other SET operation. 回答1: While all your sizes can fit into INT (up to 2^31 - 1 ), their SUM cannot. Cast them into BIGINT : SELECT SUM(CAST(Size AS BIGINT)) as

Java Regex include all letters of the alphabet except certain letters

醉酒当歌 提交于 2019-12-08 14:35:58
问题 What I need to do is to determine whether a word consists of letters except certain letters. For example I need to test whether a word consists of the letters from the English alphabet except letters: I, V and X. Currently I have this long regex for the simple task above: Pattern pattern = Pattern.compile("[ABCDEFGHJKLMNOPQRSTUWYZ]+"); Any of you know any shorthand way of excluding certain letters from a Java regex? Thanks. 回答1: You can use the && operator to create a compound character class

Generate a file from a string without having to create a template file in Chef?

被刻印的时光 ゝ 提交于 2019-12-08 14:35:58
问题 I currently use this code in a recipe: template "/var/django/.ssh/id_rsa" do source "id_rsa.erb" owner "django" group "django" variables :key => ssh_key mode 00600 end And here's what id_rsa.erb looks like: <%= @key %> I was wondering if I could avoid having a template, and simply produce the file from the string. Something like this perhaps: file_from_string "/var/django/.ssh/id_rsa" do source ssh_key owner "django" group "django" mode 00600 end 回答1: Use the file resource and specify the


两盒软妹~` 提交于 2019-12-08 14:35:57
因为目前公司的项目采用的是微服务架构,为了保证一致性,也自然而然的考虑到了使用分布式事务来解决数据一致性问题,所以我们就用到了LCN分布式事务,详细的大家可以点击链接: 这是国内的一个开源项目。因为这个东西用了很长时间,也就慢慢信任了这个项目,但是今天突然遇到了一个问题,就是在A调用B服务时,B服务正常返回的时候报错了,LCN爆了一个事务组状态修改异常,最后通过同事的层层调试发现,原来是使用ThreadLocal造成的异常。当然看到问题时一脸懵逼,不知道是为什么会这样错

Is there an indexable sorted list in the Java.util package?

橙三吉。 提交于 2019-12-08 14:35:57
问题 I'm looking for a data structure in the java.util package. I need it to meet the following requirements: The number of elements is (theoretically) unbounded. The elements are sorted in an ascending order. You can get the nth element (fast). You can remove the nth element (fast). I expected to find an indexable skip list, but I didn't. Do they have any data structure which meets the requirements I'v stated? 回答1: There exists no simple data structure that fulfills all your criteria. The only

Can I skip attribute “type” in “style” tag in HTML5? [duplicate]

若如初见. 提交于 2019-12-08 14:35:55
问题 This question already has answers here : Are Type Attributes on SCRIPT, STYLE, and LINK elements still needed? (4 answers) Closed 4 years ago . According to W3Schools, I can skip attribute type for tag script in HTML5. Evidence : Differences Between HTML 4.01 and HTML5 The "type" attribute is required in HTML 4, but optional in HTML5. Can I do exactly the same with style tag? I was unable to find similar note. It only says type text/css Specifies the media type of the tag but no info about

copypng failed with exit code 1

a 夏天 提交于 2019-12-08 14:35:55
问题 I am getting the following error when building my iPhone application. The reddarkedge.png is right there in the supporting files folder. /Users/azamsharp/Desktop/UltraCam/UltraCam/TCam/reddarkedge.pngCommand /Applications/ Build System Support.xcplugin/Contents/Resources/copypng failed with exit code 1 Even if I remove the reddarkedge.png from the project it still gives me the same error.

Why async / await allows for implicit conversion from a List to IEnumerable?

。_饼干妹妹 提交于 2019-12-08 14:35:54
问题 I've just been playing around with async/await and found out something interesting. Take a look at the examples below: // 1) ok - obvious public Task<IEnumerable<DoctorDto>> GetAll() { IEnumerable<DoctorDto> doctors = new List<DoctorDto> { new DoctorDto() }; return Task.FromResult(doctors); } // 2) ok - obvious public async Task<IEnumerable<DoctorDto>> GetAll() { IEnumerable<DoctorDto> doctors = new List<DoctorDto> { new DoctorDto() }; return await Task.FromResult(doctors); } // 3) ok - not

Triggering a .NET garbage collection externally

一笑奈何 提交于 2019-12-08 14:35:54
问题 Is there a way to trigger a garbage collection in a .NET process from another process or from inside WinDBG? There are the Managed Debugging Assistants that force a collection as you move across a native/managed boundary, and AQTime seems to have button that suggests it does this, but I can't find any documentation on how to do it. 回答1: Well... there's the immediate window. If you have the luxury of attaching to the process, I supposed you could manually GC.Collect in the immediate window.

Write UTF-8 files from R

隐身守侯 提交于 2019-12-08 14:35:53
问题 Whereas R seems to handle Unicode characters well internally, I'm not able to output a data frame in R with such UTF-8 Unicode characters. Is there any way to force this? data.frame(c("hīersumian","ǣmettigan"))->test write.table(test,"test.txt",row.names=F,col.names=F,quote=F,fileEncoding="UTF-8") The output text file reads: hiersumian <U+01E3>mettigan I am using R version 3.0.2 in a Windows environment (Windows 7). EDIT It's been suggested in the answers that R is writing the file correctly