Search Results

Search found 57 results on 3 pages for 'lea'.

Page 2/3 | < Previous Page | 1 2 3  | Next Page >

  • Any way to access the type of a Scala Option declaration at runtime using reflection?

    - by Graham Lea
    So, I have a Scala class that looks like this: class TestClass { var value: Option[Int] = None } and I'm tackling a problem where I have a String value and I want to coerce it into that Option[Int] at runtime using reflection. To do so, I need to know that the field is an Option and that the type parameter of the Option is Int. What are my options for figuring out that the type of 'value' is Option[Int] at runtime (i.e. using reflection)? I have seen similar problems solved by annotating the field, e.g. @OptionType(Int.class). I'd prefer a solution that didn't require annotations on the reflection target if possible.

    Read the article

  • Android - Two different programs at the same time in an emulator

    - by Léa Massiot
    I'm new to Android development. My OS is WinXP. I'm trying to install two different applications on an Android Device Emulator in command line. I have two Android projects "ap1" and "ap2". In the "ap1" project directory, I ran "ant debug". I got an "ap1.apk" executable. In the "ap2" project directory, I ran "ant debug". I got an "ap2.apk" executable. I created an Android Virtual Device: cmd_line android create avd -n avd1 -t 1 --abi x86 I launched the emulator: cmd_line emulator -avd avd1 -verbose The "adb devices" command returns: List of devices attached emulator-5554 device I installed the first program on the emulator: cmd_line adb -s emulator-5554 install "ap1.apk" I ran the program: cmd_line adb shell am start -a android.intent.action.MAIN -n my.pkg.android/.Activity1 = It worked. I installed the second program on the emulator: cmd_line adb -s emulator-5554 install "ap2.apk" I ran the program: cmd_line adb shell am start -a android.intent.action.MAIN -n my.pkg2.android/.AnotherActivity1 = It worked. All this works except that the second executable "replaced" of the first one. If I try to run the first executable, I get an error: cmd_line adb shell am start -a android.intent.action.MAIN -n my.pkg.android/.Activity1 Starting: Intent { act=android.intent.action.MAIN cmp=my.pkg.android/.Activity1 } Error type 3 Error: Activity class {my.pkg.android/my.pkg.android.Activity1} does not exist. It looks like I can't have the two apps at the same time in the emulator. What do you think? What do I have to do to have the two apps available (at the same time) in the emulator? Thank you for helping. Best regards.

    Read the article

  • modalpopupextender.Show() wont fire

    - by Peter Lea
    I'm pretty new to developing for the web so bare with me. I have a company page with multiple locations and emails etc at each of these addresses. The idea is to have a single modalpopup to edit each type of data (one for email, one for urls, one for addresses etc). I link the modalpopupextender to a hiddenbutton and then call an edit function from various places where I can populate some hiddenfields and textboxes in the panel before showing it. The code executes but it just wont show the damn popup, I just see a flash and can't figure out if its my panel, my css or something I don't understand about ajax and postbacks etc. Things i've tried after reading various threads: Disable smart navigation in web.config Move ToolKitScriptManager up to master page and use proxy in content set hiddenbutton to use style="display:none" tried links etc instead of hidden button Heres my code CSS .modalBackground { position: absolute; z-index: 100; top: 0px; left: 0px; background-color: #000; filter: alpha(opacity=60); -moz-opacity: 0.6; opacity: 0.6; } .modalPopup { background-color: #FFD; border-width: 3px; border-style: solid; border-color: gray; padding: 3px;} Asp/html <ajaxToolkit:ModalPopupExtender runat="server" ID="mpe_email" BackgroundCssClass="modalBackground" PopupControlID="modal_email" CancelControlID="btn_cancel_email" TargetControlID="fake_btn_email" /> <asp:Button ID="fake_btn_email" runat="server" Text="email" style="display:none;" /> <asp:panel id="modal_email" runat="server" class="modalPopup" Width="500px" Height="500px"> <asp:HiddenField ID="hf_modal_email_location_id" runat="server" Value="" /> <asp:HiddenField ID="hf_modal_email_contact_id" runat="server" Value="" /> <asp:HiddenField ID="hf_modal_email_comms_id" runat="server" Value="" /> <table width="100%"> <tr> <td> <asp:Label ID="lbl_mpe_email_title" runat="server" Text="Edit Email Address" /> </td> </tr> <tr> <td> <table width="100%"> <tr> <td width="40px"><img src="../images/email.png" height="30px" width="30px"/></td> <td> <table width="100px"> <tr> <td><span>Quick Ref: <asp:TextBox ID="txb_mpe_email_qref" runat="server" Text="" /></span></td> </tr> <tr> <td><span>Email Address: <asp:TextBox ID="txb_mpe_email_address_full" runat="server" Text="" /></span></td> </tr> </table> </td> </tr> </table> </td> </tr> <tr> <td width="40px" align="left"><asp:Button ID="btn_cancel_email" runat="server" Text="Cancel"/></td> <td align="right"><asp:Button ID="btn_save_email" runat="server" Text="Save" OnCommand="save_modal_email" /></td> </tr> <tr> <td colspan="2" align="right"><asp:Label ID="lbl_mpe_email_err" runat="server" Text="" /></td> </tr> </table> c# public void oloc_ocon_email_edit(object sender, RepeaterCommandEventArgs e) { switch (e.CommandName) { case "edit": hf_modal_email_location_id.Value = ((HiddenField)e.Item.FindControl("hf_oloc_ocon_emails_location_id")).Value; hf_modal_email_contact_id.Value = ((HiddenField)e.Item.FindControl("hf_oloc_ocon_emails_contact_id")).Value; hf_modal_email_comms_id.Value = ((HiddenField)e.Item.FindControl("hf_oloc_ocon_emails_comms_id")).Value; lbl_mpe_email_title.Text = "Edit Email Address"; txb_mpe_email_qref.Text = ((HiddenField)e.Item.FindControl("hf_oloc_ocon_emails_qref")).Value; txb_mpe_email_address_full.Text = ((HiddenField)e.Item.FindControl("hf_oloc_ocon_emails_email_full")).Value; lbl_mpe_email_err.Text = ""; mpe_email.Show(); break; case "new": hf_modal_email_location_id.Value = ((HiddenField)e.Item.FindControl("hf_oloc_ocon_emails_location_id_p")).Value; hf_modal_email_contact_id.Value = ((HiddenField)e.Item.FindControl("hf_oloc_ocon_emails_contact_id_p")).Value; hf_modal_email_comms_id.Value = "0"; lbl_mpe_email_title.Text = "New Email Address"; txb_mpe_email_qref.Text = ""; txb_mpe_email_address_full.Text = ""; lbl_mpe_email_err.Text = ""; mpe_email.Show(); break; } } Stuff makes so much more sense in a desktop environment, I hope someone can point me in the right direction. Thanks

    Read the article

  • How would I implement code in a .h file into the main.cpp file?

    - by Lea
    I have a c++ project I am working on. I am a little stumped at the moment. I need a little help. I need to implement code from the .h file into the main.cpp file and I am not sure how to do that. For example code code from main.cpp: switch (choice){ case 1: // open an account { cout << "Please enter the opening balence: $ "; cin >> openBal; cout << endl; cout << "Please enter the account number: "; cin >> accountNum; cout << endl; break; } case 2:// check an account { cout << "Please enter the account number: "; cin >> accountNum; cout << endl; break; } and code from the .h file: void display(ostream& out) const; // displays every item in this list through out bool retrieve(elemType& item) const; // retrieves item from this list // returns true if item is present in this list and // element in this list is copied to item // false otherwise // transformers void insert(const elemType& item); // inserts item into this list // preconditions: list is not full and // item not present in this list // postcondition: item is in this list In the .h file you would need to use the void insert under transformer in the main.cpp under case 1. How would you do that? Any help is apprecaited. I hope I didn't confuse anyone on what I am needing to know how to do. Thanks

    Read the article

  • Using public domain source code from JDK in my application

    - by user2941369
    Can I use source code from ThreadPoolExecutor.java taken from JDK 1.7 considering that the following clausule is at the beginning of the ThreadPoolExecutor.java: /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * http://creativecommons.org/licenses/publicdomain */ And just before that there is also: /* * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */

    Read the article

  • Windows Metro: The hardest Hello World example I have ever seen :P

    - by Rob Addis
    http://msdn.microsoft.com/en-us/library/windows/apps/hh986965.aspx  Contrast that with Hello World in assembler on Windows:.386.model flat, stdcalloption casemap :noneextrn MessageBoxA@16 : PROCextrn ExitProcess@4 : PROC.data        HelloWorld db "Hello World!", 0.codestart:        lea eax, HelloWorld        mov ebx, 0        push ebx        push eax        push eax        push ebx        call MessageBoxA@16        push ebx        call ExitProcess@4end start

    Read the article

  • FileNotFoundException, altough the XML file should be deployed

    - by Bernhard V
    Hi, I've got problems starting my WAR application on a local JBoss. After two other EARs are deployed and the TomcatDeployer begins deploying the WAR, I'm getting the following error message: 2010-04-28 10:01:56,605 ERROR [org.jboss.ejb.plugins.LogInterceptor] [] [main] EJBException in method: public abstract at.sozvers.stp.zpv.ejb.lea.rwsuc.EJBLeaRegelwerkSuchenRemote at.sozvers.stp.zpv.ejb.lea.rwsuc.EJBLeaRegelwerkSuchenHome.create() throws javax.ejb.CreateException,java.rmi.RemoteException, causedBy: javax.ejb.EJBException: org.springframework.beans.factory.access.BootstrapException: Unable to initialize group definition. Group resource name [classpath*:applicationContext.xml], factory key [contextService]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contextService' defined in URL [jar:file:/C:/ta30/nutzb/jboss-4.2.3.GA.ZPV/server/default/deploy/deploy.last/zpv-app-web-frontend-1.0-SNAPSHOT.war/WEB-INF/lib/zpv-comp-ejb-modules-1.0-SNAPSHOT-client.jar!/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.context.support.ClassPathXmlApplicationContext]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [at/sozvers/stp/zpv/dao/ContextBasic.xml]; nested exception is java.io.FileNotFoundException: class path resource [at/sozvers/stp/zpv/dao/ContextBasic.xml] cannot be opened because it does not exist The sad thing is that the resource at/sozvers/stp/zpv/dao/ContextBasic.xml actually is placed in a JAR in one of my EAR files which should be deployed before the WAR. And at least I get a message that the deployment of the EAR has been successful. I also looked into the JAR with my file archiver and the ContextBasic.xml is indeed there at the right place. Is there a way for me to get sure that the JAR, not the EAR as a whole, is really deployed to the JBoss? I'm already starting to lose my head about this issue. Thank you. Bernhard

    Read the article

  • FileNotFoundException, although the XML file should be deployed

    - by Bernhard V
    Hi, I've got problems starting my WAR application on a local JBoss. After two other EARs are deployed and the TomcatDeployer begins deploying the WAR, I'm getting the following error message: 2010-04-28 10:01:56,605 ERROR [org.jboss.ejb.plugins.LogInterceptor] [] [main] EJBException in method: public abstract at.sozvers.stp.zpv.ejb.lea.rwsuc.EJBLeaRegelwerkSuchenRemote at.sozvers.stp.zpv.ejb.lea.rwsuc.EJBLeaRegelwerkSuchenHome.create() throws javax.ejb.CreateException,java.rmi.RemoteException, causedBy: javax.ejb.EJBException: org.springframework.beans.factory.access.BootstrapException: Unable to initialize group definition. Group resource name [classpath*:applicationContext.xml], factory key [contextService]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contextService' defined in URL [jar:file:/C:/ta30/nutzb/jboss-4.2.3.GA.ZPV/server/default/deploy/deploy.last/zpv-app-web-frontend-1.0-SNAPSHOT.war/WEB-INF/lib/zpv-comp-ejb-modules-1.0-SNAPSHOT-client.jar!/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.context.support.ClassPathXmlApplicationContext]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [at/sozvers/stp/zpv/dao/ContextBasic.xml]; nested exception is java.io.FileNotFoundException: class path resource [at/sozvers/stp/zpv/dao/ContextBasic.xml] cannot be opened because it does not exist The sad thing is that the resource at/sozvers/stp/zpv/dao/ContextBasic.xml actually is placed in a JAR in one of my EAR files which should be deployed before the WAR. And at least I get a message that the deployment of the EAR has been successful. I also looked into the JAR with my file archiver and the ContextBasic.xml is indeed there at the right place. Is there a way for me to get sure that the JAR, not the EAR as a whole, is really deployed to the JBoss? I'm already starting to lose my head about this issue. Thank you. Bernhard

    Read the article

  • Aquatic Prime on 10.6?

    - by Kevin
    Hello, I have 2 applications that I use with Aquatic Prime. One is an application just with the Aquatic Prime framework, and the other is an application that I've been working on that has been incorporated with the Aquatic Prime framework. The first application I mentioned before has its SDK set to 10.5 with the architecture to 32-bit. The second application I made has its SDK that is set to 10.6 (which it has to since I need NSRunningApplication) and its architecture to 32-bit. Now my question is, whenever I debug my first application it works perfectly fine, but with my second it gives me this interrupted error right after Running. What's going wrong? I've tried doing some breakpoints like "objc-exception-throw" but all it says is stopped at breakpoint 1. I need 10.6 in my application, but I also need Aquatic Prime. Can anyone help me solve this problem? Ok here's the one from the stack trace which I have no idea how to read: 0x91cdff11 <+0000> push %ebp 0x91cdff12 <+0001> mov %esp,%ebp 0x91cdff14 <+0003> sub $0x28,%esp 0x91cdff17 <+0006> mov %ebx,-0xc(%ebp) 0x91cdff1a <+0009> mov %esi,-0x8(%ebp) 0x91cdff1d <+0012> mov %edi,-0x4(%ebp) 0x91cdff20 <+0015> call 0x91cdff25 <objc_exception_throw+20> 0x91cdff25 <+0020> pop %ebx 0x91cdff26 <+0021> mov 0x8(%ebp),%esi 0x91cdff29 <+0024> lea 0xe4cbb8b(%ebx),%edi 0x91cdff2f <+0030> mov 0x4(%edi),%eax 0x91cdff32 <+0033> test %eax,%eax 0x91cdff34 <+0035> jne 0x91cdff3b <objc_exception_throw+42> 0x91cdff36 <+0037> call 0x91ce4f53 <set_default_handlers> 0x91cdff3b <+0042> mov %esi,(%esp) 0x91cdff3e <+0045> nop 0x91cdff3f <+0046> nopl 0x0(%eax) 0x91cdff43 <+0050> mov %esi,(%esp) 0x91cdff46 <+0053> call *0x4(%edi) 0x91cdff49 <+0056> lea 0xfd44(%ebx),%eax 0x91cdff4f <+0062> mov %eax,(%esp) 0x91cdff52 <+0065> call 0x91ce4e1f <_objc_fatal> The the GDB tells me its all good: run [Switching to process 990] Running… 2009-10-14 15:20:33.233 ApplicationName[990:a0f] init Sincerely, Kevin

    Read the article

  • Need help with BOOST_FOREACH/compiler bug

    - by Jacek Lawrynowicz
    I know that boost or compiler should be last to blame, but I can't see another explanation here. I'm using msvc 2008 SP1 and boost 1.43. In the following code snippet execution never leaves third BOOST_FOREACH loop typedef Graph<unsigned, unsigned>::VertexIterator Iter; Graph<unsigned, unsigned> g; g.createVertex(0x66); // works fine Iter it = g.getVertices().first, end = g.getVertices().second; for(; it != end; ++it) ; // fine std::pair<Iter, Iter> p = g.getVertices(); BOOST_FOREACH(unsigned handle, p) ; // fine unsigned vertex_count = 0; BOOST_FOREACH(unsigned handle, g.getVertices()) vertex_count++; // oops, infinite loop vertex_count = 0; BOOST_FOREACH(unsigned handle, g.getVertices()) vertex_count++; vertex_count = 0; BOOST_FOREACH(unsigned handle, g.getVertices()) vertex_count++; // ... last block repeated 7 times Iterator code: class Iterator : public boost::iterator_facade<Iterator, unsigned const, boost::bidirectional_traversal_tag> { public: Iterator() : list(NULL), handle(INVALID_ELEMENT_HANDLE) {} explicit Iterator(const VectorElementsList &list, unsigned handle = INVALID_ELEMENT_HANDLE) : list(&list), handle(handle) {} friend std::ostream& operator<<(std::ostream &s, const Iterator &it) { s << "[list: " << it.list <<", handle: " << it.handle << "]"; return s; } private: friend class boost::iterator_core_access; void increment() { handle = list->getNext(handle); } void decrement() { handle = list->getPrev(handle); } unsigned const& dereference() const { return handle; } bool equal(Iterator const& other) const { return handle == other.handle && list == other.list; } const VectorElementsList<T> *list; unsigned handle; }; Some ASM fun: vertex_count = 0; BOOST_FOREACH(unsigned handle, g.getVertices()) // initialization 013E1369 mov edi,dword ptr [___defaultmatherr+8 (13E5034h)] // end iterator handle: 0xFFFFFFFF 013E136F mov ebp,dword ptr [esp+0ACh] // begin iterator handle: 0x0 013E1376 lea esi,[esp+0A8h] // begin iterator list pointer 013E137D mov ebx,esi 013E137F nop // forever loop begin 013E1380 cmp ebp,edi 013E1382 jne main+238h (13E1388h) 013E1384 cmp ebx,esi 013E1386 je main+244h (13E1394h) 013E1388 lea eax,[esp+18h] 013E138C push eax // here iterator is incremented in ram 013E138D call boost::iterator_facade<detail::VectorElementsList<Graph<unsigned int,unsigned int>::VertexWrapper>::Iterator,unsigned int const ,boost::bidirectional_traversal_tag,unsigned int const &,int>::operator++ (13E18E0h) 013E1392 jmp main+230h (13E1380h) vertex_count++; // forever loop end It's easy to see that iterator handle is cached in EBP and it never gets incremented despite of a call to iterator operator++() function. I've replaced Itarator implmentation with one deriving from std::iterator and the issue persisted, so this is not iterator_facade fault. This problem exists only on msvc 2008 SP1 x86 and amd64 release builds. Debug builds on msvc 2008 and debug/release builds on msvc 2010 and gcc 4.4 (linux) works fine. Furthermore the BOOST_FOREACH block must be repeaded exacly 10 times. If it's repeaded 9 times, it's all OK. I guess that due to BOOST_FOREACH use of template trickery (const auto_any), compiler assumes that iterator handle is constant and never reads its real value again. I would be very happy to hear that my code is wrong, correct it and move on with BOOST_FOREACH, which I'm very found of (as opposed to BOOST_FOREVER :). May be related to: http://stackoverflow.com/questions/1275852/why-does-boost-foreach-not-work-sometimes-with-c-strings

    Read the article

  • Flex Builder debug problem

    - by Chetan Sachdev
    I am running on Windows XP and recently updated Flash Player from v9 to v10.1. And Now, in the Debug Console under Flex Builder, I am getting a lot of debug statements(I think that is assembly). Below is an example, of what I get: " active: eax(737-757) ecx(738-758) ebx(3-797) esi(728-756) @739 st 143112124(0) <- @3 09002830 mov 143112124(0), ebx active: eax(737-757) ecx(738-758) ebx(3-797) esi(728-756) @740 ldop 0(@3) 09002836 mov edx, 0(ebx) active: eax(737-757) ecx(738-758) edx(740-754) ebx(3-797) esi(728-756) @741 ldop 20(@740) 09002838 mov edi, 20(edx) active: eax(737-757) ecx(738-758) edx(740-754) ebx(3-797) esi(728-756) edi(741-742) * @742 lea 4(@741) spans call 0900283B lea edi, 4(edi) active: eax(737-757) ecx(738-758) edx(740-754) ebx(3-797) esi(728-756) edi(742-769) * @743 st 143111460(0) <- @742 0900283E mov 143111460(0), edi active: eax(737-757) ecx(738-758) edx(740-754) ebx(3-797) esi(728-756) edi(742-769) * @744 alloc 12 alloca 12 at 120 for @744 activation.size 132 stacksize 132 entries 17 -8(ebp) (6-792) alloc -20(ebp) (7-792) alloc -68(ebp) (8-792) alloc -72(ebp) (0-793) arg -76(ebp) (16-797) def -80(ebp) (440-797) def -80(ebp) -84(ebp) -88(ebp) (1-793) arg -92(ebp) -96(ebp) -100(ebp) (2-793) arg -104(ebp) -112(ebp) -116(ebp) -120(ebp) -132(ebp) (744-760) alloc active: eax(737-757) ecx(738-758) edx(740-754) ebx(3-797) esi(728-756) edi(742-769) * @745 imm 2 active: eax(737-757) ecx(738-758) edx(740-754) ebx(3-797) esi(728-756) edi(742-769) * @746 st 0(@744) <- @745 09002844 mov -132(ebp), 2 active: eax(737-757) ecx(738-758) edx(740-754) ebx(3-797) esi(728-756) edi(742-769) * @747 imm 139523392 active: eax(737-757) ecx(738-758) edx(740-754) ebx(3-797) esi(728-756) edi(742-769) * @748 st 4(@744) <- @747 0900284E mov -128(ebp), 139523392 active: eax(737-757) ecx(738-758) edx(740-754) ebx(3-797) esi(728-756) edi(742-769) * @749 imm 136426472 active: eax(737-757) ecx(738-758) edx(740-754) ebx(3-797) esi(728-756) edi(742-769) * @750 st 8(@744) <- @749 09002855 mov -124(ebp), 136426472 active: eax(737-757) ecx(738-758) edx(740-754) ebx(3-797) esi(728-756) edi(742-769) * @751 ldop 16(@738) STEAL any @738 alloca 4 at 80 for @738 activation.size 132 stacksize 132 entries 17 -8(ebp) (6-792) alloc -20(ebp) (7-792) alloc -68(ebp) (8-792) alloc -72(ebp) (0-793) arg -76(ebp) (16-797) def -80(ebp) (440-797) def -80(ebp) -84(ebp) (738-758) use -88(ebp) (1-793) arg -92(ebp) -96(ebp) -100(ebp) (2-793) arg -104(ebp) -112(ebp) -116(ebp) -120(ebp) -132(ebp) (744-760) alloc 0900285C mov -84(ebp), ecx 0900285F mov ecx, 16(ecx) active: eax(737-757) ecx(751-759) edx(740-754) ebx(3-797) esi(728-756) edi(742-769) * @752 imm 1 active: eax(737-757) ecx(751-759) edx(740-754) ebx(3-797) esi(728-756) edi(742-769) * @753 or @738 @752 STEAL any @751 alloca 4 at 88 for @751 activation.size 132 stacksize 132 entries 17 -8(ebp) (6-792) alloc -20(ebp) (7-792) alloc -68(ebp) (8-792) alloc -72(ebp) (0-793) arg -76(ebp) (16-797) def -80(ebp) (440-797) def -80(ebp) -84(ebp) (738-758) use -88(ebp) (1-793) arg -92(ebp) (751-759) ldop -96(ebp) -100(ebp) (2-793) arg -104(ebp) -112(ebp) -116(ebp) -120(ebp) -132(ebp) (744-760) alloc 09002862 mov -92(ebp), ecx 09002865 mov ecx, -84(ebp) 09002868 or ecx, 1 active: eax(737-757) ecx(753-759) edx(740-754) ebx(3-797) esi(728-756) edi(742-769) * " I am not sure, why it started, but any help will be appreciated.

    Read the article

  • wordexp followed by strcpy = EXC_BAD_ACCESS + sharedlibrary apply-load-rules-all

    - by fyngyrz
    The implication is a memory problem. I have static allocations for these: char akdir[400]; char homedir[400]; This crashes on the first strcpy(): void setuplibfoo() { long ii; double x; wordexp_t result; // This obtains the user's home directory // -------------------------------------- homedir[0]=0; // in case wordexp fails switch (wordexp("~/",&result,0)) { case 0: // Successful. We'll fall into deallocate when done. { strcpy(homedir,result.we_wordv[0]); // <<--- CRASH! strcpy(akdir,homedir); strcat(akdir,"ak-plugins/"); vs_status(akdir); } case WRDE_NOSPACE: // If the error was WRDE_NOSPACE, then { // perhaps part of the result was allocated. wordfree (&result); } default: // all other errors do not require deallocation { break; } } ...additional code clipped.. doesn't get there on crash. This is in a shared library I've written that is linked to my application, also something I've written. In this case, it doesn't get very far, although if it starts, it's fine. ...I've read the wordexp docs several times; they say they allocate new objects, so you just set up that type and call them with the address. The switch error model is right from the wordexp docs: http://www.gnu.org/s/libc/manual/html_mono/libc.html#Wordexp-Example It doesn't always crash. Just sometimes, and just under 10.6. Never under 10.5 I'm building debug mode with XCode 3.1.1, under OSX 10.5.8 it seems to run ok, I've not seen a crash -- under 10.6, it crashes... sometimes. But always with that same exception, and always in the same place. The Google has it that this actually means, somehow, that it's too soon to allocate memory. But all the instances I could find were memory errors on the part of the programmer. Overruns, etc. And I can't find any docs on when it IS safe to allocate memory. Now, the path that expands there is nowhere near 400 characters. it's this (it it completes): /Users/flake/ak-plugins/ and this: /Users/flake/ ...if it doesn't. the strcpy... copies 2nd param to first. Theirs to mine. And it works! under 10.5. :/ So is wordexp broke? Is 10.6 broke? Am I cRaZy? Here's the debugger output: 0x00013446 <+0049> call 0xc98da <dyld_stub_wordexp> 0x0001344b <+0054> test %eax,%eax 0x0001344d <+0056> je 0x13454 <setuplibfoo+63> 0x0001344f <+0058> jmp 0x134da <setuplibfoo+197> 0x00013454 <+0063> mov -0x1c(%ebp),%eax 0x00013457 <+0066> mov (%eax),%eax 0x00013459 <+0068> mov %eax,0x4(%esp) 0x0001345d <+0072> lea 0xb6cc2(%ebx),%eax 0x00013463 <+0078> mov (%eax),%eax 0x00013465 <+0080> mov %eax,(%esp) 0x00013468 <+0083> call 0xc9898 <dyld_stub_strcpy> 0x0001346d <+0088> lea 0xb6cc2(%ebx),%eax <<--CRASH!

    Read the article

  • Tab Sweep - Upgrade to Java EE 6, Groovy NetBeans, JSR310, JCache interview, OEPE, and more

    - by alexismp
    Recent Tips and News on Java, Java EE 6, GlassFish & more : • Implementing JSR 310 (New Date/Time API) in Java 8 Is Very Strongly Favored by Developers (java.net) • Upgrading To The Java EE 6 Web Profile (Roger) • NetBeans for Groovy (blogs.oracle.com) • Client Side MOXy JSON Binding Explained (Blaise) • Control CDI Containers in SE and EE (Strub) • Java EE on Google App Engine: CDI to the Rescue - Aleš Justin (jaxenter) • The Java EE 6 Example - Testing Galleria - Part 4 (Markus) • Why is OpenWebBeans so fast? (Strub) • Welcome to the new Oracle Enterprise Pack for Eclipse Blog (blogs.oracle.com) • Java Spotlight Episode 75: Greg Luck on JSR 107 Java Temporary Caching API (Spotlight Podcast) • Glassfish cluster installation and administration on top of SSH + public key (Paulo) • Jfokus 2012 on Parleys.com (Parleys) • Java Tuning in a Nutshell - Part 1 (Rupesh) • New Features in Fork/Join from Java Concurrency Master, Doug Lea (DZone) • A Java7 Grammar for VisualLangLab (Sanjay) • Glassfish version 3.1.2: Secure Admin must be enabled to access the DAS remotely (Charlee) • Oracle Announces the Certification of the Oracle Database on Oracle Linux 6 and Red Hat Enterprise Linux 6

    Read the article

  • Removing ocurrances of characters in a string

    - by DmainEvent
    I am reading this book, programming Interviews exposed by John Wiley and sons and in chapter 6 they are discussing removing all instances of characters in a src string using a removal string... so removeChars(string str, string remove) In there writeup they sey the steps to accomplish this are to have a boolean lookup array with all values initially set to false, then loop through each character in remove setting the corresponding value in the lookup array to true (note: this could also be a hash if the possible character set where huge like Unicode-16 or something like that or if str and remove are both relatively small... < 100 characters I suppose). You then iterate through the str with a source and destination index, copying each character only if its corresponding value in the lookup array is false... Which makes sense... I don't understand the code that they use however... They have for(src = 0; src < len; ++src){ flags[r[src]] == true; } which is turning the flag value at the remove string indexed at src to true... so if you start out with PLEASE HELP as your str and LEA as your remove you will be setting in your flag table at 0,1,2... t|t|t but after that you will get an out of bounds exception because r doesn't have have anything greater than 2 in it... even using there example you get an out of bounds exception... Am is there code example unworkable?

    Read the article

  • "call" instruction that seemingly jumps into itself

    - by Checkers
    I have gcc 4 compiling some C++ code into the following (from objdump): 00000030 <func()>: 30: 55 push %ebp 31: 89 e5 mov %esp,%ebp 33: 56 push %esi 34: 31 f6 xor %esi,%esi 36: 53 push %ebx 37: bb 00 00 00 00 mov $0x0,%ebx 3c: 83 ec 40 sub $0x40,%esp 3f: c7 04 24 01 00 00 00 movl $0x1,(%esp) 46: e8 fc ff ff ff call 47 <func()+0x17> 4b: 8d 55 ec lea 0xffffffec(%ebp),%edx 4e: 89 14 24 mov %edx,(%esp) 51: 89 5c 24 04 mov %ebx,0x4(%esp) 55: 89 74 24 08 mov %esi,0x8(%esp) 59: 89 44 24 0c mov %eax,0xc(%esp) ; the rest of the function is omitted I can't understand the operand of call instruction here, why does it call into itself, but with one byte off?

    Read the article

  • First ASM program

    - by Tal
    Hello, I'm trying to run my first ASM 8086 program on MASM on Windows Vista 64bit OS. I put this program on my MASM editor: .model small .stack .data message db "Hello world, I'm learning Assembly !!!", "$" .code main proc mov ax,seg message mov ds,ax mov ah,09 lea dx,message int 21h mov ax,4c00h int 21h main endp end main and the MASM editor gives me this output that I got no idea what's wrong with the program: Assembling: D:\masm32\First.asm D:\masm32\First.asm(9) : error A2004: symbol type conflict D:\masm32\First.asm(19) : warning A4023: with /coff switch, leading underscore required for start address : main _ Assembly Error Where is the problem with this code? This is my first ASM program please remember. Thank you :)

    Read the article

  • x86 assembler question

    - by b-gen-jack-o-neill
    Hi, I have 2 simple, but maybe tricky questions. Let´s say I have assembler instruction: MOV EAX,[ebx+6*7] - what I am curious is, does this instruction really actually translates into opcode as it stands,so computation of code in brackets is encoded into opcode, or is this just pseudo intruction for compiler, not CPU, so that compiler before computes the value in brackets using add mul and so, store outcome in some reg and than uses MOV EAX,reg with computed value? Just to be clear, I know the output will be the same. I am interested in execution. Second is about LEA instruction. I know what it does, but I am more interested wheather its real instruction, so compiles does not further change it, just make it into opcode as it stands, or just pseudo code for compiler to, again, first compute adress and than store it.

    Read the article

  • Is there an existing solution to the multithreaded data structure problem?

    - by thr
    I've had the need for a multi-threaded data structure that supports these claims: Allows multiple concurrent readers and writers Is sorted Is easy to reason about Fulfilling multiple readers and one writer is a lot easier, but I really would wan't to allow multiple writers. I've been doing research into this area, and I'm aware of ConcurrentSkipList (by Lea based on work by Fraser and Harris) as it's implemented in Java SE 6. I've also implemented my own version of a concurrent Skip List based on A Provably Correct Scalable Concurrent Skip List by Herlihy, Lev, Luchangco and Shavit. These two implementations are developed by people that are light years smarter then me, but I still (somewhat ashamed, because it is amazing work) have to ask the question if these are the two only viable implementations of a concurrent multi reader/writer data structures available today?

    Read the article

  • How to generate <a> tag from input fields

    - by NonProgrammer
    Using ASP.Net (in C#), I need to generate a tag that contains person's name, address, etc. I have barely any experience with ASP.NET (or .NET languages) and I am given this assignment. Could someone please guide me to correct path please? Link should look like this: https://example.com/PRR/Info/Login.aspx?SupplierId=36&RegisteredUserLogin=T000001&Mode=RegisteredLoginless&RegisteredModeFunction=AutoShowTotals&RegisteredModeFunction=AutoShowTotals&PayerCountry=FI&[email protected]&ExternalOrderId=1000123&ServiceId=286&Amount286=5000.00&PayerInfo286=T000001|10000123|type1|m&SuccessReturnURL=http://success.html&FailureReturnURL=http://failure.html&SuccessCallbackURL=http://youpay.com/p247/success.html&FailureCallbackURL=http://yourfailure.html following components/fields needs to be sent to API in order to pre-populate information for users: FirstName, LastName, SupplierID = integer, Person's userlogin (Should increment by 1. Example: person 1 = t00001. Person2 = t00002, etc.), PayerCountry, Email, amount For some reason, my management thinks that this is something a non-technical person can do! Any help would be appreciated! Thanks!

    Read the article

  • Removing occurrences of characters in a string

    - by DmainEvent
    I am reading this book, programming Interviews exposed by John Wiley and sons and in chapter 6 they are discussing removing all instances of characters in a src string using a removal string... so removeChars(string str, string remove) In there writeup they sey the steps to accomplish this are to have a boolean lookup array with all values initially set to false, then loop through each character in remove setting the corresponding value in the lookup array to true (note: this could also be a hash if the possible character set where huge like Unicode-16 or something like that or if str and remove are both relatively small... < 100 characters I suppose). You then iterate through the str with a source and destination index, copying each character only if its corresponding value in the lookup array is false... Which makes sense... I don't understand the code that they use however... They have for(src = 0; src < len; ++src){ flags[r[src]] == true; } which is turning the flag value at the remove string indexed at src to true... so if you start out with PLEASE HELP as your str and LEA as your remove you will be setting in your flag table at 0,1,2... t|t|t but after that you will get an out of bounds exception because r doesn't have have anything greater than 2 in it... even using there example you get an out of bounds exception... Am is there code example unworkable? Entire function string removeChars( string str, string remove ){ char[] s = str.toCharArray(); char[] r = remove.toCharArray(); bool[] flags = new bool[128]; // assumes ASCII! int len = s.Length; int src, dst; // Set flags for characters to be removed for( src = 0; src < len; ++src ){ flags[r[src]] = true; } src = 0; dst = 0; // Now loop through all the characters, // copying only if they aren’t flagged while( src < len ){ if( !flags[ (int)s[src] ] ){ s[dst++] = s[src]; } ++src; } return new string( s, 0, dst ); } as you can see, r comes from the remove string. So in my example the remove string has only a size of 3 while my str string has a size of 11. len is equal to the length of the str string. So it would be 11. How can I loop through the r string since it is only size 3? I haven't compiled the code so I can loop through it, but just looking at it I know it won't work. I am thinking they wanted to loop through the r string... in other words they got the length of the wrong string here.

    Read the article

  • Far jump in ntdll.dll's internal ZwCreateUserProcess

    - by user49164
    I'm trying to understand how the Windows API creates processes so I can create a program to determine where invalid exes fail. I have a program that calls kernel32.CreateProcessA. Following along in OllyDbg, this calls kernel32.CreateProcessInternalA, which calls kernel32.CreateProcessInternalW, which calls ntdll.ZwCreateUserProcess. This function goes: mov eax, 0xAA xor ecx, ecx lea edx, dword ptr [esp+4] call dword ptr fs:[0xC0] add esp, 4 retn 0x2C So I follow the call to fs:[0xC0], which contains a single instruction: jmp far 0x33:0x74BE271E But when I step this instruction, Olly just comes back to ntdll.ZwCreateUserProcess at the add esp, 4 right after the call (which is not at 0x74BE271E). I put a breakpoint at retn 0x2C, and I find that the new process was somehow created during the execution of add esp, 4. So I'm assuming there's some magic involved in the far jump. I tried to change the CS register to 0x33 and EIP to 0x74BE271E instead of actually executing the far jump, but that just gave me an access violation after a few instructions. What's going on here? I need to be able to delve deeper beyond the abstraction of this ZwCreateUserProcess to figure out how exactly Windows creates processes.

    Read the article

  • OpenGL Calls Lock/Freeze

    - by Necrolis
    I am using some dell workstations(running WinXP Pro SP 2 & DeepFreeze) for development, but something was recenlty loaded onto these machines that prevents any opengl call(the call locks) from completing(and I know the code works as I have tested it on 'clean' machines, I also tested with simple opengl apps generated by dev-cpp, which will also lock on the dell machines). I have tried to debug my own apps to see where exactly the gl calls freeze, but there is some global system hook on ZwQueryInformationProcess that messes up calls to ZwQueryInformationThread(used by ExitThread), preventing me from debugging at all(it causes the debugger, OllyDBG, to go into an access violation reporting loop or the program to crash if the exception is passed along). the hook: ntdll.ZwQueryInformationProcess 7C90D7E0 B8 9A000000 MOV EAX,9A 7C90D7E5 BA 0003FE7F MOV EDX,7FFE0300 7C90D7EA FF12 CALL DWORD PTR DS:[EDX] 7C90D7EC - E9 0F28448D JMP 09D50000 7C90D7F1 9B WAIT 7C90D7F2 0000 ADD BYTE PTR DS:[EAX],AL 7C90D7F4 00BA 0003FE7F ADD BYTE PTR DS:[EDX+7FFE0300],BH 7C90D7FA FF12 CALL DWORD PTR DS:[EDX] 7C90D7FC C2 1400 RETN 14 7C90D7FF 90 NOP ntdll.ZwQueryInformationToken 7C90D800 B8 9C000000 MOV EAX,9C the messed up function + call: ntdll.ZwQueryInformationThread 7C90D7F0 8D9B 000000BA LEA EBX,DWORD PTR DS:[EBX+BA000000] 7C90D7F6 0003 ADD BYTE PTR DS:[EBX],AL 7C90D7F8 FE ??? ; Unknown command 7C90D7F9 7F FF JG SHORT ntdll.7C90D7FA 7C90D7FB 12C2 ADC AL,DL 7C90D7FD 14 00 ADC AL,0 7C90D7FF 90 NOP ntdll.ZwQueryInformationToken 7C90D800 B8 9C000000 MOV EAX,9C So firstly, anyone know what if anything would lead to OpenGL calls cause an infinite lock,and if there are any ways around it? and what would be creating such a hook in kernal memory ? Update: After some more fiddling, I have discovered a few more kernal hooks, a lot of them are used to nullify data returned by system information calls(such as the remote debugging port), I also managed to find out the what ever is doing this is using madchook.dll(by madshi) to do this, this dll is also injected into every running process(these seem to be some anti debugging code). Also, on the OpenGL side, it seems Direct X is fine/unaffected(I ran one of the DX 9 demo's without problems), so could one of these kernal hooks somehow affect OpenGL?

    Read the article

  • Locking database edit by key name

    - by Will Glass
    I need to prevent simultaneous edits to a database field. Users are executing a push operation on a structured data field, so I want to sequence the operations, not simply ignore one edit and take the second. Essentially I want to do synchronized(key name) { push value onto the database field } and set up the synchronized item so that only one operation on "key name" will occur at a time. (note: I'm simplifying, it's not always a simple push). A crude way to do this would be a global synchronization, but that bottlenecks the entire app. All I need to do is sequence two simultaneous writes with the same key, which is rare but annoying occurrence. This is a web-based java app, written with Spring (and using JPA/MySQL). The operation is triggered by a user web service call. (the root cause is when a user sends two simultaneous http requests with the same key). I've glanced through the Doug Lea/Josh Bloch/et al Concurrency in Action, but don't see an obvious solution. Still, this seems simple enough I feel there must be an elegant way to do this.

    Read the article

  • How to write a buffer-overflow exploit in windows XP,x86?

    - by Mask
    void function(int a, int b, int c) { char buffer1[5]; char buffer2[10]; int *ret; ret = buffer1 + 12; (*ret) += 8;//why is it 8?? } void main() { int x; x = 0; function(1,2,3); x = 1; printf("%d\n",x); } The above demo is from here: http://insecure.org/stf/smashstack.html But it's not working here: D:\test>gcc -Wall -Wextra hw.cpp && a.exe hw.cpp: In function `void function(int, int, int)': hw.cpp:6: warning: unused variable 'buffer2' hw.cpp: At global scope: hw.cpp:4: warning: unused parameter 'a' hw.cpp:4: warning: unused parameter 'b' hw.cpp:4: warning: unused parameter 'c' 1 And I don't understand why it's 8 though the author thinks: A little math tells us the distance is 8 bytes. My gdb dump as called: Dump of assembler code for function main: 0x004012ee <main+0>: push %ebp 0x004012ef <main+1>: mov %esp,%ebp 0x004012f1 <main+3>: sub $0x18,%esp 0x004012f4 <main+6>: and $0xfffffff0,%esp 0x004012f7 <main+9>: mov $0x0,%eax 0x004012fc <main+14>: add $0xf,%eax 0x004012ff <main+17>: add $0xf,%eax 0x00401302 <main+20>: shr $0x4,%eax 0x00401305 <main+23>: shl $0x4,%eax 0x00401308 <main+26>: mov %eax,0xfffffff8(%ebp) 0x0040130b <main+29>: mov 0xfffffff8(%ebp),%eax 0x0040130e <main+32>: call 0x401b00 <_alloca> 0x00401313 <main+37>: call 0x4017b0 <__main> 0x00401318 <main+42>: movl $0x0,0xfffffffc(%ebp) 0x0040131f <main+49>: movl $0x3,0x8(%esp) 0x00401327 <main+57>: movl $0x2,0x4(%esp) 0x0040132f <main+65>: movl $0x1,(%esp) 0x00401336 <main+72>: call 0x4012d0 <function> 0x0040133b <main+77>: movl $0x1,0xfffffffc(%ebp) 0x00401342 <main+84>: mov 0xfffffffc(%ebp),%eax 0x00401345 <main+87>: mov %eax,0x4(%esp) 0x00401349 <main+91>: movl $0x403000,(%esp) 0x00401350 <main+98>: call 0x401b60 <printf> 0x00401355 <main+103>: leave 0x00401356 <main+104>: ret 0x00401357 <main+105>: nop 0x00401358 <main+106>: add %al,(%eax) 0x0040135a <main+108>: add %al,(%eax) 0x0040135c <main+110>: add %al,(%eax) 0x0040135e <main+112>: add %al,(%eax) End of assembler dump. Dump of assembler code for function function: 0x004012d0 <function+0>: push %ebp 0x004012d1 <function+1>: mov %esp,%ebp 0x004012d3 <function+3>: sub $0x38,%esp 0x004012d6 <function+6>: lea 0xffffffe8(%ebp),%eax 0x004012d9 <function+9>: add $0xc,%eax 0x004012dc <function+12>: mov %eax,0xffffffd4(%ebp) 0x004012df <function+15>: mov 0xffffffd4(%ebp),%edx 0x004012e2 <function+18>: mov 0xffffffd4(%ebp),%eax 0x004012e5 <function+21>: movzbl (%eax),%eax 0x004012e8 <function+24>: add $0x5,%al 0x004012ea <function+26>: mov %al,(%edx) 0x004012ec <function+28>: leave 0x004012ed <function+29>: ret In my case the distance should be - = 5,right?But it seems not working..

    Read the article

< Previous Page | 1 2 3  | Next Page >