private static bool RemoveInheritanceBits(AceFlags existing, AceFlags remove, bool isDS, out AceFlags result, out bool total) { result = AceFlags.None; total = false; AF af = AFFromAceFlags(existing, isDS); AF af2 = AFFromAceFlags(remove, isDS); PM pm = AFtoPM[(int)af]; PM pm2 = AFtoPM[(int)af2]; if ((pm == PM.GO) || (pm2 == PM.GO)) { return(false); } PM pm3 = pm & ~pm2; if (pm3 == 0) { total = true; return(true); } AF af3 = PMtoAF[(int)pm3]; if (af3 == AF.Invalid) { return(false); } result = AceFlagsFromAF(af3, isDS); return(true); }
public ChooseType(int id_rodzaj, int Mode, string ID, Form mdiParent) : this(id_rodzaj, Mode, mdiParent) { SqlCommand Command = new SqlCommand(); Command.CommandText = "SELECT LTRIM(RTRIM(rodzaj_zas)) AS rodzaj_zas FROM artykuly WHERE kod = @kod;"; Command.Parameters.AddWithValue("@kod", ID); DataTable Dt = CommonFunctions.ReadData(Command, ref Settings.Connection); if (Dt.Rows.Count > 0) { ArtykulyForm AF; if (Dt.Rows[0]["rodzaj_zas"].ToString().ToLower() == "c") { AF = new ArtykulyForm(ArtykulyForm.KindEnum.Magazine, ArtykulyForm.ModeEnum.ReadOnlyCatalog, ID); } else { AF = new ArtykulyForm(ArtykulyForm.KindEnum.Book, ArtykulyForm.ModeEnum.ReadOnlyCatalog, ID); } AF.ShowDialog(); } }
private void generateButt_Click(object sender, RoutedEventArgs e) { long p, g; getRandPG(out p, out g); PField.Text = p.ToString(); GField.Text = g.ToString(); alise = new DH_Exschange(p, g); bob = new DH_Exschange(p, g); ASKey.Text = alise.getSecretKey().ToString(); BSKey.Text = bob.getSecretKey().ToString(); long AM, BM; AM = alise.getMiddleKey(); BM = bob.getMiddleKey(); AMKey.Text = AM.ToString(); BMKey.Text = BM.ToString(); long AF, BF; AF = alise.getFinKey(BM); BF = bob.getFinKey(AM); AFKey.Text = AF.ToString(); BFKey.Text = BF.ToString(); }
public void TestInsert() { arango.CreateCollection("stuff", CollectionType.Document); JsonObject obj = new JsonObject() .Add("_key", "key") .Add("foo", 42); Assert.AreEqual( "[42]".Replace("'", "\""), executor.ExecuteToArray( new AqlQuery() .Insert(obj).Into("stuff") .Return((NEW) => NEW["foo"]) ).ToString() ); Assert.AreEqual( "[42]".Replace("'", "\""), executor.ExecuteToArray( new AqlQuery() .Return(() => AF.Document("stuff", "key")["foo"]) ).ToString() ); }
public void Activation(AF af) { for (int j = 0; j < yLength; j++) { for (int i = 0; i < xLength; i++) { matrix[i, j] = af(matrix[i, j], false); } } }
public void Derivatives(AF af) { for (int j = 0; j < yLength; j++) { for (int i = 0; i < xLength; i++) { matrix[i, j] = af(matrix[i, j], true); } } }
public void ItParsesArangoFunctions() { Assert.AreEqual( "DOCUMENT(\"users\", \"123\")", parser.Parse(() => AF.Document("users", "123")).ToAql() ); Assert.AreEqual( "DOCUMENT(\"users\", x.foo)", parser.Parse((x) => AF.Document("users", x["foo"])).ToAql() ); }
/// <summary> /// 构造神经层 /// </summary> /// <param name="inputsize">输入数据大小</param> /// <param name="outputsize">输出数据大小</param> /// <param name="Name">神经层名字</param> /// <param name="af">激励函数</param> /// <param name="WeightRa">是否权重随机</param> public Denes(int inputsize, int outputsize, string Name, AF af = null, bool WeightRa = true) : base(Name, af) { if (WeightRa) { Weight = matrix.Function.Random(inputsize, outputsize, -1, 1); } else { Weight = new Matrix(inputsize, outputsize, 2); } Bias = new Matrix(1, outputsize, 0); }
public void ItEvaluatesArangoFunctions() { // overwrite DOCUMENT function implementation arango.FunctionRepository .Register("DOCUMENT", (args) => new JsonObject() .Add("collection", args[0]) .Add("key", args[1]) ); Assert.AreEqual( "{'collection':'foo','key':'bar'}".Replace("'", "\""), parser .Parse(() => AF.Document("foo", "bar")) .Evaluate(executor, frame) .ToString() ); }
/// <summary> /// Find the document of an entity by entity id /// </summary> internal JsonObject FindDocument(string entityId) { try { var id = DocumentId.Parse(entityId); id.ThrowIfHasNull(); return(arango.ExecuteAqlQuery(new AqlQuery() .Return(() => AF.Document(id.Collection, id.Key)) ).First().AsJsonObject); } catch (ArangoException e) when(e.ErrorNumber == 1203) { // collection or view not found return(null); } }
public JsonObject Load(string sessionId) { try { JsonObject document = arango.ExecuteAqlQuery( new AqlQuery() .Return(() => AF.Document(CollectionName, sessionId)) ).First().AsJsonObject; return(document?["sessionData"].AsJsonObject ?? new JsonObject()); } catch (ArangoException e) when(e.ErrorNumber == 1203) { // collection or view not found return(new JsonObject()); } }
// Use this for initialization void Start() { A a0 = new A(); a0.rigidbody_.transform_.position_ = Vector3.forward; A a1 = new A(); a1.rigidbody_.transform_.position_ = Vector3.back; var a0f = new AF(a0.m); a0f(); var a1f = new AF(a1.m); a1f(); a0.rigidbody_.transform_.position_ = Vector3.left; a0f(); a1.rigidbody_.transform_.position_ = Vector3.right; a1f(); }
public void ItParsesStringConcatenation() { Assert.AreEqual( "CONCAT(x, \"bar\")", parser.Parse((x) => x + "bar").ToAql() ); Assert.AreEqual( "CONCAT(CONCAT(\"foo\", x), \"baz\")", parser.Parse((x) => "foo" + x + "baz").ToAql() ); Assert.AreEqual( "CONCAT(\"foo\", CONCAT(5, x))", parser.Parse((x) => "foo" + (5 + (string)x)).ToAql() ); Assert.AreEqual( "CONCAT(\"foo\", 5, x)", parser.Parse((x) => AF.Concat("foo", 5, x)).ToAql() ); }
private static AceFlags AceFlagsFromAF(AF af, bool isDS) { AceFlags none = AceFlags.None; if ((af & AF.CI) != 0) { none = (AceFlags)((byte)(none | AceFlags.ContainerInherit)); } if (!isDS && ((af & AF.OI) != 0)) { none = (AceFlags)((byte)(none | (AceFlags.None | AceFlags.ObjectInherit))); } if ((af & AF.IO) != 0) { none = (AceFlags)((byte)(none | AceFlags.InheritOnly)); } if ((af & AF.Invalid) != 0) { none = (AceFlags)((byte)(none | (AceFlags.None | AceFlags.NoPropagateInherit))); } return(none); }
private static AF AFFromAceFlags(AceFlags aceFlags, bool isDS) { AF af = 0; if (((byte)(aceFlags & AceFlags.ContainerInherit)) != 0) { af |= AF.CI; } if (!isDS && (((byte)(aceFlags & (AceFlags.None | AceFlags.ObjectInherit))) != 0)) { af |= AF.OI; } if (((byte)(aceFlags & AceFlags.InheritOnly)) != 0) { af |= AF.IO; } if (((byte)(aceFlags & (AceFlags.None | AceFlags.NoPropagateInherit))) != 0) { af |= AF.Invalid; } return(af); }
private static bool MergeInheritanceBits(AceFlags left, AceFlags right, bool isDS, out AceFlags result) { result = AceFlags.None; AF af = AFFromAceFlags(left, isDS); AF af2 = AFFromAceFlags(right, isDS); PM pm = AFtoPM[(int)af]; PM pm2 = AFtoPM[(int)af2]; if ((pm == PM.GO) || (pm2 == PM.GO)) { return(false); } PM pm3 = pm | pm2; AF af3 = PMtoAF[(int)pm3]; if (af3 == AF.Invalid) { return(false); } result = AceFlagsFromAF(af3, isDS); return(true); }
public CoreServices(IPoderosaWorld world) { _world = world; _adapterFactory = new AF(_world, this); _world.AdapterManager.RegisterFactory(_adapterFactory); }
/// <summary> /// Iterate over a collection /// </summary> /// <param name="collectionName">Collection name</param> public AqlForOperationBuilder In(string collectionName) => In(() => AF.Collection(collectionName));
// Push and Pop private void POPAF() { AF = Pop().AND(0xFFF0).OR(AF.AND(0x000F)); } // PopAF retains bottom 4 of F
public ActionResult Create(AF tbl_req_af) { if (ModelState.IsValid) { using (SqlConnection con = new SqlConnection(connectionString)) { SqlCommand cmd = new SqlCommand("AddReqAF", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Allow_STATUS", tbl_req_af.ALLOW_STATUS); cmd.Parameters.AddWithValue("@USER_NO", tbl_req_af.USER_NO); cmd.Parameters.AddWithValue("@AF_Site", tbl_req_af.AF_SITE); cmd.Parameters.AddWithValue("@AF_Folder", tbl_req_af.AF_FOLDER); cmd.Parameters.AddWithValue("@AF_Status", tbl_req_af.AF_STATUS); cmd.Parameters.AddWithValue("@REQ_STATUS", tbl_req_af.REQ_STATUS); cmd.Parameters.AddWithValue("@AF_Note", tbl_req_af.AF_NOTE); cmd.Parameters.AddWithValue("@AF_REQUESTER", tbl_req_af.AF_REQUESTER); cmd.Parameters.AddWithValue("@AF_DATE", tbl_req_af.AF_DATE); cmd.Parameters.Add("@AF_CODE", SqlDbType.NVarChar, 20); cmd.Parameters["@AF_CODE"].Direction = ParameterDirection.Output; TempData["msg"] = "<script>alert('Saved succesfully');</script>"; con.Open(); cmd.ExecuteNonQuery(); con.Close(); ViewBag.EmpCount = cmd.Parameters["@AF_CODE"].Value.ToString(); var email = Session["USER_EMAIL"].ToString(); var approve = Session["USER_EMAIL_APPROVE"].ToString(); MailMessage mm = new MailMessage(); mm.To.Add(approve); mm.From = new MailAddress(email); mm.Subject = "แบบฟอร์มการขอและยกเลิกสิทธิใช้ระบบ ALFRESCO"; mm.IsBodyHtml = true; mm.Body = GetFormattedMessageHTML(); SmtpClient smtp = new SmtpClient(); smtp.Host = "mail01.pranda.co.th"; smtp.Port = 25; smtp.EnableSsl = false; smtp.UseDefaultCredentials = true; smtp.Credentials = new System.Net.NetworkCredential(); System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate(object s, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors) { return(true); }; smtp.Send(mm); return(RedirectToAction("Index")); } } ViewData["ALLOW_STATUS"] = new SelectList(db.tbl_req_allow_status, "ALLOW_STATUS", "ALLOW_DESC", tbl_req_af.ALLOW_STATUS); ViewData["AF_STATUS"] = new SelectList(db.tbl_req_af_status, "AF_STATUS", "AF_STATUS_NAME", tbl_req_af.AF_STATUS); return(View(tbl_req_af)); }
public Layer(string Name, AF af) { this.Name = Name; this.ActivationFunction = af; }
private static AF[] CreatePMtoAFConversionMatrix() { var pmToAf = new AF[32]; for ( int i = 0; i < pmToAf.Length; i++ ) { pmToAf[i] = AF.Invalid; } // // This table is a reverse lookup table of the AFtoPM table // Given how inheritance is applied to child objects and containers, // it helps figure out whether that pattern is expressible using // the four ACE inheritance bits // pmToAf[( int )( PM.F | 0 | 0 | 0 | 0 )] = 0 | 0 | 0 | 0 ; pmToAf[( int )( PM.F | 0 | PM.CO | 0 | PM.GO )] = 0 | AF.OI | 0 | 0 ; pmToAf[( int )( PM.F | 0 | PM.CO | 0 | 0 )] = 0 | AF.OI | 0 | AF.NP ; pmToAf[( int )( 0 | 0 | PM.CO | 0 | PM.GO )] = 0 | AF.OI | AF.IO | 0 ; pmToAf[( int )( 0 | 0 | PM.CO | 0 | 0 )] = 0 | AF.OI | AF.IO | AF.NP ; pmToAf[( int )( PM.F | PM.CF | 0 | PM.GF | 0 )] = AF.CI | 0 | 0 | 0 ; pmToAf[( int )( PM.F | PM.CF | 0 | 0 | 0 )] = AF.CI | 0 | 0 | AF.NP ; pmToAf[( int )( 0 | PM.CF | 0 | PM.GF | 0 )] = AF.CI | 0 | AF.IO | 0 ; pmToAf[( int )( 0 | PM.CF | 0 | 0 | 0 )] = AF.CI | 0 | AF.IO | AF.NP ; pmToAf[( int )( PM.F | PM.CF | PM.CO | PM.GF | PM.GO )] = AF.CI | AF.OI | 0 | 0 ; pmToAf[( int )( PM.F | PM.CF | PM.CO | 0 | 0 )] = AF.CI | AF.OI | 0 | AF.NP ; pmToAf[( int )( 0 | PM.CF | PM.CO | PM.GF | PM.GO )] = AF.CI | AF.OI | AF.IO | 0 ; pmToAf[( int )( 0 | PM.CF | PM.CO | 0 | 0 )] = AF.CI | AF.OI | AF.IO | AF.NP ; return pmToAf; }
// // Converts lookup table representation of AceFlags into the "public" form // private static AceFlags AceFlagsFromAF( AF af, bool isDS ) { AceFlags aceFlags = 0; if (( af & AF.CI ) != 0 ) { aceFlags |= AceFlags.ContainerInherit; } // // ObjectInherit applies only to regular aces not object aces // so it can be ignored in the object aces case // if (( !isDS ) && (( af & AF.OI ) != 0 )) { aceFlags |= AceFlags.ObjectInherit; } if (( af & AF.IO ) != 0 ) { aceFlags |= AceFlags.InheritOnly; } if (( af & AF.NP ) != 0 ) { aceFlags |= AceFlags.NoPropagateInherit; } return aceFlags; }
public ActionResult Create(AF tbl_Req_AF) { if (ModelState.IsValid) { using (SqlConnection con = new SqlConnection(connectionString)) { SqlCommand cmd = new SqlCommand("AutoAF", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Allow_STATUS", tbl_Req_AF.Allow_STATUS); cmd.Parameters.AddWithValue("@USER_NO", tbl_Req_AF.USER_NO); cmd.Parameters.AddWithValue("@AF_Site", tbl_Req_AF.AF_Site); cmd.Parameters.AddWithValue("@AF_Folder", tbl_Req_AF.AF_Folder); cmd.Parameters.AddWithValue("@AF_STATUS_ID", tbl_Req_AF.AF_STATUS_ID); cmd.Parameters.AddWithValue("@REQ_STATUS", tbl_Req_AF.REQ_STATUS); cmd.Parameters.AddWithValue("@AF_Note", tbl_Req_AF.AF_Note); cmd.Parameters.AddWithValue("@AF_REQUESTER", tbl_Req_AF.AF_REQUESTER); cmd.Parameters.AddWithValue("@AF_DATE", tbl_Req_AF.AF_DATE); cmd.Parameters.AddWithValue("@AF_APPROVER ", tbl_Req_AF.AF_APPROVER); cmd.Parameters.AddWithValue("@Date_APPROVER ", tbl_Req_AF.Date_APPROVER); cmd.Parameters.Add("@Req_AF_CODE", SqlDbType.NVarChar, 20); cmd.Parameters["@Req_AF_CODE"].Direction = ParameterDirection.Output; con.Open(); cmd.ExecuteNonQuery(); con.Close(); ViewBag.EmpCount = cmd.Parameters["@Req_AF_CODE"].Value.ToString(); var email = Session["USER_EMAIL"].ToString(); MailMessage mm = new MailMessage(); mm.To.Add("*****@*****.**"); mm.From = new MailAddress(email); mm.Subject = "แบบฟอร์มการขอสิทธิ ALFRESCO"; mm.IsBodyHtml = true; mm.Body = GetFormattedMessageHTML(); SmtpClient smtp = new SmtpClient(); smtp.Host = "mail01.pranda.co.th"; smtp.Port = 25; smtp.EnableSsl = false; smtp.UseDefaultCredentials = true; smtp.Credentials = new System.Net.NetworkCredential(); System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate(object s, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors) { return(true); }; smtp.Send(mm); return(RedirectToAction("Index")); } } return(View(tbl_Req_AF)); }
private static AceFlags AceFlagsFromAF(AF af, bool isDS) { AceFlags none = AceFlags.None; if ((af & AF.CI) != 0) { none = (AceFlags) ((byte) (none | AceFlags.ContainerInherit)); } if (!isDS && ((af & AF.OI) != 0)) { none = (AceFlags) ((byte) (none | (AceFlags.None | AceFlags.ObjectInherit))); } if ((af & AF.IO) != 0) { none = (AceFlags) ((byte) (none | AceFlags.InheritOnly)); } if ((af & AF.Invalid) != 0) { none = (AceFlags) ((byte) (none | (AceFlags.None | AceFlags.NoPropagateInherit))); } return none; }