我已经开始学习iOS开发了.
我想enum在我的示例项目中使用.
我已经声明enum中sample.h像下面.我希望我已经正确宣布了这一点.
typedef enum{s=1,m,t,w,th,f,sa} days;
Run Code Online (Sandbox Code Playgroud)
我想用这个viewController.m.在viewController.h,我已经导入sample.h.
我想使用名称之类的枚举"days.sa".但是我在谷歌搜索的代码越多,他们就像在"sample.h"类似的地方创建一个实例变量
@interface Sample:NSObject
{
days d;
}
Run Code Online (Sandbox Code Playgroud)
如果我想使用这种方法,我需要创建和使用实例.但我不想那样.
我需要使用像
days.d or days.sa or days.th
Run Code Online (Sandbox Code Playgroud)
怎么做?,这必须用于整个项目和
如何创建枚举作为类变量而不是实例变量?
当我尝试重定向到操作时,我收到时参数总是为空?我不知道为什么会发生这样的事情.
ActionResult action1() {
if(ModelState.IsValid) {
// Here user object with updated data
redirectToAction("action2", new{ user = user });
}
return view(Model);
}
ActionResult action2(User user) {
// user object here always null when control comes to action 2
return view(user);
}
Run Code Online (Sandbox Code Playgroud)
有了这个,我还有另一个疑问.当我通过路径访问动作时,我只能通过获取值RouteData.Values["Id"].路由的值不会发送到参数.
<a href="@Url.RouteUrl("RouteToAction", new { Id = "454" }> </a>
Run Code Online (Sandbox Code Playgroud)
我错过任何配置?或者我想念的任何东西
ActionResult tempAction(Id) {
// Here Id always null or empty..
// I can get data only by RouteData.Values["Id"]
}
Run Code Online (Sandbox Code Playgroud) 搜索谷歌并使用企业库数据访问来连接数据库.
使用https://www.nuget.org/packages/EnterpriseLibrary.Data/仅安装数据访问包.
添加到项目后,我已将配置设置如下,
<configSections>
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" />
</configSections>
<dataConfiguration defaultDatabase="dProvider" />
<connectionStrings>
<add name="dProvider" connectionString="server=local;Initial Catalog=n;uid=sa;pwd=pwd"
providerName="System.Data.SqlClient" />
</connectionStrings>
Run Code Online (Sandbox Code Playgroud)
通过以下应用程序调用,
Database db;
string sqlCommand;
DbCommand dbCommand;
db = DatabaseFactory.CreateDatabase("dProvider"); or DatabaseFactory.CreateDatabase();
Run Code Online (Sandbox Code Playgroud)
运行应用程序后,我得到以下异常,
{"Database provider factory not set for the static DatabaseFactory. Set a provider factory invoking the DatabaseFactory.SetProviderFactory method or by specifying custom mappings by calling the DatabaseFactory.SetDatabases method."}
Run Code Online (Sandbox Code Playgroud)
我犯了什么错误?如何解决这个问题?
当我部署版本时,我会将数字作为查询字符串添加到JavaScript和CSS文件中,如下所示?
'app/source/scripts/project.js?burst=32472938'
Run Code Online (Sandbox Code Playgroud)
我正在使用上面的内容在浏览器中突发缓存.
但在Firefox中,我得到了我修改过的最新脚本.但在Chrome中,我没有收到我修改过的最新脚本.而不是那样,我得到旧的.
但是在开发者控制台中,我看到了最新修改的突发数量.
我有一个方法.从硬盘检索文档.我不能通过单元测试来测试这个.它总是抛出异常无效的空路径或其他东西.如何测试.我暂时创建了单元测试会话.但我不能为这个Server.MapPath.怎么做 ?
我已经提出了请求.
我已经更改了两个文件并提交了pull请求.
在提交者之后,我收到了喜欢的,
该分支与基本分支没有冲突
但是,我变得像
失败:Travis CI构建失败
我在web api中使用asp.net身份进行基于令牌的身份验证.
对于刷新令牌,我已经基于以下链接实现了
我添加了以下两个类,并在启动配置中提到.
从ui我通过api单独使用用户名和密码调用
当我调用上面的api时,请求直接转到ValidateClientAuthentication方法.
但在这种方法逻辑中,我们需要发送客户端ID和客户端密钥.
在用户登录特定用户之前,我们如何知道这两个?
我认为工作流程应该是这样的,我们需要检查数据库的用户名和密码,并应生成访问令牌和刷新令牌.
但是我在哪里做这个逻辑.
样本中提到的这个系统的工作流程是什么?
在此系统之前,我将在我的应用程序中调用Common/login api,并在成功验证后,
我将调用代码使用户登录
var userIdentity=await user.GenerateUserIdentityAsync(UserManager);
AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistent }, userIdentity);
Run Code Online (Sandbox Code Playgroud)
在上面的代码之后,我将从用户身份生成访问令牌.
我已经多次尝试过以下实现并厌倦了流程.
帮助我关于这里提到的逻辑和流程.
SimpleAuthorizationServerProvider
namespace AngularJSAuthentication.API.Providers
{
public class SimpleAuthorizationServerProvider : OAuthAuthorizationServerProvider
{
public override Task ValidateClientAuthentication(OAuthValidateClientAuthenticationContext context)
{
string clientId = string.Empty;
string clientSecret = string.Empty;
Client client = null;
if (!context.TryGetBasicCredentials(out clientId, out clientSecret))
{
context.TryGetFormCredentials(out clientId, out clientSecret);
}
if (context.ClientId == null)
{
//Remove the comments from …Run Code Online (Sandbox Code Playgroud) asp.net-web-api asp.net-web-api2 asp.net-identity-2 asp.net-identity-3
我已经用asp.net身份验证实现了asp.net mvc。
我使用了基于cookie的身份验证。重新启动IIS /停止并为我的站点启动IIS之后,当我打开网站时,用户将自动登录到系统。
用户cookie不会被清除,并且仍然对用户有效。重新启动iis后如何强制用户注销?
我使用了网站上的默认示例。 http://www.nuget.org/packages/Microsoft.AspNet.Identity.Samples
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
Provider = new CookieAuthenticationProvider
{
// Enables the application to validate the security stamp when the user logs in.
// This is a security feature which is used when you change a password or add an external login to your account.
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
validateInterval: TimeSpan.FromMinutes(30),
regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
}
});
Run Code Online (Sandbox Code Playgroud) 要在我的Web应用程序中发送批量电子邮件,我使用filewatcher发送应用程序.
我计划用控制台应用程序而不是Windows服务或调度程序来编写filewatcher.
我已在以下路径中复制了可执行文件快捷方式.
%appdata%\ Microsoft\Windows\Start Menu\Programs
参考:https://superuser.com/questions/948088/how-to-add-exe-to-start-menu-in-windows-10
运行可执行文件后,不会始终监视文件观察程序.搜索了一些网站后,我发现我们需要添加代码
new System.Threading.AutoResetEvent(false).WaitOne();
Run Code Online (Sandbox Code Playgroud)
这是添加可执行文件和观看文件夹的正确方法吗?
运行控制台应用程序(没有上面的代码)后,文件将不会被始终监视?
什么是使用文件观察者的正确方法?
FileSystemWatcher watcher = new FileSystemWatcher();
string filePath = ConfigurationManager.AppSettings["documentPath"];
watcher.Path = filePath;
watcher.EnableRaisingEvents = true;
watcher.NotifyFilter = NotifyFilters.FileName;
watcher.Filter = "*.*";
watcher.Created += new FileSystemEventHandler(OnChanged);
Run Code Online (Sandbox Code Playgroud) 我搜索了我发现以下内容的网站.
使用html5,我们可以轻松触发数字键盘,如下所示,
<input type='tel' />
<input type='number'/>
<input type='text' pattern='some pattern' /> (This will work in IOS and not in android)
Run Code Online (Sandbox Code Playgroud)
但是我使用autoNumeric插件来格式化/限制用户输入,如果是数字. 根据autoNumeric插件(http://www.decorplanit.com/plugin/)的文档,如果输入type ='tel/number ' ,autoNumeric将不起作用.我试过,是的,它不起作用.
我的要求是,
如何在没有html5的情况下启用/触发移动/ ipad/iphone中的数字键盘?
要么
是否有任何jquery插件可以在没有html5和autoNumeric js(autonumeric js)的移动/ ipad/iphone中启用/触发数字键盘?
c# ×3
asp.net ×1
caching ×1
enums ×1
file-watcher ×1
github ×1
html5 ×1
iis ×1
ios ×1
javascript ×1
jquery ×1
mobile ×1
numeric ×1
objective-c ×1
unit-testing ×1