Search Results

Search found 7738 results on 310 pages for 'calling convention'.

Page 1/310 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • "Exception has been thrown by the target of an invocation" Running Tests - VS2008 SP1

    - by omatrot
    I'm using Visual Studio 2008 Team Suite and I'm unable to run tests and display the Test/Windows/Test Result Window. The result is a dialog box with the following content : "Exception has been thrown by the target of an invocation". Team Explorer has been installed after Visual Studio 2008 SP1. So I have re-apllied the service pack. Searching the web I found that this error is pretty common but unfortunately, the proposed solutions does not work for me. The problem was never analysed so I decided to give it a try : I reproduced the problem on a computer, attached the process with windbg and start with the basic investigations. Following are the first results : 0:000>!dumpstack OS Thread Id: 0xdb0 (0) Current frame: USER32!NtUserWaitMessage+0x15 ChildEBP RetAddr Caller,Callee 003fec94 75a32674 USER32!DialogBox2+0x222, calling USER32!NtUserWaitMessage 003fecd0 75a3288a USER32!InternalDialogBox+0xe5, calling USER32!DialogBox2 003fecfc 75a6f8d0 USER32!SoftModalMessageBox+0x757, calling USER32!InternalDialogBox 003fed3c 6eb61996 mscorwks!Thread::ReverseLeaveRuntime+0x95, calling mscorwks!_EH_epilog3 003fedb0 75a6fbac USER32!MessageBoxWorker+0x269, calling USER32!SoftModalMessageBox 003fede0 6ea559c3 mscorwks!SetupThreadNoThrow+0x19a, calling mscorwks!_EH_epilog3_catch_GS 003fee24 6eb61d8a mscorwks!HasIllegalReentrancy+0xac, calling mscorwks!_EH_epilog3 003fee30 6ea89796 mscorwks!SimpleComCallWrapper::Release+0x2e, calling mscorwks!CompareExchangeMP 003fee38 6ea0da05 mscorwks!CLRException::HandlerState::CleanupTry+0x16, calling mscorwks!GetCurrentSEHRecord 003fee44 6ea0c9c0 mscorwks!Thread::EnablePreemptiveGC+0xf, calling mscorwks!Thread::CatchAtSafePoint 003fee4c 6ea8a241 mscorwks!Unknown_Release_Internal+0x24d, calling mscorwks!GCHolder<1,0,0>::Pop 003fee50 6ea0c86c mscorwks!_EH_epilog3_catch_GS+0xa, calling mscorwks!__security_check_cookie 003fee54 6ea8a24c mscorwks!Unknown_Release_Internal+0x258, calling mscorwks!_EH_epilog3_catch_GS 003fee7c 75a16941 USER32!UserCallWinProcCheckWow+0x13d, calling ntdll!RtlDeactivateActivationContextUnsafeFast 003feed8 7082119e msenv!ATL::CComCritSecLock<ATL::CComCriticalSection>::Lock+0xd, calling ntdll!RtlEnterCriticalSection 003fef08 75a6fe5b USER32!MessageBoxIndirectW+0x2e, calling USER32!MessageBoxWorker 003fef7c 70a1e367 msenv!MessageBoxPVoidW+0xda 003fefd4 70a1db60 msenv!VBDialogCover2+0x11b 003ff01c 70a1e4c0 msenv!VBMessageBox2W+0xf0, calling msenv!VBDialogCover2 003ff044 7087246b msenv!main_GetAppNameW+0xa, calling msenv!GetAppNameInternal 003ff04c 70a1e4f2 msenv!VBMessageBox3W+0x1c, calling msenv!VBMessageBox2W 003ff064 70a1d6d7 msenv!_IdMsgShow+0x362, calling msenv!VBMessageBox3W 003ff0cc 70951841 msenv!TaskDialogCallback+0x7e0, calling msenv!_IdMsgShow 003ff118 6eb20da4 mscorwks!Unknown_QueryInterface+0x230, calling mscorwks!_EH_epilog3_catch_GS 003ff14c 6eb20c43 mscorwks!Unknown_QueryInterface_Internal+0x3d8, calling mscorwks!_EH_epilog3_catch_GS 003ff168 02006ec4 02006ec4, calling 0247a1e8 003ff16c 6ea0c86c mscorwks!_EH_epilog3_catch_GS+0xa, calling mscorwks!__security_check_cookie 003ff198 6eb20562 mscorwks!COMToCLRWorker+0xb34, calling mscorwks!_EH_epilog3_catch_GS 003ff19c 0247a235 0247a235, calling mscorwks!COMToCLRWorker 003ff1c4 7083249f msenv!CVSCommandTarget::ExecCmd+0x937 003ff1e4 7086d5c8 msenv!VsReportErrorInfo+0x11, calling msenv!TaskDialogCallback+0xd8 003ff1f8 7093e65b msenv!CVSCommandTarget::ExecCmd+0x945, calling msenv!VsReportErrorInfo 003ff25c 7081f53a msenv!ATL::CComPtr<IVsLanguageInfo>::~CComPtr<IVsLanguageInfo>+0x24, calling msenv!_EH_epilog3 003ff260 70b18d72 msenv!LogCommand+0x4c, calling msenv!ATL::CComPtr<IVsCodePageSelection>::~CComPtr<IVsCodePageSelection> 003ff264 70b18d77 msenv!LogCommand+0x51, calling msenv!_EH_epilog3 003ff280 70a4fd0e msenv!CMsoButtonUser::FClick+0x1d1, calling msenv!CVSCommandTarget::ExecCmd 003ff2f4 70823a87 msenv!CTLSITE::QueryInterface+0x16 003ff31c 70cb7d4d msenv!TBCB::FNotifyFocus+0x204 003ff35c 70ce5fda msenv!TB::NotifyControl+0x101 003ff3bc 709910f6 msenv!TB::FRequestFocus+0x4ed, calling msenv!TB::NotifyControl 003ff414 708254ba msenv!CMsoButtonUser::FEnabled+0x3d, calling msenv!GetQueryStatusFlags 003ff428 7086222a msenv!TBC::FAutoEnabled+0x24 003ff43c 7098e1eb msenv!TB::LProcessInputMsg+0xdb4 003ff458 6bec1c49 (MethodDesc 0x6bcd7f54 +0x89 System.Windows.Forms.Form.DefWndProc(System.Windows.Forms.Message ByRef)), calling 6be3b738 003ff50c 70823ab0 msenv!FPtbFromSite+0x16 003ff520 70991c43 msenv!TB::PtbParent+0x25, calling msenv!FPtbFromSite 003ff52c 708dda49 msenv!TBWndProc+0x2da 003ff588 0203d770 0203d770, calling 0247a1e8 003ff598 70822a70 msenv!CPaneFrame::Release+0x118, calling msenv!_EH_epilog3 003ff5b0 75a16238 USER32!InternalCallWinProc+0x23 003ff5dc 75a168ea USER32!UserCallWinProcCheckWow+0x109, calling USER32!InternalCallWinProc 003ff620 75a16899 USER32!UserCallWinProcCheckWow+0x6a, calling ntdll!RtlActivateActivationContextUnsafeFast 003ff654 75a17d31 USER32!DispatchMessageWorker+0x3bc, calling USER32!UserCallWinProcCheckWow 003ff688 70847f2b msenv!CMsoComponent::FPreTranslateMessage+0x72, calling msenv!MainFTranslateMessage 003ff6b4 75a17dfa USER32!DispatchMessageW+0xf, calling USER32!DispatchMessageWorker 003ff6c4 70831553 msenv!EnvironmentMsgLoop+0x1ea, calling USER32!DispatchMessageW 003ff6f8 708eb9bd msenv!CMsoCMHandler::FPushMessageLoop+0x86, calling msenv!EnvironmentMsgLoop 003ff724 708eb94d msenv!SCM::FPushMessageLoop+0xb7 003ff74c 708eb8e9 msenv!SCM_MsoCompMgr::FPushMessageLoop+0x28, calling msenv!SCM::FPushMessageLoop 003ff768 708eb8b8 msenv!CMsoComponent::PushMsgLoop+0x28 003ff788 708ebe4e msenv!VStudioMainLogged+0x482, calling msenv!CMsoComponent::PushMsgLoop 003ff7ac 70882afe msenv!CVsActivityLogSingleton::Instance+0xdf, calling msenv!_EH_epilog3 003ff7d8 70882afe msenv!CVsActivityLogSingleton::Instance+0xdf, calling msenv!_EH_epilog3 003ff7dc 707e4e31 msenv!VActivityLogStartupEntries+0x42 003ff7f4 7081f63b msenv!ATL::CComPtr<IClassFactory>::~CComPtr<IClassFactory>+0x24, calling msenv!_EH_epilog3 003ff7f8 708b250f msenv!ATL::CComQIPtr<IUnknown,&IID_IUnknown>::~CComQIPtr<IUnknown,&IID_IUnknown>+0x1d, calling msenv!_EH_epilog3 003ff820 708e7561 msenv!VStudioMain+0xc1, calling msenv!VStudioMainLogged 003ff84c 2f32aabc devenv!util_CallVsMain+0xff 003ff878 2f3278f2 devenv!CDevEnvAppId::Run+0x11fd, calling devenv!util_CallVsMain 003ff97c 77533b23 ntdll!RtlpAllocateHeap+0xe73, calling ntdll!_SEH_epilog4 003ff9f0 77536cd7 ntdll!RtlpLowFragHeapAllocFromContext+0x882, calling ntdll!RtlpSubSegmentInitialize 003ffa10 7753609f ntdll!RtlNtStatusToDosError+0x3b, calling ntdll!RtlNtStatusToDosErrorNoTeb 003ffa14 775360a4 ntdll!RtlNtStatusToDosError+0x40, calling ntdll!_SEH_epilog4 003ffa40 775360a4 ntdll!RtlNtStatusToDosError+0x40, calling ntdll!_SEH_epilog4 003ffa44 75bd2736 kernel32!LocalBaseRegOpenKey+0x159, calling ntdll!RtlNtStatusToDosError 003ffa48 75bd2762 kernel32!LocalBaseRegOpenKey+0x22a, calling kernel32!_SEH_epilog4 003ffac4 75bd2762 kernel32!LocalBaseRegOpenKey+0x22a, calling kernel32!_SEH_epilog4 003ffac8 75bd28c9 kernel32!RegOpenKeyExInternalW+0x130, calling kernel32!LocalBaseRegOpenKey 003ffad8 75bd28de kernel32!RegOpenKeyExInternalW+0x211 003ffae0 75bd28e5 kernel32!RegOpenKeyExInternalW+0x21d, calling kernel32!_SEH_epilog4 003ffb04 6f282e2b MSVCR90!_unlock+0x15, calling ntdll!RtlLeaveCriticalSection 003ffb14 75bd2642 kernel32!BaseRegCloseKeyInternal+0x41, calling ntdll!NtClose 003ffb28 75bd25d0 kernel32!RegCloseKey+0xd4, calling kernel32!_SEH_epilog4 003ffb5c 75bd25d0 kernel32!RegCloseKey+0xd4, calling kernel32!_SEH_epilog4 003ffb60 2f321ea4 devenv!DwInitSyncObjects+0x340 003ffb90 2f327bf4 devenv!WinMain+0x74, calling devenv!CDevEnvAppId::Run 003ffbac 2f327c68 devenv!License::GetPID+0x258, calling devenv!WinMain 003ffc3c 75bd3677 kernel32!BaseThreadInitThunk+0xe 003ffc48 77539d72 ntdll!__RtlUserThreadStart+0x70 003ffc88 77539d45 ntdll!_RtlUserThreadStart+0x1b, calling ntdll!__RtlUserThreadStart 0:000> !pe -nested Exception object: 050aae9c Exception type: System.Reflection.TargetInvocationException Message: Exception has been thrown by the target of an invocation. InnerException: System.NullReferenceException, use !PrintException 050aac64 to see more StackTrace (generated): SP IP Function 003FEC2C 6D2700F7 mscorlib_ni!System.RuntimeType.CreateInstanceSlow(Boolean, Boolean)+0x57 003FEC5C 6D270067 mscorlib_ni!System.RuntimeType.CreateInstanceImpl(Boolean, Boolean, Boolean)+0xe7 003FEC94 6D270264 mscorlib_ni!System.Activator.CreateInstance(System.Type, Boolean)+0x44 003FECA4 6AD02DAF Microsoft_VisualStudio_Shell_9_0_ni!Microsoft.VisualStudio.Shell.Package.CreateToolWindow(System.Type, Int32, Microsoft.VisualStudio.Shell.ProvideToolWindowAttribute)+0x67 003FED30 6AD0311B Microsoft_VisualStudio_Shell_9_0_ni!Microsoft.VisualStudio.Shell.Package.CreateToolWindow(System.Type, Int32)+0xb7 003FED58 6AD02D12 Microsoft_VisualStudio_Shell_9_0_ni!Microsoft.VisualStudio.Shell.Package.FindToolWindow(System.Type, Int32, Boolean, Microsoft.VisualStudio.Shell.ProvideToolWindowAttribute)+0x7a 003FED88 6AD02D39 Microsoft_VisualStudio_Shell_9_0_ni!Microsoft.VisualStudio.Shell.Package.FindToolWindow(System.Type, Int32, Boolean)+0x11 003FED94 02585E30 Microsoft_VisualStudio_QualityTools_TestCaseManagement!Microsoft.VisualStudio.TestTools.TestCaseManagement.QualityToolsPackage.InitToolWindowVariable[[System.__Canon, mscorlib]](System.__Canon ByRef, System.String, Boolean)+0x58 003FEDD0 02585DBE Microsoft_VisualStudio_QualityTools_TestCaseManagement!Microsoft.VisualStudio.TestTools.TestCaseManagement.QualityToolsPackage.InitToolWindowVariable[[System.__Canon, mscorlib]](System.__Canon ByRef, System.String)+0x36 003FEDE4 02585D32 Microsoft_VisualStudio_QualityTools_TestCaseManagement!Microsoft.VisualStudio.TestTools.TestCaseManagement.QualityToolsPackage.ShowToolWindow[[System.__Canon, mscorlib]](System.__Canon ByRef, System.String, Boolean)+0x3a 003FEE00 02585AB4 Microsoft_VisualStudio_QualityTools_TestCaseManagement!Microsoft.VisualStudio.TestTools.TestCaseManagement.QualityToolsPackage.OpenTestResultsToolWindow()+0x2c 003FEE10 02585A6E Microsoft_VisualStudio_QualityTools_TestCaseManagement!Microsoft.VisualStudio.TestTools.TestCaseManagement.QualityToolsPackage.OnMenuViewTestResults(System.Object, System.EventArgs)+0x6 003FEE18 6CD4F993 System_ni!System.ComponentModel.Design.MenuCommand.Invoke()+0x43 003FEE40 6CD4F9D4 System_ni!System.ComponentModel.Design.MenuCommand.Invoke(System.Object)+0x8 003FEE48 6AD000FA Microsoft_VisualStudio_Shell_9_0_ni!Microsoft.VisualStudio.Shell.OleMenuCommandService.Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget.Exec(System.Guid ByRef, UInt32, UInt32, IntPtr, IntPtr)+0x11a 003FEEA0 6AD03FB8 Microsoft_VisualStudio_Shell_9_0_ni!Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget.Exec(System.Guid ByRef, UInt32, UInt32, IntPtr, IntPtr)+0x44 StackTraceString: <none> HResult: 80131604 0:000> !PrintException 050aac64 Exception object: 050aac64 Exception type: System.NullReferenceException Message: Object reference not set to an instance of an object. InnerException: <none> StackTrace (generated): SP IP Function 003FE660 078E60BE Microsoft_VisualStudio_TeamSystem_Integration!Microsoft.VisualStudio.TeamSystem.Integration.TcmResultsPublishManager..ctor(Microsoft.VisualStudio.TeamSystem.Integration.ResultsPublishManager)+0xc6 003FE674 078E5C91 Microsoft_VisualStudio_TeamSystem_Integration!Microsoft.VisualStudio.TeamSystem.Integration.ResultsPublishManager..ctor(Microsoft.VisualStudio.TeamSystem.Integration.TeamFoundationHostHelper)+0x59 003FE684 078E2FA0 Microsoft_VisualStudio_TeamSystem_Integration!Microsoft.VisualStudio.TeamSystem.Integration.VsetServerHelper..ctor(System.IServiceProvider)+0x50 003FE6A4 078E2E90 Microsoft_VisualStudio_TeamSystem_Common!Microsoft.VisualStudio.TeamSystem.Integration.Client.VsetHelper.InitializeThrow(System.IServiceProvider)+0x20 003FE6B8 078E2E2A Microsoft_VisualStudio_TeamSystem_Common!Microsoft.VisualStudio.TeamSystem.Integration.Client.VsetHelper.InitializeHelper(System.IServiceProvider)+0x22 003FE6E0 078E2DEC Microsoft_VisualStudio_TeamSystem_Common!Microsoft.VisualStudio.TeamSystem.Integration.Client.VsetHelper.CreateVsetHelper(System.IServiceProvider)+0x1c 003FE6F0 078E2DAC Microsoft_VisualStudio_QualityTools_TestCaseManagement!Microsoft.VisualStudio.TestTools.TestCaseManagement.QualityToolsPackage.get_VsetHelper()+0x14 003FE6F8 02586BBE Microsoft_VisualStudio_QualityTools_TestCaseManagement!Microsoft.VisualStudio.TestTools.TestCaseManagement.ResultsToolWindow..ctor()+0x9f6 003FE798 02585F8A Microsoft_VisualStudio_QualityTools_TestCaseManagement!Microsoft.VisualStudio.TestTools.TestCaseManagement.ResultToolWindowHost..ctor()+0x1a StackTraceString: <none> HResult: 80004003 In order to be able to continue the analysis, we need to get the parameters to see what is going on. I also tried to run devenv.exe with the /log switch. No error in the log after reproducing the problem. Finally, If Team Explorer is removed from the system, the problem goes away. Any help appreciated. TIA. Olivier.

    Read the article

  • Using struts.xml with convention plugin

    - by David Alt
    This seems like it should be easy to do, but I just can make it work. I'm hooked on the convention plugin in Struts 2.1. However, I need to define some package-level configuration such as a new interceptor stack and exception mappings. I'd like to use the struts.xml file for this, but I can't get the convention-based packages matched to the struts.xml packages. My struts.xml looks like: <struts> <constant name="struts.convention.default.parent.package" value="default"/> <package name="default" extends="struts-default"> </package> <package name="root" namespace="/" extends="struts-default"> <action name="index"> <result>/index.jsp</result> </action> </package> <package name="my.package.actions.myaccount" namespace="/myaccount" extends="struts-default"> <interceptors> <interceptor name="authenticationInterceptor" class="my.package.interceptors.AuthenticationInterceptor"/> <interceptor-stack name="secureStack"> <interceptor-ref name="authenticationInterceptor"/> <interceptor-ref name="defaultStack"/> </interceptor-stack> </interceptors> <default-interceptor-ref name="secureStack"/> </package> </struts> I have my interceptor in: /src/my/package/interceptors and my actions in: /src/my/package/actions/myaccount

    Read the article

  • How do I compile boost using __cdecl calling convention?

    - by Sorin Sbarnea
    I have a project compiled using __cdecl calling convention (msvc2010) and I compiled boost using the same compiler using the default settings. The project linked with boost but I at runtime I got an assert message like this: File: ...\boost\boost\program_options\detail\parsers.hpp Line: 79 Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention. There are the following questions: what calling convention does boost build with by default on Windows (msvc2010) how to I compile boost with __cdecl calling convention why boost wasn't able to prevent linking with code with different calling conventions? I understood that boost has really smart library auto-inclusion code.

    Read the article

  • Question about Objective C calling convention and argument passing on ARM

    - by overboming
    I want to know how objective C runtime handle arguments when I call a objective C method like [NSString stringWithFomat:@"%@, %@", @"Hello", @"World"] There are three arguments for this objective C call, how does it work compared to typical way on a ARM system. I have known register r0, r1, r2, r3 will hold first 4 arguments, how about there are additional arguments? How does it put them on a stack and pop them later?

    Read the article

  • Calling SDL/OpenGL from Assembly code on Linux

    - by Lie Ryan
    I'm write a simple graphic-based program in Assembly for learning purpose; for this, I intended to use either OpenGL or SDL. I'm trying to call OpenGL/SDL's function from assembly. The problem is, unlike many assembly and OpenGL/SDL tutorials I found in the internet, the OpenGL/SDL in my machine apparently doesn't use C calling convention. I wrote a simple program in C, compile it to assembly (using -S switch), and apparently the assembly code that is generated by GCC calls the OpenGL/SDL functions by passing parameters in the registers instead of being pushed to the stack. Now, the question is, how do I determine how to pass arguments to these OpenGL/SDL functions? That is, how do I figure out which argument corresponds to which registers? Obviously since GCC can compile C code to call OpenGL/SDL, so therefore there must be a way to figure out the correspondence between function arguments and registers. In C calling conventions, the rule is easy, push parameters backwards and return value in eax/rax, I can simply read their C documentation and I can easily figure out how to pass the parameters. But how about these? Is there a way to call OpenGL/SDL using C calling convention? btw, I'm using yasm, with gcc/ld as the linker on Gentoo Linux amd64.

    Read the article

  • Fluent Nhibernate Automap convention for not-null field

    - by user215015
    Hi, Could some one help, how would I instruct automap to have not-null for a cloumn? public class Paper : Entity { public Paper() { } [DomainSignature] [NotNull, NotEmpty] public virtual string ReferenceNumber { get; set; } [NotNull] public virtual Int32 SessionWeek { get; set; } } But I am getting the following: <column name="SessionWeek"/> I know it can be done using fluent-map. but i would like to know it in auto-mapping way. Many thanks. Regards Robie

    Read the article

  • Fluent-NHibernate - Component property attributes ignored by Convention

    - by BobTodd
    I have a component with a number of properties that have various attributes Normally when these attributes are added to a plain old domain object they are picked up by my custom AttributeConventions. For the Component properties they are not. Is there some extra wiring needed for these? e.g. public class Component { [Length(Max=50)] public virtual string Name {get; set;} } public class MyClass { public virtual Component Component {get; set;} [Length(Max=50)] public virtual string Color {get; set;} } I get a table MyClass with columns Color & ComponentName Color is an nvarchar(50) whilst ComponentName is an nvarchar(255) (the default)

    Read the article

  • nasm/yasm arguments, linkage to C++

    - by arionik
    Hello everybody, I've got a question concerning nasm and its linkage to C++. I declare a litte test function as extern "C" void __cdecl myTest( byte i1, byte i2, int stride, int *width ); and I call it like this: byte i1 = 1, i2 = 2; int stride = 3, width = 4; myTest( i1, i2, stride, &width ); the method only serves to debug assembly and have a look at how the stack pointer is used to get the arguments. beyond that, the pointer arguments value shall be set to 7, to figure out how that works. This is implemented like this: global _myTest _myTest: mov eax, [esp+4] ; 1 mov ebx, [esp+8] ; 2 mov ecx, dword [esp+16] ; width mov edx, dword [esp+12] ; stride mov eax, dword [esp+16] mov dword [eax], 7 ret and compiled via yasm -f win32 -g cv8 -m x86 -o "$(IntDir)\$(InputName).obj" "$(InputPath)" , then linked to the c++ app. In debug mode, everything works fine. the function is called a couple of times and works as expected, whereas in release mode the function works once, but subsequent programm operations fail. It seems to me that something's wrong with stack/frame pointers, near/far, but I'm quite new to this subject and need a little help. thanks in advance! a.

    Read the article

  • Naming convention: Final fields (not static)

    - by Zeeker
    Today I had a discussion with a co-worker about the naming of final fields in Java classes. In his opionion final fields should also be considered constants since their values won't change after the creation of the instance. This would lead to the following naming convention for final fields: public class Foo { private static final String BLA_BLA = "bla"; private final String BAR_BATZ; ... } In my opinion only static final fields should be considered constants while fields which are only final should follow the usual camelCase naming convention. public class Foo { private static final String BLA = "bla"; private final String barBatz; ... } Now I'm a bit uncertain since he is a far more experienced programmer than I am and I usually agree with his opinions and consider him a very good developer. Any input on this?

    Read the article

  • C++ Function Calling Itself

    - by Ben
    Suppose I wish to have a function that fills an array either in pattern x,y,x,y,x,ywhere x and y are variables defined by some algorithm and x,y,z,x,y,z where x, y and z are variables defined by the same algorithm. This should continue for all number of variables. Is this a viable way to implement it. int recurse_n(int n) { while(n > 0) { --n; recurse_n(n); n = 0; // Use algorithm here } }

    Read the article

  • Python - what's your conventions to declare your attributes in a class ?

    - by SeyZ
    Hello, In Python, I can declare attributes all over the class. For example : class Foo: def __init__(self): self.a = 0 def foo(self): self.b = 0 It's difficult to retrieve all attributes in my class when I have a big class with a lot of attributes. Is it better to have the following code (a) or the next following code (b) : a) Here, it's difficult to locate all attributes : class Foo: def __init__(self): foo_1() foo_2() def foo_1(self): self.a = 0 self.b = 0 def foo_2(self): self.c = 0 b) Here, it's easy to locate all attributes but is it beautiful ? class Foo: def __init__(self): (self.a, self.b) = foo_1() self.c = foo_2() def foo_1(self): a = 0 b = 0 return (a, b) def foo_2(self): c = 0 return c In a nutshell, what is your conventions to declare your attributes in a class ?

    Read the article

  • Naming Convention for Dedicated Thread Locking objects

    - by Chris Sinclair
    A relatively minor question, but I haven't been able to find official documentation or even blog opinion/discussions on it. Simply put: when I have a private object whose sole purpose is to serve for private lock, what do I name that object? class MyClass { private object LockingObject = new object(); void DoSomething() { lock(LockingObject) { //do something } } } What should we name LockingObject here? Also consider not just the name of the variable but how it looks in-code when locking. I've seen various examples, but seemingly no solid go-to advice: Plenty of usages of SyncRoot (and variations such as _syncRoot). Code Sample: lock(SyncRoot), lock(_syncRoot) This appears to be influenced by VB's equivalent SyncLock statement, the SyncRoot property that exists on some of the ICollection classes and part of some kind of SyncRoot design pattern (which arguably is a bad idea) Being in a C# context, not sure if I'd want to have a VBish naming. Even worse, in VB naming the variable the same as the keyword. Not sure if this would be a source of confusion or not. thisLock and lockThis from the MSDN articles: C# lock Statement, VB SyncLock Statement Code Sample: lock(thisLock), lock(lockThis) Not sure if these were named minimally purely for the example or not Kind of weird if we're using this within a static class/method. Several usages of PadLock (of varying casing) Code Sample: lock(PadLock), lock(padlock) Not bad, but my only beef is it unsurprisingly invokes the image of a physical "padlock" which I tend to not associate with the abstract threading concept. Naming the lock based on what it's intending to lock Code Sample: lock(messagesLock), lock(DictionaryLock), lock(commandQueueLock) In the VB SyncRoot MSDN page example, it has a simpleMessageList example with a private messagesLock object I don't think it's a good idea to name the lock against the type you're locking around ("DictionaryLock") as that's an implementation detail that may change. I prefer naming around the concept/object you're locking ("messagesLock" or "commandQueueLock") Interestingly, I very rarely see this naming convention for locking objects in code samples online or on StackOverflow. Question: What's your opinion generally about naming private locking objects? Recently, I've started naming them ThreadLock (so kinda like option 3), but I'm finding myself questioning that name. I'm frequently using this locking pattern (in the code sample provided above) throughout my applications so I thought it might make sense to get a more professional opinion/discussion about a solid naming convention for them. Thanks!

    Read the article

  • Naming convention for iOS

    - by RMDan
    I am learning Objective-C and iOS development and not sure what proper naming convention should be used. I understand how to use the label aspect of Obj-C methods but not the proper way to name each label. What is the best practice for naming methods, properties, objects, outlets, and actions? Also, Should different naming conventions be used between Obj-C code and C code? And if so what differences is there?

    Read the article

  • Can someone explain to me C#'s coding convention?

    - by AedonEtLIRA
    I recently started working with Unity3D and primarily scripting with C#. As, I normally program in Java, the differences aren't too great but I still referred to a crash course just to make sure I am on the right track. However, My biggest curiosity with C# is that is capitalises the first letter its method names (eg. java: getPrime() C#: GetPrime() aka: Pascal Case?). Is there a good reason for this? I understand from the crash course page that I read that apparently it's convention for .Net and I have no way of ever changing it, but I am curious to hear why it was done like this as opposed to the normal (relative?) camel case that, say, Java uses. Note: I understand that languages have their own coding conventions (python methods are all lower case which also applies in this question) but I've never really understood why it isn't formalised into a standard.

    Read the article

  • Case convention- Why the variation between languages?

    - by Jason
    Coming from a Java background, I'm very used to camelCase. When writing C, using the underscore wasn't a big adjustment, since it was only used sparingly when writing simple Unix apps. In the meantime, I stuck with camelCase as my style, as did most of the class. However, now that I'm teaching myself C# in preparation for my upcoming Usability Design class in the fall, the PascalCase convention of the language is really tripping me up and I'm having to rely on intellisense a great deal in order to make sure the correct API method is being used. To be honest, switching to the PascalCase layout hasn't quite sunk in the muscle memory just yet, and that is frustrating from my point of view. Since C# and Java are considered to be brother languages, as both are descended from C++, why the variation in the language conventions? Was it a personal decision by the creators based on their comfort level, or was it just to play mindgames with new introductees to the language?

    Read the article

  • Naming convention: field starting with "m" or "s"

    - by Noya
    Hope this question hasn't posted yet... I saw lot of code (for example some Android source code) where fields name start with a "m" while static fields start with "s" Example (taken from Android View class source): private SparseArray<Object> mKeyedTags; private static int sNextAccessibilityViewId; I was wondering what "m" and "s" stand for... maybe is "m" mutable and "s" static? Since it seems that is a largely adopted pattern do you know if there some literature about this kind of naming convention?

    Read the article

  • Control convention for circular movement?

    - by Christian
    I'm currently doing a kind of training project in Unity (still a beginner). It's supposed to be somewhat like Breakout, but instead of just going left and right I want the paddle to circle around the center point. This is all fine and dandy, but the problem I have is: how do you control this with a keyboard or gamepad? For touch and mouse control I could work around the problem by letting the paddle follow the cursor/finger, but with the other control methods I'm a bit stumped. With a keyboard for example, I could either make it so that the Left arrow always moves the paddle clockwise (it starts at the bottom of the circle), or I could link it to the actual direction - meaning that if the paddle is at the bottom, it goes left and up along the circle or, if it's in the upper hemisphere, it moves left and down, both times toward the outer left point of the circle. Both feel kind of weird. With the first one, it can be counter intuitive to press Left to move the paddle right when it's in the upper area, while in the second method you'd need to constantly switch buttons to keep moving. So, long story short: is there any kind of existing standard, convention or accepted example for this type of movement and the corresponding controls? I didn't really know what to google for (control conventions for circular movement was one of the searches I tried, but it didn't give me much), and I also didn't really find anything about this on here. If there is a Question that I simply didn't see, please excuse the duplicate.

    Read the article

  • Need help with the naming convention for an incremental variable [closed]

    - by iStryker
    I am using a voting module, that allows you vote either up or down [or reset]. If you vote up, the value is +1. If you vote down, the value is -1. If you vote up then down, the value is -1. I want to extend this module to allow you to vote multiple times, and the votes to be incremental. Examples Up, Up = +1, +1 = +2 Up, Up, Down = +1, +1, -1 = +1 I want to create a new boolean variable. If FALSE/NULL then use the old system +1/-1. If TRUE, voting will be incremental. What should be the name of this variable be? I feel 'incremental' is not the correct name. This module is part of an open-source project and is used on 3,177+ websites, so I want to get the naming convention right. Naturally, I'll be setting an upper and lower limit the variable be. [ie 5 & 0] Side-question: Is there a mathematics term to describe something being either +1/-1?

    Read the article

  • Calling delegate methods and calling selectors

    - by Crystal
    I'm new to the concept of delegates and selectors when used with notifications. So my first question is, 1) Let's say you have a button that has a delegate that implements some doWork method. If you want the same functionality that's in the method, is it 'ok' to just call that method? I didn't know if that was considered good coding practices and/or if you should do that, or do something different in getting that type of functionality. Like if that is ok architecture? 2) Similarly, with NSNotificationCenter, I see some code that posts a notification. Then there's a HandleSegmentedControl:(NSNotification *)notification method. If I want to manually have that functionality, but without pressing the segment control, is it 'ok' to just take that functionality out of that method and put it in a new method so it would look like this: Original: - (void)HandleSegmentedControl:(NSNotification *)notification { NSDictionary *dict = [userInfo notification]; // do stuff with the dictionary } New: - (void)HandleSegmentedControl:(NSNotification *)notification { NSDictionary *dict = [userInfo notification]; [self newMethod:dict]; } - (void)newMethod:(NSDictionary *)dict { // do stuff with the dictionary } - (void)myOtherMethodThatNeedsTheSameFunctionality { NSDictionary *dict = // create some dictionary [self newMethod:dict]; } Sorry if these are basic questions. I'm not sure what the best practices are for things like this and wanted to start the right way. Thanks.

    Read the article

  • Skype Video Calling Comes To iPhone And iPod Touch

    - by Gopinath
    Skype 3.0 app for iPhone/iPod Touch lets you make video calls right from your iOS device to another iOS device or computer running Skype application. Skype blog post says This season is very special as we are releasing a new version of Skype for iPhone and iPod Touch with video calling. Skype video calling is supported over WiFi and 3G* data connections. You can enjoy video calls with users on all Skype desktop versions and with other Skype for iPhone, iPod Touch, and iPad users. You can make video calls in both portrait and landscape mode and use both front and back cameras. Users on iPhone 4, 3GS and iPod Touch (4th Generation) can enjoy full 2-way video calling. Users with iPod Touch (3rd Generation) and iPads can receive video. Download the app straight from AppStore This article titled,Skype Video Calling Comes To iPhone And iPod Touch, was originally published at Tech Dreams. Grab our rss feed or fan us on Facebook to get updates from us.

    Read the article

  • Cross-language Extension Method Calling

    - by Tom Hines
    Extension methods are a concise way of binding functions to particular types. In my last post, I showed how Extension methods can be created in the .NET 2.0 environment. In this post, I discuss calling the extensions from other languages. Most of the differences I find between the Dot Net languages are mainly syntax.  The declaration of Extensions is no exception.  There is, however, a distinct difference with the framework accepting excensions made with C++ that differs from C# and VB.  When calling the C++ extension from C#, the compiler will SOMETIMES say there is no definition for DoCPP with the error: 'string' does not contain a definition for 'DoCPP' and no extension method 'DoCPP' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?) If I recompile, the error goes away. The strangest problem with calling the C++ extension from C# is that I first must make SOME type of reference to the class BEFORE using the extension or it will not be recognized at all.  So, if I first call the DoCPP() as a static method, the extension works fine later.  If I make a dummy instantiation of the class, it works.  If I have no forward reference of the class, I get the same error as before and recompiling does not fix it.  It seems as if this none of this is supposed to work across the languages. I have made a few work-arounds to get the examples to compile and run. Note the following examples: Extension in C# using System; namespace Extension_CS {    public static class CExtension_CS    {  //in C#, the "this" keyword is the key.       public static void DoCS(this string str)       {          Console.WriteLine("CS\t{0:G}\tCS", str);       }    } } Extension in C++ /****************************************************************************\  * Here is the C++ implementation.  It is the least elegant and most quirky,  * but it works. \****************************************************************************/ #pragma once using namespace System; using namespace System::Runtime::CompilerServices;     //<-Essential // Reference: System.Core.dll //<- Essential namespace Extension_CPP {        public ref class CExtension_CPP        {        public:               [Extension] // or [ExtensionAttribute] /* either works */               static void DoCPP(String^ str)               {                      Console::WriteLine("C++\t{0:G}\tC++", str);               }        }; } Extension in VB ' Here is the VB implementation.  This is not as elegant as the C#, but it's ' functional. Imports System.Runtime.CompilerServices ' Public Module modExtension_VB 'Extension methods can be defined only in modules.    <Extension()> _       Public Sub DoVB(ByVal str As String)       Console.WriteLine("VB" & Chr(9) & "{0:G}" & Chr(9) & "VB", str)    End Sub End Module   Calling program in C# /******************************************************************************\  * Main calling program  * Intellisense and VS2008 complain about the CPP implementation, but with a  * little duct-tape, it works just fine. \******************************************************************************/ using System; using Extension_CPP; using Extension_CS; using Extension_VB; // vitual namespace namespace TestExtensions {    public static class CTestExtensions    {       /**********************************************************************\        * For some reason, this needs a direct reference into the C++ version        * even though it does nothing than add a null reference.        * The constructor provides the fake usage to please the compiler.       \**********************************************************************/       private static CExtension_CPP x = null;   // <-DUCT_TAPE!       static CTestExtensions()       {          // Fake usage to stop compiler from complaining          if (null != x) {} // <-DUCT_TAPE       }       static void Main(string[] args)       {          string strData = "from C#";          strData.DoCPP();          strData.DoCS();          strData.DoVB();       }    } }   Calling program in VB  Imports Extension_CPP Imports Extension_CS Imports Extension_VB Imports System.Runtime.CompilerServices Module TestExtensions_VB    <Extension()> _       Public Sub DoCPP(ByVal str As String)       'Framework does not treat this as an extension, so use the static       CExtension_CPP.DoCPP(str)    End Sub    Sub Main()       Dim strData As String = "from VB"       strData.DoCS()       strData.DoVB()       strData.DoCPP() 'fake    End Sub End Module  Calling program in C++ // TestExtensions_CPP.cpp : main project file. #include "stdafx.h" using namespace System; using namespace Extension_CPP; using namespace Extension_CS; using namespace Extension_VB; void main(void) {        /*******************************************************\         * Extension methods are called like static methods         * when called from C++.  There may be a difference in         * syntax when calling the VB extension as VB Extensions         * are embedded in Modules instead of classes        \*******************************************************/     String^ strData = "from C++";     CExtension_CPP::DoCPP(strData);     CExtension_CS::DoCS(strData);     modExtension_VB::DoVB(strData); //since Extensions go in Modules }

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >