Search Results

Search found 5915 results on 237 pages for 'practices'.

Page 118/237 | < Previous Page | 114 115 116 117 118 119 120 121 122 123 124 125  | Next Page >

  • Do preconditions ALWAYS have to be checked?

    - by Pin
    These days I'm used to checking every single precondition for every function since I got the habit from an OS programming course back at uni. On the other hand, at the software engineering course we were taught that a common precondition should only be checked once, so for example, if a function is delegating to another function, the first function should check them but checking them again in the second one is redundant. I do see the redundancy point, but I certainly feel it's safer to always check them, plus you don't have to keep track of where they were checked previously. What's the best practice here?

    Read the article

  • Efficiently store last X items in an MySQL Database

    - by Saif Bechan
    I want to store the last 3 items in an MySQL database in an efficient way. So when the 4th item is stored the first should be deleted. The way I do this not is first run a query getting the items. Than check what I should do then insert/delete. There has to be a better way to do this. Any suggestions?

    Read the article

  • Tracking user changes in ASP.NET MVC

    - by Ian Roke
    I have a requirement to track what authenticated users change with regards to the data when logged in. I don't need to track what pages they look at although that could be very useful in future. I have thought about saving the User Guid but that seems very clunky. Are there other methods/best practises?

    Read the article

  • What do I need to do besides code?

    - by user151841
    I'm a single-person operation for my small employer. I'm working on a couple of web applications that have grown to medium-size. We have backups going and everything is in version control with Subversion. I have comments in my code, but documentation outside of code is "spotty at best", and frequently things change. What do I need to do to bring it to the next level, beyond a pile of ( version-controlled, well-commented ) code? What would you say is required to have a robust set of documentation outside of the codebase itself, where the project is at, and where it's going? Ideally I would like some integrated system that would go from brainstorm, to requirements, to tracking bugs and features in svn check-in messages, to documentation. Would trac or redmine do something like this? I would like to show to my boss, "This is the prioritized list of features, this is where we are now, this is how long I spend on this feature, how long I spent on this bug" and I'd like to spend the minimum amount of time managing the projects :) What about ERD and UML diagrams? Is a project incomplete without them?

    Read the article

  • Hide Adsense on localhost

    - by collimarco
    I have a site built in Ruby On Rails which has many ads in different templates and views. It is hard to actualy remove each ad between tests and deployments. I don't know whether Google approves many impressions (even if without clicks) on localhost. How do you deal with this issue? Maybe it is a good solution to set a variable/constant available everywere to enable/disable ads easily. Do you think it is a good solution? If so, how do I declare a global variable for views?

    Read the article

  • STLifying C++ classes

    - by shambulator
    I'm trying to write a class which contains several std::vectors as data members, and provides a subset of vector's interface to access them: class Mesh { public: private: std::vector<Vector3> positions; std::vector<Vector3> normals; // Several other members along the same lines }; The main thing you can do with a mesh is add positions, normals and other stuff to it. In order to allow an STL-like way of accessing a Mesh (add from arrays, other containers, etc.), I'm toying with the idea of adding methods like this: public: template<class InIter> void AddNormals(InIter first, InIter last); Problem is, from what I understand of templates, these methods will have to be defined in the header file (seems to make sense; without a concrete iterator type, the compiler doesn't know how to generate object code for the obvious implementation of this method). Is this actually a problem? My gut reaction is not to go around sticking huge chunks of code in header files, but my C++ is a little rusty with not much STL experience outside toy examples, and I'm not sure what "acceptable" C++ coding practice is on this. Is there a better way to expose this functionality while retaining an STL-like generic programming flavour? One way would be something like this: (end list) class RestrictedVector<T> { public: RestrictedVector(std::vector<T> wrapped) : wrapped(wrapped) {} template <class InIter> void Add(InIter first, InIter last) { std::copy(first, last, std::back_insert_iterator(wrapped)); } private: std::vector<T> wrapped; }; and then expose instances of these on Mesh instead, but that's starting to reek a little of overengineering :P Any advice is greatly appreciated!

    Read the article

  • Boost shared_ptr use_count function

    - by photo_tom
    My application problem is the following - I have a large structure foo. Because these are large and for memory management reasons, we do not wish to delete them when processing on the data is complete. We are storing them in std::vector<boost::shared_ptr<foo>>. My question is related to knowing when all processing is complete. First decision is that we do not want any of the other application code to mark a complete flag in the structure because there are multiple execution paths in the program and we cannot predict which one is the last. So in our implementation, once processing is complete, we delete all copies of boost::shared_ptr<foo>> except for the one in the vector. This will drop the reference counter in the shared_ptr to 1. Is it practical to use shared_ptr.use_count() to see if it is equal to 1 to know when all other parts of my app are done with the data. One additional reason I'm asking the question is that the boost documentation on the shared pointer shared_ptr recommends not using "use_count" for production code.

    Read the article

  • Secrets of delivering .NET size large products?

    - by Joan Venge
    In software companies I have seen it's really hard to work on very large products where everything depends on everything else. For instance Microsoft works on C#, F#, .NET, WPF, Visual Studio where these things are interconnected. I don't know how many people are involved, but if it's in 100s, how do they keep in sync with everything, so they design and implement features without conflicting with other dependencies and future plans of other products? I am wondering that if MS is able to do this, they must have a very good system. Any guidelines or secrets for MS or non-MS very large software product delivering?

    Read the article

  • How to keep statefull web clients in sync, when multiple clients are looking at the same data?

    - by Hilbrand
    In a RIA web client, created with GWT, the state is maintained in the web client, while the server is (almost) stateless (this is the preferred technique to keep the site scalable). However, if multiple users looking at the same data in their browser and one user changes something, which is send to the server and stored in the database, the other users still have the old data in their browser state. For example a tree is shown and one of the users adds/removes an item from the tree. Since there can be a lot of state in the client, what is the best technique to keep the state in the clients in sync? Are there any java frameworks that take care of this?

    Read the article

  • Correct way to protect a private API key when versioning a python application on a public git repo

    - by systempuntoout
    I would like to open-source a python project on Github but it contains an API key that should not be distributed. I guess there's something better than removing the key each time a "push" is committed to the repo. Imagine a simplified foomodule.py : import urllib2 API_KEY = 'XXXXXXXXX' urllib2.urlopen("http://example.com/foo?id=123%s" % API_KEY ).read() What i'm thinking is: Move the API_KEY in a second key.py module importing it on foomodule.py; i would then add key.py on .gitignore file. Same as 1 but using ConfigParser Do you know a good programmatic way to handle this scenario?

    Read the article

  • Best practice: How to persist simple data without a database in django?

    - by Infinity
    I'm building a website that doesn't require a database because a REST API "is the database". (Except you don't want to be putting site-specific things in there, since the API is used by mostly mobile clients) However there's a few things that normally would be put in a database, for example the "jobs" page. You have master list view, and the detail views for each job, and it should be easy to add new job entries. (not necessarily via a CMS, but that would be awesome) e.g. example.com/careers/ and example.com/careers/77/ I could just hardcode this stuff in templates, but that's no DRY- you have to update the master template and the detail template every time. What do you guys think? Maybe a YAML file? Or any better ideas? Thx

    Read the article

  • Best practice for avoiding locks on a heavily read table?

    - by Luiggi
    Hi, I have a big database (~4GB), with 2 large tables (~3M records) having ~180K SELECTs/hour, ~2k UPDATEs/hour and ~1k INSERTs+DELETEs/hour. What would be the best practice to guarantee no locks for the reading tasks while inserting/updating/deleting? I was thinking about using a NOLOCK hint, but there is so much discussed about this (is good, is bad, it depends) that I'm a bit lost. I must say I've tried this in a dev environment and I didn't find any problems, but I don't want to put it on production until I get some feedback... Thank you! Luiggi

    Read the article

  • CSS: Base styles on body or html?

    - by Svish
    When I declare some base styles for my site I have used to do that on the body tag. Like for example body { font-size: medium; line-height: 1.3em; } But I have also seen people do things like that on the html tag. And on both. Where should it be done? Should some be at one and some at the other? Should all be on one of them? Or does it simply not matter at all? Or?

    Read the article

  • How do you remove/clean-up code which is no longer used?

    - by clarke ching
    So, we have a project which had to be radically descoped in order to ship on time. It's got a lot of code left in it which is not actually used. I want to clean up the code, removing any dead-wood. I have the authority to do it and I can convince people that it's a commercially sensible thing to do. [I have a lot of automated unit tests, some automated acceptance tests and a team of testers who can manually regression test.] My problem: I'm a manager and I don't know technically how to go about it. Any help?

    Read the article

  • Am i using too much jquery? When i'm crossing the line?

    - by Andrea
    Lately i find myself using jquery and javascript a lot, often to do the same things that i did before using css. For example, i alternate table rows color or create buttons and links hover effects using javascript/jquery. Is this acceptable? Or should i keep using css for these kind of things? So the real question is: When i'm using too much jquery? How can i understand when i'm crossing the line? Thanks.

    Read the article

  • Defining implicit and explicit casts for C# interfaces

    - by ehdv
    Is there a way to write interface-based code (i.e. using interfaces rather than classes as the types accepted and passed around) in C# without giving up the use of things like implicit casts? Here's some sample code - there's been a lot removed, but these are the relevant portions. public class Game { public class VariantInfo { public string Language { get; set; } public string Variant { get; set; } } } And in ScrDictionary.cs, we have... public class ScrDictionary: IScrDictionary { public string Language { get; set; } public string Variant { get; set; } public static implicit operator Game.VariantInfo(ScrDictionary s) { return new Game.VariantInfo{Language=sd.Language, Variant=sd.Variant}; } } And the interface... public interface IScrDictionary { string Language { get; set; } string Variant { get; set; } } I want to be able to use IScrDictionary instead of ScrDictionary, but still be able to implicitly convert a ScrDictionary to a Game.VariantInfo. Also, while there may be an easy way to make this work by giving IScrDictionary a property of type Game.VariantInfo my question is more generally: Is there a way to define casts or operator overloading on interfaces? (If not, what is the proper C# way to maintain this functionality without giving up interface-oriented design?)

    Read the article

  • Any reason to clean up unused imports in Java, other than reducing clutter?

    - by Kip
    Is there any good reason to avoid unused import statements in Java? As I understand it, they are there for the compiler, so lots of unused imports won't have any impacts on the compiled code. Is it just to reduce clutter and to avoid naming conflicts down the line? (I ask because Eclipse gives a warning about unused imports, which is kind of annoying when I'm developing code because I don't want to remove the imports until I'm pretty sure I'm done designing the class.)

    Read the article

  • Implement abstract class as a local class? pros and cons

    - by sinec
    Hi, for some reason I'm thinking on implementing interface within a some function(method) as local class. Consider following: class A{ public: virtual void MethodToOverride() = 0; }; A * GetPtrToAImplementation(){ class B : public A { public: B(){} ~B(){} void MethodToOverride() { //do something } }; return static_cast<A *>(new B()); } int _tmain(int argc, _TCHAR* argv[]) { A * aInst = GetPtrToAImplementation(); aInst->MethodToOverride(); delete aInst; return 0; } the reason why I'm doing this are: I'm lazy to implement class (B) in separate files MethodToOverride just delegates call to other class Class B shouldn't be visible to other users no need to worry about deleting aInst since smart pointers are used in real implementation So my question is if I'm doing this right? Thanks in advance!

    Read the article

  • How to change the value of progressbar in C#?

    - by shekhar
    Hi, I want to add an progress bar into my C# based application. I would like to know what is the good way of updating its value at particular events? My problem is, I have single function in UI which does all the processing.This function in turn calls many more functions, creates objects, updates database, etc. (basically performs all the work) and returns values in an output file. I have access to that function only. So in this how to update the progressbar's value at the end of each step? What is the best practice for this kind of situation? What is the good way to keep UI logic and business logic seperate? I want to avoid writting progressbar related code in my library code. Please suggest some solution. Thanks and Regards,

    Read the article

  • Factory Method Using Is/As Operator

    - by Swim
    I have factory that looks something like the following snippet. Foo is a wrapper class for Bar and in most cases (but not all), there is a 1:1 mapping. As a rule, Bar cannot know anything about Foo, yet Foo takes an instance of Bar. Is there a better/cleaner approach to doing this? public Foo Make( Bar obj ) { if( obj is Bar1 ) return new Foo1( obj as Bar1 ); if( obj is Bar2 ) return new Foo2( obj as Bar2 ); if( obj is Bar3 ) return new Foo3( obj as Bar3 ); if( obj is Bar4 ) return new Foo3( obj as Bar4 ); // same wrapper as Bar3 throw new ArgumentException(); } At first glance, this question might look like a duplicate (maybe it is), but I haven't seen one exactly like it. Here is one that is close, but not quite: http://stackoverflow.com/questions/242097/factory-based-on-typeof-or-is-a

    Read the article

  • Should I create a new extension for an xml file?

    - by macleojw
    I'm working with a data model stored in XML files. I want to create some metadata for the model and store it alongside, but would like to be able to distinguish between the two. The data model is imported into some software from time to time and we don't want it to try to import the meta data files. To get round this, I've been thinking of creating a new extension for the metadata xml files (say .mdml). Is this good practice?

    Read the article

  • moving a website built on struts to a CMS

    - by fabiobeta
    Hi. Imagine having developed a classical website with java&struts. Now you customer is learning that redeploying the application to change an image or a text is a significant cost. And it asks to add a function to the site: cms-like handling of the contents (editing, versioning, approved publishing). How would you handle this request? Would you develop it in the webapp? Would you merge the webapp with a CMS? Would tou MOVE the webapp into a cms? Would you run away?

    Read the article

< Previous Page | 114 115 116 117 118 119 120 121 122 123 124 125  | Next Page >