///<summary> ///For a given neural network with one output and a list of files that should be given ///either an output of 1 (goodFiles) or 0 (badFiles), and prints bad/uncertain ones ///</summary> private double trainingError(net netIn, List <string> goodFiles, List <string> badFiles) { //count how many the net get right, wrong, or uncertain //print the wrong and uncertain ones double error = 0; int right = 0; int uncertain = 0; int wrong = 0; //All the files that should output 1 for (int i = 0; i < goodFiles.Count; i++) { Vector <double> input = fileToInput(goodFiles[i]); Vector <double> output = Vector <double> .Build.Dense(1); output[0] = 1; double result = netIn.forward(input)[0]; if (result > 0.9) { right += 1; } else if (result > 0.1) { uncertain += 1; System.Diagnostics.Debug.WriteLine(result.ToString() + ", " + goodFiles[i]); } else { wrong += 1; System.Diagnostics.Debug.WriteLine(result.ToString() + ", " + goodFiles[i]); } error += netIn.error(input, output); } //all the files that should output 0 for (int i = 0; i < badFiles.Count; i++) { Vector <double> input = fileToInput(badFiles[i]); Vector <double> output = Vector <double> .Build.Dense(1); output[0] = 0; double result = netIn.forward(input)[0]; if (result < 0.1) { right += 1; } else if (result < 0.9) { uncertain += 1; System.Diagnostics.Debug.WriteLine(result.ToString() + ", " + badFiles[i]); } else { wrong += 1; System.Diagnostics.Debug.WriteLine(result.ToString() + ", " + badFiles[i]); } error += netIn.error(input, output); } System.Diagnostics.Debug.WriteLine(right.ToString() + ", " + uncertain.ToString() + ", " + wrong.ToString()); return(error / (goodFiles.Count + badFiles.Count)); }
private void GetEventsCompleted(object sender, net.cloudapp.geteventinfo.getAllEventsCompletedEventArgs e) { allEvents = new List<net.cloudapp.geteventinfo.Eventas>(); allEvents = e.Result.ToList(); foreach (net.cloudapp.geteventinfo.Eventas event1 in allEvents) { addEvent(event1); } }
private void addEvent(net.cloudapp.geteventinfo.Eventas event1) { MarkerOptions marker = new MarkerOptions(); marker.SetPosition(new LatLng(event1.latitude, event1.longitude)); marker.SetTitle(event1.eventname); marker.SetSnippet(event1.description); marker.SetIcon(BitmapDescriptorFactory.FromAsset("f.png")); gMap.AddMarker(marker); }
public override void alertOfManualUpdate(net.mcforge.system.updater.Updatable u) { DialogResult answer; using (ManualUpdateReady mur = new Dialogs.ManualUpdateReady(u, getServer().getUpdateService())) { answer = mur.ShowDialog(); } if (answer == DialogResult.No) getServer().getUpdateService().ignoreUpdate(u); }
public void setInfo(net.mcforge.iomodel.Player player) { this.grpInfo.Text = player.getGroup().name; this.txtTitle.Text = player.getPrefix(); if (txtTitle.Text.StartsWith("&")) txtTitle.Text = txtTitle.Text.Substring(2); this.txtMap.Text = player.getLevel().name; this.txtIp.Text = player.getIP(); this.txtName.Text = player.getName(); this.txtStatus.Text = "Online"; //lolwut ? }
/// <summary> /// Get the current host language from the Saxon context /// </summary> public static string hostLanguage(net.sf.saxon.expr.XPathContext context) { int lang = context.getController().getExecutable().getHostLanguage(); if (lang == net.sf.saxon.Configuration.XQUERY) { return "XQuery"; } else if (lang == net.sf.saxon.Configuration.XSLT) { return "XSLT"; } else if (lang == net.sf.saxon.Configuration.XPATH) { return "XPath"; } else { return "unknown"; } }
public IList<Schema> GetSchemas(net.datacowboy.SqlServerDatabaseDocumentationGenerator.Model.Database parent) { //get schemas List<Schema> schemaList = this.queryForSchemas(); //get tables for each schema if (schemaList != null && schemaList.Count > 0) { var tableInspector = new TableInspector(this.peta); var viewInspector = new ViewInspector(this.peta); var sprocInspector = new StoredProcedureInspector(this.peta); var scalarUdfInspector = new ScalarFunctionInspector(this.peta); var tableUdfInspector = new TableFunctionInspector(this.peta); Schema schema = null; for (int i = 0; i < schemaList.Count; i++) { schema = schemaList[i]; schema.Tables = tableInspector.GetTables(schema); schema.Views = viewInspector.GetViews(schema); schema.StoredProcedures = sprocInspector.GetStoredProcedures(schema); schema.ScalarFunctions = scalarUdfInspector.GetScalarFunctions(schema); schema.TableFunctions = tableUdfInspector.GetTableFunctions(schema); schema.Parent = parent; } } return schemaList; }
public void ReadJsFile(string in_filename) { IronJS.Hosting.Context ctx = IronJS.Hosting.Context.Create(); // set up 'puts' function // Action<object> emit = ( obj ) => { Console.WriteLine( JsTypeConverter.ToString( obj ) ); }; var emit = IronJS.Api.HostFunction.create <Action <IronJS.Box> >(ctx.Environment, (obj) => { Console.WriteLine(IronJS.Api.TypeConverter.toString(obj)); }); ctx.PutGlobal("puts", emit); // Forms the `net" namespace net netObj = new net(ctx.Environment); ctx.PutGlobal("net", netObj); // Forms the `http" namespace /* * http httpObj = new http( ctx.Environment ); * ctx.PutGlobal( "http", httpObj ); */ ctx.ExecuteFile(in_filename); }
public void ReadJsFile(string in_filename) { var context = Context.Create(); var astBuilder = new AstGenerator(); var etGenerator = new EtGenerator(); var astNodes = astBuilder.Build(in_filename, Encoding.UTF8); Action <Scope> compiled = etGenerator.Build(astNodes, context); var globals = Scope.CreateGlobal(context); context.SetupGlobals(globals); // set up 'puts' function Action <object> emit = (obj) => { Console.WriteLine(JsTypeConverter.ToString(obj)); }; globals.Global("puts", emit); // Forms the `net" namespace net netObj = new net(context); globals.Global("net", netObj); compiled(globals); }
// Generating method code for callFunction public virtual object CallFunction(NHtmlUnit.Html.HtmlPage htmlPage, net.sourceforge.htmlunit.corejs.javascript.Function function, net.sourceforge.htmlunit.corejs.javascript.Scriptable scope, net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObject, System.Object[] args) { return WObj.callFunction((com.gargoylesoftware.htmlunit.html.HtmlPage)htmlPage.WrappedObject, function, scope, thisObject, args); }
// Generating method code for jsConstructor public virtual void JsConstructor(string type, net.sourceforge.htmlunit.corejs.javascript.ScriptableObject details) { WObj.jsConstructor(type, details); }
public screenshotDetector() { InitializeComponent(); System.Diagnostics.Debug.Write(File.Exists("../../../../eu4ScreenshotDetector.net")); eu4detector = new net("../../../../eu4ScreenshotDetector.net"); }
// Generating method code for compile public virtual net.sourceforge.htmlunit.corejs.javascript.Script Compile(NHtmlUnit.InteractivePage owningPage, net.sourceforge.htmlunit.corejs.javascript.Scriptable scope, string sourceCode, string sourceName, int startLine) { return WObj.compile((com.gargoylesoftware.htmlunit.InteractivePage)owningPage.WrappedObject, scope, sourceCode, sourceName, startLine); }
// Generating method code for call public virtual object Call(net.sourceforge.htmlunit.corejs.javascript.Context cx, net.sourceforge.htmlunit.corejs.javascript.Scriptable scope, net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj, System.Object[] args) { var arg = WObj.call(cx, scope, thisObj, args); return ObjectWrapper.CreateWrapper<object>(arg); }
// Generating method code for detachEvent public virtual void DetachEvent(string type, net.sourceforge.htmlunit.corejs.javascript.Function listener) { WObj.detachEvent(type, listener); }
// Generating method code for removeEventListener public virtual void RemoveEventListener(string type, net.sourceforge.htmlunit.corejs.javascript.Function listener, bool useCapture) { WObj.removeEventListener(type, listener, useCapture); }
// Generating method code for setOnreadystatechange public virtual void SetOnreadystatechange(net.sourceforge.htmlunit.corejs.javascript.Function stateChangeHandler) { WObj.setOnreadystatechange(stateChangeHandler); }
// Generating method code for getCurrentPosition public virtual void GetCurrentPosition(net.sourceforge.htmlunit.corejs.javascript.Function successCallback, object errorCallback, object options) { WObj.getCurrentPosition(successCallback, errorCallback, options); }
// Generating method code for watchPosition public virtual int WatchPosition(net.sourceforge.htmlunit.corejs.javascript.Function successCallback, object errorCallback, object options) { return WObj.watchPosition(successCallback, errorCallback, options); }
public FrmObjectsWithoutDescription(net.datacowboy.SqlServerDatabaseDocumentationGenerator.Model.Database database) { InitializeComponent(); this.database = database; }
// Generating method code for setEventHandler public virtual void SetEventHandler(string eventName, net.sourceforge.htmlunit.corejs.javascript.Function eventHandler) { WObj.setEventHandler(eventName, eventHandler); }
/// <summary> /// Check the type of signature and use the publicKeyDer to verify the /// signedBlob using the appropriate signature algorithm. /// </summary> /// /// <param name="signature"></param> /// <param name="signedBlob">the SignedBlob with the signed portion to verify.</param> /// <param name="publicKeyDer"></param> /// <returns>True if the signature is verified, false if failed.</returns> /// <exception cref="System.Security.SecurityException">if the signature type is not recognized or ifpublicKeyDer can't be decoded.</exception> protected internal static bool verifySignature( net.named_data.jndn.Signature signature, SignedBlob signedBlob, Blob publicKeyDer) { if (signature is Sha256WithRsaSignature) { if (publicKeyDer.isNull()) return false; return verifySha256WithRsaSignature(signature.getSignature(), signedBlob, publicKeyDer); } else if (signature is Sha256WithEcdsaSignature) { if (publicKeyDer.isNull()) return false; return verifySha256WithEcdsaSignature(signature.getSignature(), signedBlob, publicKeyDer); } else if (signature is DigestSha256Signature) return verifyDigestSha256Signature(signature.getSignature(), signedBlob); else // We don't expect this to happen. throw new SecurityException( "PolicyManager.verify: Signature type is unknown"); }
public static string DotNetFramework(in string version = "4.7.2") => Concat(net, version.Replace(dot, Empty));
// Generating method code for startDownload public virtual void StartDownload(string uri, net.sourceforge.htmlunit.corejs.javascript.Function callback) { WObj.startDownload(uri, callback); }
public StaticNodeList(java.util.List elements, net.sourceforge.htmlunit.corejs.javascript.ScriptableObject parentScope) : this(new com.gargoylesoftware.htmlunit.javascript.host.StaticNodeList(elements, parentScope)) { }
///<summary> ///Train a neural network on a bunch of images to distinguish between two categories of images ///(currently EU4 screenshots versus everything else, as that's what I had images of available) ///with a random selection of images as testing images. The network doesn't train with these, and so ///they provide a good measure of the accuracy of the network ///</summary> public void pictureNetTrain() { int testCountPerCat = 30; Random rnd = new Random(); //Grab all the good (output = 1) and bad (output = 0) images and put them in a list in random order List <string> goodFilesIn = System.IO.Directory.GetFiles(goodDirectory).ToList(); List <string> goodFiles = new List <string>(goodFilesIn.OrderBy(x => rnd.Next()).ToArray()); //The last testCountPerCat images in the goodFiles list will be used as test images; not trained against int goodFileCount = goodFiles.Count() - testCountPerCat; List <string> goodFilesTrain = goodFiles.GetRange(0, goodFileCount); List <string> goodFilesTest = goodFiles.GetRange(goodFileCount, testCountPerCat); List <string> badFilesIn = System.IO.Directory.GetFiles(badDirectory).ToList(); List <string> badFiles = new List <string>(badFilesIn.OrderBy(x => rnd.Next()).ToArray()); //same idea as for good files int badFileCount = badFiles.Count() - testCountPerCat; List <string> badFilesTrain = badFiles.GetRange(0, badFileCount); List <string> badFilesTest = badFiles.GetRange(badFileCount, testCountPerCat); //Make a list of the inputs and outputs, excluding the testing images List <Vector <double> > inputs = new List <Vector <double> >(); List <Vector <double> > outputs = new List <Vector <double> >(); for (int j = 0; j < goodFileCount; j++) //only goes up to goodFileCount - therefore excludes test images { string file; Vector <double> output = Vector <double> .Build.Dense(1); file = goodFiles[j]; output[0] = 1; Vector <double> input = fileToInput(file); inputs.Add(input); outputs.Add(output); } for (int j = 0; j < badFileCount; j++) { string file; Vector <double> output = Vector <double> .Build.Dense(1); file = badFiles[j]; output[0] = 0; Vector <double> input = fileToInput(file); inputs.Add(input); outputs.Add(output); } //a list of locations in the input/output lists, will be randomized to draw from to train int[] intRange = Enumerable.Range(0, goodFileCount + badFileCount).ToArray(); //Load in an old net or create a new one net net; if (loadNet) { net = new net(loadLoc); } else { net = new net(4 * pictureWidth * pictureHeight, 1, 2, 30); } //We'll only save the net to file when it's error on the test images decreases double priorError = 1; int trainNum = 0; //Until the user closes the training thing while (true) { //randomly grab 10 inputs and their corresponding outputs int[] imageID = intRange.OrderBy(x => rnd.Next()).ToArray(); List <Vector <double> > inputsForRound = new List <Vector <double> >(); List <Vector <double> > outputsForRound = new List <Vector <double> >(); for (int j = 0; j < 10; j++) { inputsForRound.Add(inputs[imageID[j]]); outputsForRound.Add(outputs[imageID[j]]); } //train the net with the selected inputs and outputs net.train(inputsForRound, outputsForRound, 1); //every once in a while, check how we're doing, record it on the graph, and save if we're improving if (trainNum % 100 == 0) { double error = trainingError(net, goodFilesTest, badFilesTest); addPoint(trainNum, error, 1); addPoint(trainNum, net.error(inputsForRound, outputsForRound), 0); if (error < priorError) { priorError = error; net.serialize(saveLoc); } System.Diagnostics.Debug.WriteLine(error); } trainNum++; } }
// Generating method code for attachEvent public virtual bool AttachEvent(string type, net.sourceforge.htmlunit.corejs.javascript.Function listener) { return WObj.attachEvent(type, listener); }
// Generating method code for call public virtual object Call(net.sourceforge.htmlunit.corejs.javascript.Context cx, net.sourceforge.htmlunit.corejs.javascript.Scriptable scope, net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObj, System.Object[] args) { return WObj.call(cx, scope, thisObj, args); }
// Generating method code for construct public virtual net.sourceforge.htmlunit.corejs.javascript.Scriptable Construct(net.sourceforge.htmlunit.corejs.javascript.Context cx, net.sourceforge.htmlunit.corejs.javascript.Scriptable scope, System.Object[] args) { return WObj.construct(cx, scope, args); }
// Generating method code for execute public virtual object Execute(NHtmlUnit.Html.HtmlPage htmlPage, net.sourceforge.htmlunit.corejs.javascript.Script script) { return WObj.execute((com.gargoylesoftware.htmlunit.html.HtmlPage)htmlPage.WrappedObject, script); }
// Generating method code for set public virtual void Set(net.sourceforge.htmlunit.corejs.javascript.ScriptableObject sourceArray, int offset) { WObj.set(sourceArray, offset); }
// Generating method code for callFunction public virtual object CallFunction(NHtmlUnit.Html.HtmlPage htmlPage, net.sourceforge.htmlunit.corejs.javascript.Function javaScriptFunction, net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObject, System.Object[] args, NHtmlUnit.Html.DomNode htmlElement) { return WObj.callFunction((com.gargoylesoftware.htmlunit.html.HtmlPage)htmlPage.WrappedObject, javaScriptFunction, thisObject, args, (com.gargoylesoftware.htmlunit.html.DomNode)htmlElement.WrappedObject); }
// Generating method code for executeJavaScriptFunctionIfPossible public virtual NHtmlUnit.ScriptResult ExecuteJavaScriptFunctionIfPossible(net.sourceforge.htmlunit.corejs.javascript.Function function, net.sourceforge.htmlunit.corejs.javascript.Scriptable thisObject, System.Object[] args, NHtmlUnit.Html.DomNode htmlElementScope) { return ObjectWrapper.CreateWrapper<NHtmlUnit.ScriptResult>(WObj.executeJavaScriptFunctionIfPossible(function, thisObject, args, (com.gargoylesoftware.htmlunit.html.DomNode)htmlElementScope.WrappedObject)); }
// Generating method code for execute public virtual object Execute(NHtmlUnit.InteractivePage page, net.sourceforge.htmlunit.corejs.javascript.Scriptable scope, net.sourceforge.htmlunit.corejs.javascript.Script script) { var arg = WObj.execute((com.gargoylesoftware.htmlunit.InteractivePage)page.WrappedObject, scope, script); return ObjectWrapper.CreateWrapper<object>(arg); }
public net.sf.saxon.om.SequenceIterator resolve(string href, string baseStr, net.sf.saxon.expr.XPathContext context) { try { List<Uri> docs; if (href == null) { docs = (List<Uri>)collections[new Uri("http://www.saxonica.com/defaultCollection")]; } else { XmlUrlResolver res = new XmlUrlResolver(); Uri abs= res.ResolveUri(new Uri(baseStr), href); docs = (List<Uri>)collections[abs]; } if (docs == null) { return net.sf.saxon.tree.iter.EmptyIterator.getInstance(); } else { java.util.List list = new java.util.ArrayList(); foreach(Uri uri in docs){ list.add(new net.sf.saxon.value.AnyURIValue(uri.ToString())); } return new net.sf.saxon.tree.iter.ListIterator(list); } } catch (java.net.URISyntaxException e) { Console.WriteLine("** Invalid Uri: " + e.Message); return net.sf.saxon.tree.iter.EmptyIterator.getInstance(); } }
public Namespace(net.sourceforge.htmlunit.corejs.javascript.ScriptableObject parentScope, string name, string urn) : this(new com.gargoylesoftware.htmlunit.javascript.host.Namespace(parentScope, name, urn)) { }