var options = new StaticFileOptions
{
OnPrepareResponse = (context) =>
{
var path = context.File.Name;
if (path.IndexOf("editor.html") >= 0)
{
if ((context.Context.User?.Identity?.IsAuthenticated ?? false) == false)
{
// respond HTTP 401 Unauthorized.
context.Context.Response.StatusCode = (int)HttpStatusCode.Unauthorized;
context.Context.Response.ContentLength = 0;
context.Context.Response.Body = Stream.Null;
context.Context.Response.Redirect("login.html");
}
}
},
};
app.UseStaticFiles(options);
public static void SetupFolderPermission(string folderPath, string account,
FileSystemRights right, AccessControlType controlType)
{
DirectoryInfo directory = new DirectoryInfo(folderPath);
DirectorySecurity security = directory.GetAccessControl();
security.AddAccessRule(new FileSystemAccessRule(account, right,
InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit,
PropagationFlags.None, controlType));
directory.SetAccessControl(security);
}
public static void MakeFolderList(string base_path, List<string> list, int current_level, int depth, int width)
{
list.Add(base_path);
if (current_level >= depth) return;
string parent_name;
if (Path.GetPathRoot(base_path).Equals(base_path))
{
parent_name = "folder";
}
else
{
parent_name = Path.GetFileName(base_path);
}
for (int i = 0; i < width; i++)
{
var path = Path.Combine(base_path, parent_name + "_" + (i + 1));
MakeFolderList(path, list, current_level + 1, depth, width);
}
}
<IPRRecord>
<Endpoints>
<d3p1:string>192.168.1.100:61812</d3p1:string>
<d3p1:string>192.168.1.100:61822</d3p1:string>
<d3p1:string>192.168.1.100:61833</d3p1:string>
<d3p1:string>192.168.1.100:61841</d3p1:string>
<d3p1:string>192.168.1.100:61850</d3p1:string>
</Endpoints>
<Transport>webapi</Transport>
<Key>exchange_name</Key>
<Title>MyService</Title>
<Version>1.0</Version>
</IPRRecord>
public bool Equals(BaseEntity other)
{
if ((object)this == (object)other)
return true;
if (this == null) // и так бывает
throw new NullReferenceException();
if (other == null)
return false;
if (ReferenceEquals(this, other))
return true;
if (this.GetType() != other.GetType())
return false;
return Id == other.Id;
}
public override bool Equals(object obj)
{
if (this == null)
throw new NullReferenceException();
return Equals(obj as BaseEntity);
}
public static bool operator ==(BaseEntity first, BaseEntity second) => Equals(first, second);
public static bool operator !=(BaseEntity first, BaseEntity second) => !Equals(first, second);
public class CoastModel : BaseEntity
{
public string AppointmentCoast { get; set; }
public double CurrencyUAH { get; set; } = 0;
public double CurrencyUSD { get; set; } = 0;
public double CourseOfExchange { get; set; } = 0;
public string CategoryId { get; set; }
public string CheckUrl { get; set; } = null;
public DateTime Date { get; set; }
public string AutorCoastID { get; set; }
public override bool Equals(object obj)
{
return this.Equals(obj as CoastModel);
}
public bool Equals(CoastModel other)
{
if (other == null) return false;
bool eq = base.Equals(other);
if (false == eq) return false;
eq &= this.CurrencyUAH == other.CurrencyUAH;
eq &= this.CurrencyUSD == other.CurrencyUSD;
eq &= this.CourseOfExchange == other.CourseOfExchange;
eq &= String.Compare(this.AppointmentCoast, other.AppointmentCoast, StringComparison.Ordinal) == 0;
eq &= String.Compare(this.CategoryId, other.CategoryId, StringComparison.Ordinal) == 0;
eq &= String.Compare(this.CheckUrl, other.CheckUrl, StringComparison.Ordinal) == 0;
eq &= String.Compare(this.AutorCoastID, other.AutorCoastID, StringComparison.Ordinal) == 0;
eq &= DateTime.Compare(this.Date, other.Date) == 0;
return eq;
}
}
conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
запустил юпитер и торч завелся.
Ностальгия аж по XP и его DLL Hell проснулась. Надеюсь когда нибудь и в никсах смогут работать с версионностью нормально)