• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Guide: Use the internals of OcBible!

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

MrSeanKon

Member
Joined
May 23, 2005
Location
See my profile....
Here at Aoaforums I created a thread.
I do not want to repeat the same posts.
Post here questions etc...
Don't ask me here what is OcBible here is its supported thread for Ocforums

The first edition of guides are available --> go to Aoaforums and download the zip file.
I will not post every time here "the new version is available etc" making unusual posts.
Thus check the Aoaforums thread to download any new editions of dlls.
When I have something important to say I will post here.

Good luck with programming! :)
 
Last edited:

MrSeanKon

Member
Joined
May 23, 2005
Location
See my profile....
Java# example
Although General CPU speed estimator performs fitting for five pairs someone may hate its interface.
Here is an example:

Code:
package Java_fit_example;

import System.Drawing.*;
import System.Collections.*;
import System.ComponentModel.*;
import System.Windows.Forms.*;
import System.Data.*;

public class Form1 extends System.Windows.Forms.Form
{
	private Approximation Fit;
	private System.Windows.Forms.Button button1;
	private System.ComponentModel.Container components = null;

	public Form1()
	{
		InitializeComponent();
		Fit=new Approximation();
	}

	protected void Dispose(boolean disposing)
	{
		if (disposing)
		{
			if (components != null)
			{
				components.Dispose();
			}
		}
		super.Dispose(disposing);
	}

	#region Windows Form Designer generated code
	private void InitializeComponent()
	{
		this.button1 = new System.Windows.Forms.Button();
		this.SuspendLayout();
		this.button1.set_FlatStyle(System.Windows.Forms.FlatStyle.System);
		this.button1.set_Location(new System.Drawing.Point(32, 24));
		this.button1.set_Name("button1");
		this.button1.set_TabIndex(0);
		this.button1.set_Text(" Estimate");
		this.button1.add_Click( new System.EventHandler(this.button1_Click));
		this.set_AutoScaleBaseSize(new System.Drawing.Size(5, 13));
		this.set_ClientSize(new System.Drawing.Size(144, 62));
		this.get_Controls().Add(this.button1);
		this.set_MaximizeBox(false);
		this.set_MinimizeBox(false);
		this.set_Name("Form1");
		this.set_ShowInTaskbar(false);
		this.set_StartPosition(System.Windows.Forms.FormStartPosition.CenterScreen);
		this.set_Text("Fit example");
		this.set_TopMost(true);
		this.ResumeLayout(false);
	}
	#endregion

	public static void main(String[] args) 
	{
		Application.EnableVisualStyles();
		Application.Run(new Form1());
	}

	private void button1_Click (Object sender, System.EventArgs e)
	{
		double msf1,msf2,msf3,msf4,volt1,volt2,volt3,volt4,input,output;

		msf1=2000;
		msf2=2050;
		msf3=2100;
		msf4=2150;
		volt1=1.5;
		volt2=1.55;
		volt3=1.65;
		volt4=1.8;
		input=1.9;

		double[] data = new double[5];       	// Let's construct the 
		double[] values = new double[5];     	// necessary arrays

		values[1]=msf1;
		values[2]=msf2;	
		values[3]=msf3;
		values[4]=msf4;
		data[1]=volt1;
		data[2]=volt2;	
		data[3]=volt3;
		data[4]=volt4;
		output=Fit.Logarithmic(data,values,4)[1]+Fit.Logarithmic(data,values,4)[2]*Math.log(input);
		if (output > 2200.2 && output < 2200.3)
			MessageBox.Show("Approximated value is 2200 MHz");  // Actual value is 2200.29.... MHz
	}
}

Just open Visual studio, copy and paste this code.
LOL I do not know Java :santa: but some commands are same with C#.
 

MrSeanKon

Member
Joined
May 23, 2005
Location
See my profile....
Solve example
Let's use the Cramer 3x3 subroutine:

Code:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace Cramer
{
	public class Form1 : System.Windows.Forms.Form
	{
		private System.ComponentModel.Container components = null;
		private Solve Linear_system;  // Add reference for Solve.dll

		public Form1()
		{
			InitializeComponent();
			Linear_system=new Solve();   // Class initialization
		}

		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		private void InitializeComponent()
		{
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(248, 190);
			this.Name = "Form1";
			this.Text = "Form1";
			this.Load += new System.EventHandler(this.Form1_Load);
		}
		#endregion

		
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
			Application.EnableVisualStyles();
		}

		private void Form1_Load(object sender, System.EventArgs e)
		{
			double[] solutions=new double[4];
			double[,] a=new double[4,5];       // Let's make a 3x3 linear system
 
			a[1,1]=1;		a[1,2]=22.5;		a[1,3]=71.25;		a[1,4]=-46.57;     
			a[2,1]=2.5;		a[2,2]=71.25;		a[2,3]=23.125;		a[2,4]=-141.075;        
			a[3,1]=71.25;		a[3,2]=23.125;		a[3,3]=958.3125;	a[3,4]=-487.4925;       
			solutions=Linear_system.Cramer_3x3(a,5);
			if (Linear_system.Cramer_solutions() != 0)
			{         
				for (int i=1; i<=3; i++)
					solutions[i]=Math.Round(solutions[i],5);
				MessageBox.Show("x1 = " + solutions[1].ToString() + "\nx2 = " + solutions[2].ToString() 
					+ "\nx3 = " + solutions[3].ToString(),"Solutions are");
			}
			else
				MessageBox.Show("No solution can be found!","Ill conditioned problem!",
					MessageBoxButtons.OK,MessageBoxIcon.Error);
			this.Close();
		}
	}
}

Double precision variables are used.
 
Last edited:

MrSeanKon

Member
Joined
May 23, 2005
Location
See my profile....
Windows commands

Code:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace System_commands
{
	public class Form1 : System.Windows.Forms.Form
	{
		private System.ComponentModel.Container components = null;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.Button button3;
		private API Win_calls;  // It uses API.dll 

		public Form1()
		{
			InitializeComponent();
			Win_calls=new API();
		}

		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		private void InitializeComponent()
		{
			this.button1 = new System.Windows.Forms.Button();
			this.button2 = new System.Windows.Forms.Button();
			this.button3 = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(88, 32);
			this.button1.Name = "button1";
			this.button1.TabIndex = 0;
			this.button1.Text = "Log off";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(88, 88);
			this.button2.Name = "button2";
			this.button2.TabIndex = 1;
			this.button2.Text = "Restart";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// button3
			// 
			this.button3.Location = new System.Drawing.Point(88, 152);
			this.button3.Name = "button3";
			this.button3.TabIndex = 2;
			this.button3.Text = "Shutdown";
			this.button3.Click += new System.EventHandler(this.button3_Click);
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(248, 214);
			this.Controls.Add(this.button3);
			this.Controls.Add(this.button2);
			this.Controls.Add(this.button1);
			this.Name = "Form1";
			this.Text = "Windows commander";
			this.Load += new System.EventHandler(this.Form1_Load);
			this.ResumeLayout(false);
		}
		#endregion

		[STAThread]
		static void Main() 
		{
			Application.EnableVisualStyles();
			Application.Run(new Form1());
		}
		// When form is loading
		private void Form1_Load(object sender, System.EventArgs e)
		{                        
			this.button1.FlatStyle=System.Windows.Forms.FlatStyle.System;  // You must change the style property
			this.button2.FlatStyle=System.Windows.Forms.FlatStyle.System;  // of boxes to enable the visual styles
			this.button3.FlatStyle=System.Windows.Forms.FlatStyle.System;  
		}
		// Implementation section
		private DialogResult result; // External variable used by next routines
		private void button1_Click(object sender, System.EventArgs e)
		{
			result=MessageBox.Show("Please close all open applications\nand save any changes...","You will log off!",
			MessageBoxButtons.OKCancel,MessageBoxIcon.Information,MessageBoxDefaultButton.Button2);
			if (result == DialogResult.OK)
				if (Win_calls.Log_off() == 0)
					MessageBox.Show("The process failed!","FAILURE!",MessageBoxButtons.OK,MessageBoxIcon.Error);			
		}
		// Restart routine
		private void button2_Click(object sender, System.EventArgs e)
		{
			result=MessageBox.Show("Please close all open applications\nand save any changes...","PC will be restarted!",
				MessageBoxButtons.OKCancel,MessageBoxIcon.Information,MessageBoxDefaultButton.Button2);
			if (result == DialogResult.OK)
				if (Win_calls.Reboot() == 0)
					MessageBox.Show("The process failed!","FAILURE!",MessageBoxButtons.OK,MessageBoxIcon.Error);
		}
		// Shutdown routine
		private void button3_Click(object sender, System.EventArgs e)
		{
			result=MessageBox.Show("Please close all open applications\nand save any changes...","PC will be turned off!",
				MessageBoxButtons.OKCancel,MessageBoxIcon.Information,MessageBoxDefaultButton.Button2);
			if (result == DialogResult.OK)
				if (Win_calls.Shutdown() == 0)
					MessageBox.Show("The process failed!","FAILURE!",MessageBoxButtons.OK,MessageBoxIcon.Error);
		}
	}
}
 

MrSeanKon

Member
Joined
May 23, 2005
Location
See my profile....
Variation analysis

Code:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace Variation_analysis
{
	public class Form1 : System.Windows.Forms.Form
	{
		private System.ComponentModel.Container components = null;
		private Functions OcBible;  // Add reference for Functions.dll

		public Form1()
		{
			InitializeComponent();
			OcBible=new Functions();
		}

		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		private void InitializeComponent()
		{
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(292, 266);
			this.Name = "Form1";
			this.Text = "Form1";
			this.Load += new System.EventHandler(this.Form1_Load);
		}
		#endregion

		[STAThread]
		static void Main() 
		{
			Application.EnableVisualStyles();
			Application.Run(new Form1());
		}

		private void Form1_Load(object sender, System.EventArgs e)
		{
			double[] data=new double[6];
			double max,min,mean,range,variance;

			for (int i=1; i<=5; i++)     // The zero element of each array is BANNED look
			{                            // in Aoaforums supported thread for more info
				data[i]=i;		
			}
			max=OcBible.Variation_analysis(data,5)[5];
			min=OcBible.Variation_analysis(data,5)[4];
			mean=OcBible.Variation_analysis(data,5)[1];
			range=OcBible.Variation_analysis(data,5)[3];
			variance=OcBible.Variation_analysis(data,5)[2];
			MessageBox.Show("Maximum is  " + max.ToString()  + ",    Minimum is  " + min.ToString()  + "\n" +
				            "Mean is " + mean.ToString() + ",    Range is " + range.ToString() + "\n" +
				            "Variance is " + variance.ToString(System.Globalization.NumberFormatInfo.InvariantInfo)
							+ "\n","Output");
			this.Close();
		}
	}
}

Of course this example does not support the BAN Technology :D