Search Results

Search found 3592 results on 144 pages for 'pointer'.

Page 126/144 | < Previous Page | 122 123 124 125 126 127 128 129 130 131 132 133  | Next Page >

  • Search box with images strange issue in ie

    - by mebots
    Have the following searchbox image: With the following code and css: #searchcontainer { margin: 40px 0 0 0; } .search { float: right; margin: 0; padding: 0; height: 21px; width: 310px; } .search input, .search button { margin: 0; padding: 0; font-size: 0.9em; color: #A7A9AC; border: 0; outline: none; } .search input.box { margin: 0; padding: 2px 5px 0 5px; width:230px; height: 19px; background: #FFF url(images/search.gif) no-repeat top left; } .search input.btn { margin: 0 0 0 -5px; padding: 0; width:70px; height: 21px; cursor:pointer; cursor: hand; /* cross browser */ text-indent: -9999px; background: #FFF url(images/search.gif) no-repeat top right; } <div id="searchcontainer"> <form id="searchform" class="search" method="post" action="#"> <input name="box" type="text" value="zoek..." class="box" /> <input name="btn" type="button" class="btn" /> </form> </div> In firefox it looks ok, but in ie and chrome the button "Zoek" goes down a bit, see image In my opinion the css is ok. but can't find where it goes wrong.

    Read the article

  • Can you target Google Chrome? (Yes, you can)

    - by Kyle Sevenoaks
    Hi, I need to position this update button on www.euroworker.no/order (you'll have to add an item to the cart, use the Kjøp button to add and Handlevogn to view the cart). Works in FF and IE. (Although there is another alignment problems with IE) but not in Chrome or Safari. I had it working before, but the only thing I can think of to do is target safari and Chrome. Is this possible? Here's the CSS and HTML(Smarty) for you. HTML(Smarty): {capture assign="cartUpdate"} <div id="cartUpdate"><!--<input type="submit" class="submit" value="{tn _update}" />--> <button type="submit" class="submit" id="oppdatersubmit" name="saveFields" title="Oppdater" value="">&nbsp;</button> </div> {/capture} {assign var="cartUpdate" value=$cartUpdate|@str_split:10000} {php}$GLOBALS['cartUpdate'] = $this->get_template_vars('cartUpdate'); $this->assign_by_ref('GLOBALS', $GLOBALS);{/php} {form action="controller=order action=update" method="POST" enctype="multipart/form-data" handle=$form id="cartItems"} CONTENT {/form} And the CSS: #oppdatersubmit { background-image:url(../../upload/oppdater.png); background-repeat:no-repeat; background-position:left; background-color:none; border:none; overflow:hidden; outline:none; white-space: nowrap; width:77px; height:25px; cursor:pointer; position:absolute; } #cartUpdate { position:absolute; width:160px; height:30px; left:580px; bottom:130px; } Need to change these for Chrome and Safari. Thanks.

    Read the article

  • Class is not applying to submit button

    - by Mayur
    Hi All, I m Trying to apply a class to following submit button Code: <input type="submit" value="Submit" name="commit"> css : .confirm-button-submit { width : 79px; font : bold 12px sans-serif;; color : #000; background : url("../images/confirm-btn.png") 0 -33px no-repeat; text-decoration : none; margin-top :0px; text-align:center; border:0px; cursor : pointer; height:170px; } .confirm-button a { display : block; width : 79px; padding : 8px 0px 12px 0px; font : bold 12px sans-serif;; color : #000; background : url("../images/confirm-btn.png") 0 -33px no-repeat; text-decoration : none; margin-top :0px; text-align:center; } .confirm-button a:hover { display : block; width : 79px; padding : 8px 0px 12px 0px; font : bold 12px sans-serif;; color : #fff; background : url("../images/confirm-btn.png") 0 0 no-repeat; text-decoration : none; margin-top :0px; text-align:center; } But its not working proper what to do Thanks

    Read the article

  • Creating a new variable in C from only part of an existing u_char

    - by Alex Kloss
    I'm writing some C code to parse IEEE 802.11 frames, but I'm stuck trying to create a new variable whose length depends on the size of the frame itself. Here's the code I currently have: int frame_body_len = pkt_hdr->len - radio_hdr->len - wifi_hdr_len - 4; u_char *frame_body = (u_char *) (packet + radio_hdr->len + wifi_hdr_len); Basically, the frame consists of a header, a body, and a checksum at the end. I can calculate the length of the frame body by taking the length of the packet and subtracting the length of the two headers that appear before it (radio_hdr->len and wifi_hdr_len respectively), plus 4 bytes at the end for the checksum. However, how can I create the frame_body variable without the trailing checksum? Right now, I'm initializing it with the contents of the packet starting at the position after the two headers, but is there some way to start at that position and end 4 bytes before the end of packet? packet is a pointer to a u_char, if it helps. I'm a new C programmer, so any and all advice about my code you can give me would be much appreciated. Thanks!

    Read the article

  • C# / this. and List<T>

    - by user3533030
    I am having trouble understanding how to initialize a List of objects and use it with methods inside of a class. I understand the mechanics of the List, but not how to initialize it inside a method and use it later. For example, I want to have a class that creates the List when it is constructed. Then, I want to use a method of that class to add elements to the list. The elements in the list are objects defined by the SolidWorks API. So, to construct the List, I used... public class ExportPoints : Exporter { public List<SldWorks.SketchPoint> listOfSketchPoints; public ExportPoints(SldWorks.SldWorks swApp, string nameSuffix) : base(swApp, nameSuffix) { List<SldWorks.SketchPoint> listOfSketchPoints = new List<SldWorks.SketchPoint>(); } public void createListOfFreePoints() { try { [imagine more code here] this.listOfSketchPoints.Add(pointTest); } catch (Exception e) { Debug.Print(e.ToString()); return; } } This fails during execution as if the listOfSketchPoints was never initialized as a List. So, I tried a hack and this worked: public ExportPoints(SldWorks.SldWorks swApp, string nameSuffix) : base(swApp, nameSuffix) { List<SldWorks.SketchPoint> listOfSketchPoints = new List<SldWorks.SketchPoint>(); this.listOfSketchPoints = listOfSketchPoints; } This approach creates the behavior that I want. However, it seems that I lack some understanding as to why this is necessary. Shouldn't it be possible to "initialize" a List that is a property of your object with a constructor? Why would you need to create the list, then assign the pointer of that new List to your property?

    Read the article

  • C++, inject additional data in a method

    - by justik
    I am adding the new modul in some large library. All methods here are implemented as static. Let mi briefly describe the simplified model: typedef std::vector<double> TData; double test ( const TData &arg ) { return arg ( 0 ) * sin ( arg ( 1 ) + ...;} double ( * p_test ) ( const TData> &arg) = &test; class A { public: static T f1 (TData &input) { .... //some computations B::f2 (p_test); } }; Inside f1() some computations are perfomed and a static method B::f2 is called. The f2 method is implemented by another author and represents some simulation algorithm (example here is siplified). class B { public: static double f2 (double ( * p_test ) ( const TData &arg ) ) { //difficult algorithm working p_test many times double res = p_test(arg); } }; The f2 method has a pointer to some weight function (here p_test). But in my case some additional parameters computed in f1 for test() methods are required double test ( const TData &arg, const TData &arg2, char *arg3.... ) { } How to inject these parameters into test() (and so to f2) to avoid changing the source code of the f2 methods (that is not trivial), redesign of the library and without dirty hacks :-) ? The most simple step is to override f2 static double f2 (double ( * p_test ) ( const TData &arg ), const TData &arg2, char *arg3.... ) But what to do later? Consider, that methods are static, so there will be problems with objects. Thanks for your help.

    Read the article

  • how to pass vector of string to foo(char const *const *const)?

    - by user347208
    Hi, This is my first post so please be nice. I searched in this forum and googled but I still can not find the answer. This problem has bothered me for more than a day, so please give me some help. Thank you. I need to pass a vector of string to a library function foo(char const *const *const). I can not pass the &Vec[0] since it's a pointer to a string. Therefore, I have an array and pass the c_str() to that array. The following is my code (aNames is the vector of string): const char* aR[aNames.size()]; std::transform(aNames.begin(), aNames.end(), aR, boost::bind(&std::string::c_str, _1)); foo(aR); However, it seems it causes some undefined behavior: If I run the above code, then the function foo throw some warnings about illegal characters ('èI' blablabla) in aR. If I print aR before function foo like this: std::copy(aR, aR+rowNames.size(), std::ostream_iterator<const char*>(std::cout, "\n")); foo(aR); Then, everything is fine. My questions are: Does the conversion causes undefined behavior? If so, why? What is the correct way to pass vector of string to foo(char const *const *const)? Thank you very much for your help!

    Read the article

  • AS3 TextField is blank, doesn't accept any of my settings??

    - by Andy Melichar
    Having a strange issue with assigning a TextField to a movie clip. nameFormat = new TextFormat(); nameFormat.size = 14; nameFormat.color = "0x000000"; nameFormat.border = true; nameFormat.font = "Arial"; charName = new TextField(); charName.defaultTextFormat = nameFormat; charName.text = value.charname; charName.x = 92.5; charName.y = 6.5; charName.width = 205; charName.height = 21; thechars[value.charid].addChild(charName); If I trace charName.text it traces correctly, but when the containing movieclip is displayed, it is always blank and none of my settings (borders, background color, etc..) show up. I'm placing several of these movieclips into another movieclip, which is then added to a scroller as such: scrollContent.addChild(thechars[newvalue.charid]); theScroller.source = scrollContent; The strange thing is that I am using the exact same method to drop a button into each of the 'thechars' and it shows up and works fine. AND... if I hover my mouse over the spot where the textField should be, I can see my mouse change from a pointer to a text cursor, so the textFields are showing up, they are just blank? Help?

    Read the article

  • Can somebody please explain this recursive function for me?

    - by capncoolio
    #include <stdio.h> #include <stdlib.h> void reprint(char *a[]) { if(*a) { printf("%d ",a); reprint(a+1); printf("%s ",*a); } } int main() { char *coll[] = {"C", "Objective", "like", "don't", "I", NULL}; reprint(coll); printf("\n"); return EXIT_SUCCESS; } As the more experienced will know, this prints the array in reverse. I don't quite understand how! I need help understanding what reprint(char *a[]) does. I understand pointer arithmetic to a degree, but from inserting printf's here and there, I've determined that the function increments up to the array end, and then back down to the start, only printing on the way down. However, I do not understand how it does this; all I've managed to understand by looking at the actual code is that if *a isn't NULL, then call reprint again, at the next index. Thanks guys!

    Read the article

  • Using memset on structures in C++

    - by garry
    Hey guys. I am working on fixing older code for my job. It is currently written in C++. They converted static allocation to dynamic but didn't edit the memsets/memcmp/memcpy. This is my first programming internship so bare with my newbe-like question. The following code is in C, but I want to have it in C++ ( I read that malloc isn't good practice in C++). I have two scenarios: First, we have f created. Then you use &f in order to fill with zero. The second is a pointer *pf. I'm not sure how to set pf to all 0's like the previous example in C++. Could you just do pf = new foo instead of malloc and then call memset(pf, 0, sizeof(foo))? struct foo { ... } f; memset( &f, 0, sizeof(f) ); //or struct foo { ... } *pf; pf = (struct foo*) malloc( sizeof(*pf) ); memset( pf, 0, sizeof(*pf) );

    Read the article

  • Scan file contents into an array of a structure.

    - by ZaZu
    Hello, I have a structure in my program that contains a particular array. I want to scan a random file with numbers and put the contents into that array. This is my code : ( NOTE : This is a sample from a bigger program, so I need the structure and arrays as declared ) The contents of the file are basically : 5 4 3 2 5 3 4 2 #include<stdio.h> #define first 500 #define sec 500 struct trial{ int f; int r; float what[first][sec]; }; int trialtest(trial *test); main(){ trial test; trialtest(&test); } int trialtest(trial *test){ int z,x,i; FILE *fin; fin=fopen("randomfile.txt","r"); for(i=0;i<5;i++){ fscanf(fin,"%5.2f\t",(*test).what[z][x]); } fclose(fin); return 0; } But the problem is, whenever this I run this code, I get this error : (25) : warning 508 - Data of type 'double' supplied where a pointer is required I tried adding do{ for(i=0;i<5;i++){ q=fscanf(fin,"%5.2f\t",(*test).what[z][x]); } }while(q!=EOF); But that didnt work either, it gives the same error. Does anyone have a solution to this problem ?

    Read the article

  • pass parameter from $.post() callback to outer variable

    - by Nazmin
    basically i want to hold a parameter that retrieve value from $.post() call like this: init = function(){ var lastpage = getLastPage(); } function getLastPage(){ $.post("getInfo.php",{ last: "yes" }, function(data){ setLast(data.last); },'json'); return function setLast(data){ return data; } } so when reach at last post (last page) i should check with lastpage variable that has a value returned from getLastPage() function. I'm pretty blur with javascript pointer and all. Please help guys. update (20/4/2010): I've done the other way around, like this: init = function(){ getLastPage(); if((page+1) == $("#lastpage").val()){ alert("this is last post"); }else{ page++; //get info and display to the page here } } function getLastPage(){ $.post("getInfo.php",{ last: "yes" }, function(data){ $("#lastpage").val(data.last); },'json'); } first run the function to temporarily store the value in hidden input tag (lastpage) and then grab the value again to check it whenever i click forward button. if you all have more appropriate way please tell me.

    Read the article

  • Array length is zero in jQuery.

    - by James123
    I wrote like this. After submit click loop is not excuting. But I saw value are there, But array lenght is showing '0'. (Please see picture). Why it is not going into loop? and $('#myVisibleRows').val(idsString); becoming 'empty'. $(document).ready(function() { $('tr[@class^=RegText]').hide().children('td'); var list_Visible_Ids = []; var idsString, idsArray; alert($('#myVisibleRows').val()); idsString = $('#myVisibleRows').val(); idsArray = idsString.split(','); $.each(idsArray, function() { if (this != "") { $('#' + this).siblings(('.RegText').toggle(true)); window['list_Visible_Ids'][this] = 1; } }); $('tr.subCategory1') .css("cursor", "pointer") .attr("title", "Click to expand/collapse") .click(function() { //this = $(this); $(this).siblings('.RegText').toggle(); list_Visible_Ids[$(this).attr('id')] = $(this).css('display') != 'none' ? 1 : null; alert(list_Visible_Ids[$(this).attr('id')]) }); $('#form1').submit(function() { idsString = ''; $.each(list_Visible_Ids, function(key, val) { alert(val); if (val) { idsString += (idsString != '' ? ',' : '') + key; } }); $('#myVisibleRows').val(idsString); form.submit(); }); });

    Read the article

  • Can I make a derived class inherit a derived member from its base class in Java?

    - by Eric
    I have code that looks like this: public class A { public void doStuff() { System.out.print("Stuff successfully done"); } } public class B extends A { public void doStuff() { System.out.print("Stuff successfully done, but in a different way"); } public void doMoreStuff() { System.out.print("More advanced stuff successully done"); } } public class AWrapper { public A member; public AWrapper(A member) { this.member = member; } public void doStuffWithMember() { a.doStuff(); } } public class BWrapper extends AWrapper { public B member; public BWrapper(B member) { super(member); //Pointer to member stored in two places: this.member = member; //Not great if one changes, but the other does not } public void doStuffWithMember() { member.doMoreStuff(); } } However, there is a problem with this code. I'm storing a reference to the member in two places, but if one changes and the other does not, there could be trouble. I know that in Java, an inherited method can narrow down its return type (and perhaps arguments, but I'm not certain) to a derived class. Is the same true of fields?

    Read the article

  • C Map String to Function

    - by Scriptonaut
    So, I'm making a Unix minishell, and have come to a roadblock. I need to be able to execute built-in functions, so I made a function: int exec_if_built_in(char **args) It takes an array of strings(the first being the command, and the rest being arguments). For non built-in commands I simply use something like execvp, however I need to find a way to map the first string to a function. I was thinking of making two arrays, one of strings, and another with their corresponding function pointers. However, since many of these functions will be different(return and accept different things), this approach won't work. I also thought of making an array of structs with a name property and a function pointer property, however once again due to the varied nature of the functions I'll be using, this won't work. So, what's the best way to execute a function based on the input of a string? How do I map a string to a certain function? I'm not very familiar with function pointers so I may be missing something. Thank you guys for the help :)

    Read the article

  • Is this an error in "More Effective C++" in Item28?

    - by particle128
    I encountered a question when I was reading the item28 in More Effective C++ .In this item, the author shows to us that we can use member template in SmartPtr such that the SmartPtr<Cassette> can be converted to SmartPtr<MusicProduct>. The following code is not the same as in the book,but has the same effect. #include <iostream> class Base{}; class Derived:public Base{}; template<typename T> class smart{ public: smart(T* ptr):ptr(ptr){} template<typename U> operator smart<U>() { return smart<U>(ptr); } ~smart(){delete ptr;} private: T* ptr; }; void test(const smart<Base>& ) {} int main() { smart<Derived> sd(new Derived); test(sd); return 0; } It indeed can be compiled without compilation error. But when I ran the executable file, I got a core dump. I think that's because the member function of the conversion operator makes a temporary smart, which has a pointer to the same ptr in sd (its type is smart<Derived>). So the delete directive operates twice. What's more, after calling test, we can never use sd any more, since ptr in sd has already been delete. Now my questions are : Is my thought right? Or my code is not the same as the original code in the book? If my thought is right, is there any method to do this? Thanks very much for your help.

    Read the article

  • Why does this CSS button mess with <a> tags?

    - by Ian McCullough
    Here is my CSS button { border: 0 none; cursor: pointer; padding: 0 15px 0 0; text-align: center; height: 30px; line-height: 30px; width: auto; } button a { color:white; text-decoration:none; } button.rounded { background: transparent url(/images/button/btn_right.png) no-repeat scroll right top; clear: left; font-size: 0.8em; } button span { display: block; padding: 0 0 0 15px; position: relative; white-space: nowrap; height: 30px; line-height: 30px; } button.rounded span { background: transparent url(/images/button/btn_left.png) no-repeat scroll left top; color: #FFFFFF; } button.rounded:hover { background-position: 100% -30px; } button.rounded:hover span { background-position: 0% -30px; } button::-moz-focus-inner { border: none; } Here is the code for my "button" with a link in it. <button class="rounded"><span><a href="profile.php">Profile</a></span></button> The issue is it does not link to the href when i click on it. Anyone know why?

    Read the article

  • C++: getting the address of the start of an std::vector ?

    - by shoosh
    Sometimes it is useful to use the starting address of an std::vector and temporarily treat that address as the address of a regularly allocated buffer. For instance replace this: char* buf = new char[size]; fillTheBuffer(buf, size); useTheBuffer(buf, size); delete[] buf; With This: vector<char> buf(size); fillTheBuffer(&buf[0], size); useTheBuffer(&buf[0], size); The advantage of this is of course that the buffer is deallocated automatically and I don't have to worry about the delete[]. The problem I'm having with this is when size == 0. In that case the first version works ok. An empty buffer is "allocated" and the subsequent functions do nothing size they get size == 0. The second version however fails if size == 0 since calling buf[0] may rightly contain an assertion that 0 < size. So is there an alternative to the idiom &buf[0] that returns the address of the start of the vector even if the vector is empty? I've also considered using buf.begin() but according to the standard it isn't even guaranteed to return a pointer.

    Read the article

  • How to delete Drawn Line in java?

    - by Jeyjey
    Hello Folks, well this is my code: import javax.swing.; import javax.; import java.awt.; import java.awt.Color; import java.awt.Graphics.; import java.awt.event.*; import javax.swing.UIManager; public class SimpleGUI extends JFrame{ public SimpleGUI(){ this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) ; } public void go(){ Drawpanel = new Mypanel(); JFrame frame = new JFrame("Chasing Line"); frame.getContentPane().add(BorderLayout.CENTER, Drawpanel); frame.setSize(300,300); frame.setVisible(true); Drawpanel.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseMoved(java.awt.event.MouseEvent evt) { DrawpanelMouseMoved(evt); } }); } public void DrawpanelMouseMoved(java.awt.event.MouseEvent evt) { xpos=evt.getX(); ypos=evt.getY(); System.out.println("Coordinates : X :"+ xpos+"Y: "+ypos); Drawpanel.paintImage(xpos,ypos); } class Mypanel extends JPanel{ public void paintImage(int xpost,int ypost){ Graphics d = getGraphics(); d.setColor(Color.black); d.drawLine(xpost, 0, xpost, this.getHeight()); d.setColor(Color.red); d.drawLine(0, ypost, this.getWidth(),ypost); this.validate(); } } // end the inner class public static void main(String[] args){ try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch(Exception e) { System.err.println("Look and feel not set"); } SimpleGUI win = new SimpleGUI(); win.go(); } Mypanel Drawpanel; private int xpos=0; private int ypos=0; } // close SimpleGUI class The problem is how can i delete the old lines?, i mea,make only the current x and y lines appear on the screen, make the intersection between both lines "follow" the mouse pointer. thanks for any reply.

    Read the article

  • Fit into div in CSS

    - by Teodoris
    Hello everyone my menu bar can't fit into my <div> area at different browser. I have checked with Opera and Chrome it looks fine but with Explorer and Firefox my menu can't fit. And my menu is in this <div> tag: .page { width: 964px; margin-left: auto; margin-right: auto; background-image:url(../images2/images/orta_alan_bg_GOLGE.png); background-repeat:repeat-y; } Here is my menu: ul#menu { padding: 0 0 2px; position: relative; margin: 0; text-align: center; } ul#menu li { display: inline; list-style: none; font-family: 'Museo300Regular'; font-size:17px; font-style:normal; } ul#menu li a { background-image:url(../../images2/images/menu_bg_normal.jpg); background-repeat: repeat; padding: 5px 19px 5px; font-weight: normal; text-decoration: none; line-height: 2.8em; background-color: #e8eef4; color: #FEFEFF; border-radius: 4px 4px 0 0; -webkit-border-radius: 4px 4px 0 0; -moz-border-radius: 4px 4px 0 0; cursor:pointer; } So what is the problem why it can't fit into with Explorer and Firefox? I attach an image you can understand what I mean Here is the Chrome and Opera it can fit

    Read the article

  • Convert one delphi code line to c++

    - by user1332636
    How can I write that line in c++? This is the code in delphi type TSettings = record sFileName: String[50]; siInstallFolder: Byte; bRunFile: Boolean; ... end; .. var i: dword; sZdData: PChar; Settings :Tsettings; begin .... ZeroMemory(@Settings, sizeof(Tsettings)); settings := Tsettings(Pointer(@sZdData[i])^); // this code to c++ c++ code (hope the rest is OK) struct TSettings{ char sFileName[50]; byte siInstallFolder; bool bRunFile; ... } Settings; ... DWORD i; LPBYTE sZdData; ZeroMemory(&Settings, sizeof(TSettings)); Settings = ????? // im failing here i dunno what to do // i need same as in delphi code above

    Read the article

  • Refetching a previously visited page

    - by user613665
    All, I am having a field day with page refetching. Any help or pointer will be greatly appreciated!! The behavior is a bit specific to mobile browser. Problem: I have two pages and created a shortcut link to pg#1 in the home page. Through a form submit button, user is taken from pg#1 to pg#2. All that is working fine. Now once I am on pg#2. I will leave the browser and click the shortcut later. The browser will stay on pg#2 and won't go to pg#1 even though the path in URLS is different between the two views. It is almost like Django decides that since I have already visited view#1, it doesn't need to fetch it again. This problem or behavior doesn't happen if I move the same code that handle the two views and the templates to a bare bone test project. Setup: I am using django-registration, context session. I am not using any HTML caching tag. I already have DEBUG turned on in my settings.py. Are there other ways that I can tell what the server is doing. Thanks in advance. pdxMobile Update: Here is the code snippets. def sendmsg(request): if request.method =='POST': messages.add_message(request, messages.INFO, "Hello world") return redirect ('rcvmsg') return render_to_response('sendMsg.html',RequestContext(request)) def rcvmsg(request): '''view that receives the msg.''' printMsg ='Didnt get a message' if messages: thisMsg = messages.get_messages(request) for rcvMsg in thisMsg: printMsg = rcvMsg return render_to_response('rcvMsg.html',{'print_msg':printMsg},RequestContext(request)) URL: url(r'^rcvMsg/','mydomain.mainApp.views.rcvmsg',name='rcvmsg'), (r'^sendMsg/code','mydomain.mainApp.views.sendmsg'),

    Read the article

  • When are temporaries created as part of a function call destroyed?

    - by Michael Mrozek
    Is a temporary created as part of an argument to a function call guaranteed to stay around until the called function ends, even if the temporary isn't passed directly to the function? There's virtually no chance that was coherent, so here's an example: class A { public: A(int x) : x(x) {printf("Constructed A(%d)\n", x);} ~A() {printf("Destroyed A\n");} int x; int* y() {return &x;} }; void foo(int* bar) { printf("foo(): %d\n", *bar); } int main(int argc, char** argv) { foo(A(4).y()); } If A(4) were passed directly to foo it would definitely not be destroyed until after the foo call ended, but instead I'm calling a method on the temporary and losing any reference to it. I would instinctively think the temporary A would be destroyed before foo even starts, but testing with GCC 4.3.4 shows it isn't; the output is: Constructed A(4) foo(): 4 Destroyed A The question is, is GCC's behavior guaranteed by the spec? Or is a compiler allowed to destroy the temporary A before the call to foo, invaliding the pointer to its member I'm using?

    Read the article

  • Game design flaw, need help investigating

    - by Snake
    I am not sure if I will be able to get help here but I would give it a shot. The problem is I dont know where the problem is. I have a cards game, in which when you "human" play by dragging a card, then at the end of card being dragged, a handler using postExecute is called with delay of 0.5 sec to start the next player in turn (which is a bot) The bot chooses the color and plays it and at the end of the animation (the card moving to the middle) a handler is started for the next bot and so on. Once the play reaches again to the human player, it waits for his touchs to drag the crad and start the cycle again. The problem that in production, sometimes I am getting errors. The error is resulting in somehow messing up the sequence which ends up with players having more cards than others. After investigation, I found that the transition from human to bot is the problem. Somehow, the transition is happening twice (meaning handler calling post execute twice and the bot is playing twice and everything is messed up). Its been mutliple months and I can't reproduce it (to fix it) and I cna't figure out why this is happeneing? ANY IDEA how I can go after it? How can I get more info about or how can I solve something like that? any pointer would help me

    Read the article

  • multiple dependent android projects in eclipse

    - by lope
    Hi there! I just started to play with android dev and java+eclipse is pretty new to me. I managed to create simple project and run it on my device. Now I want to create simple game (more of them actually) and I would love to use shared code base for all of them (game loop, initialization, etc..). Problem is that I have no idea how to correctly do this. I created android project called engine with all basic stuff that I need and made it work on device. Now I tried to create another project in same workspace called mygame. Main class (activity) of mygame is MyGameApp which inherits from EngineApp (main activity of my engine project) which inherits from Activity. I added engine project into required projects in mygame build path tab in properties. Problem is that when I try to run this project it crashes on ClassNotFoundException trying to find my MyGameApp class. Any help (or pointer to some articles that explain how this is done) is greatly appreciated. few hours of googling didn't help much :/

    Read the article

< Previous Page | 122 123 124 125 126 127 128 129 130 131 132 133  | Next Page >