Search Results

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

Page 55/237 | < Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >

  • Taming the malloc/free beast -- tips & tricks

    - by roufamatic
    I've been using C on some projects for a master's degree but have never built production software with it. (.NET & Javascript are my bread and butter.) Obviously, the need to free() memory that you malloc() is critical in C. This is fine, well and good if you can do both in one routine. But as programs grow, and structs deepen, keeping track of what's been malloc'd where and what's appropriate to free gets harder and harder. I've looked around on the interwebs and only found a few generic recommendations for this. What I suspect is that some of you long-time C coders have come up with your own patterns and practices to simplify this process and keep the evil in front of you. So: how do you recommend structuring your C programs to keep dynamic allocations from becoming memory leaks?

    Read the article

  • Defining - and dealing with - Evil

    - by Chris Becke
    As a software developer one sometimes gets feature requests that seem to be in some kind of morally grey area. Sometimes one can deflect them, or implement them in a way that feels less 'evil' - sometimes - on reflection - while the feature request 'feels' wrong theres no identifiable part of it that actually causes harm. Sometimes one feels a feature is totally innocent but various anti virus products start tagging one as malware. For example - I personally consider EULAs to (a) hopefully be unenforceable and (b) a means by which rights are REMOVED from consumers. However Anti Virus scanners frequently mark as malware any kind of download agent that does not display a EULA. Which to me is the result of a curious kind of double think. What I want to know is - are there any online (or offline) resources that cover evil software development practices? How can I know if a software practice that I consider dodgy is in fact evil enough to consider fighting?

    Read the article

  • Cleaning up code - flatten a nested hash structure

    - by knorv
    The following Perl sub flattens a nested hash structure: sub flatten { my $hashref = shift; my %hash; my %i = %{$hashref}; foreach my $ii (keys(%i)) { my %j = %{$i{$ii}}; foreach my $jj (keys(%j)) { my %k = %{$j{$jj}}; foreach my $kk (keys(%k)) { my $value = $k{$kk}; $hash{$kk} = $value; } } } return %hash; } While the code works it is not very readable or clean. My question is two-fold: In what ways does it not correspond to modern Perl best practices? How would you clean it up?

    Read the article

  • Is wrapping new within the constructor good or bad?

    - by Timothy
    I watched John Resig's Best Practices in JavaScript Library Design presentation; one slide suggested "tweaking" the object constructor so it instantiates itself. function jQuery(str, con) { if (window === this) { return new jQuery(str, con); } // ... } With that, new jQuery("#foo") becomes jQuery("# foo"). I thought it was rather interesting, but I haven't written a constructor like that in my own code. A little later I read a post here on SO. (Sorry, I don't remember which or I'd supply a link. I will update the question if I can find it again.) One of the comments said it was bad practice to hide new from the programmer like that, but didn't go into details. My question is, it the above generally considered good, bad, or indifferent, and why?

    Read the article

  • What guides or standards do you use for version control in your team ?

    - by PaulHurleyuk
    I'm starting to do a small amount of development within my company. I'm intending to use Git for version control, and I'm interested to see what guidelines or standards people are using around version in their groups, similar to coding standards are often written within the group for the group. I'm assuming there will be things like; Commit often (at least every day/week/meeting etc) Release builds are always made from the master branch Prior to release, a new branch will be created for Testing and tagged as such. only bug fixes from this point onwards. The final release of this will be tagged as such and the bug fixes merged back into the trunk Each developer will have a public repo New features should get their own branch Obviously a lot of this will depend on what cvs you're using and how you've structured it. Similar Questions; http://stackoverflow.com/questions/273695/git-branch-naming-best-practices http://stackoverflow.com/questions/2006265/is-there-an-standard-naming-convention-for-git-tags

    Read the article

  • Can anyone recommend a primer to Erlang?

    - by Till
    I've recently found myself getting more and more interested in Erlang. I've purchased a book (Programming in Erlang) and started reading up on the basics. Reading books is time consuming so I am looking to shortcut this a bit and go back to the book later. What I lack is a good introductory tutorial. Kind of like, hands on, this is what you need to get started in Erlang, these are best practices, this is how you organize code and this is how you do a small project. I've googled this topic extensively and haven't had much luck. ;)

    Read the article

  • Can't declare unused exception variable when using catch-all pattern

    - by b0x0rz
    what is a best practice in cases such as this one: try { // do something } catch (SpecificException ex) { Response.Redirect("~/InformUserAboutAn/InternalException/"); } the warning i get is that ex is never used. however all i need here is to inform the user, so i don't have a need for it. do i just do: try { // do something } catch { Response.Redirect("~/InformUserAboutAn/InternalException/"); } somehow i don't like that, seems strange!!? any tips? best practices? what would be the way to handle this. thnx

    Read the article

  • What's the best way to format long strings of HTML in PHP?

    - by dclowd9901
    I know it's really a subjective question, but for best-practices (and readability), I can't seem to get a fix on the best way to format long strings of HTML. I typically do it like this: echo ' <div> <p>Content Inside</p> <div class="subbox"> <ul> <li>etc.</li> <li>etc.</li> <li>etc.</li> <li>etc.</li> </ul> </div> </div> '; But I still don't like the outcome, especially if this appears in the middle of a large block of code. It just feels messy.

    Read the article

  • SQL Server: Mitigating schema changes/upgrades

    - by bradhe
    I haven't spent a ton of time researching this yet, mostly looking for best practices on upgrading/changing DB schemas. We're actively developing a new product and as such we often have additions or changes to our DB schema. We also have many copies of the DB -- one for the test environment, one for the prod environment, dev environments, you name it. We don't really want to have to blow away test data every time we want to make a change to the DB. Are there good ways of automating this or handling this? None of us have really ever had to deal with this so...

    Read the article

  • How do you keep track of what you have released in production?

    - by systempuntoout
    Tipically a deploy in production does not involve just a mere source code update (build) but requires a lot of other important tasks like for example: Db scripts (tables, query..) Configuration files (differents from test\production) Batch to schedule Executables to move to the correct path Etc. etc. In our company we just send an email to a "Release email address" describing the tasks in order, which changeset need to be published (TFS), which SP need to be updated, db scripts and so on. I believe there's not a magic tool that does these tasks automagically in order, rollback included; but probably there's something better than email that helps to keep track of releases in production. Do you have any tools to suggest or practices to share?

    Read the article

  • ArgumentException or ArgumentNullException for string parameters?

    - by Anna Lear
    Far as best practices are concerned, which is better: public void SomeMethod(string str) { if(string.IsNullOrEmpty(str)) { throw new ArgumentException("str cannot be null or empty."); } // do other stuff } or public void SomeMethod(string str) { if(str == null) { throw new ArgumentNullException("str"); } if(str == string.Empty) { throw new ArgumentException("str cannot be empty."); } // do other stuff } The second version seems more precise, but also more cumbersome than the first. I usually go with #1, but figured I'd check if there's an argument to be made for #2.

    Read the article

  • Is it a good idea to keep documentation in the VCS?

    - by Jj
    At work we just moved to Mercurial for our VCS from SVN. In SVN we used to have a "docs" folder next to "trunk", in "docs" we would keep all our file documentation, client files, diagrams, mockups, etc. (we use a wiki(Redmine) for internal documentation). Now in a DVCS enviroment we don't need a "trunk" folder, so we drop the code at the root of the repo, and now having a "docs" folder inside the repo feels weird being at the same level that the code. This has taken me to reconsider if it is a good idea to keep those files in the VCS, we have a "documents" section in Redmine, but I have never used it because it is a pain to have to download a file each time I want to open it and I can't access the file when I'm offline. What best practices have you guys found to manage these kind of non-code files?

    Read the article

  • What is the best way to handle navigation with PRISM?

    - by stiank81
    Using Prism - what is the best way to handle navigation in a WPF application? And how do you apply this? Are there any best practices? In my application I'm currently using Event Aggregation. Any menu item or other item that should result in navigation in the program will publish an event, and the module responsible for opening the view represented by the published event will do so. This works just fine, but I have a feeling this is not the best way to handle navigation with Prism. Is it?

    Read the article

  • TFS Automated Builds to Code Packages

    - by Adam Jenkin
    I would like to hear the best practices or know how people perform the following task in TFS 2008. I am intending on using TFS for building and storing web applications projects. Sometimes these projects can contain 100's of files (*.cs, *.acsx etc) During the lifetime of the website, a small bug will get raised resulting in say a stylesheet change, and a change to default.aspx.cs for example. On checking in these changes to TFS, and automated build would be triggered (great!), however for deploying the changes to the target production machine, I only need to deploy for example: style.css default.asx MyWebApplications.dll So my question is, can MSBuild be customized to generate a "code pack" of only the files which require deploying to the production server based on the changeset which cause the re-build?

    Read the article

  • Books/resources on authentication and authorization in layered applications

    - by Tommy Jakobsen
    I've been trying to find resources and guidelines for implementing authentication and authorization in multiple layered architectures (C#), but haven't found any "best practices" or patterns to use. And I figured, that there must be some patterns for this, as it is a pretty important area? The application that we're developing, is layered traditionally, having data layer (Entity Framework 4) repositories domain layer service layer (can be WCF, with data transfer objects) multiple clients consuming the WCF service (ASP.NET [MVC], Silverlight, WPF) and clients accessing a service layer directly (no WCF) Are there books/articles/blogs that dig deeply into this area? Primarily about authorization such as handling multiple roles and attributes attached to users). It doesn’t have to be specific for the .NET Framework, but it would be preferred.

    Read the article

  • User controlled html title tags

    - by zaf
    What are the best practices for allowing a user to maintain the html title tags of all the major pages of his/her site? One way could be to allow the mapping of URLs to some text. For example, we have an app with the following (most complex) url format: http://lang.example.com/searchpage.zaf?a=foo&b=bar&c=RANDOM There are several parts to this: Language sub domain Search page Static parameter 'a' (user may want this in the title) Dynamic and relevant parameter 'b' (user may want this in the title) Dynamic parameter 'c' which can be ignored Never done this before, so I'm asking how you would tackle this!

    Read the article

  • Global Exception Handlers in Java

    - by Samuh
    I am thinking of setting up a global, default Exception handler for my (Android) Mobile application(which uses Java syntax) using Thread.setDefaultUncaughtExceptionHandler(...) call. I am thinking of just displaying an Alert Dialog with appropriate message to the user. Are there any gotchas, caveats and rules that one needs to follow when setting DefaultExceptionHandlers? Any best practices like making sure that the process is killed, full stack trace is written to logs etc. ? Links to documentation, tutorials etc. that can throw some light on this are welcome. Thanks.

    Read the article

  • CAn unused exception variable when catching all exceptions

    - by b0x0rz
    what is a best practice in cases such as this one: try { // do something } catch (SpecificException ex) { Response.Redirect("~/InformUserAboutAn/InternalException/"); } the warning i get is that ex is never used. however all i need here is to inform the user, so i don't have a need for it. do i just do: try { // do something } catch { Response.Redirect("~/InformUserAboutAn/InternalException/"); } somehow i don't like that, seems strange!!? any tips? best practices? what would be the way to handle this. thnx

    Read the article

  • How do I write a Java text file viewer for big log files

    - by Hannes de Jager
    I am working on a software product with an integrated log file viewer. Problem is, its slow and unstable for really large files because it reads the whole file into memory when you view a log file. I'm wanting to write a new log file viewer that addresses this problem. What are the best practices for writing viewers for large text files? How does editors like notepad++ and VIM acomplish this? I was thinking of using a buffered Bi-directional text stream reader together with Java's TableModel. Am I thinking along the right lines and are such stream implementations available for Java?

    Read the article

  • How many variables is to many when storing in _SESSION?

    - by steve
    Hi - I'm looking for an idea of best practices here. I have a web based application that has a number of hooks into other systems. Let's say 5, and each of these 5 systems has a number of flags to determine different settings the user has selected in said systems, lets say 5 settings per system (so 5*5). I am storing the status of these settings in the user sesion variables and was wondering is that a sufficient way of doing it? I'm learning php as I go along so not sure about any pitfalls that this could run me into!

    Read the article

  • Better to extend a class or modify it directly?

    - by primehunter326
    Hi, So I'm working on creating a visualization for a data structure in Java. I already have the implementation of the data structure (Binary Search Tree) to start with, but I need to add some additional functionality to the included node class. As far as conventions and best practices are concerned, should I create a subclass of the node with this added functionality or should I just modify what I have and document it there? My question is similar to what's asked here but that's a little over my head. I know it probably doesn't matter much for what I'm doing, so I'm asking this more as a general thing.

    Read the article

  • Using function arguments as local variables

    - by Rubys
    Something like this (yes, this doesn't deal with some edge cases - that's not the point): int CountDigits(int num) { int count = 1; while (num >= 10) { count++; num /= 10; } return count; } What's your opinion about this? That is, using function arguments as local variables. Both are placed on the stack, and pretty much identical performance wise, I'm wondering about the best-practices aspects of this. I feel like an idiot when I add an additional and quite redundant line to that function consisting of int numCopy = num, however it does bug me. What do you think? Should this be avoided?

    Read the article

  • Modern way to validate POST-data in MVC 2

    - by zerkms
    There are a lot of articles devoted to working with data in MVC, and nothing about MVC 2. So my question is: what is the proper way to handle POST-query and validate it. Assume we have 2 actions. Both of them operates over the same entity, but each action has it's own separated set of object properties that should be bound in automatic manner. For example: Action "A" should bind only "Name" property of object, taken from POST-request Action "B" should bind only "Date" property of object, taken from POST-request As far as I understand - we cannot use Bind attribute in this case. So - what are the best practices in MVC2 to handle POST-data and probably validate it.

    Read the article

  • Converting table based layout into a div/css based one.

    - by nimo9367
    I'm supposed to rewrite the UI for a rather large web application. The thing is that the layout is completely based on tables and if I could somehow, semi automatically, convert the tables into divs it would save me a huge amount of time. What are the best practices when doing something like this? Is this a good idea at all? The application use layout files (containing something similar to helpers) that are parsed into html at runtime and the application itself also output html at specific places. So the work will consist of converting these helpers and the htmloutput code within the application.

    Read the article

  • How to create custom CSS "on the fly" based on account settings in a Django site?

    - by sdolan
    So I'm writing a Django based website that allows users select a color scheme through an administration interface. I already have middleware/context processors that links the current request (based on domain) to the account. My question is how to dynamically serve the CSS with the account's custom color scheme. I see two options: Add a CSS block to the base template that overrides the styles w/variables passed in through a context processors. Use a custom URL (e.g. "/static/dynamic/css//styles.css") that gets routed to a view that grabs all the necessary values and creates the css file. I'm content with either option, but was wondering if anyone else out there has dealt with similar problems and could give some insight as to "Best Practices".

    Read the article

< Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >