text
stringlengths
8
267k
meta
dict
Q: Passing in an Object to an abstract type's constructor in C++ I'm trying to create CnD_Message_Handler of parent type i_MessageHandler. i_MessageHandler constructor takes a i_MessageFactory, another abstract class. CnD_Message_Factory inherits from i_MessageFactory. When I try to instantiate the CnD_Message_Handler, I get the following error: error C2664: 'CnD_Message_Handler::CnD_Message_Handler' : cannot convert parameter 1 from 'CnD_Message_Factory' to 'const CnD_Message_Handler &' Reason: cannot convert from 'CnD_Message_Factory' to 'const CnD_Message_Handler' From examples online, I believe I'm passing msg_factory correctly. I'm also confused as the constructor requests i_MessageFactory(CnD_Message_Factory) instead of i_MessageHandler(CnD_Message_Handler) Thanks for any help in advance! CnD_Device (which instantiates CnD_Message_Factory and CnD_Message_Handler) CnD_Device::CnD_Device(void) { CnD_Message_Factory msg_factory; //Inherited by i_MessageFactory CnD_Message_Handler msg_handler( msg_factory ); } CnD_Message_Factory #include "i_messagefactory.h" class CnD_Message_Factory : public i_MessageFactory { public: CnD_Message_Factory(void); ~CnD_Message_Factory(void); /** * Creates a message using the stream of data passed in. * @param id Id of the message to create. * @param stream Data stream to create the message from. * @return The created message (which must be returned to the factory by * calling the deleteMessage() method, or null if the factory could not * create a message. */ Message* createMessage(UInt32 id, const char* stream); /** * Returns a message to the factory for deleting/recycling. * @param msg The message being returned. */ void deleteMessage(Message& msg); }; CnD_Message_Handler #include "i_messagehandler.h" class CnD_Message_Handler : public i_MessageHandler { public: CnD_Message_Handler::~CnD_Message_Handler(void); /** * Called by a i_MessageDriver object to process a message received. * @param msg Message to process. */ void CnD_Message_Handler::handleMessage (Message& msg); /** * Called by a i_MessageDriver object when an error occurs with an * interface The exact type of errors are driver specific. * @param error The error that occurred. */ void CnD_Message_Handler::handleError (MessageEvent& error); /** * Called by the i_MessageDriver object when an event occurs with an * interface. The exact type of events are driver specific. * @param event The event that occurred. */ void CnD_Message_Handler::handleEvent (MessageEvent& event); }; i_MessageHandler class i_MessageFactory { public: /** * Destructor. */ virtual ~i_MessageFactory(void) { } /** * Creates a message using the stream of data passed in. * @param id Id of the message to create. * @param stream Data stream to create the message from. * @return The created message (which must be returned to the factory by * calling the deleteMessage() method, or null if the factory could not * create a message. */ virtual Message* createMessage(UInt32 id, const char* stream) = 0; /** * Returns a message to the factory for deleting/recycling. * @param msg The message being returned. */ virtual void deleteMessage(Message& msg) = 0; protected: /** * Constructor. */ i_MessageFactory(void) { } }; A: CnD_Message_Handler does not redefine the constructor. Constructors are not "inherited" in C++03. You are required to provide constructor arguments for all types you inherit from. Here is an example. struct Arg {}; struct Foo { Foo(Arg arg) {} virtual ~Foo() {} }; struct Bar : public Foo { Bar(Arg arg) : Foo(arg) {} }; They can be inherited C++11, but require special syntax. struct Bar : public Foo { using Foo::Foo; }; A: CnD_Message_Handler has no user defined constructors. Instead its trying to use the copy constructor that the compiler gives you for free, and its telling you it can't convert the factory you passed in to the const CnD_Message_Handler& that the compiler-provided copy constructor expects. Simply define a constructor for CnD_Message_Handler to take a factory and instantiate its base class: CnD_Message_Handler(i_MessageFactory& foo) : i_MessageHandler(foo) {} A: What are the constructors defined by CnD_Message_Handler? You need one that takes a (reference to a) i_MessageFactory (or CnD_Message_Factory). If not, it'll try the constructors generated automagically, like the copy constructor. And I think that is what's happening here.
{ "language": "en", "url": "https://stackoverflow.com/questions/7636611", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "2" }
Q: JVM Fatal Error in native code, Not sure what to do I'm developing a game in Java using LWJGL. Along with the main game, I'm developing a few Swing-based applications (a launcher, a configuration editor, and a map editor). When I run the launcher, I sometimes (about 10% of the time) get a fatal JVM crash. It's very strange - I can run the program a few seconds later and everything works. I have zero compilation errors or warnings, and when the program does work, it's completely functional. I haven't gotten the error when I run my LWJGL game, it's only when I run the launcher first. The process I use to initialize the launcher is: * *Tell swing to use a Substance Look and Feel for window decoration. *Setup a directory on the user's computer in which to store files (save games, configurations, etc). *Check if extracting the LWJGL required libraries to the previously mentioned directory is necessary; if so, extract them. Then, set the LWJGL path property of the JVM (this allows LWJGL methods to function). (This has been extensively tested by itself; I don't know if it would somehow interfere with the Substance LaF. I wouldn't expect it to.) *Initialize the launcher window. It has a central image and a series of JButtons. *Begin looping a background soundtrack for ambiance using JLayer. This error would occur before I implemented this feature, and adding it did not change anything. The error I get is as follows: # # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000007fefd800c7b, pid=6128, tid=4364 # # JRE version: 6.0_27-b07 # Java VM: Java HotSpot(TM) 64-Bit Server VM (20.2-b06 mixed mode windows-amd64 compressed oops) # Problematic frame: # C [ole32.dll+0x10c7b] # # An error report file with more information is saved as: # J:\Development\workspace\Crypt Utils\hs_err_pid6128.log # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # Then, the error log file: # # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000007fefd800c7b, pid=6128, tid=4364 # # JRE version: 6.0_27-b07 # Java VM: Java HotSpot(TM) 64-Bit Server VM (20.2-b06 mixed mode windows-amd64 compressed oops) # Problematic frame: # C [ole32.dll+0x10c7b] # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # --------------- T H R E A D --------------- Current thread (0x000000000713d000): JavaThread "AWT-EventQueue-0" [_thread_in_native, id=4364, stack(0x0000000007e30000,0x0000000007f30000)] siginfo: ExceptionCode=0xc0000005, writing address 0x0000000000000038 Registers: RAX=0x0000000000000000, RBX=0x000000000b933c70, RCX=0x000000000000110c, RDX=0x000007fefd996620 RSP=0x0000000007f2dfa0, RBP=0x000000000026dc90, RSI=0x0000000000000000, RDI=0x000000000b933c70 R8 =0x00000000000003d4, R9 =0x000007fefd977f18, R10=0x0000000000000000, R11=0x0000000007f2dec0 R12=0x0000000000000000, R13=0x000000000b90a3c0, R14=0x0000000000000000, R15=0x0000000000000000 RIP=0x000007fefd800c7b, EFLAGS=0x0000000000010246 Top of Stack: (sp=0x0000000007f2dfa0) 0x0000000007f2dfa0: 000000000b933c70 0000000000000000 0x0000000007f2dfb0: 0000000000000000 000007fefd81311b 0x0000000007f2dfc0: 0000000000000000 0000000007f2e050 0x0000000007f2dfd0: 000017f000001000 d0b221343c39b318 0x0000000007f2dfe0: 000081de6b223eb8 000007fefd813032 0x0000000007f2dff0: 0000000000000001 00000000070e9c18 0x0000000007f2e000: 0000000000000000 000000000026dc90 0x0000000007f2e010: 000000000713d1d0 000007fefd801225 0x0000000007f2e020: 0000000007f2e080 000000000026dc90 0x0000000007f2e030: 0000000000000000 000000000000008c 0x0000000007f2e040: 000000000c797be0 000007fefd963135 0x0000000007f2e050: 000000000026dc90 000000000713ca28 0x0000000007f2e060: 0000000006697d00 000007fefd0f8c12 0x0000000007f2e070: 000000000c797be0 000007fefd91de9d 0x0000000007f2e080: 000000000026dc90 00000000070e9c18 0x0000000007f2e090: 0000000000000018 0000000000000514 Instructions: (pc=0x000007fefd800c7b) 0x000007fefd800c5b: 60 1c 00 41 b8 d4 03 00 00 e8 47 82 01 00 85 f6 0x000007fefd800c6b: 78 2b f3 0f 6f 44 24 30 48 8b 45 18 4c 89 6d 20 0x000007fefd800c7b: f3 0f 7f 40 30 f6 45 0c 01 75 12 48 8b cd e8 be 0x000007fefd800c8b: fa ff ff 8b f0 85 c0 78 04 83 4d 0c 01 48 8b cd Register to memory mapping: RAX=0x0000000000000000 is an unknown value RBX=0x000000000b933c70 is an unknown value RCX=0x000000000000110c is an unknown value RDX=0x000007fefd996620 is an unknown value RSP=0x0000000007f2dfa0 is pointing into the stack for thread: 0x000000000713d000 RBP=0x000000000026dc90 is an unknown value RSI=0x0000000000000000 is an unknown value RDI=0x000000000b933c70 is an unknown value R8 =0x00000000000003d4 is an unknown value R9 =0x000007fefd977f18 is an unknown value R10=0x0000000000000000 is an unknown value R11=0x0000000007f2dec0 is pointing into the stack for thread: 0x000000000713d000 R12=0x0000000000000000 is an unknown value R13=0x000000000b90a3c0 is an unknown value R14=0x0000000000000000 is an unknown value R15=0x0000000000000000 is an unknown value Stack: [0x0000000007e30000,0x0000000007f30000], sp=0x0000000007f2dfa0, free space=1015k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [ole32.dll+0x10c7b] CLSIDFromString+0x5fb Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) sun.awt.windows.WComponentPeer.addNativeDropTarget()J+0 sun.awt.windows.WComponentPeer.addDropTarget(Ljava/awt/dnd/DropTarget;)V+9 java.awt.dnd.DropTarget.addNotify(Ljava/awt/peer/ComponentPeer;)V+60 java.awt.Component.addNotify()V+297 java.awt.Container.addNotify()V+8 javax.swing.JComponent.addNotify()V+1 java.awt.Container.addNotify()V+61 javax.swing.JComponent.addNotify()V+1 java.awt.Container.addNotify()V+61 javax.swing.JComponent.addNotify()V+1 javax.swing.JMenuBar.addNotify()V+1 java.awt.Container.addNotify()V+61 javax.swing.JComponent.addNotify()V+1 org.pushingpixels.substance.internal.utils.SubstanceTitlePane.addNotify()V+1 java.awt.Container.addNotify()V+61 javax.swing.JComponent.addNotify()V+1 java.awt.Container.addNotify()V+61 javax.swing.JComponent.addNotify()V+1 javax.swing.JRootPane.addNotify()V+5 java.awt.Container.addNotify()V+61 java.awt.Window.addNotify()V+73 java.awt.Frame.addNotify()V+70 java.awt.Window.pack()V+28 gui.launcher.LauncherWindow.()V+156 main.Crypt.runLauncher()V+28 main.Crypt$1.run()V+0 java.awt.event.InvocationEvent.dispatch()V+47 java.awt.EventQueue.dispatchEventImpl(Ljava/awt/AWTEvent;Ljava/lang/Object;)V+21 java.awt.EventQueue.access$000(Ljava/awt/EventQueue;Ljava/awt/AWTEvent;Ljava/lang/Object;)V+3 java.awt.EventQueue$1.run()Ljava/lang/Void;+12 java.awt.EventQueue$1.run()Ljava/lang/Object;+1 v ~StubRoutines::call_stub java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;+0 java.security.AccessControlContext$1.doIntersectionPrivilege(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;Ljava/security/AccessControlContext;)Ljava/lang/Object;+28 java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V+46 java.awt.EventDispatchThread.pumpOneEventForFilters(I)Z+204 java.awt.EventDispatchThread.pumpEventsForFilter(ILjava/awt/Conditional;Ljava/awt/EventFilter;)V+30 java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Component;)V+11 java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V+4 java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V+3 java.awt.EventDispatchThread.run()V+9 v ~StubRoutines::call_stub --------------- P R O C E S S --------------- Java Threads: ( => current thread ) 0x0000000007309000 JavaThread "Substance heap status" daemon [_thread_blocked, id=5732, stack(0x000000000c000000,0x000000000c100000)] 0x000000000737e000 JavaThread "Headspace mixer frame proc thread" daemon [_thread_blocked, id=5520, stack(0x000000000bd00000,0x000000000be00000)] 0x00000000072a2800 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=2956, stack(0x000000000b700000,0x000000000b800000)] 0x00000000071dc800 JavaThread "Thread-3" [_thread_in_native, id=4104, stack(0x00000000082b0000,0x00000000083b0000)] 0x00000000003db800 JavaThread "DestroyJavaVM" [_thread_blocked, id=5600, stack(0x0000000002570000,0x0000000002670000)] =>0x000000000713d000 JavaThread "AWT-EventQueue-0" [_thread_in_native, id=4364, stack(0x0000000007e30000,0x0000000007f30000)] 0x00000000067af800 JavaThread "AWT-Windows" daemon [_thread_in_native, id=5760, stack(0x0000000007830000,0x0000000007930000)] 0x00000000067ae800 JavaThread "AWT-Shutdown" [_thread_blocked, id=2600, stack(0x0000000007730000,0x0000000007830000)] 0x00000000066ea800 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=4244, stack(0x00000000074e0000,0x00000000075e0000)] 0x0000000006684000 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=5196, stack(0x0000000006d10000,0x0000000006e10000)] 0x0000000006681000 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=4192, stack(0x0000000006c10000,0x0000000006d10000)] 0x000000000666e000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=4260, stack(0x0000000006b10000,0x0000000006c10000)] 0x000000000666b000 JavaThread "Attach Listener" daemon [_thread_blocked, id=5008, stack(0x0000000006a10000,0x0000000006b10000)] 0x0000000006666000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=4032, stack(0x0000000006910000,0x0000000006a10000)] 0x000000000064b800 JavaThread "Finalizer" daemon [_thread_blocked, id=1132, stack(0x0000000006810000,0x0000000006910000)] 0x0000000000649000 JavaThread "Reference Handler" daemon [_thread_blocked, id=5336, stack(0x0000000006510000,0x0000000006610000)] Other Threads: 0x0000000000641000 VMThread [stack: 0x0000000006410000,0x0000000006510000] [id=3820] 0x0000000006697000 WatcherThread [stack: 0x0000000006e10000,0x0000000006f10000] [id=5156] VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None Heap PSYoungGen total 19136K, used 15506K [0x00000000eaab0000, 0x00000000ec000000, 0x0000000100000000) eden space 16448K, 94% used [0x00000000eaab0000,0x00000000eb9d4b98,0x00000000ebac0000) from space 2688K, 0% used [0x00000000ebd60000,0x00000000ebd60000,0x00000000ec000000) to space 2688K, 0% used [0x00000000ebac0000,0x00000000ebac0000,0x00000000ebd60000) PSOldGen total 43712K, used 0K [0x00000000c0000000, 0x00000000c2ab0000, 0x00000000eaab0000) object space 43712K, 0% used [0x00000000c0000000,0x00000000c0000000,0x00000000c2ab0000) PSPermGen total 21248K, used 15942K [0x00000000bae00000, 0x00000000bc2c0000, 0x00000000c0000000) object space 21248K, 75% used [0x00000000bae00000,0x00000000bbd91870,0x00000000bc2c0000) Code Cache [0x0000000002670000, 0x00000000028e0000, 0x0000000005670000) total_blobs=470 nmethods=39 adapters=385 free_code_cache=49729536 largest_free_block=6336 Dynamic libraries: 0x0000000000400000 - 0x000000000042e000 C:\Program Files\Java\jre6\bin\javaw.exe 0x00000000770f0000 - 0x0000000077299000 C:\Windows\SYSTEM32\ntdll.dll 0x0000000076ed0000 - 0x0000000076fef000 C:\Windows\system32\kernel32.dll 0x000007fefd0f0000 - 0x000007fefd15c000 C:\Windows\system32\KERNELBASE.dll 0x0000000074de0000 - 0x0000000074e1f000 C:\Program Files\AVAST Software\Avast\snxhk64.dll 0x000007fefdde0000 - 0x000007fefdebb000 C:\Windows\system32\ADVAPI32.dll 0x000007fefd410000 - 0x000007fefd4af000 C:\Windows\system32\msvcrt.dll 0x000007fefd4b0000 - 0x000007fefd4cf000 C:\Windows\SYSTEM32\sechost.dll 0x000007fefef90000 - 0x000007feff0bd000 C:\Windows\system32\RPCRT4.dll 0x0000000076ff0000 - 0x00000000770ea000 C:\Windows\system32\USER32.dll 0x000007fefdec0000 - 0x000007fefdf27000 C:\Windows\system32\GDI32.dll 0x000007fefee50000 - 0x000007fefee5e000 C:\Windows\system32\LPK.dll 0x000007feff0c0000 - 0x000007feff189000 C:\Windows\system32\USP10.dll 0x000007fefe090000 - 0x000007fefe0be000 C:\Windows\system32\IMM32.DLL 0x000007fefd4d0000 - 0x000007fefd5d9000 C:\Windows\system32\MSCTF.dll 0x000000006d7f0000 - 0x000000006dfa8000 C:\Program Files\Java\jre6\bin\server\jvm.dll 0x000007fefa980000 - 0x000007fefa9bb000 C:\Windows\system32\WINMM.dll 0x000000006d760000 - 0x000000006d76e000 C:\Program Files\Java\jre6\bin\verify.dll 0x000000006d3b0000 - 0x000000006d3d7000 C:\Program Files\Java\jre6\bin\java.dll 0x000000006d7b0000 - 0x000000006d7c2000 C:\Program Files\Java\jre6\bin\zip.dll 0x000000006d000000 - 0x000000006d1c3000 C:\Program Files\Java\jre6\bin\awt.dll 0x000007fefa620000 - 0x000007fefa691000 C:\Windows\system32\WINSPOOL.DRV 0x000007fefd7f0000 - 0x000007fefd9f3000 C:\Windows\system32\ole32.dll 0x000007fefe0c0000 - 0x000007fefee48000 C:\Windows\system32\SHELL32.dll 0x000007fefef10000 - 0x000007fefef81000 C:\Windows\system32\SHLWAPI.dll 0x000007fefbaf0000 - 0x000007fefbce4000 C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_fa396087175ac9ac\COMCTL32.dll 0x000007fefb3b0000 - 0x000007fefb3c8000 C:\Windows\system32\DWMAPI.DLL 0x000007fefb780000 - 0x000007fefb7d6000 C:\Windows\system32\uxtheme.dll 0x000007fef93b0000 - 0x000007fef942f000 C:\Program Files\Common Files\microsoft shared\ink\tiptsf.dll 0x000007fefd5e0000 - 0x000007fefd6b7000 C:\Windows\system32\OLEAUT32.dll 0x000007fefc180000 - 0x000007fefc18c000 C:\Windows\system32\version.dll 0x000007fefcf70000 - 0x000007fefcf7f000 C:\Windows\system32\CRYPTBASE.dll 0x000000006d2a0000 - 0x000000006d306000 C:\Program Files\Java\jre6\bin\fontmanager.dll 0x000000006d600000 - 0x000000006d617000 C:\Program Files\Java\jre6\bin\net.dll 0x000007fefee60000 - 0x000007fefeead000 C:\Windows\system32\WS2_32.dll 0x000007feff210000 - 0x000007feff218000 C:\Windows\system32\NSI.dll 0x000007fefc870000 - 0x000007fefc8c5000 C:\Windows\system32\mswsock.dll 0x000007fefc860000 - 0x000007fefc867000 C:\Windows\System32\wship6.dll 0x000000006d620000 - 0x000000006d62b000 C:\Program Files\Java\jre6\bin\nio.dll 0x0000000180000000 - 0x0000000180050000 C:\Users\Chris\AppData\Roaming\jRabbit Data\LWJGL Natives\lwjgl64.dll 0x000007fef1550000 - 0x000007fef166d000 C:\Windows\system32\OPENGL32.dll 0x000007fef47c0000 - 0x000007fef47ed000 C:\Windows\system32\GLU32.dll 0x000007fef1210000 - 0x000007fef1301000 C:\Windows\system32\DDRAW.dll 0x000007fef8090000 - 0x000007fef8098000 C:\Windows\system32\DCIMAN32.dll 0x000007feff220000 - 0x000007feff3f7000 C:\Windows\system32\SETUPAPI.dll 0x000007fefd160000 - 0x000007fefd196000 C:\Windows\system32\CFGMGR32.dll 0x000007fefd3b0000 - 0x000007fefd3ca000 C:\Windows\system32\DEVOBJ.dll 0x000007fefa2a0000 - 0x000007fefa49f000 C:\Windows\system32\d3d9.dll 0x000007fefa290000 - 0x000007fefa297000 C:\Windows\system32\d3d8thk.dll 0x000007feed900000 - 0x000007feee777000 C:\Windows\system32\nvd3dumx.dll 0x000007fefb860000 - 0x000007fefb88c000 C:\Windows\system32\powrprof.dll 0x000000006d510000 - 0x000000006d53e000 C:\Program Files\Java\jre6\bin\jsound.dll 0x000007fefb730000 - 0x000007fefb77b000 C:\Windows\system32\MMDevAPI.DLL 0x000007fefb940000 - 0x000007fefba6c000 C:\Windows\system32\PROPSYS.dll 0x000007fefa5e0000 - 0x000007fefa61b000 C:\Windows\system32\wdmaud.drv 0x0000000074a00000 - 0x0000000074a06000 C:\Windows\system32\ksuser.dll 0x000007fefbae0000 - 0x000007fefbae9000 C:\Windows\system32\AVRT.dll 0x000007fefa590000 - 0x000007fefa5df000 C:\Windows\system32\AUDIOSES.DLL 0x000007fefa4e0000 - 0x000007fefa4ea000 C:\Windows\system32\msacm32.drv 0x000007fefa4c0000 - 0x000007fefa4d8000 C:\Windows\system32\MSACM32.dll 0x000007fefa4a0000 - 0x000007fefa4a9000 C:\Windows\system32\midimap.dll 0x000000006d210000 - 0x000000006d238000 C:\Program Files\Java\jre6\bin\dcpr.dll 0x000007fefdf30000 - 0x000007fefdfc9000 C:\Windows\system32\CLBCatQ.DLL 0x000007fefcb00000 - 0x000007fefcb17000 C:\Windows\system32\CRYPTSP.dll 0x000007fefc5d0000 - 0x000007fefc617000 C:\Windows\system32\rsaenh.dll 0x000007fefc390000 - 0x000007fefc3ae000 C:\Windows\system32\USERENV.dll 0x000007fefcfa0000 - 0x000007fefcfaf000 C:\Windows\system32\profapi.dll 0x000007fefad70000 - 0x000007fefad85000 C:\Windows\system32\NLAapi.dll 0x000007fefb220000 - 0x000007fefb235000 C:\Windows\system32\napinsp.dll 0x000007fefb200000 - 0x000007fefb219000 C:\Windows\system32\pnrpnsp.dll 0x000007fefc6f0000 - 0x000007fefc74b000 C:\Windows\system32\DNSAPI.dll 0x000007fefbac0000 - 0x000007fefbacb000 C:\Windows\System32\winrnr.dll 0x0000000074700000 - 0x000000007472e000 C:\Program Files\Common Files\Microsoft Shared\Windows Live\WLIDNSP.DLL 0x00000000772b0000 - 0x00000000772b7000 C:\Windows\system32\PSAPI.DLL 0x00000000746d0000 - 0x00000000746f6000 C:\Program Files\Bonjour\mdnsNSP.dll 0x000007fef9ec0000 - 0x000007fef9ee7000 C:\Windows\system32\Iphlpapi.DLL 0x000007fef9eb0000 - 0x000007fef9ebb000 C:\Windows\system32\WINNSI.DLL 0x000007fefc250000 - 0x000007fefc257000 C:\Windows\System32\wshtcpip.dll 0x000007fefb7e0000 - 0x000007fefb7e8000 C:\Windows\system32\rasadhlp.dll 0x000007fef9cf0000 - 0x000007fef9d43000 C:\Windows\System32\fwpuclnt.dll 0x000007fefcf80000 - 0x000007fefcf94000 C:\Windows\system32\RpcRtRemote.dll VM Arguments: jvm_args: -Dfile.encoding=Cp1252 java_command: main.Crypt Launcher Type: SUN_STANDARD Environment Variables: CLASSPATH=.;C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip PATH=C:/Program Files/Java/jre6/bin/server;C:/Program Files/Java/jre6/bin;C:/Program Files/Java/jre6/lib/amd64;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\SlikSvn\bin\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Autodesk\Backburner\;J:\Development\Eclipse; USERNAME=Chris OS=Windows_NT PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 15 Stepping 11, GenuineIntel --------------- S Y S T E M --------------- OS: Windows 7 , 64 bit Build 7601 Service Pack 1 CPU:total 4 (4 cores per cpu, 1 threads per core) family 6 model 15 stepping 11, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3 Memory: 4k page, physical 4193464k(2246544k free), swap 8385080k(6086692k free) vm_info: Java HotSpot(TM) 64-Bit Server VM (20.2-b06) for windows-amd64 JRE (1.6.0_27-b07), built on Jul 19 2011 01:08:22 by "java_re" with MS VC++ 8.0 (VS2005) time: Mon Oct 03 09:29:15 2011 elapsed time: 1 seconds From looking around on Stack Overflow, it seems like this is occasionally related to memory settings. Is that the case here? I've already set Eclipse to run with a lot of memory at its disposal; additionally, I'm only creating a small JFrame with a few components on it, plus initializing the LWJGL libraries. That doesn't take up much memory. A: I often have problems with java 6 and Swing on my Windows Vista 64 box (but only when I launch my app from eclipse). The way to fix it for me was to disable Direct3D: java -Dsun.java2d.d3d=false ... See also http://download.oracle.com/javase/6/docs/technotes/guides/2d/flags.html#d3d for further information. A: Well, the error is from a dll trying to write to memory where it shouldn't. If it happens just sometimes, it may be from not building components on the event dispatch thread. It can't hurt to check. A: This bug report at oracle may be related: http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=e5f1f1011daf96ffffffffdd154dd2e731150?bug_id=6967456 It may be related to swing's drag & drop functionality - see if disabling drag and drop on your form components supresses the error. A: @CodeBunny, that would be comment: 1) is there Trindent.jar 2) how do you apply Substance Look and Feel to the JFrame, SwingUtilities.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(new SubstanceOfficeSilver2007LookAndFeel()); SwingUtilities.updateComponentTreeUI(frame); } catch (UnsupportedLookAndFeelException e) { throw new RuntimeException(e); } } }); in most cases (if there some BackGround task) required usage of invokeAndWait EDIT depends 1) if you are load empty container, then add data (invokeLater) 2) or load everything and wait for that (invokeAndWait), 3) are your contructor for Container in last line contains setVisible(true), last from possible lines, 4) maybe you are outside EDT, something you must loading so heavy, isn't there RepaintManager Error??? 5) disable Substance, if you get this error, then came from mistake in codeing or some your code returns error, otherwise is there something rellated with RepaintManager (overload Native OS Latency) or with Concurency, simple your code is out of EDT, 6) Substance is so sensitive, very sensitive for done code out of EDT issues, remove all Thread.sleep(int) from GUI rellated code
{ "language": "en", "url": "https://stackoverflow.com/questions/7636614", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "3" }
Q: WPF Broken edges I’m experiencing a rather strange problem with WPF. When I place buttons on a form they look fine in design time, they look fine on windows XP but when the application is run on windows 7 the edges become broken. Here is a screen shot of the normal icons (XP and design time) And here is one with the broken edges (windows 7) Any ideas? EDIT: As requested here is the code I use for the button <Button Height="38" HorizontalAlignment="Center" Name="cmdChange_dataset" VerticalAlignment="Center" Width="130" Grid.Column="0" > <Grid Width="120"> <Grid.ColumnDefinitions> <ColumnDefinition Width="auto"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Image Source="/Sales_express_lite_WPF;component/Images/note_to_self_32.png" Stretch="None" Grid.Column="0" HorizontalAlignment="Left"/> <Label Content="Change DataSet" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"/> </Grid> <Button.Effect> <DropShadowEffect BlurRadius="5" Color="Gray" /> </Button.Effect> </Button> A: Maybe is related to this? Layout Rounding on the WPF Text Blog Summary from the blog post: WPF’s layout engine frequently gives elements sub-pixel positions. Antialiasing algorithms cause these sub-pixel positioned elements to be rendered over multiple physical pixels after filtering. This can result in blurry lines and other non desirable rendering artifacts. Layout rounding has been introduced in WPF 4.0 to allow developers to force the WPF layout system to position elements on pixel boundaries, eliminating many of the negative side effects of sub-pixel positioning. The attached property UseLayoutRounding has been introduced to allow layout rounding functionality to be toggled on or off. This property can either be True or False. The value of this property is inherited by an element’s children. <Grid UseLayoutRounding="True" Height="100" Width="200"> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="*"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Rectangle Grid.Row="0" Fill="DarkBlue"/> <Rectangle Grid.Row="1" Fill="DarkBlue"/> <Rectangle Grid.Row="2" Fill="DarkBlue"/> </Grid>
{ "language": "en", "url": "https://stackoverflow.com/questions/7636615", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "3" }
Q: rails 3 jquery button_to remote json not decoding I'm using jQuery in a rails 3.1 project. I use a button_to with :remote => true : <%= button_to "View Examples", "#{requisition_assign_path(@req.id, category_row.id)}?show_examples=1", :remote => true, :method => 'get' %> This gets to the server fine, and is handled here : def show @assignment = Assignment.find params[:id] @tag = @assignment.assignee examples = [] @tag.example[@tag.tag].each do |e| examples << {:id => e.id} end @examples_json = examples.to_json respond_to do |format| format.js {render "assign/show.js.erb"} end end Which calls show.js.erb just fine : alert(jQuery.parseJSON("<%= @examples_json %>"); But in the browser, the text arrives, but I can't get it to parse to the original array of hashes. What am I missing? ---- what I may have been missing is simply using jQuery's getJSON function... A: Could you post the log for this action? One problem I did have with using the built in 'remote' helpers is that they request content in JS, not JSON. With your current controller code you will not get any response from $.getJSON (your controller is set to respond only to JS). You might try to add a respond_to block at the top of the controller respond_to :html, :json and your action might look like def show @assignment = Assignment.find(params[:id]) @tag = assignment.assignee @examples = [] @tag.example[@tag.tag].each do |e| @examples << {:id => e.id} end respond_with(@examples) end What happens is that if you ask for JSON content the Rails 3 default Responder will automatically convert @examples to JSON. You might try this with the generic jQuery AJAX function jQuery.ajax({ url: $(this).attr('href'), type: 'GET', dataType: 'JSON', success: function(data){ json = jQuery.parseJSON(data.responseText); console.log(json); } }); Best regards!
{ "language": "en", "url": "https://stackoverflow.com/questions/7636618", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: cxfreeze (or equivalent) and cross build? Is it possible for cx_freeze (or any other tool with the same purpose) to cross build binaries? I.e. build Windows binary on a Linux PC? Or is this too much to ask? I tried with cx_freeze and got the following: cx_Freeze.freezer.ConfigError: no base named Win32GUI Thanks, A: If you install Python etc. inside Wine, cx_Freeze will run, but it misses out some key DLLs. So no. If building on Windows isn't an option, you can work out the DLLs that it requires, and manually copy them into the build directory after running cx_Freeze. (Technical note: If anyone has the know-how to work on Wine, I believe the BindImageEx function in imagehlp.dll needs to be implemented for this to work)
{ "language": "en", "url": "https://stackoverflow.com/questions/7636619", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "3" }
Q: jquery dynamic href based on user_id I have typed up this little Jquery to dynamically append the href of my billing page based on the users id. It doesn't seem to be working tho? Hopefully someone can point out my mistake. Thanks in advance for your help and code snippets. $individualpage="billing".$_SESSION['user_id'].".php"; $("a#billing").attr("href", "$individualpage"); Link on page <a href="" id="billing">billing</a> A: You're mixing JavaScript (a client-side language) with PHP (a server-side language). Remember that PHP is done by the time JavaScript begins. With that said, try something like this: Somewhere in your PHP page: <?php $individualpage="billing".$_SESSION['user_id'].".php"; ?> Then, within the HTML of the page, use PHP to dump the value to JavaScript so it can pick up and complete the request: $('a#billing').attr('href','<?= $individualpage; ?>'); Although, you're probably better off just dumping it directly in to the <a> tag: <a id="billing" href="<?= $individualpage; ?>" ... >...</a> (And skipping JavaScript altogether.) A: Your probably mixing PHP and JS code together. You need <script> $(function() { var individualpage="billing<?php echo $_SESSION['user_id'] ?>.php"; $("a#billing").attr("href", individualpage); }); </script> in your view script.
{ "language": "en", "url": "https://stackoverflow.com/questions/7636620", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: Hashing gone wrong I'm using the same function to hash values for comparison during login as I am to hash the passwords when users register: Public Shared Function Compute(ByVal text As String, ByVal algorithm As String, Optional ByVal salt() As Byte = Nothing) As String If salt Is Nothing Then Dim saltSize As Integer = 8 salt = New Byte(saltSize - 1) {} Dim rng As New RNGCryptoServiceProvider rng.GetNonZeroBytes(salt) End If Dim textBytes As Byte() = Encoding.UTF8.GetBytes(text) Dim saltedTextBytes() As Byte = New Byte(textBytes.Length + salt.Length - 1) {} For i As Integer = 0 To textBytes.Length - 1 saltedTextBytes(i) = textBytes(i) Next i For i As Integer = 0 To salt.Length - 1 saltedTextBytes(textBytes.Length + i) = salt(i) Next i Dim hash As HashAlgorithm If algorithm Is Nothing Then algorithm = "" End If Select Case algorithm.ToUpper Case "SHA1" : hash = New SHA1Managed Case "SHA256" : hash = New SHA256Managed Case "SHA384" : hash = New SHA384Managed Case "SHA512" : hash = New SHA512Managed Case Else : hash = New MD5CryptoServiceProvider End Select Dim hashBytes As Byte() = hash.ComputeHash(saltedTextBytes) Dim saltedHash() As Byte = New Byte(hashBytes.Length + salt.Length - 1) {} For i As Integer = 0 To hashBytes.Length - 1 saltedHash(i) = hashBytes(i) Next i For i As Integer = 0 To salt.Length - 1 saltedHash(hashBytes.Length + i) = salt(i) Next i Dim hashValue As String = Convert.ToBase64String(saltedHash) Return Left(hashValue, 36) End Function My problem is that when I try to log in on an account whose password was hashed by this function, the hashed values don't match up. I think I'm skipping a step or something. Here's the code for user account creation: ' The email address needs to be valid Dim pattern As String = "^(?("")("".+?""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-zA-Z])@))(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,6}))$" Dim match As Match = Regex.Match(txtEmail.Text, pattern) If match.Success Then 'Hash the user's password before entering it into the database. Dim pass As String = Crypt.Compute(txtPass.Text, "SHA512", Nothing) ' Enter the information from the form into the database. Dim sql As String = "INSERT INTO Users(Username, Password, EmailAddress) " & _ "VALUES(@User, @Pass, @Email)" Dim cmd As New SqlCommand(sql, conn) cmd.Parameters.AddWithValue("@User", txtName.Text) cmd.Parameters.AddWithValue("@Pass", pass) cmd.Parameters.AddWithValue("@Email", txtEmail.Text) conn.Open() cmd.ExecuteNonQuery() conn.Close() Else lblError.Text = "Invalid email address. Please correct." lblError.ForeColor = Drawing.Color.Red End If There are more checks that aren't included here that aren't relevant to my problem. Here's my user login: Dim pass As String = Crypt.Compute(txtPass.Text, "SHA512", Nothing) Dim UserData As New DataSet Dim UserAdapter As New SqlDataAdapter UserAdapter.SelectCommand = New SqlCommand("SELECT * FROM Users " & _ "WHERE Username = @User AND Password = @Pass", conn) UserAdapter.SelectCommand.Parameters.AddWithValue("@User", txtUser.Text) UserAdapter.SelectCommand.Parameters.AddWithValue("@Pass", pass) UserAdapter.Fill(UserData) If UserData.Tables(0).Rows.Count <> 1 Then lblError.Text = "Invalid username or password." lblError.ForeColor = Drawing.Color.Red Session("LoginAttempt") = CInt(Session("LoginAttempt")) + 1 Else Session("LoggedIn") = True Response.Redirect("Home.aspx") End If As far as I can see, there is no difference in the hashing I've done here. Does anyone have any ideas? A: * *When you creating an account by inserting into the table, you are using txtName.Text for the username, but when checking the credentials you are using txtUser.Text. *Why are you using a random salt? Doesn't the salt have to be the same for every encryption? I've pasted your code into a new project, and when I run the Compute method twice in a row for the same password, I get two different results... obviously that won't work. Try passing in a salt value instead of Nothing, and use the same salt for creating accounts and comparing login. Here's some sample code that works: Dim thePass As String = "MyPassword" Dim theSalt As String = "salt" Dim pass As String = Compute(thePass, "SHA512", Encoding.UTF8.GetBytes(theSalt)) Console.WriteLine(pass) Dim pass2 As String = Compute(thePass, "SHA512", Encoding.UTF8.GetBytes(theSalt)) Console.WriteLine(pass2) 'pass and pass2 are identical Hope this helps! A: Unless I'm missing it (not really familiar with the language), you don't store the salt anywhere. You have to use the same salt you've used when creating the account for the verification. On a side note: You can either generate a random salt for every user account or use a fixed salt for all accounts. Either method works. The first is theoretically more secure, but if the salt is long enough, both are fine for practical purposes.
{ "language": "en", "url": "https://stackoverflow.com/questions/7636629", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "2" }
Q: Open web browser on launch of App I need to know how to have an iphone app do nothing but open the web browser as soon as it starts. I know the code needed to open a broswer.. its NSURL *url = [NSURL URLWithString:@"http://www.google.com"]; [[UIApplication sharedApplication] openURL:url]; My problem is I don't know where to put this code. Ive tried putting it in main.m but it either errors or does nothing. I'd like to avoid needing to use a button. I'd prefer it be automatic as soon as the app is launched. I also need to image this to a HDMI TV and once again, I know the code for this.. I just don't know where it should be put, as I also want it to begin as soon as the app is started. Thanks. A: If you plan to submit this app to the App Store I've got bad news for you, Apple will reject your app if all it does is open a website. But back to your question place the code in app delegate: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { NSURL *url = [NSURL URLWithString:@"http://www.google.com"]; [[UIApplication sharedApplication] openURL:url]; }
{ "language": "en", "url": "https://stackoverflow.com/questions/7636630", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: Cisco Phone Status ASP.NET integration We're trying to find a way to retrieve information about when an employee is currently on the phone. The phones we use are Cisco IP Phone 7945 brand with CallManager 7.1.30000-1 and we were wanting to integrate it with asp.net. We want to be able to know when an employee's phone is off the hook. We have gone to http://developer.cisco.com, but we are uncertain on which API or SDK to use. We have tried AXL but it doesn't do what we're looking for. Is TAPI/JTAPI the way to go? Is there an example to get started for .NET? A: I don't know what TAPI/JTAPI can do, but we just query the callmanager database directly to get that kind of information.
{ "language": "en", "url": "https://stackoverflow.com/questions/7636635", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "2" }
Q: large matrix computation I write a simple code in C++ and I compile it with g++ on linux ubuntu 11.04 and I don't get any errors but when I run the executable file, I get this error "segmentation fault". I know that my code has no problem and tHat this error is related to the compiler. Can somebody help me? My code is : #include <math.h> int main() { double a[200][200][200],b[200][200][200],c[200][200][200]; int i,j,k; double const pi=3.14; for(k=0;k<200;k++) { for(j=0;j<200;j++) { for(i=0;i<200;i++) { a[i][j][k]=sin(1.5*pi*i)*cos(3.5*pi*j)*k; b[i][j][k]=cos(1.5*pi*i)*cos(2.5*pi*k)*j; c[i][j][k]=a[i][j][k]-b[i][j][k]; } } } } A: You're putting huge arrays of double onto the stack (presumably, assuming that's how your architecture does local variables). Almost surely your system's stack can't hold that much space. Instead, use vectors instead to allocate on the heap: std::vector<std::vector<std::vector<double> > > a(200, std::vector<std::vector<double> >(200, std::vector<double>(200))); A: This function can help you: double ***alloc3d(int l, int m, int n) { double *data = new double [l*m*n]; double ***array = new double **[l]; for (int i=0; i<l; i++) { array[i] = new double *[m]; for (int j=0; j<m; j++) { array[i][j] = &(data[(i*m+j)*n]); } } return array; } A: The three arrays require about 190MB of space, which almost certainly exceeds the stack size limit imposed by your operating system. Try allocating them on the heap (using new) instead of placing them on the stack. A: stack overflow -> segmentation fault A: for a non symmetric case we must use this: double*** a=new double**[IE]; for(int i=0;i<IE;i++){ a[i]=new double *[JE]; for(int j=0;j<JE;j++){ a[i][j]=new double [KE]; } } with above code we can build huge matrixes as our computer's ram allows.
{ "language": "en", "url": "https://stackoverflow.com/questions/7636638", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "5" }
Q: How do you select an image that was just pasted to MS Word via VBA Just pasted an image to MS Word in VBA using the following wordApp.Selection.PasteSpecial DataType:=wdPasteMetafilePicture, Placement:=wdInLine My thinking is to move one char left and then select next object, but I don't know how to do this. EDIT: Well here are some encoraging development, using the following line, I was able to select the paragraph which include the image, but I can't manipulate it because it's selecting a range. Do anyone know how I can pin down the image inside the selection? wordApp.Selection.Expand wdParagraph A: Here is what I used: wordApp.Selection.Find.Execute replace:=2 wordApp.Selection.Expand wdParagraph wordApp.Selection.InlineShapes(1).Select A: I was also doing the same. It seems that after pasting an image into word, its already selected. You can just use the selected object with the simple code below: Selection.InlineShapes(1).Select A: I've never used VBA in Word but here's a quick thought. If you're pasting the image inline and immediately trying to get a reference it should be the last item in the InlineShapes collection. This code will give you a reference you can use: thisDocument.InlineShapes(thisDocument.InlineShapes.Count) For example, to set the width of last pasted image you would use the following: thisDocument.InlineShapes(thisDocument.InlineShapes.Count).Width = 100 To store the shape in a variable: Dim pastedImage As InlineShape Set pastedImage = ThisDocument.InlineShapes(ThisDocument.InlineShapes.Count) A: The solution i found is to use the property "AlternativeText" to mark the pasted shapes as old, so whenever a shape is not old it has to be the New one. I use the following: Dim pShape as InLineShape' The shape i'm looking for Dim iShape as InlineShape For Each iShape In ActiveDocument.InlineShapes If iShape.AlternativeText = "" Then Set pShape = iShape pShape.AlternativeText = "old" Exit For End If Next Not very clean, but in VBA is always the same. A: You can simply mark the element left from your cursor position: Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
{ "language": "en", "url": "https://stackoverflow.com/questions/7636645", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "5" }
Q: Search Form Not Working In Production For some reason my search form is not working correctly when my app is launched, in the localhost its working without a problem but when I go to use the search on the launched app the search seems to be broken. I can't figure out why, I followed the Railscasts Simple Search Form to implement it and it hasn't been a problem in local at all. My user model looks like def self.search(search) if search find(:all, :conditions => ['name LIKE ?', "%#{search}%"]) else find(:all) end end My users controller index looks like def index @users = User.search(params[:search]) @title = "All Users" respond_to do |format| format.html format.json { render :json => @users } end end My user index view <% form_tag users_path, :method => 'get' do %> <p> <%= text_field_tag :search, params[:search] %> <%= submit_tag "Search", :name => nil %> </p> <% end %> <ul class="users"> <%= render @users %> </ul> Not only is the search not working correctly but when I type a name and its not there it should return all users but instead it returns an empty page, not sure if thats relevant but I thought I'd be as through as possible. Thanks. A: i am assuming that you are using MySQL for development and heroku's PostgreSQL for production. Normally errors like this are probably due to differences in production and development database environments. The problem could be the statement find(:all, :conditions => ['name LIKE ?', "%#{search}%"]) change it to this find(:all, :conditions => ['name ILIKE ?', "%#{search}%"]) notice the ILIKE. Always best to use same database in development and production, as this will prevent problems later on. Also checkout the heroku docs here. if you are using heroku. Hope it helps A: Are you using a hosting provider or are you running the app in 'production' on a local server? If you are using Heroku, Heroku uses Postgres which can handle sql queries differenly. To test you could setup Postgres in your dev environment and check the results of your queries.
{ "language": "en", "url": "https://stackoverflow.com/questions/7636657", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "3" }
Q: Why might CorelDraw's publish to pdf feature produce different size files depending on which group the executing user account is in? As part of a project I am developing a web service to convert CDR files to PDF. I am using c# to trigger CorelDraw's publish to PDF feature. The conversion is run as a command line utility called by the web service. I am hosting the web service in IIS. I have created a user account for the website's application pool in order to be able to run CorelDraw (I was unable to get it to work with the default application pool and configuring DCOM). I am getting PDF files of different sizes depending on whether I manually log in to the account and run the conversion program or trigger it through the web service from another machine. I seem also to get different file sizes depending of whether the application pool account is in the users or administrators group. Can anyone suggest why this might be happening and what I can do about it? A: pdf files sometimes have partial or complete typeface (font) data embedded in them. Maybe access permissions to the font source are different for the different credentials you're using and Corel is leaving them out if it doesn't have access to them. In Adobe Reader, right click, choose Document Properties, and look at the Fonts tab. Check both the bigger and smaller pdf files, and see if they have same set of font data loaded.
{ "language": "en", "url": "https://stackoverflow.com/questions/7636666", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: How to load the layout at runtime in Magento? I know that we can design the layout in *.xml then in the action just invoke loadLayout, and renderLayout to render the blocks/views. But, I have a question is: - How can I load the layout at runtime? If we have an action which does not really design its layout and will be decided how to render at runtime. You can please consider the answer from the question for more clear. A: Writing a new answer because it seems that you actually DO still want to render, you just want to render a different route's layout XML updates. I believe the _forward() method from Mage_Core_Controller_Varien_Action will allow you to do what you are describing with the least amount of pain. You should add your action controller directory ahead of the catalog directory, create a ProductController with a viewAction, and check customer is not logged in - in this check you would call $this->_forward('customer','account','login');. This approach though is going to require more effort in order to be usable, as I imagine that you want the user to be sent to the product page upon login. Have you seen Vinai Kopp's Login Only Catalog module? It should do this for you. A: loadLayout() and renderLayout() just execute block output method toHtml() (usually) and take the resulting strings and apply them to the response object via appendBody(). In an action controller you can just call $this->getResponse()->setBody('response string'). How you build the string is up to you. You can also use Mage_Core_Block_Flush to immediately send output to the browser without using the response object.
{ "language": "en", "url": "https://stackoverflow.com/questions/7636670", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: Selenium tests not getting executed on Eclipse I am trying to login to our company product site via selenium.I am able to do it via the Selenium IDE. And this is the code that the IDE exports using JUnit4(Remote Control): package com.beginning; import com.thoughtworks.selenium.*; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.util.regex.Pattern; public class testcase extends SeleneseTestCase { @Before public void setUp() throws Exception { selenium = new DefaultSelenium("localhost", 4444, "*chrome", "link"); selenium.start(); } @Test public void testTestcase() throws Exception { selenium.open("complete link"); selenium.type("name=j_username", "username"); selenium.type("name=j_password", "password"); selenium.click("css=input[type=\"submit\"]"); selenium.waitForPageToLoad("30000"); //selenium.click("link=Sign out"); //selenium.waitForPageToLoad("30000"); } @After public void tearDown() throws Exception { selenium.stop(); } } My doubts are : 1.Why does selenium IDE export the browser type as *chrome when I am actually doing it in firefox. 2.If I use the test as it is, it enters the values and then gives an exception . 3.If I change the browser Type to *firefox, it starts execution but nothing happens at all. Basically hangs. Things work fine when doing it from the IDE. Thanks. A: Change your "link" (4th parameter of DefaultSelenium constructor) so it's actually a valid URL (the site you want to target) A: Would reccommend you to check the version of firefox and upgrade to latest.I have used a similar scenario. Pls find the code below. You can use this its works grt.Hope you find it useful. import com.thoughtworks.selenium.DefaultSelenium; import com.thoughtworks.selenium.Selenium; public class TestRun { public static void main(String[] args) { Selenium selenium=new DefaultSelenium("localhost", 4444 , "*firefox","myurl"); selenium.start(); selenium.open("myurl"); System.out.println("Open browser "+selenium); selenium.windowMaximize(); selenium.type("id=j_username","Lal"); selenium.type("name=j_password","lal"); selenium.click("name=submit"); **selenium.waitForPageToLoad("60000");** if(selenium.isTextPresent("Lal")) { selenium.click("id=common_header_logout"); } else { System.out.println("User not found"); } } }
{ "language": "en", "url": "https://stackoverflow.com/questions/7636673", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: How to update variable dynamically within Rails app I am writing my first Rails app using the twitter gem. I'm simply retrieving search results and trying to cycle through them individually every 5 seconds or so. My thought was to create a variable and have this variable represent the array index and simply update this variable dynamically with Javascript (every 5 seconds or so). What's the best way to achieve this on the client-side? AJAX? Javascript? Does this make sense? I will be glad to provide more context if helpful. Thanks. A: Sounds you're trying to build a "recent tweets" marquee of some sort. Without knowing your requirements, you could try simply loading the ten most recent tweets in Rails, putting them in ten hidden divs, and then using jQuery just to cycle through the different tweets on the page. If it is a requirement to "update" the most recent tweets without the user refreshing the page, then yes, you'd probably need an AJAX call. A: It's hard to tell what you think you're asking: by the time your JavaScript is executing the server is no longer involved. If you want to update some sort of count on the server side and persist it in a meaningful way, you can do so via Ajax. What are you actually trying to do, though? A: Ruby runs on the server while JavaScript (usually) runs on the client. The Ruby generates an HTML document (perhaps with embedded JS) and the server delivers it to the client. At that stage the Ruby has finished executing. The only way to do anything further with Ruby would be to make a new HTTP request to the server. This could be done by following a link, submitting a form, setting location.href, using XMLHttpRequest or numerous other techniques. This would cause the Ruby program to be executed again (or a different one to be executed) which would do whatever it did with the input data. You cannot simply "set a variable" on the server from the client. A: In my particular case, I used ruby's .to_json method to convert the data and then manipulated it with javascript. This gave me the flexibility to loop through the data pretty seamlessly. Atleast it seemed to work for my particular situation. Thanks for the help guys!
{ "language": "en", "url": "https://stackoverflow.com/questions/7636679", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "1" }
Q: Configure Zookeeper zoodiscovery centralized and replicated mode I have a problem configuring Zookeeper to work with zoodiscovery mode centralized and replicated. The guide at http://wiki.eclipse.org/Zookeeper_Based_ECF_Discovery is a little mysterious about that. I'm working on Windows XP SP3, Java JDK 1.6, Eclipse STS 2.7.2, org.eclipse.osgi 3.7 and a proxied network. NOTE: Using the standalone configuration mode gives no problem. I use -Dzoodiscovery.flavor.standalone=192.168.23.21:3030;clientPort=3031 on the server and -Dzoodiscovery.flavor.standalone=192.168.23.28:3031;clientPort=3030 and it works nicely. I will split the question in multiple parts: 1) In a setup with a (one) central server on 192.168.23.28, multiple clients. The clients will both publish and consume services. I launch the server as: java -Dzoodiscovery.dataDir=name -Dzoodiscovery.flavor=zoodiscovery.flavor.centralized=192.168.23.28 -jar org.eclipse.osgi.jar -console -consoleLog -clean -configuration c:\temp\osgiserver\configuration I can see the ZooDiscovery> Discovery Service Activated. When I launch the clients (in the example there's only one) as: java -Dzoodiscovery.autoStart=true -Dzoodiscovery.flavor=zoodiscovery.flavor.centralized=192.168.23.28 -jar org.eclipse.osgi.jar -console -consoleLog -clean -configuration c:\temp\osgiclient\configuration I can see ZooDiscovery> Discovery Service Activated. but then INFO - Attempting connection to server: /192.168.23.28 which goes on and on never succeeding. I have to start server and clients by configuring Zookeeper from command line, I cannot insert those parameters inside the bundles. I have tried setting the -Dzoodiscovery.clientPort=8888 on the server (8888 is available) and then -Dzoodiscovery.flavor=zoodiscovery.flavor.centralized=192.168.23.28:8888 on the client, but still it changes nothing. How do I configure such a setup? 2) Plus I'd like to know if it's possible, using centralized, to have multiple central servers talking between them or if I'd have to use the replicated mode. 3) Which leads to.. how do I configure server and clients to use replicated mode by passing VM command line arguments? 4) In replicated mode, if I add a new Zookeeper instance later on, will I have to stop and reconfigure the existing Zookeeper instances to work with the new one or is it sufficient to configure the new one to work with the existing ones? Thank you very much, cheers
{ "language": "en", "url": "https://stackoverflow.com/questions/7636686", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "2" }
Q: Eclipse/Win7 - Scrolling in Content Assist with mouse without focus Recently switched from Linux to Windows for development in Eclipse Indigo SR1. In Linux, if I Ctrl-Space'd to open a Content Assist window, I could immediately start scrolling with the mouse wheel (with the cursor over the Content Assist window of course). Now, in Windows 7, if I try to scroll in the same way the Content Assist window goes away, and whatever editor I have open is scrolled instead. If I first press Tab to give focus to the Content Assist window, the mouse wheel scrolling works as expected, but I'd much rather it behaved as it did for me on Linux, rather than retrain myself to press Tab every time. Is there a way to make the mouse work this way with Eclipse? A: Found an answer that appears to work. It's a little dated but seems to still do the trick. http://divby0.blogspot.com/2007/04/focus-follows-mouse.html Dropped this jar in the eclipse plugins folder and restarted. At first I thought it didn't work, but later I noticed there is a little X button added to your toolbar that you need to toggle. Scrolling seems to work properly now.
{ "language": "en", "url": "https://stackoverflow.com/questions/7636687", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "0" }
Q: Is there a force flag in windows azure to change the role size? I tried to change the role size (upwards) in an Azure role and got the following error after uploading "The role size specified for role 'Website' in the newly uploaded package differs from the role size for this role in the currently deployed service. Changing the size of the role will cause all local data on the role instance to be lost. Please use the Force flag if you want to allow the loss of local data." which leads to the question - is there a force flag? Where is it? How do I set it? A: Its just appeared! An update to the Management Portal today (20 Oct 2011) has added an "Allow VM size or role count to be updated" tick box to the Upgrade Deployment dialog. So I guess that's the shiny new Force Flag! A: The information I've heard on the Azure forums is that it is not possible to modify the role size without a full redeploy (and this has been my experience as well). Over time Microsoft has allowed more things to be modified during an upgrade and Mark Russinovich may have suggested in a Mix or TechEd presentation that role size modification would be supported some point in the future. The error message you are receiving may be an early artefact of the implementation of a size upgrade enhancement. The research I've done (and I have done a LOT of asking around) would indicate that the "Force Flag" mentioned is not actually implemented yet - although I'm more than happy to be proven wrong. A: Right now, the vmsize is inside of the package (cspkg) which is sent to AppFabric. It's a decision which is part of the build/packaging. So, to change it, you need to change the VMSize, build the package and then [re]deploy. If you have a running system, you can avoid down time by using VIP Swap. It will basically stand up another AT[s] in the staging slot with your new VM size and then swap over to it. So, there's more moving parts involved but you can still change it with virtually no impact.
{ "language": "en", "url": "https://stackoverflow.com/questions/7636689", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "7" }
Q: Get Path and Filename from Camera intent result I want to make a picture with the camera intent and save it to the default DCIM folder. Then I want to get the path/filename where the picture is stored. I am trying it with the following code: Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent, TAKE_PICTURE); With this code, the camera opens and after I have taken one picture it closes and saves the picture to the default image folder (usually /dcim/camera or sdcard/dcim/camera...) but how can I get the path and filename of the taken picture now? I have tried almost everything in onActivityResult I tried String result = data.getData(); and String result = data.getDataString(); and String result = data.toURI(); and Uri uri = data.getData(); etc. I researched the last two days to find a solution for this, there are many articles on the web and on stackoverflow but nothing works. I don't want a thumbnail, I only want the path (uri?) to the image that the camera has taken. Thank you for any help EDIT: When I try: path=Environment.DIRECTORY_DCIM + "/test.jpg"; File file = new File(path); Uri outputFileUri = Uri.fromFile(file); Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri); startActivityForResult(intent, TAKE_PICTURE); it does not store the image as test.jpg but with the normal image name 2011-10-03.....jpg (but that is ok too, i only need the path to the image, it does not matter what the name is). Best regards EDIT Again path=Environment.getExternalStorageDirectory().getPath() + "/DCIM/Camera/"; File file = new File(path,"test111111111.jpg"); try { file.createNewFile(); } catch (IOException e) { e.printStackTrace(); } Uri outputFileUri = Uri.fromFile(file); Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri); startActivityForResult(intent, TAKE_PICTURE); When I try this, it stores the image to the right folder and with the given name (e.g. test111111.jpg). But how can I get the filepath now in onActivityResult? A: The picture will be stored twice, first on gallery folder, and after on the file you especified on putExtra(MediaStore.EXTRA_OUTPUT, path) method. You can obtain the last picture taken doing that: /** * Gets the last image id from the media store * @return */ private int getLastImageId(){ final String[] imageColumns = { MediaStore.Images.Media._ID, MediaStore.Images.Media.DATA }; final String imageOrderBy = MediaStore.Images.Media._ID+" DESC"; Cursor imageCursor = managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, imageColumns, null, null, imageOrderBy); if(imageCursor.moveToFirst()){ int id = imageCursor.getInt(imageCursor.getColumnIndex(MediaStore.Images.Media._ID)); String fullPath = imageCursor.getString(imageCursor.getColumnIndex(MediaStore.Images.Media.DATA)); Log.d(TAG, "getLastImageId::id " + id); Log.d(TAG, "getLastImageId::path " + fullPath); imageCursor.close(); return id; }else{ return 0; } } This sample was based on post: Deleting a gallery image after camera intent photo taken A: you can use like this in onActivityResult() if(requestCode==CAMERA_CAPTURE) { Cursor cursor = getContentResolver().query(Media.EXTERNAL_CONTENT_URI, new String[]{Media.DATA, Media.DATE_ADDED, MediaStore.Images.ImageColumns.ORIENTATION}, Media.DATE_ADDED, null, "date_added ASC"); if(cursor != null && cursor.moveToFirst()) { do { String picturePath =cursor.getString(cursor.getColumnIndex(Media.DATA)); Uri selectedImage = Uri.parse(picturePath); } while(cursor.moveToNext()); cursor.close(); File out = new File(picturePath); try { mOriginal = decodeFile(out); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } mSelected.setImageBitmap(mOriginal); } } A: When you are starting the ACTION_IMAGE_CAPTURE you can pass an extra MediaStore.EXTRA_OUTPUT as the URI of the file where you want to save the picture. Here is a simple example: File file = new File(path); Uri outputFileUri = Uri.fromFile(file); Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri); startActivityForResult(intent, TAKE_PICTURE); EDIT: I just tried on my device and file.createNewFile() solved the problem for me.
{ "language": "en", "url": "https://stackoverflow.com/questions/7636697", "timestamp": "2023-03-29T00:00:00", "source": "stackexchange", "question_score": "18" }