Omnet++ GUI keeps crashing - tcl
i guess the problem was the file ~/.tkenvrc
after removing it everything was fine. Only problem was that its not deleted or reset with make clean.
It seems that it saves the current arrangement and values of the GUI
In case anybody else has this error i hope this post is of some help.
cheers
Initializing Global User Observer
2014-07-07 13:01:19.526 OverSim[1039:507] An uncaught exception was raised
2014-07-07 13:01:19.527 OverSim[1039:507] Error (1000) creating window shape
2014-07-07 13:01:19.527 OverSim[1039:507] (
0 CoreFoundation 0x00007fff8717925c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff8e5b4e75 objc_exception_throw + 43
2 CoreFoundation 0x00007fff8717910c +[NSException raise:format:] + 204
3 AppKit 0x00007fff92d7c9d9 _NSCreateWindowWithOpaqueShape2 + 159
4 AppKit 0x00007fff92d7ba41 -[NSWindow _commonAwake] + 3720
5 AppKit 0x00007fff92d7a717 -[NSWindow _makeKeyRegardlessOfVisibility] + 85
6 AppKit 0x00007fff92d7a690 -[NSWindow makeKeyAndOrderFront:] + 29
7 Tk 0x000000010482dbeb XMapWindow + 134
8 Tk 0x00000001047a1afd Tk_MapWindow + 69
9 Tk 0x00000001047a9e6a TkInstallFrameMenu + 271
10 Tcl 0x000000010492b70d TclServiceIdle + 87
11 Tcl 0x0000000104912cee Tcl_DoOneEvent + 344
12 Tk 0x00000001047a9e57 TkInstallFrameMenu + 252
13 Tcl 0x000000010492b70d TclServiceIdle + 87
14 Tcl 0x0000000104912cee Tcl_DoOneEvent + 344
15 Tk 0x0000000104783760 TkGetDisplayOf + 972
16 Tcl 0x00000001048a8ab6 Tcl_ListMathFuncs + 1503
17 Tcl 0x00000001048e8d6a Tcl_ExprObj + 22469
18 Tcl 0x000000010491fdea TclObjInterpProcCore + 699
19 Tcl 0x00000001048a8ab6 Tcl_ListMathFuncs + 1503
20 Tcl 0x00000001048a9d9d Tcl_EvalEx + 1838
21 Tcl 0x00000001048ab030 Tcl_VarEvalVA + 147
22 Tcl 0x00000001048ab0fb Tcl_VarEval + 148
23 libopptkenvd.dylib 0x000000010392092a _ZN19TGraphicalModWindow12createWindowEv + 194
24 libopptkenvd.dylib 0x0000000103900bef _ZN5Tkenv7inspectEP7cObjectiPKcPv + 529
25 libopptkenvd.dylib 0x000000010392fe24 _ZN21cInspectByNameVisitor5visitEP7cObject + 392
26 liboppsimd.dylib 0x0000000103debb53 _ZN11cSimulation12forEachChildEP8cVisitor + 63
27 libopptkenvd.dylib 0x000000010392fe5c _ZN21cInspectByNameVisitor5visitEP7cObject + 448
28 liboppsimd.dylib 0x0000000103dfd07b _ZN8cVisitor7processEP7cObject + 47
29 libopptkenvd.dylib 0x000000010392ec5d _Z19inspectObjectByNamePKcS0_iS0_ + 85
30 libopptkenvd.dylib 0x0000000103914d14 _Z17inspectByName_cmdPvP10Tcl_InterpiPPKc + 264
31 Tcl 0x00000001048a7786 TclInvokeStringCommand + 124
32 Tcl 0x00000001048a8ab6 Tcl_ListMathFuncs + 1503
33 Tcl 0x00000001048e8d6a Tcl_ExprObj + 22469
34 Tcl 0x00000001048ecdbc Tcl_ExprObj + 38935
35 Tcl 0x00000001048aa73f TclEvalObjEx + 422
36 Tcl 0x00000001048b2fa4 TclDumpMemoryInfo + 19667
37 Tcl 0x00000001048a8ab6 Tcl_ListMathFuncs + 1503
38 Tcl 0x00000001048e8d6a Tcl_ExprObj + 22469
39 Tcl 0x000000010491fdea TclObjInterpProcCore + 699
40 Tcl 0x00000001048a8ab6 Tcl_ListMathFuncs + 1503
41 Tcl 0x00000001048e8d6a Tcl_ExprObj + 22469
42 Tcl 0x000000010491fdea TclObjInterpProcCore + 699
43 Tcl 0x00000001048a8ab6 Tcl_ListMathFuncs + 1503
44 Tcl 0x00000001048a9d9d Tcl_EvalEx + 1838
45 Tcl 0x00000001048ab030 Tcl_VarEvalVA + 147
46 Tcl 0x00000001048ab0fb Tcl_VarEval + 148
47 libopptkenvd.dylib 0x0000000103900f16 _ZN5Tkenv16updateInspectorsEv + 426
48 libopptkenvd.dylib 0x0000000103900970 _ZN5Tkenv6newRunEPKci + 566
49 libopptkenvd.dylib 0x000000010390cebd _Z10newRun_cmdPvP10Tcl_InterpiPPKc + 126
50 Tcl 0x00000001048a7786 TclInvokeStringCommand + 124
51 Tcl 0x00000001048a8ab6 Tcl_ListMathFuncs + 1503
52 Tcl 0x00000001048e8d6a Tcl_ExprObj + 22469
53 Tcl 0x000000010491fdea TclObjInterpProcCore + 699
54 Tcl 0x00000001048a8ab6 Tcl_ListMathFuncs + 1503
55 Tcl 0x00000001048a9d9d Tcl_EvalEx + 1838
56 Tcl 0x00000001048aa54e Tcl_Eval + 39
57 libopptkenvd.dylib 0x00000001038fec16 _ZN5Tkenv3runEv + 1788
58 liboppenvird.dylib 0x0000000103a4c20e _ZN9EnvirBase3runEiPPcP14cConfiguration + 414
59 liboppenvird.dylib 0x0000000103a48ee2 _Z18setupUserInterfaceiPPc + 2570
60 liboppenvird.dylib 0x0000000103a49e51 evMain + 81
61 OverSim 0x0000000100832855 main + 32
62 libdyld.dylib 0x00007fff8a8435fd start + 1
)
2014-07-07 13:01:19.528 OverSim[1039:507] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error (1000) creating window shape'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff8717925c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff8e5b4e75 objc_exception_throw + 43
2 CoreFoundation 0x00007fff8717910c +[NSException raise:format:] + 204
3 AppKit 0x00007fff92d7c9d9 _NSCreateWindowWithOpaqueShape2 + 159
4 AppKit 0x00007fff92d7ba41 -[NSWindow _commonAwake] + 3720
5 AppKit 0x00007fff92d7a717 -[NSWindow _makeKeyRegardlessOfVisibility] + 85
6 AppKit 0x00007fff92d7a690 -[NSWindow makeKeyAndOrderFront:] + 29
7 Tk 0x000000010482dbeb XMapWindow + 134
8 Tk 0x00000001047a1afd Tk_MapWindow + 69
9 Tk 0x00000001047a9e6a TkInstallFrameMenu + 271
10 Tcl 0x000000010492b70d TclServiceIdle + 87
11 Tcl 0x0000000104912cee Tcl_DoOneEvent + 344
12 Tk 0x00000001047a9e57 TkInstallFrameMenu + 252
13 Tcl 0x000000010492b70d TclServiceIdle + 87
14 Tcl 0x0000000104912cee Tcl_DoOneEvent + 344
15 Tk 0x0000000104783760 TkGetDisplayOf + 972
16 Tcl 0x00000001048a8ab6 Tcl_ListMathFuncs + 1503
17 Tcl 0x00000001048e8d6a Tcl_ExprObj + 22469
18 Tcl 0x000000010491fdea TclObjInterpProcCore + 699
19 Tcl 0x00000001048a8ab6 Tcl_ListMathFuncs + 1503
20 Tcl 0x00000001048a9d9d Tcl_EvalEx + 1838
21 Tcl 0x00000001048ab030 Tcl_VarEvalVA + 147
22 Tcl 0x00000001048ab0fb Tcl_VarEval + 148
23 libopptkenvd.dylib 0x000000010392092a _ZN19TGraphicalModWindow12createWindowEv + 194
24 libopptkenvd.dylib 0x0000000103900bef _ZN5Tkenv7inspectEP7cObjectiPKcPv + 529
25 libopptkenvd.dylib 0x000000010392fe24 _ZN21cInspectByNameVisitor5visitEP7cObject + 392
26 liboppsimd.dylib 0x0000000103debb53 _ZN11cSimulation12forEachChildEP8cVisitor + 63
27 libopptkenvd.dylib 0x000000010392fe5c _ZN21cInspectByNameVisitor5visitEP7cObject + 448
28 liboppsimd.dylib 0x0000000103dfd07b _ZN8cVisitor7processEP7cObject + 47
29 libopptkenvd.dylib 0x000000010392ec5d _Z19inspectObjectByNamePKcS0_iS0_ + 85
30 libopptkenvd.dylib 0x0000000103914d14 _Z17inspectByName_cmdPvP10Tcl_InterpiPPKc + 264
31 Tcl 0x00000001048a7786 TclInvokeStringCommand + 124
32 Tcl 0x00000001048a8ab6 Tcl_ListMathFuncs + 1503
33 Tcl 0x00000001048e8d6a Tcl_ExprObj + 22469
34 Tcl 0x00000001048ecdbc Tcl_ExprObj + 38935
35 Tcl 0x00000001048aa73f TclEvalObjEx + 422
36 Tcl 0x00000001048b2fa4 TclDumpMemoryInfo + 19667
37 Tcl 0x00000001048a8ab6 Tcl_ListMathFuncs + 1503
38 Tcl 0x00000001048e8d6a Tcl_ExprObj + 22469
39 Tcl 0x000000010491fdea TclObjInterpProcCore + 699
40 Tcl 0x00000001048a8ab6 Tcl_ListMathFuncs + 1503
41 Tcl 0x00000001048e8d6a Tcl_ExprObj + 22469
42 Tcl 0x000000010491fdea TclObjInterpProcCore + 699
43 Tcl 0x00000001048a8ab6 Tcl_ListMathFuncs + 1503
44 Tcl 0x00000001048a9d9d Tcl_EvalEx + 1838
45 Tcl 0x00000001048ab030 Tcl_VarEvalVA + 147
46 Tcl 0x00000001048ab0fb Tcl_VarEval + 148
47 libopptkenvd.dylib 0x0000000103900f16 _ZN5Tkenv16updateInspectorsEv + 426
48 libopptkenvd.dylib 0x0000000103900970 _ZN5Tkenv6newRunEPKci + 566
49 libopptkenvd.dylib 0x000000010390cebd _Z10newRun_cmdPvP10Tcl_InterpiPPKc + 126
50 Tcl 0x00000001048a7786 TclInvokeStringCommand + 124
51 Tcl 0x00000001048a8ab6 Tcl_ListMathFuncs + 1503
52 Tcl 0x00000001048e8d6a Tcl_ExprObj + 22469
53 Tcl 0x000000010491fdea TclObjInterpProcCore + 699
54 Tcl 0x00000001048a8ab6 Tcl_ListMathFuncs + 1503
55 Tcl 0x00000001048a9d9d Tcl_EvalEx + 1838
56 Tcl 0x00000001048aa54e Tcl_Eval + 39
57 libopptkenvd.dylib 0x00000001038fec16 _ZN5Tkenv3runEv + 1788
58 liboppenvird.dylib 0x0000000103a4c20e _ZN9EnvirBase3runEiPPcP14cConfiguration + 414
59 liboppenvird.dylib 0x0000000103a48ee2 _Z18setupUserInterfaceiPPc + 2570
60 liboppenvird.dylib 0x0000000103a49e51 evMain + 81
61 OverSim 0x0000000100832855 main + 32
62 libdyld.dylib 0x00007fff8a8435fd start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6
Related
Integer Worksheet in Google Sheets with App Script randomizing numbers
I want to create a worksheet for adding/subtracting integers. When I run the script I would like the integers to randomly repopulate in two different columns along with the operation(addition/subtraction) in a middle column. Help please :)
24 Lines of Problems function operatorsandintegers() { const ss = SpreadsheetApp.getActive(); const sh = ss.getSheetByName("Sheet0"); const ops = ["-","+","*","/"]; sh.clearContents(); let vs = [...Array.from(new Array(24).keys(),x => [Math.floor(Math.random() * 100),ops[Math.floor(Math.random() * 4)],Math.floor(Math.random() * 100),''])]; vs.unshift(["Operand1","Operation","Operand2","result"]); sh.getRange(1,1,vs.length, vs[0].length).setValues(vs); } Operand1 Operation Operand2 result 1 - 74 17 / 66 14 + 89 76 + 2 72 / 27 42 + 85 34 * 62 50 + 80 33 - 40 61 * 34 30 / 66 98 / 69 27 - 26 74 - 15 44 * 14 66 - 42 43 / 64 96 - 83 52 - 29 17 + 77 30 + 34 31 / 31 26 + 67 53 + 68 Correct answers function correctanswers() { const ss = SpreadsheetApp.getActive(); const sh = ss.getSheetByName("Sheet0"); var vs = sh.getRange(2,1,sh.getLastRow() - 1,sh.getLastColumn()).getValues(); const ops = ["-","+","*","/"]; let r = vs.map(r => { let idx = ops.indexOf(r[1]); if(~idx) { switch(idx) { case 0: return [r[0] - r[2]]; break; case 1: return [r[0] + r[2]]; break; case 2: return [r[0] * r[2]]; break; case 3: return [r[0]/r[2]]; break; } } }) sh.getRange(2,4,r.length).setValues(r); } Operand1 Operation Operand2 result 1 - 74 -73 17 / 66 0.2575757576 14 + 89 103 76 + 2 78 72 / 27 2.666666667 42 + 85 127 34 * 62 2108 50 + 80 130 33 - 40 -7 61 * 34 2074 30 / 66 0.4545454545 98 / 69 1.420289855 27 - 26 1 74 - 15 59 44 * 14 616 66 - 42 24 43 / 64 0.671875 96 - 83 13 52 - 29 23 17 + 77 94 30 + 34 64 31 / 31 1 26 + 67 93 53 + 68 121
Terminating app due to uncaught exception NSInvalidArgumentException [UIView subclass _needsSetup]
Any suggestions how to debug this? I've tried setting an exception breakpoint but it's not helping. *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView subclass _needsSetup]: unrecognized selector sent to instance 0x7fdd73366be0' ( 0 CoreFoundation 0x00000001106baff5 __exceptionPreprocess + 165 1 libobjc.A.dylib 0x0000000110031deb objc_exception_throw + 48 2 CoreFoundation 0x00000001106c361d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205 3 CoreFoundation 0x0000000110610a9a ___forwarding___ + 970 4 CoreFoundation 0x0000000110610648 _CF_forwarding_prep_0 + 120 5 UIKit 0x000000010ded0526 -[UITableView _configureCellForDisplay:forIndexPath:] + 298 6 UIKit 0x000000010deb91a0 -[UITableView _updateAnimationDidStop:finished:context:] + 2484 7 UIKit 0x000000010deb8791 __46-[UITableView _updateWithItems:updateSupport:]_block_invoke1187 + 82 8 Foundation 0x000000010fc1acd9 __NSFireDelayedPerform + 402 9 CoreFoundation 0x000000011061ae14 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20 10 CoreFoundation 0x000000011061a9c1 __CFRunLoopDoTimer + 1089 11 CoreFoundation 0x00000001105dc3d1 __CFRunLoopRun + 1937 12 CoreFoundation 0x00000001105db9b8 CFRunLoopRunSpecific + 488 13 GraphicsServices 0x0000000112748ad2 GSEventRunModal + 161 14 UIKit 0x000000010dd838fc UIApplicationMain + 171 15 Power-tvOS 0x000000010d70170d main + 109 16 libdyld.dylib 0x00000001123aa9e9 start + 1 17 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException
Can we integrate Google's IMA3 SDK on tvos9
I am integrating Google's IMA3 SDk on TVOS9. as per sample app, I have integrated the as per the sample code https://github.com/googleads/googleads-ima-ios/releases. but I am getting following error : Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteNotification imaMessage]: unrecognized selector sent to instance 0x7f823a8886d0' and the stack *** First throw call stack: ( 0 CoreFoundation 0x000000010ce2aff5 __exceptionPreprocess + 165 1 libobjc.A.dylib 0x000000010c22cdeb objc_exception_throw + 48 2 CoreFoundation 0x000000010ce3361d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205 3 CoreFoundation 0x000000010cd80a9a ___forwarding___ + 970 4 CoreFoundation 0x000000010cd80648 _CF_forwarding_prep_0 + 120 5 App 0x000000010af420f1 -[IMAJavascriptBridge handleMessageInitialized:] + 157 6 CoreFoundation 0x000000010cdf782c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12 7 CoreFoundation 0x000000010cdf756b _CFXRegistrationPost + 427 8 CoreFoundation 0x000000010cdf72d2 ___CFXNotificationPost_block_invoke + 50 9 CoreFoundation 0x000000010ce3cb02 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1986 10 CoreFoundation 0x000000010ccf2409 _CFXNotificationPost + 633 11 Foundation 0x000000010bdba259 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66 12 App 0x000000010af43c72 -[IMAJavascriptSession didReceiveMessage:] + 304 13 App 0x000000010af43008 -[IMAJavascriptDispatcher processNewMessage:] + 310 14 App 0x000000010af42bcb -[IMAJavascriptDispatcher processNewMessageWithChannelName:data:] + 144 15 App 0x000000010af42633 -[IMAJavascriptBridge webView:didReceiveMessage:] + 165 16 App 0x000000010af5a8f9 -[IMAWKWebView userContentController:didReceiveScriptMessage:] + 164 17 WebKit 0x000000010f311ced _ZN28ScriptMessageHandlerDelegate14didPostMessageERN6WebKit12WebPageProxyERNS0_13WebFrameProxyERKNS0_18SecurityOriginDataERN7WebCore21SerializedScriptValueE + 217 18 WebKit 0x000000010f2c2b73 _ZN6WebKit29WebUserContentControllerProxy14didPostMessageERN3IPC10ConnectionEyyRKNS_18SecurityOriginDataEyRKNS1_13DataReferenceE + 221 19 WebKit 0x000000010f2c4868 _ZN3IPC13handleMessageIN8Messages29WebUserContentControllerProxy14DidPostMessageEN6WebKit29WebUserContentControllerProxyEMS5_FvRNS_10ConnectionEyyRKNS4_18SecurityOriginDataEyRKNS_13DataReferenceEEEEvS7_RNS_14MessageDecoderEPT0_T1_ + 142 20 WebKit 0x000000010f1239e5 _ZN3IPC18MessageReceiverMap15dispatchMessageERNS_10ConnectionERNS_14MessageDecoderE + 113 21 WebKit 0x000000010f2a6210 _ZN6WebKit15WebProcessProxy17didReceiveMessageERN3IPC10ConnectionERNS1_14MessageDecoderE + 24 22 WebKit 0x000000010f0e191a _ZN3IPC10Connection15dispatchMessageENSt3__110unique_ptrINS_14MessageDecoderENS1_14default_deleteIS3_EEEE + 102 23 WebKit 0x000000010f0e3be2 _ZN3IPC10Connection18dispatchOneMessageEv + 114 24 JavaScriptCore 0x000000010bab0ad5 _ZN3WTF7RunLoop11performWorkEv + 437 25 JavaScriptCore 0x000000010bab11b2 _ZN3WTF7RunLoop11performWorkEPv + 34 26 CoreFoundation 0x000000010cd56bc1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 27 CoreFoundation 0x000000010cd4caec __CFRunLoopDoSources0 + 556 28 CoreFoundation 0x000000010cd4bfa3 __CFRunLoopRun + 867 29 CoreFoundation 0x000000010cd4b9b8 CFRunLoopRunSpecific + 488 30 GraphicsServices 0x0000000110bcdad2 GSEventRunModal + 161 31 UIKit 0x000000010db9c8fc UIApplicationMain + 171 32 App 0x000000010af35b2d main + 109 33 libdyld.dylib 0x00000001107a99e9 start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException
AFAIK Google IMA depends on WebKit which does not exist on tvOS, so you cannot use this on tvOS yet. Google will need to release a build specifically for tvOS...
JSON framework error
I am trying to run the salesforce ios phonegap app for mobile sdk project named https://github.com/forcedotcom/SalesforceMobileSDK-iOS/tree/master/hy... The app starts but stops with the Exception: 2012-01-09 17:18:15.897 VFConnector[1354:207] -[NSCFString JSONValue]: unrecognized selector sent to instance 0x5aac9b0 2012-01-09 17:18:15.916 VFConnector[1354:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '- [NSCFString JSONValue]: unrecognized selector sent to instance 0x5aac9b0' *** Call stack at first throw: ( 0 CoreFoundation 0x01a775a9 __exceptionPreprocess + 185 1 libobjc.A.dylib 0x01bcb313 objc_exception_throw + 44 2 CoreFoundation 0x01a790bb - [NSObject(NSObject) doesNotRecognizeSelector:] + 187 3 CoreFoundation 0x019e8966 ___forwarding___ + 966 4 CoreFoundation 0x019e8522 _CF_forwarding_prep_0 + 50 5 VFConnector 0x00004af3 - [SalesforceOAuthPlugin populateOAuthProperties:] + 99 6 VFConnector 0x00003a8d - [SalesforceOAuthPlugin authenticate:withDict:] + 365 7 VFConnector 0x0001772b -[PhoneGapDelegate execute:] + 434 8 VFConnector 0x00002d67 - [SFContainerAppDelegate execute:] + 71 9 VFConnector 0x00017150 -[PhoneGapDelegate executeQueuedCommands] + 265 10 VFConnector 0x000171fd -[PhoneGapDelegate flushCommandQueue] + 81 11 VFConnector 0x0001756c -[PhoneGapDelegate webView:shouldStartLoadWithRequest:navigationType:] + 822 12 VFConnector 0x00003060 - [SFContainerAppDelegate webView:shouldStartLoadWithRequest:navigationType:] + 96 13 UIKit 0x004bea92 -[UIWebView webView:decidePolicyForNavigationAction:request:frame:decisionListener:] + 291 14 CoreFoundation 0x019e7c7d __invoking___ + 29 15 CoreFoundation 0x019e7b51 -[NSInvocation invoke] + 145 16 CoreFoundation 0x01a15858 -[NSInvocation invokeWithTarget:] + 72 17 WebKit 0x025d8c76 - [_WebSafeForwarder forwardInvocation:] + 182 18 CoreFoundation 0x019e8a04 ___forwarding___ + 1124 19 CoreFoundation 0x019e8522 _CF_forwarding_prep_0 + 50 20 CoreFoundation 0x019e7c7d __invoking___ + 29 21 CoreFoundation 0x019e7b51 -[NSInvocation invoke] + 145 22 WebCore 0x030cc150 _ZL20HandleDelegateSourcePv + 64 23 CoreFoundation 0x01a588ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15 24 CoreFoundation 0x019b688b __CFRunLoopDoSources0 + 571 25 CoreFoundation 0x019b5d86 __CFRunLoopRun + 470 26 CoreFoundation 0x019b5840 CFRunLoopRunSpecific + 208 27 CoreFoundation 0x019b5761 CFRunLoopRunInMode + 97 28 GraphicsServices 0x021141c4 GSEventRunModal + 217 29 GraphicsServices 0x02114289 GSEventRun + 115 30 UIKit 0x00335c93 UIApplicationMain + 1160 31 VFConnector 0x00002777 main + 135 32 VFConnector 0x000026e5 start + 53 33 ??? 0x00000001 0x0 + 1 ) terminate called after throwing an instance of 'NSException' Please Help because I am stuck on this for 2 days!
The error is a JSON library dependency issue. Ensure all the JSON libraries required are installed.
Code-golf: Output multiplication table to the Console
Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. I recently pointed a student doing work experience to an article about dumping a multiplication table to the console. It used a nested for loop and multiplied the step value of each. This looked like a .NET 2.0 approach. I was wondering, with the use of Linq and extension methods,for example, how many lines of code it would take to achieve the same result. Is the stackoverflow community up to the challenge? The challenge: In a console application, write code to generate a table like this example: 01 02 03 04 05 06 07 08 09 02 04 06 08 10 12 14 16 18 03 06 09 12 15 18 21 24 27 04 08 12 16 20 24 28 32 36 05 10 15 20 25 30 35 40 45 06 12 18 24 30 36 42 48 54 07 14 21 28 35 42 49 56 63 08 16 24 32 40 48 56 64 72 09 18 27 36 45 54 63 72 81 As this turned into a language-agnostic code-golf battle, I'll go with the communities decision about which is the best solution for the accepted answer. There's been alot of talk about the spec and the format that the table should be in, I purposefully added the 00 format but the double new-line was originally only there because I didn't know how to format the text when creating the post!
J - 8 chars - 24 chars for proper format */~1+i.9 Gives: 1 2 3 4 5 6 7 8 9 2 4 6 8 10 12 14 16 18 3 6 9 12 15 18 21 24 27 4 8 12 16 20 24 28 32 36 5 10 15 20 25 30 35 40 45 6 12 18 24 30 36 42 48 54 7 14 21 28 35 42 49 56 63 8 16 24 32 40 48 56 64 72 9 18 27 36 45 54 63 72 81 This solution found by #earl: 'r(0)q( )3.'8!:2*/~1+i.9 Gives: 01 02 03 04 05 06 07 08 09 02 04 06 08 10 12 14 16 18 03 06 09 12 15 18 21 24 27 04 08 12 16 20 24 28 32 36 05 10 15 20 25 30 35 40 45 06 12 18 24 30 36 42 48 54 07 14 21 28 35 42 49 56 63 08 16 24 32 40 48 56 64 72 09 18 27 36 45 54 63 72 81
MATLAB - 10 characters a=1:9;a'*a ... or 33 characters for stricter output format a=1:9;disp(num2str(a'*a,'%.2d '))
Brainf**k - 185 chars >---------[++++++++++>---------[+<[-<+>>+++++++++[->+>>---------[>-<++++++++++<]<[>]>>+<<<<]>[-<+>]<---------<]<[->+<]>>>>++++[-<++++>]<[->++>+++>+++<<<]>>>[.[-]<]<]++++++++++.[-<->]<+]
cat - 252 characters 01 02 03 04 05 06 07 08 09 02 04 06 08 10 12 14 16 18 03 06 09 12 15 18 21 24 27 04 08 12 16 20 24 28 32 36 05 10 15 20 25 30 35 40 45 06 12 18 24 30 36 42 48 54 07 14 21 28 35 42 49 56 63 08 16 24 32 40 48 56 64 72 09 18 27 36 45 54 63 72 81 Assuming that a trailing newline is wanted; otherwise, 251 chars. * runs *
Python - 61 chars r=range(1,10) for y in r:print"%02d "*9%tuple(y*x for x in r)
C# This is only 2 lines. It uses lambdas not extension methods var nums = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; nums.ForEach(n => { nums.ForEach(n2 => Console.Write((n * n2).ToString("00 "))); Console.WriteLine(); }); and of course it could be done in one long unreadable line new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9 }.ForEach(n => { new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9 }.ForEach(n2 => Console.Write((n * n2).ToString("00 "))); Console.WriteLine(); }); all of this is assuming you consider a labmda one line?
K - 12 characters Let's take the rosetta-stoning seriously, and compare Kdb+'s K4 with the canonical J solution (*/~1+i.9): a*/:\:a:1+!9 1 2 3 4 5 6 7 8 9 2 4 6 8 10 12 14 16 18 3 6 9 12 15 18 21 24 27 4 8 12 16 20 24 28 32 36 5 10 15 20 25 30 35 40 45 6 12 18 24 30 36 42 48 54 7 14 21 28 35 42 49 56 63 8 16 24 32 40 48 56 64 72 9 18 27 36 45 54 63 72 81 J's "table" operator (/) equals the K "each-left each-right" (/:\:) idiom. We don't have J's extremely handy "reflexive" operator (~) in K, so we have to pass a as both left and right argument.
Fortran95 - 40 chars (beating perl by 4 chars!) This solution does print the leading zeros as per the spec. print"(9(i3.2))",((i*j,i=1,9),j=1,9);end
Oracle SQL, 103 characters: select n, n*2, n*3, n*4, n*5, n*6, n*7, n*8, n*9 from (select rownum n from dual CONNECT BY LEVEL < 10)
C# - 117, 113, 99, 96, 95 89 characters updated based on NickLarsen's idea for(int x=0,y;++x<10;) for(y=x;y<x*10;y+=x) Console.Write(y.ToString(y<x*9?"00 ":"00 \n")); 99, 85, 82 81 characters ... If you don't care about the leading zeros and would allow tabs for alignment. for(int x=0,y;++x<10;) { var w=""; for(y=1;++y<10;) w+=x*y+" "; Console.WriteLine(w); }
COBOL - 218 chars -> 216 chars PROGRAM-ID.P.DATA DIVISION.WORKING-STORAGE SECTION. 1 I PIC 9. 1 N PIC 99. PROCEDURE DIVISION.PERFORM 9 TIMES ADD 1 TO I SET N TO I PERFORM 9 TIMES DISPLAY N' 'NO ADVANCING ADD I TO N END-PERFORM DISPLAY'' END-PERFORM. Edit 216 chars (probably a different compiler) PROGRAM-ID.P.DATA DIVISION.WORKING-STORAGE SECTION. 1 I PIC 9. 1 N PIC 99. PROCEDURE DIVISION. PERFORM B 9 TIMES STOP RUN. B. ADD 1 TO I set N to I PERFORM C 9 TIMES DISPLAY''. C. DISPLAY N" "NO ADVANCING Add I TO N.
Not really a one-liner, but the shortest linq i can think of: var r = Enumerable.Range(1, 9); foreach (var z in r.Select(n => r.Select(m => n * m)).Select(a => a.Select(b => b.ToString("00 ")))) { foreach (var q in z) Console.Write(q); Console.WriteLine(); } In response to combining this and SRuly's answer Enumberable.Range(1,9).ToList.ForEach(n => Enumberable.Range(1,9).ToList.ForEach(n2 => Console.Write((n * n2).ToString("00 "))); Console.WriteLine(); });
Ruby - 42 Chars (including one linebreak, interactive command line only) This method is two lines of input and only works in irb (because irb gives us _), but shortens the previous method by a scant 2 charcters. 1..9 _.map{|y|puts"%02d "*9%_.map{|x|x*y}} Ruby - 44 Chars (tied with perl) (a=1..9).map{|y|puts"%02d "*9%a.map{|x|x*y}} Ruby - 46 Chars 9.times{|y|puts"%02d "*9%(1..9).map{|x|x*y+x}} Ruby - 47 Chars And back to a double loop (1..9).map{|y|puts"%02d "*9%(1..9).map{|x|x*y}} Ruby - 54 chars! Using a single loop saves a couple of chars! (9..89).map{|n|print"%02d "%(n/9*(x=n%9+1))+"\n"*(x/9)} Ruby - 56 chars 9.times{|x|puts (1..9).map{|y|"%.2d"%(y+x*y)}.join(" ")}
Haskell — 85 84 79 chars r=[1..9] s x=['0'|x<=9]++show x main=mapM putStrLn[unwords[s$x*y|x<-r]|y<-r] If double spacing is required (89 81 chars), r=[1..9] s x=['0'|x<=9]++show x main=mapM putStrLn['\n':unwords[s$x*y|x<-r]|y<-r]
F# - 61 chars: for y=1 to 9 do(for x=1 to 9 do printf"%02d "(x*y));printfn"" If you prefer a more applicative/LINQ-y solution, then in 72 chars: [1..9]|>Seq.iter(fun y->[1..9]|>Seq.iter((*)y>>printf"%02d ");printfn"")
c# - 125, 123 chars (2 lines): var r=Enumerable.Range(1,9).ToList(); r.ForEach(n=>{var s="";r.ForEach(m=>s+=(n*m).ToString("00 "));Console.WriteLine(s);});
C - 97 79 characters #define f(i){int i=0;while(i++<9) main()f(x)f(y)printf("%.2d ",x*y);puts("");}}
Perl, 44 chars (No hope of coming anywhere near J, but languages with matrix ops are in a class of their own here...) for$n(1..9){printf"%3d"x9 .$/,map$n*$_,1..9}
R (very similar to Matlab on this level): 12 characters. > 1:9%*%t(1:9) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 1 2 3 4 5 6 7 8 9 [2,] 2 4 6 8 10 12 14 16 18 [3,] 3 6 9 12 15 18 21 24 27 [4,] 4 8 12 16 20 24 28 32 36 [5,] 5 10 15 20 25 30 35 40 45 [6,] 6 12 18 24 30 36 42 48 54 [7,] 7 14 21 28 35 42 49 56 63 [8,] 8 16 24 32 40 48 56 64 72 [9,] 9 18 27 36 45 54 63 72 81
PHP, 71 chars for($x=0;++$x<10;print"\n"){for($y=0;++$y<10;){printf("%02d ",$x*$y);}} Output: $ php -r 'for($x=0;++$x<10;print"\n"){for($y=0;++$y<10;){printf("%02d ",$x*$y);}}' 01 02 03 04 05 06 07 08 09 02 04 06 08 10 12 14 16 18 03 06 09 12 15 18 21 24 27 04 08 12 16 20 24 28 32 36 05 10 15 20 25 30 35 40 45 06 12 18 24 30 36 42 48 54 07 14 21 28 35 42 49 56 63 08 16 24 32 40 48 56 64 72 09 18 27 36 45 54 63 72 81
C#, 135 chars, nice and clean: var rg = Enumerable.Range(1, 9); foreach (var rc in from r in rg from c in rg select (r * c).ToString("D2") + (c == 9 ? "\n\n" : " ")) Console.Write(rc);
PostgreSQL: 81 74 chars select array(select generate_series(1,9)*x)from generate_series(1,9)as x;
Ruby - 56 chars :D 9.times{|a|9.times{|b|print"%02d "%((a+1)*(b+1))};puts;}
C - 66 Chars This resolves the complaint about the second parameter of main :) main(x){for(x=8;x++<89;)printf("%.2d%c",x/9*(x%9+1),x%9<8?32:10);} C - 77 chars Based on dreamlax's 97 char answer. His current answer somewhat resembles this one now :) Compiles ok with gcc, and main(x,y) is fair game for golf i reckon #define f(i){for(i=0;i++<9;) main(x,y)f(x)f(y)printf("%.2d ",x*y);puts("");}}
XQuery 1.0 (96 bytes) string-join(for$x in 1 to 9 return(for$y in 1 to 9 return concat(0[$x*$y<10],$x*$y,' '),' '),'') Run (with XQSharp) with: xquery table.xq !method=text
Scala - 77 59 58 chars print(1 to 9 map(p=>1 to 9 map(q=>"%02d "format(p*q))mkString)mkString("\n")) Sorry, I had to do this, the Scala solution by Malax was way too readable... [Edit] For comprehension seems to be the better choice: for(p<-1 to 9;q<-{println;1 to 9})print("%02d "format p*q) [Edit] A much longer solution, but without multiplication, and much more obfuscated: val s=(1 to 9).toSeq (s:\s){(p,q)=>println(q.map("%02d "format _)mkString) q zip(s)map(t=>t._1+t._2)}
PHP, 62 chars for(;$x++<9;print"\n",$y=0)while($y++<9)printf("%02d ",$x*$y);
Java - 155 137 chars Update 1: replaced string building by direct printing. Saved 18 chars. class M{public static void main(String[]a){for(int x,y=0,z=10;++y<z;System.out.println())for(x=0;++x<z;System.out.printf("%02d ",x*y));}} More readable format: class M{ public static void main(String[]a){ for(int x,y=0,z=10;++y<z;System.out.println()) for(x=0;++x<z;System.out.printf("%02d ",x*y)); } }
Another attempt using C#/Linq with GroupJoin: Console.Write( String.Join( Environment.NewLine, Enumerable.Range(1, 9) .GroupJoin(Enumerable.Range(1, 9), y => 0, x => 0, (y, xx) => String.Join(" ", xx.Select(x => x * y))) .ToArray()));
Ruby — 47 chars puts (a=1..9).map{|i|a.map{|j|"%2d"%(j*i)}*" "} Output 1 2 3 4 5 6 7 8 9 2 4 6 8 10 12 14 16 18 3 6 9 12 15 18 21 24 27 4 8 12 16 20 24 28 32 36 5 10 15 20 25 30 35 40 45 6 12 18 24 30 36 42 48 54 7 14 21 28 35 42 49 56 63 8 16 24 32 40 48 56 64 72 9 18 27 36 45 54 63 72 81 (If we ignore spacing, it becomes 39: puts (a=1..9).map{|i|a.map{|j|j*i}*" "} And anyway, I feel like there's a bit of room for improvement with the wordy map stuff.)