我正处于自由职业生涯的某个阶段,我为中小型企业开发了几个支持项目管理,预订/预订和电子邮件管理等内容的Web应用程序.
我喜欢这项工作,但发现最终我的应用程序达到了维护人员听到非常高的程度.我回顾一下我6个月前写的代码,发现我必须花一些时间重新学习我最初的代码,然后才能修复或增加功能.我确实尝试使用框架(之前我使用过Zend Framework,并考虑将Django用于我的下一个项目)
您使用哪些技术或策略来规划一个能够处理大量用户而不会破坏并仍然保持代码足够清晰以便轻松维护的应用程序?如果任何人有任何他们可以推荐的书籍或文章,那也将非常感激.
为什么是这样?我觉得能够锁定一些扩展方法只能在我的一个类中使用它真的很棒.真的不想在任何地方都有某些扩展方法......而且它们看起来比常规静态方法好得多:P
为了澄清:
我想要这些扩展方法的原因是因为我正在扩展一个Form,它上面有一个DataGridView.而且我对这些行感到厌倦:
foreach(var row in grid.Rows.OfType<DataGridViewRow>().Where(r => (bool) r.Cells[checkBoxColumn.Index].Value))
foreach(var row in grid.SelectedRows.OfType<DataGridViewRow>().Where(r => (bool) r.Cells[checkBoxColumn.Index].Value))
Run Code Online (Sandbox Code Playgroud)
想要一个扩展方法,以便我可以做到
foreach(var row in grid.Rows.CheckedRows())
foreach(var row in grid.SelectedRows.CheckedRows())
Run Code Online (Sandbox Code Playgroud)
换句话说,这个扩展方法在这个类之外根本没用.但它会使代码更清洁.当然可以制定常规方法,这就是我最终做的事情,因为这是不可能的.
Aaanyways,我只是想知道是否有人有一些很好的论据,为什么他们选择在这里使用扩展方法创建这样的限制.必须在静态类中才有意义.不能在嵌套的静态类中不...至少对我来说......
如何在Mac OS X Mail的撰写模式下打开*.eml文件?对于Outlook"X-Unsent:1"似乎可以解决问题,但不适用于Mac OS X Mail仍然以只读方式打开.
看一下下面的代码:
<asp:HyperLinkField
DataNavigateUrlFields="NameID"
DataNavigateUrlFormatString="names.aspx?nameid={0}"
DataTextField="name"
HeaderText="Name"
ItemStyle-Width="100px"
ItemStyle-Wrap="true" />
Run Code Online (Sandbox Code Playgroud)
它只需要名称id即可导航到下一页.我将如何包含不在gridview中的其他两个参数.导航URL使用必须采用gridview中已存在的关键字和数据库表中的其他两个参数.我尝试使用所有这些代码.没有什么对我有用.
<asp:HyperLinkField DataTextField="Keyword" DataNavigateUrlFields="Keyword"
DataNavigateUrlFormatString="KeywordSrchSumDtl.aspx?Keyword={0}&State={1}&City={2}"
HeaderStyle-VerticalAlign="Bottom" ItemStyle-HorizontalAlign="center" />
Run Code Online (Sandbox Code Playgroud)
我不能使用上面的代码,因为州和城市不在gridview中,但在我的数据表中可用.
我也尝试使用以下代码,但它不起作用
<asp:TemplateField HeaderText="Keyword" ItemStyle-HorizontalAlign="Center" FooterStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:HyperLink ID="link" runat="server" NavigateUrl='<% # "KeywordSrchSumDtl.aspx?Keyword="Eval("Keyword")+"&State="+Request.QueryString["State"]%>' Text='<%# Eval("Keyword") %>'>
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
Run Code Online (Sandbox Code Playgroud)
我也尝试过这个,
<asp:HyperLink ID="Link1" runat="Server" NavigateUrl='<%#redirectURL()+Server.UrlEncode((Eval("Keyword")).ToString())%>' Text='<%# DataBinder.Eval(Container.DataItem,"Keyword") %>'>
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
Run Code Online (Sandbox Code Playgroud)
我Donno怎么解决这个..请帮我解决这个问题.谢谢.
我正在使用Visual Studio 2012 Professional并使用高级安装程序(第三方)创建安装程序.
当我在Windows XP上运行已安装的.exe时,我收到以下消息:
<appName> .exe不是有效的Win32应用程序.
安装的可执行文件在Windows 7和8上都能正常运行.
如何让程序在Windows XP上运行?
只是一个关于该方法的好奇问题IComparable<T>.CompareTo();我知道该方法需要根据比较返回正数、负数或零,但在前两种情况下我返回的内容实际上重要吗?换句话说,我返回+1 或+1000 有什么区别吗?
我有一个应用程序,我有1个大文件的1000多个小部分.
我必须一次最多上传16个零件.
我使用.Net的Thread并行库.
我使用Parallel.For来划分多个部分并分配1个应该为每个部分执行的方法,并将DegreeOfParallelism设置为16.
我需要使用由不同部件上传生成的校验和值来执行1方法,因此我必须设置某些机制,我必须等待所有部件上传说1000完成.在TPL库中,我面临的问题是它是从1000中随机执行16个线程中的任何一个.
我想要一些机制,我可以在最初运行前16个线程,如果第一个或第二个或任何16个线程完成其任务,则应该启动第17个部分.
我怎样才能实现这一目标?
c# multithreading task-parallel-library c#-4.0 parallel.foreach
我尝试克隆并构建此项目https://github.com/mitrejcevski/ui-testing,但是在Android Studio中打开它后,出现以下构建错误:
ERROR: The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher.
The following dependencies do not satisfy the required version:
root project 'ui-testing' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.21
Affected Modules: app
Run Code Online (Sandbox Code Playgroud)
但是,当我单击“ app”超链接时,我被带到模块级build.gradle文件,该文件显示为
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 27
defaultConfig {
applicationId "nl.jovmit"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors { …Run Code Online (Sandbox Code Playgroud) 我将我们的网络核心 API 应用程序从 2.1 更新到 3.1,将 SwashBuckle.Asp.NetCore 更新到 5.0.0。这是我的启动集:
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
string authServerUrl = "http://testserver.com/identityserver4";
services.AddControllersWithViews();
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Version = "v1", Title = "NetCore API V1" });
// Define the OAuth2.0 scheme that's in use (i.e. Implicit …Run Code Online (Sandbox Code Playgroud) 我在路径上创建了一个文件夹C:\Users\MYUSER\Desktop\TEST\.
我有以下代码:
private const string DIR = @"C:\Users\MYUSER\Desktop\TEST\tmp";
static void Main(string[] args)
{
if (Directory.Exists(DIR))
Directory.Delete(DIR);
for (int i = 0; i < 100; i++)
{
var dinfo = Directory.CreateDirectory(DIR);
Directory.Delete(DIR);
}
Directory.CreateDirectory(DIR);
}
Run Code Online (Sandbox Code Playgroud)
当我执行代码时,大多数时候它运行正常,我可以看到文件夹中有一个文件夹tmp TEST.
我的问题是,在其他一些时候,Directory.CreateDirectory(DIR)根本不创建目录.我甚至检查了DirectoryInfo它的回报和它的Exists属性是false和Directory.CreateDirectory(DIR),因为该文件夹不存在,将无法正常工作.对这种奇怪的行为有什么解释吗?
c# ×6
.net ×1
.net-core ×1
android ×1
c#-4.0 ×1
directory ×1
email ×1
frameworks ×1
gradle ×1
gridview ×1
hyperlink ×1
io ×1
kotlin ×1
macos ×1
nested-class ×1
swagger ×1
swagger-ui ×1
swashbuckle ×1
vb.net ×1
windows-xp ×1