|
Start by writing the class diagram for individual elements in electrical circuits like register,inductor, capacitor , they may have properties like inputCurrent , inputVoltage , outPutCurrent, outputVoltage (outputCurrent and outPutVoltage should be read only) , stuff like this
in this class you need to incorporate the logic so that outputVoltage and current are set accordingly .
Let us take an example of a resister
Will have property like
Resistance
InputCurrent
OutputCurrent(read only)
InputVoltage
OutputVoltage (read only)
of as soon as InputVoltage and InputCurrent are set than (using Resistance property ) we can calculate the voltage drop across it hence the outputVoltage and current
I am not very good electrical , right now this is what i can think of .......
After this you need to have a class which has behavior like circuit board , know how to handel parallel and serial connection .........all those stuff
Not a easy task .........Will require a lot of knowledge and time
-Regards
Bharat Jain
bharat.jain.nagpur@gmail.com
|
|
|
|
|
hi evryone
is it posible to run my WebService in IIS on UNIX ?
if no, so what can i do ?
thank's for any help
|
|
|
|
|
E_Gold wrote: is it posible to run my WebService in IIS on UNIX ?
You want to run IIS on Unix , that is not possible .
-Regards
Bharat Jain
bharat.jain.nagpur@gmail.com
|
|
|
|
|
Hi,
as already said is it not possible to run IIS on UNIX.
But there is a port of the .NET framework for UNIX called MONO. AFAIK it is possible to run .NET webservices with MONO.
Have a look here:
http://www.mono-project.com/Main_Page[^]
Regards
Sebastian
|
|
|
|
|
Firstly, how does this relate to C#?
Secondly, ISS is a WINDOWS based web server, if you want to run a web server on a unix system go for apache[^]
Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL
you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
I have a function that very often are called. Any tip on how to optimize this code:
private static double CalculateDifferance(object from, object to)
{
if (typeof(int) == from.GetType())
{
return (int)to - (int)from;
}
else if (typeof(DateTime) == from.GetType())
{
return ((DateTime)to - (DateTime)from).TotalSeconds;
}
else if(typeof(double) == from.GetType())
{
return (double)to - (double)from;
}
return double.NaN;
}
_____________________________
...and justice for all
|
|
|
|
|
well, this code totally sucks, not sure how you could hope to improve it apart from scrapping it. You could write a generic version, but I don't think generics in .NET support specialisation. How about abandoning it ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Also, what happens when from is an int and to is a DateTime?
Cheers,
Vıkram.
I've never ever worked anywhere where there has not been someone who given the choice I would not work with again. It's a job, you do your work, put up with the people you don't like, accept there are probably people there that don't like you a lot, and look forward to the weekends.
- Josh Gray.
|
|
|
|
|
Use Convert.ToDouble and Convert.ToDateTime
|
|
|
|
|
Instead of "if (typeof(X) == from.GetType()) ", use "if (from is X) ".
But it would be better if you redesign the program so that you don't have to test the type at all.
|
|
|
|
|
The only way to do something like this 'properly' is using generics. This however creates all sorts of problems as doing math on T is not allowed for obvious reasons.
Have a look at http://www.codeproject.com/KB/cs/genericnumerics.aspx[^] article - it may help.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
private static double CalculateDifferance(object from, object to)
{
Type t = typeof(from);
switch (t)
{
case System.Int32:
return (int)to - (int)from;
break;
case System.DateTime:
return ((DateTime)to - (DateTime)from).TotalSeconds;
break;
case System.Double:
return (double)to - (double)from;
break;
default:
return double.NaN;
break;
}
}
Unless you have a way of indicating the types of the incoming parameters you will have to do the type-checks and unboxing which will be the biggest performance hits. I'd recommend reviewing the calls into the function and see if you know at that time whether you're dealing with int, DateTime, or double. If so, break it out into 3 separate functions that are type-specific.
Hope in one hand and poop in the other; see which fills up first. Hope and change were good slogans, now show us more than words.
|
|
|
|
|
public static double CalculateDifference(double to, double from){
return to-from;
}
public static int CalculateDifference(int to, int from){
return to - from;
}
etc.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
If you don't ask questions the answers won't stand in your way.
Most of this sig is for Google, not ego.
|
|
|
|
|
Edited to get < and > to display!
This works - using an interface/generics.
public interface IMath<T>
{
double CalculateDifference(T from, T to);
}
public class TestMath : IMath<int>, IMath<double>, IMath<datetime>
{
#region IMath<int> Members
public double CalculateDifference(int from, int to)
{
return to - from;
}
#endregion
#region IMath<double> Members
public double CalculateDifference(double from, double to)
{
return to - from;
}
#endregion
#region IMath<datetime> Members
public double CalculateDifference(DateTime from, DateTime to)
{
return (to - from).TotalSeconds;
}
#endregion
}
TestMath testMath = new TestMath();
Console.WriteLine(testMath.CalculateDifference(DateTime.Now, DateTime.Now.AddDays(1)));
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
modified on Friday, February 6, 2009 9:40 AM
|
|
|
|
|
Hi,
I am facing problem with combobox in gridview.I have used combobox in gridview and i am binding data to gridview combobox from database. If i click 2 times on combobox then it is showing the items and first item looks like blank.
Can anybody help me to resolve this problem how to display items in gridview combobox without double click and it will show first item by default without selection.The application is windows application.
Thanks in advance
Pavani
|
|
|
|
|
plz give us some idea of how to use single query for updating two tables in the database
|
|
|
|
|
Show us what have you done so far
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswam@its.co.za
|
|
|
|
|
write a stored proc for the update and fire a trigger to update the other table..
vikas da
|
|
|
|
|
Hi all
i have created a windows application using c#... its working fine in the developed system(ie server)...and i have created an exe of that and put it in another system...which is connected to the server...am getting an sql error(remote connection error)
and the system which i put the exe doesnt have sql/VS
what can be the reason?
|
|
|
|
|
Really that is not a Complete Error and you know it, post us a complete error.
When you Deploy the Application to a Client machine, the machine does not need to have VS or SQL installed. How did you create your exe and when does this error occurs ?
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswam@its.co.za
|
|
|
|
|
This is the error am getting while running the exe
--------------------------------------------------
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject)
at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at Webcam_Test.Form1.btnok_Click(Object sender, EventArgs e) in C:\Documents and Settings\Sreenivas\Desktop\cafeCup-04-02-09\C__Webcam_161075762003\Webcam_Test\Form1.cs:line 358
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Webcam_Test
Assembly Version: 1.0.3324.23182
Win32 Version: 1.0.3324.23182
CodeBase: file:///C:/Program%20Files/DotNet/Setup06-02/Webcam_Test.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Management
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Management/2.0.0.0__b03f5f7f11d50a3a/System.Management.dll
----------------------------------------
System.Data
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
WebCam_Capture
Assembly Version: 1.0.3322.24568
Win32 Version: 1.0.3322.24568
CodeBase: file:///C:/Program%20Files/DotNet/Setup06-02/WebCam_Capture.DLL
----------------------------------------
System.Transactions
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
------------------------------------------------
|
|
|
|
|
There are Different reasons why you see this
Do you have a .NET Framework install in the Target Machine ? If so What is the Version and what Version of VS are you using ?
Are you installing this From a Network share ? Because if so there might be CAS(Ssecurity Problems) Problems ?
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswam@its.co.za
|
|
|
|
|
ya i have installed .NetFrameWork 3.5..
and am installing this directly to the system...
|
|
|
|
|
So that means you are using VS2008 ?
And Did you create setup Project or you just build the project and take the exe that gets created in the bin directory ?
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswam@its.co.za
|
|
|
|
|
ya..what i did is..i have created a setup for that and that i put it in the other machine and run the set up to install... den i copied the exe in the bin and put in the sytem and tried running and got this error..
may be my approach is wrong
am new to c# and learning...
can u just tel me how to how to create the setup and wht and all i should do to the client machine to get it work?...
|
|
|
|