我有以下课程: -
public class Requirements
{
public string EventMessageUId { get; set; }
public string ProjectId { get; set; }
public List<Message> Message { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我正在把它映射到Json: -
Requirements objRequirement = JsonObject.ToObject<Requirements>();
Run Code Online (Sandbox Code Playgroud)
我想在上面的映射之后检查类的任何属性是否没有值或者是否为null.
为此,我试过: -
bool isNull= objRequirement.GetType().GetProperties().All(p => p != null);
Run Code Online (Sandbox Code Playgroud)
但是在调试的过程中,我发现每次属性都是否为Null时它是否为true.
请帮助我如何通过Avoioding For/foreach循环实现这一点.
我想调用某些功能,在按下homebuttonclick事件时显示通知.
我引用了这个博客.
书面代码如下:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event){
if(keyCode == KeyEvent.KEYCODE_HOME){
APP_STATUS="SLEEP";
LocalToNotification();
}
return true;
}
Run Code Online (Sandbox Code Playgroud)
但不幸的是,它无法正常工作.
我通过调试器进行了测试,但发现调试器在按下主页按钮时也没有在这行代码上进行测试.
上面的代码有什么问题?
请帮我.
我在MySql中有以下代码块:
DROP TABLE IF EXISTS `account.info`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `account.info` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`account_id` int(11) NOT NULL,
`year_id` int(11) NOT NULL,
`school_id` int(11) NOT NULL,
PRIMARY KEY (`id`,`account_id`,`year_id`,`school_id`)
) ENGINE=InnoDB AUTO_INCREMENT=7177 DEFAULT CHARSET=utf8;
Run Code Online (Sandbox Code Playgroud)
它给我第一行的错误:
ERROR 1103 (42000) at line 56: Incorrect table name 'account.info'
Run Code Online (Sandbox Code Playgroud)
它有什么问题?
请帮我.
我有以下存储过程:
CREATE procedure validateLogin
(
@password varchar(200),
@username varchar(100),
@IpAddress varchar(100)
)
AS
BEGIN
Declare @qry varchar(max), @LockedIp varchar(max), @LockedTime DateTime, @TimeDifference int;
set @qry = 'select IdUser, UserName, FirstName, LastName, idOrg, Users.idRole, Roles.Title as [Role], Allowed_IP from Users, Roles where Users.idRole = Roles.idRole
and lower(UserName) = @username and [password] = @password' ;
select
@LockedIp = isnull(Allowed_IP,''),
@LockedTime = isnull(LockedTime, getDate())
from Users
where UserName = ISNULL(@username,'');
SELECT
@TimeDifference = DATEDIFF(MINUTE, @LockedTime, GETDATE())
IF exists(select * from Users where UserName …Run Code Online (Sandbox Code Playgroud) 我想在打开的 Excel 文档中设置文本的前景色以写入文本。
为此我尝试过:
var stylesheet1 = spreadSheet.WorkbookPart.WorkbookStylesPart.Stylesheet;
Fills fills1 = new Fills() { Count = (UInt32Value)5U };
Fill fill5 = new Fill();
PatternFill patternFill5 = new PatternFill() { PatternType = PatternValues.Solid };
ForegroundColor foregroundColor3 = new ForegroundColor() { Rgb = "#FF0000" };
patternFill5.Append(foregroundColor3);
fill5.Append(patternFill5);
fills1.Append(fill5);
stylesheet1.Fills.Append(fills1);
var fid = stylesheet1.Fills.Count++;
wbsp.Stylesheet = stylesheet1;
Row excelRow;
excelRow = new Row();
excelRow.RowIndex = 0;
Cell cell = new Cell()
{
//create the cell reference of format A1, B2 etc
//CellReference = …Run Code Online (Sandbox Code Playgroud) 我有这种形式的字符串:19/8/1988
注意: String DateOfBirth=" 19/8/1988"
当我使用Datetime.parse(DateOfBirth)它给我invalid dateformat error.
我也无法做到 cdate(DateOfBirth)
当我输入格式为mm/dd/yyyy的字符串,即8/19/1988它不会给我错误.
请帮我将字符串转换为日期mm/ddd/yyyy格式.
我用以下代码制作样式:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CodeFont" parent="@android:style/TextAppearance.Medium">
<item name="android:layout_width">150dip</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">#00FF00</item>
<item name="android:typeface">monospace</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
并将其应用为:
<EditText
style="CodeFont"
android:id="@+id/txt_username"
android:inputType="textPersonName" >
<requestFocus />
</EditText>
Run Code Online (Sandbox Code Playgroud)
但它没有得到应用。
如果我写相同的风格:
<EditText
android:id="@+id/txt_username"
android:layout_width="150dip"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:ems="10"
android:inputType="textPersonName" />
Run Code Online (Sandbox Code Playgroud)
然后将其应用。
我的代码有什么问题吗?
请帮我。
我可以有 2 个具有不同数据类型的 post 方法,如下所示:-
[HttpPost]
public HttpResponseMessage Post([StringBody]string data)
{
// Logic
}
[HttpPost]
public HttpResponseMessage Post(Requirements objRequirement)
{
//Logic
}
Run Code Online (Sandbox Code Playgroud)
我在邮递员中遇到以下错误:-
<Error>
<Message>An error has occurred.</Message>
<ExceptionMessage>Multiple actions were found that match the request:
System.Net.Http.HttpResponseMessage Post(Newtonsoft.Json.Linq.JObject) on type ATL.Trebuchet.RestApi.Controllers.ValuesController
System.Net.Http.HttpResponseMessage Post(ATL.Trebuchet.RestApi.Models.Requirements) on type ATL.Trebuchet.RestApi.Controllers.ValuesController</ExceptionMessage>
<ExceptionType>System.InvalidOperationException</ExceptionType>
<StackTrace> at System.Web.Http.Controllers.ApiControllerActionSelector.ActionSelectorCacheItem.SelectAction(HttpControllerContext controllerContext)
at System.Web.Http.Controllers.ApiControllerActionSelector.SelectAction(HttpControllerContext controllerContext)
at System.Web.Http.ApiController.ExecuteAsync(HttpControllerContext controllerContext, CancellationToken cancellationToken)
at System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsyncInternal(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)</StackTrace>
</Error>
Run Code Online (Sandbox Code Playgroud)
请帮助如何使用不同类型的参数使用相同的 Post 方法
我正在发送数据作为 Text (text/plain)
编辑 1:
我有下面的代码 -
var refNosToOrder = new int[9] {1,2,3,4,5,6,7,8,9}
var orderedList = lst.OrderBy(x=>x.RefNo==7)
.ThenBy(y=> refNosToOrder.Contains(y.RefNo)).ToList();
Run Code Online (Sandbox Code Playgroud)
lst是包含 int 属性的类对象列表 - RefNo : ieList<SampleClass>
class SampleClass
{
public int RefNo {get;set;}
}
Run Code Online (Sandbox Code Playgroud)
lst包含 的所有未排序数据RefNo:
lst = 2,4,6,9,7,5,8,1,3
Run Code Online (Sandbox Code Playgroud)
我想做的事 -
首先,我想lst通过将第一个元素保留为 - 来进行排序7;那么对于列表的其余部分,它应该按数组排序refNosToOrder
即我期望的最终输出是 -
7,1,2,3,4,5,6,8,9
Run Code Online (Sandbox Code Playgroud)
使用上面的代码 -
var orderedList = lst.OrderBy(x=>x.RefNo==7)
.ThenBy(y=> refNosToOrder.Contains(y.RefNo)).ToList();
Run Code Online (Sandbox Code Playgroud)
它给出了 -2,4,6,9,7,5,8,1,3即这段代码根本没有对列表进行排序。
我的桌子:
PageOrderID PageName
3 Citation Number
3 Citation Number
3 Citation Number
1 Account Info
1 Account Info
1 Account Info
Run Code Online (Sandbox Code Playgroud)
我想根据PageOrderID订购它的Pagename,但是不同的PageNames.
我尝试了以下但它不起作用:
select PageOrderID,distinct(PageName) from ScreenMaster order by PageOrderID
Run Code Online (Sandbox Code Playgroud)
这是什么错误?
O/P:
PageOrderID PageName
1 Account Info
3 Citation Number
Run Code Online (Sandbox Code Playgroud)