field

Extracting SUM of data from XML in Sql

空扰寡人 提交于 2020-01-03 14:16:50
问题 I have an XML field in SQL table like this <Root> <Name>Apollo</Name> <Code>1000</Code> <Code>2000</Code> <Code>3000</Code> </Root> I need to write an SQL query to select the 'Name' and SUM of 'Code' values SELECT T1.c.value('Name[1] AS VARCHAR(100)') AS Name, T1.c.value('Code[1] AS NUMERIC(10,5)') AS TotalCode FROM TableName CROSS APPLY xmlField.nodes('Root') AS T1(c) it gives me output like this: Name Code --------------------------- Apollo 1000 Apollo 2000 Apollo 3000 But I need SUM of

how to count horizontal values on a database?

会有一股神秘感。 提交于 2020-01-03 11:40:07
问题 assuming that I have a db that have an horizontal structure like this: ID | NAME | DATA1 | DATA2 | DATA3 | DATA4 | DATA5 | DATA6 | DATA7 1 | mmm | 0 | 1 | 0 | 3 | 5 | 1 | 0 2 | bbb | 0 | 0 | 0 | 1 | 0 | 1 | 1 the informations are the data fields and I would like to count all the times that a certain discriminant, such as "is more than 0" the way I thought it is loop trought all the fields, and count, or COUNT() each DATA field, so SUM() those 7 queries... anyone has another idea? in this case

MySql field size for storing email body

本小妞迷上赌 提交于 2020-01-03 09:08:48
问题 I want to store contents of email body into MySql. What would the correct type&size of the field be? Can varchar() provide enough storage size? Is there a limitation in the email body's length? Thanks in advance. 回答1: You will need to use blob or text types. There is no limit on the length of an email body. 回答2: "A BLOB is a binary large object that can hold a variable amount of data" http://dev.mysql.com/doc/refman/5.5/en/blob.html 来源: https://stackoverflow.com/questions/6766449/mysql-field

Proguard keep classmembers

泄露秘密 提交于 2020-01-03 07:34:06
问题 How can I tell proguard to keep my classmembers? I need them for JSON compatibility... This is my class: package com.tools.app.holiday; public class Holiday { private String name; private Calendar dateFrom = Calendar.getInstance(); private Calendar dateTo = Calendar.getInstance(); ... I already tried, but it doesnt work... -keepclassmembers class com.tools.app.holiday.Holiday -keepclassmembers class com.tools.app.holiday.Holiday *{ private String name; private Calendar dateFrom; private

How do bit fields and their alignments work in C programming?

痞子三分冷 提交于 2020-01-03 05:42:40
问题 I need your help at understanding how bit fields work in C programming. I have declared this struct: struct message { unsigned char first_char : 6; unsigned char second_char : 6; unsigned char third_char : 6; unsigned char fourth_char : 6; unsigned char fifth_char : 6; unsigned char sixth_char : 6; unsigned char seventh_char : 6; unsigned char eigth_char : 6; }__packed message; I saved the size of the struct into an integer using sizeof(message). I thought the value of the size will be 6

While read line, awk $line and write to variable

╄→尐↘猪︶ㄣ 提交于 2020-01-03 05:37:29
问题 I am trying to split a file into different smaller files depending on the value of the fifth field. A very nice way to do this was already suggested and also here. However, I am trying to incorporate this into a .sh script for qsub, without much success. The problem is that in the section where the file to which output the line is specified, i.e., f = "Alignments_" $5 ".sam" print > f , I need to pass a variable declared earlier in the script, which specifies the directory where the file

While read line, awk $line and write to variable

自作多情 提交于 2020-01-03 05:37:07
问题 I am trying to split a file into different smaller files depending on the value of the fifth field. A very nice way to do this was already suggested and also here. However, I am trying to incorporate this into a .sh script for qsub, without much success. The problem is that in the section where the file to which output the line is specified, i.e., f = "Alignments_" $5 ".sam" print > f , I need to pass a variable declared earlier in the script, which specifies the directory where the file

Drupal field_settings_form

醉酒当歌 提交于 2020-01-03 03:21:08
问题 I made my own Field in Drupal for an address. It displays things like street, number, zip,... So far so good. But for some reason, ALL field are required. Although there are set required in the UI or the Array. So I would like to edit it's field_settings_form. I found myself an example in the Drupal-core code, but it doesn't help me a lot. Goal of the field_settings is to make the fields visible or not and required or not. So I came up with this code (I got it from user_reference.module )

How to draw the direction field of van der pol oscillator?

雨燕双飞 提交于 2020-01-03 02:08:25
问题 I am trying to get the direction field and phase portrait shown on this wiki page: Van der Pol oscillator in wikipedia My code: options = odeset('MaxStep',0.5); temp = inputdlg('Enter mu value'); mu = str2double(temp{1,1}); [t,y] = ode45(@(t,y) vdp1_1(t,y,mu),[0 10],[2; 0],options); plot(y(:,1),y(:,2)); hold on quiver(y(:,1), y(:,2), gradient(y(:,1)), gradient(y(:,2) )) hold off function dydt = vdp1_1(t,y,mu) dydt = zeros(2,1); dydt(1) = y(2); dydt(2) = [mu * (1-y(1)^2)*y(2)-y(1)]; end

django REST framework multi source field

核能气质少年 提交于 2020-01-02 19:20:09
问题 Let's say that I have these in my models.py : #models.py class Theme(models.Model): """An theme is an asset of multiple levels.""" adventure = models.ForeignKey(Adventure) offset = models.PositiveSmallIntegerField() finished = models.BooleanField(default=False) class Level(models.Model): """Abstract level representation""" theme = models.ForeignKey(Theme) offset = models.PositiveSmallIntegerField() finished = models.BooleanField(default=False) class Meta: abstract = True class PuzzleLevel