Daily Archives

Articles indexed Saturday April 17 2010

Page 11/81 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Why does this cast to Base class in virtual function give a segmentation fault?

    - by dehmann
    I want to print out a derived class using the operator<<. When I print the derived class, I want to first print its base and then its own content. But I ran into some trouble (see segfault below): class Base { public: friend std::ostream& operator<<(std::ostream&, const Base&); virtual void Print(std::ostream& out) const { out << "BASE!"; } }; std::ostream& operator<<(std::ostream& out, const Base& b) { b.Print(out); return out; } class Derived : public Base { public: virtual void Print(std::ostream& out) const { out << "My base: "; //((const Base*)this)->Print(out); // infinite, calls this fct recursively //((Base*)this)->Print(out); // segfault (from infinite loop?) ((Base)*this).Print(out); // OK out << " ... and myself."; } }; int main(int argc, char** argv){ Derived d; std::cout << d; return 0; } Why can't I cast in one of these ways? ((const Base*)this)->Print(out); // infinite, calls this fct recursively ((Base*)this)->Print(out); // segfault (from infinite loop?)

    Read the article

  • NULL ForeignKeyTo property in Subsonic 3/ASP.NET MVC?

    - by chad
    Issue: the primary key of the base table is named differently than the the key in the fk table. Subsonic 3 does not know how to handle that, which is fine, its beta. So I was going to change the Html.ControlFor logic to just grab the table and use the pkname from that: var fk = db.FindTable(col.ForeignKeyTo.FriendlyName); However the .ForeignKeyTo is null. Where in the templates does that ITable get populated?

    Read the article

  • WCF is throwing UnauthorizedAccessExceptyion after upgrade to .NET 4.0

    - by Andrey
    I have a pretty simple client-server ASP.NET app; communication is via WCF service. All worked perferctly inVS 2008, now I upgraded to VS2010 and every time the client code is trying to instantiate a channel to the server: new ChannelFactory<IMemberService>("Members.MemberService").CreateChannel(); it throws an UnauthorizedAccessException "Access denied". Were there any breaking changes in the new version, or do I need to add some configuration? I'm pretty stuck, any ideas would be highly appreciated! BTW, binding used is basicHttpBinding, i don't know if thats important here. Thank you, Andrey

    Read the article

  • udp can not receive any data

    - by StoneHeart
    Here is my code Socket sck = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); sck.Bind(new IPEndPoint(IPAddress.Any, 0)); // Broadcast to find server string msg = "Imlookingforaserver:" + udp_listen_port; byte[] sendBytes4 = Encoding.ASCII.GetBytes(msg); IPEndPoint groupEP = new IPEndPoint(IPAddress.Parse("255.255.255.255"), server_port); sck.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, 1); sck.SendTo(sendBytes4, groupEP); //Wait response from server Socket sck2 = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); sck2.Bind(new IPEndPoint(IPAddress.Any, udp_listen_port)); byte[] buffer = new byte[128]; EndPoint remoteEndPoint = new IPEndPoint(IPAddress.Any, udp_listen_port); sck2.ReceiveFrom(buffer, ref remoteEndPoint); //<<< I never pass this line I use above code to try find a server. First I broadcast a message and then I wait for a response from the server. A test I made with the server written in C++ and running in Windows Vista, client written in C# and run on the same machine with server. Problem is: The server can receive message which client broadcast, but client can not receive anything from server. I try to write a client with C++ and it work like a charm, I think my problem is in C# client.

    Read the article

  • How to access the members of this data in PHP?

    - by George Edison
    Okay. Now I give up. I have been playing with this for hours. I have a variable name $data. The variable contains these contents: (extracted by using var_export()) array ( 'headers' => array ( 'content-type' => 'multipart/alternative; boundary="_689e1a7d-7a0a-442a-bd6c-a1fb1dc2993e_"', ), 'ctype_parameters' => array ( 'boundary' => '_689e1a7d-7a0a-442a-bd6c-a1fb1dc2993e_', ), 'parts' => array ( 0 => stdClass::__set_state(array( 'headers' => array ( 'content-type' => 'text/plain; charset="iso-8859-1"', 'content-transfer-encoding' => 'quoted-printable', ), 'ctype_primary' => 'text', )), ), ) I removed some non-essential data. I want to access the headers value (on the second line above) - simple: $data->headers I want to access the headers value (on the fourteenth line after the stdClass:: stuff) - how? How can I possibly access the values within the stdClass::__set_state section? I tried var_export($data->parts); but all I get is NULL

    Read the article

  • Good reasons to pass paths as strings instead of using DirectoryInfo/FileInfo

    - by neodymium
    In my new code I am not using strings to pass directory paths or file names. Instead I am using DirectoryInfo and FileInfo as they seem to encapsulate a lot of information. I have seen a lot of code that uses strings to pass directory information then they "split" and "mid" and "instr" in long incomprehensible statements until they get the part of the directory they are looking for. Is there any good reason to pass paths as strings?

    Read the article

  • Save Jquery Object without losing its binding

    - by Ahmad Satiri
    Hi I have object created using jquery where each object has it's own binding. function closeButton(oAny){ var div = create_div(); $(div).attr("id","btn_"+$(oAny).attr("id")); var my_parent = this; $(div).html("<img src='"+ my_parent._base_url +"/assets/images/close.gif'>"); $(div).click(function(){ alert("do some action here"); }); return div; } var MyObject = WindowObject(); var btn = closeButton(MyObject); $(myobject).append(btn); $("body").append(myobject); //at this point button will work as i expected //save to array for future use ObjectCollections[0] = myobject; //remove $(myobject).remove(); $(body).append(ObjectCollections[0]); // at this point button will not work For the first time i can show my object and close button is working as i expected. But if i save myobject to any variable for future use. It will loose its binding. Anybody ever try to do this ? Is there any work around ? or It is definitely a bad idea ? .And thanks for answering my question.

    Read the article

  • jquery ui dialog fixed positioning

    - by sofia
    Hi, I needed the dialog to maintain its position fixed even if the page scrolled, so i used the extension at http://forum.jquery.com/topic/dialog-position-fixed-12-1-2010 but there's 2 problems with it: it flickers in IE and Firefox on page scroll (in Safari/Chrome it's fine) on closing and then reopening, it looses its stickyness and scrolls along with the page. Here's the code i'm using for creating the dialog: $('<div id="'+divpm_id+'"><div id="inner_'+divpm_id+'"></div><textarea class="msgTxt" id="txt'+divpm_id+'" rows="2"></textarea></div>') .dialog({ autoOpen: true, title: user_str, height: 200, stack: true, sticky: true //uses ui dialog extension to keep it fixed }); And here's the code i'm using for reopening it: jQuery('#'+divpm_id).parent().css('display','block'); Suggestions/solutions? Thanks

    Read the article

  • how do you convert a directoryInfo file to string

    - by steve
    Problem is that i cant convert to string Dim path As String = "..\..\..\Tier1 downloads\CourseVB\" If countNumberOfFolders > 0 Then 'if there is a folder then ' make a reference to a directory Dim di As New IO.DirectoryInfo(path) Dim diar1 As IO.DirectoryInfo() = di.GetDirectories() Dim dra As IO.DirectoryInfo 'list the names of all files in the specified directory For Each dra In diar1 Dim lessonDirectoryName() As Lesson lessonDirectoryName(0).lessonName = dra Next 'the the lesson is an object, and lessonName is the property of type string. How do i convert the directoryInfo to string?

    Read the article

  • Problems with Airtel

    I am a housewife from Delhi, currently living in Chennai. My husband is a businessman and I usually use skype so I can constantly keep in touch with my husband. But due to frequent robberies in my ar... [Author: Francis Regan - Computers and Internet - April 16, 2010]

    Read the article

  • Windows Vista vs. Windows XP: a Comparison

    Windows XP had earned high acclaim from global clientele and still going up. But Microsoft had a different plan altogether. The result was the launch of Windows Vista, an electrifying Operating Syste... [Author: Susan Brown - Computers and Internet - April 16, 2010]

    Read the article

  • Unloading vertex buffers in OpenGL

    - by Jeremy Statz
    I have an Android live wallpaper that I suspect is leaking memory, probably either textures or vertex arrays. I'm calling glDeleteTextures on my texture IDs, but don't see any sort of equivalent for my vertex buffers. I'd like to be able to be sure both my textures and buffers are getting unloaded by OpenGL, am i missing something? The documents I've found seem to suggest OpenGL just works it out on its own, but that's not giving me a lot of comfort.

    Read the article

  • iphone touch offset in uiwebview

    - by How2iphone
    I am currently experimenting with canvas drawing function in a uiwebview.Its a simple app that allows you to finger paint on the Iphone.Can someone point me in the rite direction on a problem I'm having.I need to be able to offset the touch so you can see what your painting instead of your finger being in the way.Its built on Html,javascript and css.Any ideas would be greatly appreciated.

    Read the article

  • rails, rest, render different action with responds to

    - by Sam
    Maybe my logic is not restful or know if this is how you would do it but this is what I am trying to do. I'm getting a category inside a category controller and then once I get that category I want to return to an index page in a different controller but keep that @category and the Category.busineses. Before rest I would have just done this: render :controller = "businesses" and it would have rendered the view of the index action in that controller. now in my respond_to block I have this format.html {redirect_to(business_path)} # index.html.erb format.xml { render :xml => @businesses } but of course with a render it looses the instance variable and starts with a new action. So what I want to do is render the action instead of redirecting to that action. is this possible?

    Read the article

  • Disable proxy for entire application?

    - by Brent
    Ever since upgrading to Visual Studio 2010, I'm running into an issue where the first web request of any type (WebRequest, WebClient, etc.) hangs for about 20 seconds before completing. Subsequent calls work quickly. I've narrowed down the problem to a proxy issue. If I manually disable proxy settings, I don't experience this delay: Dim wrq As WebRequest = WebRequest.Create(Url) wrq.Proxy = Nothing What's strange is that there are no proxy settings enabled on this machine in Internet Options. What I'm wondering is if there is a way to disable proxy settings for my entire project in one shot without explicitly disabling as above for every web object. The main reason I want to be able to do this is that I'm trying to use an API (http://code.google.com/p/google-api-for-dotnet/) which uses web requests, but does not provide any way to manually disable proxy settings. I have found some information suggesting that I need to add some proxy information to the app.config file, but I get errors building my program if I make an edits to that file. Can anyone point me in the right direction?

    Read the article

  • Is using the break statement bad practice?

    - by Lchi
    I've been told by professors and peers at my university that using the break statement is bad practice, but through my coursework haven't come up with a great reason why. Those who claim that it is bad say that it's a "get out of jail free card" and that you can always avoid using it. My guesses for why its considered bad would be that you could possibly skip some cleanup code after the break, or similarly exit some control structure in an inconsistent state. Is there any reason why using break is(n't) bad practice?

    Read the article

  • How do I force showing a tooltip in WPF

    - by user316030
    Hello, I'd like to show a tooltip when I move the mouse. Here is my code: private void Grid_MouseMove(object sender, MouseEventArgs e) { Grid grid = (Grid) sender; if (e.GetPosition(grid).X < 100) grid.ToolTip = e.GetPosition(grid).X.ToString(); else grid.ToolTip = null; } However, the tooltip disappears after I click on the grid. Is there a way to force showing the tooltip?

    Read the article

  • How to make disconnected closed curves connected by adding a shortest path using MATLAB?

    - by user198729
    bwlabel can be used to get disconnected objects in an image: [L Ne] = bwlabel(image); I want to make the objects(But my target is only the contours(closed curve) of these objects) connected by adding a shortest path where necessary. How do I approach this? UPDATE Or how to dilate the closed curves so that they get connected? How to calculate the shortest path between two disconnected closed curves?

    Read the article

  • noweb dpp filter and latex not printing curly braces

    - by Dervin Thunk
    Hello. Well, this smells like a tumbleweed, but I will ask it anyway. Suppose you have a noweb file with some c# code. You also have the c++ pretty-print filter dpp. If you run the command noweave -filter ./dpp -x test.nw > csharp.tex on the file below, it will print everything except for the curly braces. Instead of them, I get an em-dash and a closing quotations marks (i.e. ?) in the dvi. The tex source looks fine... Any ideas? @ C\# test file <<test.c>>= while( (a[right] >= pivot) && (left < right) ) { right--; }

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >