Search Results

Search found 438 results on 18 pages for 'hacks'.

Page 3/18 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Inlining an array of non-default constructible objects in a C++ class

    - by porgarmingduod
    C++ doesn't allow a class containing an array of items that are not default constructible: class Gordian { public: int member; Gordian(int must_have_variable) : member(must_have_variable) {} }; class Knot { Gordian* pointer_array[8]; // Sure, this works. Gordian inlined_array[8]; // Won't compile. Can't be initialized. }; As even beginner C++ users know, the language guarantees that all members are initialized when constructing a class. And it doesn't trust the user to initialize everything in the constructor - one has to provide valid arguments to the constructors of all members before the body of the constructor even starts. Generally, that's a great idea as far as I'm concerned, but I've come across a situation where it would be a lot easier if I could actually have an array of non-default constructible objects. The obvious solution: Have an array of pointers to the objects. This is not optimal in my case, as I am using shared memory. It would force me to do extra allocation from an already contended resource (that is, the shared memory). The entire reason I want to have the array inlined in the object is to reduce the number of allocations. This is a situation where I would be willing to use a hack, even an ugly one, provided it works. One possible hack I am thinking about would be: class Knot { public: struct dummy { char padding[sizeof(Gordian)]; }; dummy inlined_array[8]; Gordian* get(int index) { return reinterpret_cast<Gordian*>(&inlined_array[index]); } Knot() { for (int x = 0; x != 8; x++) { new (get(x)) Gordian(x*x); } } }; Sure, it compiles, but I'm not exactly an experienced C++ programmer. That is, I couldn't possibly trust my hacks less. So, the questions: 1) Does the hack I came up with seem workable? What are the issues? (I'm mainly concerned with C++0x on newer versions of GCC). 2) Is there a better way to inline an array of non-default constructible objects in a class?

    Read the article

  • make my file readable as either Perl or HTML

    - by JoelFan
    In the spirit of the "Perl Preamble" where a script works properly whether executed by a shell script interpreter or the Perl interpreter... I have a Perl script which contains an embedded HTML document (as a "heredoc"), i.e.: #!/usr/bin/perl ... some perl code ... my $html = <<'END' ; <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> ... more HTML ... </html> END ... perl code that processes $html ... I would like to be able to work on the HTML that's inside the Perl script and check it out using a web browser, and only run the script when the HTML is the way I want. To accomplish this, I need the file to be openable both as an HTML file and as a Perl script. I have tried various tricks with Perl comments and HTML comments but can't get it quite perfect. It doesn't have to be "strictly legal" HTML... just displayable in a browser with no (or minimal) Perl garbage visible.

    Read the article

  • Rack rSpec Controller Tests with Rack Middleware issue

    - by Roman Gonzalez
    Howdy, I'm having big trouble testing with rSpec's controller API. Right now I'm using a middleware authentication solution (Warden), and when I run the specs, the proxy added by the middleware is not there, and all the authentication tests are throwing NilPointerExceptions all over the place. It seems rSpec is not adding the middleware to the final app on purpose, and I would like to know if there is a way to monkey patch rSpec in order to make that go. I already tested the whole thing with cucumber, however this is a refactoring of an old authentication version and there is several Controller tests that depend on authentication logic in order to work. Thanks in advance.

    Read the article

  • Firefox 3 only CSS Hack

    - by Parrfolio
    Looking for a Firefox 3 CSS hack that doesn't inherit in Firefox 3.6. html>/**/body .blockmeta .date-ui, x:-moz-any-link, x:default { border:1px solid #ccc; border-bottom:2px solid #ccc; background:#f2f2f2; margin-top:-1px; } The code above seems to also work in Firefox 3.6 which is undesirable.

    Read the article

  • Setting borders around tbody, thead and tfoot with IE8

    - by Benjamin
    Hi, I've designed a table in html that uses tbody, tfoot and thead. I would like to put a border-bottom and border-top on my tbody. Which works perfectly well with Firefox and Google Chrome. However Internet Explorer 8 does not display the borders at all. After searching on the internet I haven't found any solution that did not involve some javascript; which I am not keen on using for that task. Has anyone faced this problem before and came up with a solution that does not require javascript? Ideally I wouldn't want to start messing around with the html too much, a solution just with css would be awesome. Thanks for that.

    Read the article

  • How would I go about prevent DLL injection.

    - by wowus
    So the other day, I saw this: http://www.edgeofnowhere.cc/viewtopic.php?p=2483118 and it goes over three different methods of DLL injection. How would I prevent these from the process? Or at a bare minimum, how do I prevent the first one? I was thinking maybe a Ring 0 driver might be the only way to stop all three, but I'd like to see what the community thinks.

    Read the article

  • Is private members hacking a defined behaviour ?

    - by ereOn
    Hi, Lets say I have the following class: class BritneySpears { public: int getValue() { return m_value; }; private: int m_value; }; Which is an external library (that I can't change). I obviously can't change the value of m_value, only read it. Even subclassing BritneySpears won't work. What if I define the following class: class AshtonKutcher { public: int getValue() { return m_value; }; public: int m_value; }; And then do: BritneySpears b; // Here comes the ugly hack AshtonKutcher* a = reinterpret_cast<AshtonKutcher*>(&b); a->m_value = 17; // Print out the value std::cout << b.getValue() << std::endl; I know this is a bad practice. But just for curiosity: is this guaranted to work ? Is it a defined behaviour ? Bonus question: Have you ever had to use such an ugly hack ? Thanks !

    Read the article

  • CSS image float div problem in IE6

    - by Ben Dauphinee
    In the bottom cap of this page (bottom with corners) I seem to be having a weird IE6 issue. I've tried Google with no luck, as really, how do you ask this question. In IE6, the corner images that are floated left and right seem to cause the whitespace to drop. http://www.duncanhadleytriathlon.ca/ Any suggestions for why this may be?

    Read the article

  • Non-IE6 IE7 hack

    - by thermal7
    I managed to create a page the crashes IE6 and 7 regularly as per here: http://raven-seo-tools.com/blog/2675/crash-ie6-with-only-css I have a solution for non-IE browsers (display: inline-block), but the only way to get IE6/7 working is to use different CSS (display: inline). Normally I would have other browsers use inline-block, then in a seperate IE67 CSS file I would set display to inline. The problem is IE67 crash as soon as they reach the display: inline-block line, so I need a way to hide this code from IE6 and 7 but not other browsers.

    Read the article

  • How can I dual boot my iphone or ipad to run a very simple custom os?

    - by Jim98
    I am an experienced C/C++ programmer and have worked with assembly and many other programing language and I want to start a project as a learning process. I want to try and run a simple custom os on the iphone or ipad. What knowledge would I need to do this, and how does the iphone or ipad bootloader load the os and how could I modify it to load a custom os? Im not really sure what to ask here so I really just need to get as much information as possible so I could ask some more informed questions to get my project started Thanks

    Read the article

  • modify class on runtime?

    - by joe doe2
    how can i modify the method in memory so it makes new objects with that modified method? for example i want to modify or add page_init handler on runtime for the next time the page loads? see this also for clarification: http://stackoverflow.com/questions/3005338/page-load-another-handler

    Read the article

  • Using // in a <script>'s source

    - by Dan Beam
    Hello fellow front-end web h4X0|2s, I was wondering if anyone had any resources, proof, or personal experience in using the age-old http/https JavaScript hack: <script src="//someserver.com/js/script.js"></script> Has anyone encountered issues in any of these browsers (IE 5.5+, FF2+, Chrome, Opera 9+, Safari 3+)? Has anybody had success stories? Thank you for your help.

    Read the article

  • What are the most frustrating Python hacks to unwind, rewrite, etc.?

    - by Bialecki
    My impression of Python from the short time I've been developing with it is that it's incredible powerful and flexible, but I can't help but feel like "with great power comes great responsibility." So while I've read numerous blog posts about simple and elegant Python snippets that solve a problems, I wonder if there are design patterns or abuses of Python language features that, once built into an application or library, cause the code to be incredibly brittle and near impossible to refactor. So the question is basically what are the most frustrating, but somewhat common, Python "hacks" or language feature abuses that someone can introduce that will cause nightmares for future maintainers of that code?

    Read the article

  • Most awesomely bad hack

    - by Zypher
    As I sit watching one of my latest dirty dirty hacks run, I started wondering what kind of dirty hacks you have created that are so bad they are awesome. We all have a few of them in our past - and they are probably still running in production somewhere, chugging along somehow still working. Which reminds me of the hack we had to put into place when we were moving data centers. Our IVRs had to keep running, as the data center we were moving from was the primary DC, and the new Primary wasn't quite ready to take traffic. So what do we do. Well we answer the calls in DC1, then ship the sip stream over the internet to DC2 1900 miles away ... that just felt oh so wrong. So the question is, what is one (or more) of your awesomely bad hacks?

    Read the article

  • Travelling MVP #1: Visit to SharePoint User Group Finland

    - by DigiMortal
    My first self organized trip this autumn was visit to SharePoint User Group Finland community evening. As active community leaders who make things like these possible they are worth mentioning and on spug.fi side there was Jussi Roine the one who invited me. Here is my short review about my trip to Helsinki. User group meeting As Helsinki is near Tallinn I went there using ship. It was easy to get from sea port to venue and I had also some minutes of time to visit academic book store. Community evening was held on the ground floor of one city center hotel and room was conveniently located near hotel bar and restaurant. Here is the meeting schedule: Welcome (Jussi Roine) OpenText application archiving and governance for SharePoint (Bernd Hennicke, OpenText) Using advanced C# features in SharePoint development (Alexey Sadomov, NED Consulting) Optimizing public-facing internet sites for SharePoint (Gunnar Peipman) After meeting, of course, local dudes doesn’t walk away but continue with some beers and discussion. Sessions After welcome words by Jussi there was session by Bernd Hennicke who spoke about OpenText. His session covered OpenText history and current moment. After this introduction he spoke about OpenText products for SharePoint and gave the audience good overview about where their SharePoint extensions fit in big picture. I usually don’t like those vendors sessions but this one was good. I mean vendor dudes were not aggressively selling something. They were way different – kind people who introduced their stuff and later answered questions. They acted like good guests. Second speaker was Alexey Sadomov who is working on SharePoint development projects. He introduced some ways how to get over some limitations of SharePoint. I don’t go here deeply with his session but it’s worth to mention that this session was strong one. It is not rear case when developers have to make nasty hacks to SharePoint. I mean really nasty hacks. Often these hacks are long blocks of code that uses terrible techniques to achieve the result. Alexey introduced some very much civilized ways about how to apply hacks. Alex Sadomov, SharePoint MVP, speaking about SharePoint coding tips and tricks on C# I spoke about how I optimized caching of Estonian Microsoft community portal that runs on SharePoint Server and that uses publishing infrastructure. I made no actual demos on SharePoint because I wanted to focus on optimizing process and share some experiences about how to get caches optimized and how to measure caches. Networking After official part there was time to talk and discuss with people. Finns are cool – they have beers and they are glad. It was not big community event but people were like one good family. Developers there work often for big companies and it was very interesting to me to hear about their experiences with SharePoint. One thing was a little bit surprising for me – SharePoint guys in Finland are talking actively also about Office 365 and online SharePoint. It doesn’t happen often here in Estonia. I had to leave a little bit 21:00 to get to my ship back to Tallinn. I am sure spug.fi dudes continued nice evening and they had at least same good time as I did. Do I want to go back to Finland and meet these guys again? Yes, sure, let’s do it again! :)

    Read the article

  • How to deal with ad-hoc mindsets?

    - by Rotian
    I joined a dev team of six two month ago. People are nice, all is good. But more and more I observe an ad-hoc mindset. Stuff gets quick fixed, at the cost of future usability, there is little testing and two people happily admitted, that they like to carry the knowledge around in their head, rather than to write it down. How to deal with this? I'd like to lead by example, but time is limited - I like architecting and actually implementing the stuff. But I'm afraid the ad-hoc mindset infects me and rather than striving for clearness and simplicity in design and code - which isn't simple to establish - I get pulled down the drain of an endless spiral of hacks on hacks - which no outsider can uncouple - just for schedule's and management's sake.

    Read the article

  • Kinect hacked for augmented reality

    - by Kit Ong
    It seems Kinect has more potential than any other consoles based motion detection device given the number of hacks that are out there in the wild. http://uk.videogames.games.yahoo.com/blog/article/19744/kinect-as-youve-never-seen-it-before.html Direct links to youtube videos of Kinect hacks: http://www.youtube.com/watch?v=M-wLOfjVfVc?fs=1&hl=en_GB http://www.youtube.com/watch?v=eWmVrfjDCyw?fs=1&hl=en_GB http://www.youtube.com/watch?v=P3gfMXwQOGI?fs=1&hl=en_GB http://www.youtube.com/watch?v=4qhXQ_1CQjg?fs=1&hl=en_GB http://www.youtube.com/watch?v=VgLp-KyK5g8?fs=1&hl=en_GB http://www.youtube.com/watch?v=CeQwhujiWVk?fs=1&hl=en_GB

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >