• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

109 Neutral


  • Rank
  1. Issue with memory mapped files

    Chirs_F   I am not an expert but with such large RAM. the file is still not read at once. then could it be a paging problem on the system?   the ram could be occupied with other processes on the system and therefore the file may not  have adequate space as desired. and maximum size allowed on your system maybe less than the demand your applications are putting on the system. if at all it has anything to do with paging then at least on windows 7 this is  how you can adjust it.   http://www.youtube.com/watch?v=DWCVhk5gTps   i am sure you must know about paging but just for the benefit of doubt paging ->( when computer uses hard disk space to assist RAM because of the lack of it. )     i am sorry if my opinion is not related to your problem   Thanks Regards
  2. Dear Fellows   http://www.gamedev.net/topic/559996-why-dont-we-have-a-specs-compiler-yet/ since this topic is more than 60 days old i cannot continue there hence i have to post a new thread.   it seems reading this post that nobody knew if a SPECS c++ translator was ever attempted and if it was then where it is.!!!   Well i just found its source code. (or i think it is) hence i would like to give the link to that for the interested community members. if this is already known and the members in the original post already know about it. then i apologize as i could not see on this site anything about it. sorry   this is the link to the source of translator/(maybe compiler) http://www.csse.monash.edu.au/~damian/src/specs1.01.2.tar.gz   and this is the link  http://www.csse.monash.edu.au/~damian/papers/ where you will find other info about it if you will search for   A Modest Proposal: C++ Resyntaxed   on that page   and may i suggest ANTRL4 if anyone of you would want to bypass yacc/lex.   Thanks Regards
  3. Sir Mr. Kanato Thanks For Your Input RIGHT_THEN
  4. GentleMen I have An Inquiry About Threading As To When Is a Thread Considered Aborted/Terminated/Closed/Exist No More My Problem Is When I Use Abort() To Abort Thread An Error Pumpsup "Thread Was Being Aborted" ; I am Presenting My problem in a Simplified Way And Not Actual Code. I noticed If I remove The Abort() Error DoesNot Occur; Because While Loop Of ThreadProc Can Be Broken By Turning The While Loop Condition To Flase From Inside And Also Outside The ThreadProc; But My Confusion Is , Is The Thred Dead When It Slips Its Loop And Obviously It Would Hit The Boundary Of Its PROC Then TheEnd Or does It Continue To Remain In SOme Subtle Way But As a Useless Entity Because Cant Do Anything With It Since Its Control Is not In Its PROC or it has run out of its proc ( WHERE!!!??? ). Using System.Threading ; Using System.Windows.Forms ; Using ...... [code] namespace y { public Class x { public enum E_enum { CanAbortThread = 0, DontAbortThread = 1, NONE = -1 , IGNORE = -2 } public E_enum e_enum = new E_enum(); public system.Threading.Thread A_Thread ; public void A_ThreadProc() { while ( e_enum != E_ENUM.CanAbortThread ) { // thread exists because control Loops in it } // If Control Reaches here After Exiting While // control would run out of this PROc in about another Step // So Is Theard Dead Without Using Abort Just Like That Or not??? } public void StartThread() { A_Thread = new System.Threading.Thread(new ThreadStart(A_ThreadProc)) ; e_enum = E_ENUM.DontAbortThread ; A_Thread.Start() ; } public Cause_A_Thread_To_Abort_Or_Continue() { int z; while ( true ) { z++; if ( Z == 10 ) { e_enum = E_ENUM.CanAbortThread ; A_Thread.Abort() ; break; } else { e_enum = E_ENUM.DontAbortThread ; } } } public x() { StartThread(); Cause_A_Thread_To_Abort_Or_Continue() ; } }//end class }//end namespace [/code] I Checked While Debugging Thread Is Not Shown In The Threads WIndow When It Run Out Of its loop And Then Of Its Proc Then Should I Consider It Dead. If Thread Can Be Terminated Like This Then Should I merely Break Its Loop Without Resorting TO ABort(), Could Some Light Be Thrown On Suspend And Resume Aspect Of Thread Also Please. Thankyou RIGHT_THEN [Edited by - RIGHT_THEN on May 2, 2008 2:22:01 AM]
  5. Sir Mr. RANAKOR, Thanks as always for the reply I am right now not working at it to implement it but sure would want to use it in future I thought it would make code writting real small.If the Code itself could change itself at runtime according to user needs Your suggestions about compiler services etc etc are Considerable and i would lok into it when i apply it althou i dont understand any of it "LAMBDA" isnt that the spaceage computer.Oh yes allrigh.... well thanks a lot Ofcourse i would bother you again when i strike the wall. Actually i was writting something of an excel application i used Excel thinking it allready had built in things with it so i should build on it the application that i am. but the code is just getting tedious and bloted.SO i remembered this that had i not read it somewhere that now we can make programm to write itself. that would save me lot of Book Keping things things i am writting .But That LAMBDA Scares me off Looks like a deep learning dive i would postpone it for later.. Thanks again RIGHT_THEN
  6. Gentelmen I read somewhere that with reflection one can even make the programm to write itself, while in execution. how can that be done can that be demonstrated. for instance using System; using System.Reflections; using.... namespace WriteIt { public class ChangeIt { public int AddTwoNums ( int Num1 , Int Num2 ) { return Num1 + Num2 ; // can we convert this + sign to - sign // While running if so could this please be demosntrated // or could somebody demostrate how to write a Method // for substration on the fly } } } Thankyou RIGHT_THEN [Edited by - RIGHT_THEN on April 26, 2008 2:22:08 PM]
  7. [.net] Generics in c#

    Sir Mr. RanaKor, I have found a Way to Get the Value of a Generic Type It is like this But the Handicap About it is That I have to know its Type in Advance to use it in the End function. public struct GenericStruct1<Tp,Tp1,Tp2,Tp3> { public Tp TpVar ; public Tp1 Tp1Var ; public Tp2 Tp2Var ; public Tp3 Tp3Var ; } private void CheckGent1Test<TP,TP1,TP2,TP3>( ref GenericStruct1<TP, TP1, TP2, TP3> x) { MessageBox.Show( x.TpVar.GetType().ToString() + " <-> " + x.TpVar.ToString() + "\n" + x.Tp1Var.GetType().ToString() + " <-> " + x.Tp1Var.ToString() + "\n" + x.Tp2Var.GetType().ToString() + " <-> " + x.Tp2Var.ToString() + "\n" + x.Tp3Var.GetType().ToString() + " <-> " + x.Tp3Var.ToString() + "\n" ) ; Type[] Typ2 = x.GetType().GetGenericArguments(); FieldInfo[] FInfo1 = Typ2[3].GetFields(); Type Typ123 = x.Tp3Var.GetType(); object Con1 = Convert.ChangeType(x.Tp3Var, Type.GetType(x.Tp3Var.GetType().ToString() )); // if i had not Used GenericStruct2<> here it would not have worked // how to avoid this MessageBox.Show (((GenericStruct2<int, int, int, int>)Con1).TpVar.ToString () + "\n" + ((GenericStruct2<int, int, int, int>)Con1).Tp1Var.ToString() + "\n" + ((GenericStruct2<int, int, int, int>)Con1).Tp2Var.ToString() + "\n" + ((GenericStruct2<int, int, int, int>)Con1).Tp3Var.ToString() + "\n" + "Got It" ); return; } Next You Asked for a Real Time Code Well Here it is in the end function Which Redims a Array I would be making it to Redim a Multidimensional Array but to this point it is single dimensional I dont know how to test a Generic Type here Consider A Generic Type for some Array which a I might Make in future and need to redim it. public void CallingFunc() { PARAMSReDimPreserveArray<int[]> ReDimPreserveArrayPARAMS = new PARAMSReDimPreserveArray<int[]>(); // this work right i did redim it //PARAMSReDimPreserveArray<GenericStruct1<int, int, int, int>[]> ReDimPreserveArrayPARAMS = new PARAMSReDimPreserveArray<GenericStruct1<int, int, int, int>[]>(); // dont know how would this work so commeted it this is where i need help GenericStruct1<int, int, int, int>[] Gen1TestArry = new GenericStruct1<int, int, int, int>[5]; Gen1TestArry[0].TpVar = 1 ; Gen1TestArry[0].Tp1Var = 2 ; Gen1TestArry[0].Tp2Var = 3 ; Gen1TestArry[0].Tp3Var = 4 ; int[] IntArry = { 1,2,13 } ; //ReDimPreserveArrayPARAMS.ArrayToResize = Gen1TestArry ; // dont know how to use this in end funciton ReDimPreserveArrayPARAMS.ArrayToResize = IntArry ; // did it ReDimPreserveArrayPARAMS.SizeToSet = 10 ; ReDimPreserveArrayPARAMS.FunctionStatus = new FUNCTIONSOPINION() ; ReDimPreserveArrayPARAMS.ResizingStatus = new PARAMSReDimPreserveArray<int[]>.ReDimPreserveArray() ; //ReDimPreserveArrayPARAMS.ResizingStatus = new PARAMSReDimPreserveArray<Gen1Test<int, int, int, int>[]>.ReDimPreserveArray(); MessageBox.Show("Value In 0th element Before Rediming"+ "\n" + IntArry[0].ToString()); MessageBox.Show("Length Of Array Before Rediming"+ "\n" + IntArry.Length.ToString()); ReDimPreserveArray(ref ReDimPreserveArrayPARAMS); IntArry = ReDimPreserveArrayPARAMS.ArrayToResize; MessageBox.Show("Length Of Array After Rediming"+ "\n" +IntArry.Length.ToString ()); MessageBox.Show("Value In 3rd element After Rediming"+ "\n" + IntArry[2].ToString()); // got results correctly } public enum FUNCTIONSOPINION { NOTSUCCESSFUL = 0 , SUCCESSFUL = 1 , PARTIALLYSUCCESSFUL = 2 , FAILEDBECAUSEOFERROR = 3 , COULDNOT_DO_WHAT_THIS_FUNC_WAS_MADE_FOR = 0 , DID_WHAT_THIS_FUNC_WAS_MADE_FOR = 1 , PARTIALLY_DID_WHAT_THIS_FUNC_WAS_MADE_FOR = 2 , None = -1 , IGNORE = -2 } public struct PARAMSReDimPreserveArray<T> { public FUNCTIONSOPINION FunctionStatus ; public enum ReDimPreserveArray { RECIEVED_ARRAY_VARIABLE_ISNULL = 0 , SIZE_CANNOTBE_ZERO = 1 , RECIEVED_VARIABLE_IS_NOT_AN_ARRAY = 2 , COULDNOT_DETERMINE_THE_TYPE_OFARRAY = 3 , RESIZED = 4 , COULDNOTRESIZE = 5 , NONE = -1 , IGNORE = -2 } public ReDimPreserveArray ResizingStatus ; public T ArrayToResize ; public int SizeToSet ; } ; public void ReDimPreserveArray<T>( ref PARAMSReDimPreserveArray<T> ThisFuncsPARAMS ) { try { bool IsItArray = true ; Type TypeOfArrayRecieved ; object ArrayToResize_Dup1 = new object() ; if (ThisFuncsPARAMS.ArrayToResize == null) { ThisFuncsPARAMS.FunctionStatus = FUNCTIONSOPINION.COULDNOT_DO_WHAT_THIS_FUNC_WAS_MADE_FOR ; ThisFuncsPARAMS.ResizingStatus = PARAMSReDimPreserveArray<T>.ReDimPreserveArray.RECIEVED_ARRAY_VARIABLE_ISNULL ; return ; } IsItArray = ThisFuncsPARAMS.ArrayToResize.GetType().IsArray; if (IsItArray == false) { ThisFuncsPARAMS.FunctionStatus = FUNCTIONSOPINION.COULDNOT_DO_WHAT_THIS_FUNC_WAS_MADE_FOR ; ThisFuncsPARAMS.ResizingStatus = PARAMSReDimPreserveArray<T>.ReDimPreserveArray.RECIEVED_VARIABLE_IS_NOT_AN_ARRAY ; return ; } TypeOfArrayRecieved = ThisFuncsPARAMS.ArrayToResize.GetType() ; if ( TypeOfArrayRecieved == null ) { ThisFuncsPARAMS.FunctionStatus = FUNCTIONSOPINION.COULDNOT_DO_WHAT_THIS_FUNC_WAS_MADE_FOR ; ThisFuncsPARAMS.ResizingStatus = PARAMSReDimPreserveArray<T>.ReDimPreserveArray.COULDNOT_DETERMINE_THE_TYPE_OFARRAY ; } if (TypeOfArrayRecieved.ToString().Equals("System.Int32[]")) { ArrayToResize_Dup1 = Convert.ChangeType(ThisFuncsPARAMS.ArrayToResize, typeof(int[])); int[] OldTempArray = new int[((int[])ArrayToResize_Dup1).Length] ; int[] NewTempArray = new int[ThisFuncsPARAMS.SizeToSet] ; ((int[])ArrayToResize_Dup1).CopyTo(OldTempArray, 0) ; ArrayToResize_Dup1 = new int[ThisFuncsPARAMS.SizeToSet] ; OldTempArray.CopyTo((int[])ArrayToResize_Dup1, 0); ThisFuncsPARAMS.ArrayToResize = (T)ArrayToResize_Dup1 ; ThisFuncsPARAMS.FunctionStatus = FUNCTIONSOPINION.DID_WHAT_THIS_FUNC_WAS_MADE_FOR; ThisFuncsPARAMS.ResizingStatus = PARAMSReDimPreserveArray<T>.ReDimPreserveArray.RESIZED; return; } // Similarly i can redim the known Type but // How do i check a Generic Type here and Redimit } catch (Exception e1) { ThisFuncsPARAMS.FunctionStatus = FUNCTIONSOPINION.FAILEDBECAUSEOFERROR; DealWithErrors.ReportException Re1 = new DealWithErrors.ReportException(); Re1.e1 = e1 ; Re1.FileName = "CommonFunctions" ; Re1.FunctionName = "ReDimPreserveArray" ; DealWithErrors.CommonFunctionsRelatedErrors(ref Re1); } } GrateFully RIGHT_THEN
  8. [.net] Generics in c#

    Sir Mr. RanaKor, Thanks for your reply 1) First Thing Which you Said That "I dont Understand What you are trying to do" Well at this point i am merely testing it and not putting any logic to it.I was trying to make a class library for myself in which i would put my frequently used Functionality. In them are some functions which i have to write again only for them to handle different Types allthou inside logic is the same I tried getting the same function to work with all using Object but it does not.so i thought let me try templates. which i found are called generics in c#. So i said let me see how it works in c# so i placed all That is above in a class to test it out how it works. i am not using ToString() because i want string Representation in the end or that is what i want to do . i Used ToString() Merely because i wanted to see the values passed in the MessageBox.And see if i can Use Generics like that or not. 2) Second Thing You Said "but the point of generics isn't to be able to toss any value anywhere , just to know at compile time what type you will have to get string typing if you're gonna use it to store anything & not do operations restricted on the type you're prolly not making the right choice" Yes You Got Me by the Neck Here That is exactly what i want to do in the end Toss Any Value Anywhere. But not to Get the Type During Runtime And Get It Printed As String. But to Know Its type And Do The Needful According To the Type Recieved. 3)Third Thing You Said "x.Tp3Var.GetType().ToString() + " <-> " + x.Tp3Var.ToString() doesn't enumerate the contents of tp3var since tp3var in this case is a struct & not an int . you'd need to enumerate each of it's members one by one x.Tp3Var.TpVar.tostring();" Your Opinion Is Correct (Which Has To be) !!! But i am not trying to enumerate it there in that statement I just Got it Tell Its type twice. "x.Tp3Var.TpVar.ToString() is what i should do to enumerate it" Excatly is what i tried to do But Intellisense Wont Recognize Anything Beyound x.Tp3Var I tried Putting a Dot after it Like this x.Tp3Var.|----------| | nothing | | Appeared | | Here | |__________| But Did Write That Statement On My own x.Tp3Var.TpVar.ToString(); Complier Gave Error That is does not recognise it. If it would hve recognised I wont have posted this post. So My Question Still Stands How do i Get To Know What Is Inside A Generic Parameter And The Value Inside Those Parameters.I do know how to know the types of generic Parameters.But i do not know how to get their Values When the Generic Parameter is a Generic Struct Itself. It has to work this way for me that There is a Class Which is not generic But has a Function in it Which is generic As i have made in previous posts. When i will pass Parameter To this Function It would be a Generic Struct Contiaing Another Generic Struct as its last Field And i would Want to use the Values of that Last Field "Can That Be Done". Please Help Me Understanding This Phenonenon Aspect Of Generics. Do i need to Eleborate more on what i want to do GrateFully RIGHT_THEN [Edited by - RIGHT_THEN on March 10, 2008 2:25:23 AM]
  9. [.net] Generics in c#

    Sir Mr. SamLowry Thankyou VeryMuch For your Reply It Worked But a New Problem Arose. Here it is I thought As with events one is Object parameter and another is EventSpecific Parameter Like (Object Sender, Event e); I would make use of generics but problem arose With the Event Functions When we know the Sender object We merly typecast it [source lang=c#] ((ObjectThatHasRaisedThisEvent)Sender). |-------------| |Properties | |Of Object | |Pop Up In | |This Window | |_____________| I Thought The Same would Happen With Generics But With Generics Compiler Refuses To Change TypeCast Like That For Instance public Struct GenericStruct1<Tp,Tp1,Tp2,Tp3> { public Tp TpVar ; public Tp1 Tp1Var ; public Tp2 Tp2Var ; public Tp3 Tp3Var ; } public Struct GenericStruct2<Tp,Tp1,Tp2,Tp3> { public Tp TpVar ; public Tp1 Tp1Var ; public Tp2 Tp2Var ; public Tp3 Tp3Var ; } public void Func1() { // making variable GenericStruct1<string, string, string, GenericStruct2<int, int, int, int>> x = new GenericStruct1<string, string, string, GenericStruct2<int, int, int, int>>(); string S2 = "Hello" ; x.TpVar = "1" ; //because it is a string passing string value x.Tp1Var = S2 ; // it is string too x.Tp2Var = S2 + "1" ; // joining To Strings //caution:- i dont know why PLUS sign i wrote above is not visible in joining x.Tp3Var.TpVar = 51; // This Parameter is Struct Itself And its 1st Member i want as an int so 51 x.Tp3Var.TpVar1 = 52; // int x.Tp3Var.TpVar2 = 53; // int x.Tp3Var.TpVar3 = 54; // int /* I want to see all these values in another function So i pass it to function Like this */ Func1(ref x); // it works fine } public void Func1<Tp,Tp1,Tp2,Tp3>( ref GenericStruct1<Tp, Tp1, Tp2, Tp3> x ) { // I thought here i can see all the values like this MessageBox.Show( x.TpVar.GetType().ToString() + " <-> " + x.TpVar.ToString() + "\n" + x.Tp1Var.GetType().ToString() + " <-> " + x.Tp1Var.ToString() + "\n" + x.Tp2Var.GetType().ToString() + " <-> " + x.Tp2Var.ToString() + "\n" + x.Tp3Var.GetType().ToString() + " <-> " + x.Tp3Var.ToString() + "\n" //+ "\n" + ); // and it all works well to this point The last line in MessageBox // statement x.Tp3Var.GetType().ToString() + " <-> " + x.Tp3Var.ToString() // shows The Type as GenericStruct2<Tp, Tp1, Tp2, Tp3>> // Fine But how do i see the values inside this GenericStruct2 Passed here // i tried following things 1) string Str1 = ((GenericStruct2<Tp, Tp1, Tp2, Tp3>>)x.TpVar3).TpVar.ToString() ; // it says while compiling Cannot Convert Tp3 to GenericStruct2 Type 2) string Str1 = ((GenericStruct2<int, int, int, int>>)x.TpVar3).TpVar.ToString() ; // //Same Error As Above 3) string Str1 = ((int)x.TpVar3).TpVar.ToString() ; // same error 4) i tried FieldInfo[] FInfo = x.TpVar3.GetType().GetFields(); //okay It does //get correctly all the fields four of them and states they are System.Int32 types But how do i retrieve values inside these fields I dont know the way Please Help!!! } GrateFully RIGHT_THEN
  10. GentleMen, I am unabe to pass a structure into a generic function the error is "cannot be inferred from the usage. Try specifying the type arguments explicitly." This is what i did public struct Gen1Test<TP,TP1,TP2,TP3> { public TP S1 ; public TP1 S2 ; public TP2 S3 ; public TP3 S4 ; } public struct Gen1Test1 { public int S1; public int S2; public int S3; public int S4; } private void SomeFunc_event( object sender, EventArgs e ) { Gen1Test<string, string, string, string> x1 = new Gen1Test<string, string, string, string>(); //alright works fine Gen1Test<string, string, string, Gen1Test1> x = new Gen1Test<string, string, string, Gen1Test1>(); /* i was testing if a structure can be passed to a generic function And if A Generic Structure takes Another Structure of its own kind or other kind it does not!!! */ string S2= "hello" ; x.S1 = "1"; x.S2 = S2; x.S3 = S2 + "1"; x.S4.S1 = 50 ; x.S4.S1 = 51; x.S4.S1 = 52; x.S4.S1 = 53; CheckGent1Test( x) ; // CheckGent1Test<this is have tired too>( x) ; } //this function works if i dont Pass struct in struct Gen1Test Parameters private void CheckGent1Test<TP>( Gen1Test<TP,TP,TP,TP> x) { MessageBox.Show( x.S1.GetType().ToString() +" <-> " + x.S1.ToString()+ "\n"+ x.S2.GetType().ToString() +" <-> " + x.S2.ToString()+ "\n"+ x.S3.GetType().ToString() +" <-> " + x.S3.ToString()+ "\n"+ x.S4.GetType().ToString() +" <-> " + x.S4.ToString() ) ; } Thankyou RIGHT_THEN [\source]
  11. Sir Mr. Fiddler Thanks As Always For your Suggestion And also Sir Mr. Marineio, TheTroll GrateFully RIGHT_THEN
  12. I am not using webbrowser Control Because i didnt know about That it could do what i have stated above. Long back when i tried my hand On webbrowser control with vb6 it was a headache. Do you Mean to say That Webrowser control can take control of the DialogBoxes and i would have easy access to the dialog box buttons without resorting to winapi. because i am not creating these dialog boxes the sites Make them appear in my window when i click some of their option. But the Crux Of all is i am not as smart as most of you gentlemen Here are with emmence solutions and stratigies for everything i am just a hobbyist into programming doing home stuff for myself Thankyou RIGHT_THEN
  13. Sir Mr Headkaze Thankyou So much RIGHT_THEN
  14. Because i am Trying My hand on p/Invoke RIGHT_THEN
  15. WHat about the second part of the question did i do it right ThankYou RIGHT_THEN
  • Advertisement