Search Results

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

Page 7/237 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Unit testing JSON output module, best practices

    - by Banang
    I am currently working on a module that takes one of our business objects and returns a json representation of that object to the caller. Due to limitations in our environment I am unable to use any existing json writer, so I have written my own, which is then used by the business object writer to serialize my objects. The json writer is tested in a way similar to this @Test public void writeEmptyArrayTest() { String expected = "[ ]"; writer.array().endArray(); assertEquals(expected, writer.toString()); } which is only manageable because of the small output each instruction produces, even though I keep feeling there must be a better way. The problem I am now facing is writing tests for the object writer module, where the output is much larger and much less manageable. The risk of spelling mistakes in the expected strings mucking up my tests seem too great, and writing code in this fashion seems both silly and unmanageable in a long term perspective. I keep feeling like I want to write tests to ensure that my tests are behaving correctly, and this feeling worries me. Therefore, is there a better way of doing this? Surely there must be? Does anyone know of any good literature in regard to this specific case (doesn't have to be json, but you know what I mean)? Grateful for all help.

    Read the article

  • Best practices for developing bigger applications on Android

    - by Janusz
    I've already written some small Android Applications, most of them in one Activity and nearly no data that should be persistent on the device. Now I'm writing an application that needs more Activities and I'm a bit puzzled about how to organize all this. My app will download some data parse it show it to the user and then show other activities depending on the data and the user interaction. Some of that data could be cached, some of it has to be downloaded every time. Some of that data should not be downloaded freshly at the moment the orientation changes, but it should on the moment the activity is created... Another thing I'm confused about are things like a httpClient. I now for example create a new httpclient for every activity, the same thing for locationlisteners. Are there books, a blogs or documentations with patterns, examples and advice on organizing larger apps build on android? Everything I found until now are get startet tutorials leaving me alone after 60 lines of code...

    Read the article

  • iPhone Prefix.pch best practices

    - by hgpc
    I have seen many developers that add various convenience macros to the Prefix.pch of their iPhone project. What do (or don't) you recommend adding to the iPhone Prefix.pch file? What does your Prefix.pch look like?

    Read the article

  • Best practices for managing limited client licenses/login

    - by MicSim
    I have a multi-user software solution (containing different applications, i.e. EXEs) that should allow only a limited number of concurrent users. It's designed to run in an intranet. I dont have a really good, satisfactory solution to the problem of counting the client licenses yet. The key requirements are: Multiple instances (starts) of the same application (= process) should count as only one client licence Starting different applications of the software solution should also count as only one (the same) client licence Application crash should not lead to orphaned used licences The above should work also for Terminal Server environments (all clients same IP, but different install folders) I'm looking for estabilished patterns, solutions, tips for managing used client licenses. Specific hints for the above sitaution are also welcome.

    Read the article

  • Best Practices - Stored Procedure Logging

    - by hgulyan
    If you have a long running SP, do you log somehow it's actions or just wait for this message? "Command(s) completed successfully." I assume, that there can be plenty solutions on this subject, but is there any best practice - a simple solution that is frequently used? EDIT I've found an interesting link on this subject http://weblogs.sqlteam.com/brettk/archive/2006/09/21/12391.aspx Article describes using a log table, but there's an issue The logging procedure must be executed outside of any transaction I can't call that insert outside, because of cursor that I use and insert a line to that table on every row. Any ideas?

    Read the article

  • PHP best practices for naming conventions

    - by alex
    I recently started these naming conventions.. all functions & variables = camelCase constants with define() = ALL_CAPS_AND_UNDERSCORES Now I see a lot of other people mix up camelCase and underscores and they seem to have some sort of convention to it... What do you use and what is best? I've heard that public and private functions should have underscores before some.. I assume private have 2 underscores as in __construct() ? Thank you!

    Read the article

  • Database best practices

    - by user270797
    I have a table which stores comments, the comment can either come from another user, or another profile which are separate entities in this app. My original thinking was that the table would have both user_id and profile_id fields, so if a user submits a comment, it gives the user_id leaves the profile_id blank is this right, wrong, is there a better way?

    Read the article

  • Referring to the public root in PHP - best practices

    - by Emanuil
    I've been using the $_SERVER["DOCUMENT_ROOT"] environment variable to refer to the public root in my apps. Now I'm realizing that that's not very reliable. I'm thinking about an approach where I define a constant in my index.php based on a magic constant. Something like that: define("PUBILC", __DIR__); I'm not sure about it though. What approach would you recommend?

    Read the article

  • Silverlight layout Best Practices

    - by JustSmith
    I'm writing a fairly big interface using Silverlight. As I progress, the xaml file is getting fairly big and is becoming proportionally uglier. Questions Are there any resources out there to make the xaml more readable? For example, how would I display the order of attributes (e.g. height and Width first) so that it looks the most tidy? Another issue is that there are multiple ways to implement an interface with grids and stack panels. Is there a preferred approach when using one or the other? I am looking for advice and links to other resources that can be used as examples.

    Read the article

  • Sharing elements between Android apps, a question of best practices

    - by Emanuil
    Here's a quote from Android's Dev Guide: A central feature of Android is that one application can make use of elements of other applications (provided those applications permit it). For example, if your application needs to display a scrolling list of images and another application has developed a suitable scroller and made it available to others, you can call upon that scroller to do the work, rather than develop your own. Isn't it a bad practice to make an app dependent on other apps?

    Read the article

  • Proper usage (best practices) of Browsable attribute in .NET for runtime grid component behavior

    - by Dan
    I understand how Browsable attribute is supposed to work. It's supposed to hide a property from showing up in a PropertyGrid in design time. It also has another effect in that it will stop a Property from showing up in components such as Grids, or specifically Infragistics WinGrid. I am not sure if it has this behaviour on regular Windows Forms grids. This works, but it doesn't sound like Browsable is being use as intended when being used for 'Run time' displaying of a property on a grid component. Any literature from Microsoft on proper use. Even though it works, I don't want to use this attribute to hide columns on a grid bound to a business object if it's not indeed the correct usage of the attribute, but rather something some grid vendors decided to use to determine property visibility on their grids.

    Read the article

  • Best Practices - log in stored procedures?

    - by hgulyan
    If you have a long running SP, do you log somehow it's actions or just wait for this message? "Command(s) completed successfully." I assume, that there can be plenty solutions on this subject, but is there any best practice - a simple solution that is frequently used?

    Read the article

  • Codeigniter Best Practices for Model functions

    - by user270797
    Say my application has a "Posts" model, and one of the function is add_post(), it might be something like: function add_post($data) { $this-db-insert('posts',$data); } Where $data is an array: $data = array ('datetime'='2010-10-10 01:11:11', 'title'='test','body'='testing'); Is this best practice? It means if you use that function you need to know the names of the database fields where as my understanding of OOP is that you shouldnt need to know how the method works etc etc

    Read the article

  • Best practices for developing simple ASP.NET sites (built in controls or JQuery + scripts)

    - by Nix
    I was recently reviewing some code written by two different contractors, both were basic ASP.NET management sites. The sites allowed the user to view and edit data. Pretty much simple CRUD gateways. One group did their best to use built in ASP + AJAX Toolkit controls and did their best to use as many built in controls as possible. I found the code much easier to read and maintain. The other used jQuery and the code is heavily marked up with script blocks which are then used to build pages from javascript files. Which one is more common? The one that basically leveraged embedded HTML markup in scripts controled by javascript files screams readability and maintenance issues? Is this just the way of doing asp dev with jQuery? Assuming the second example happens a lot, are there tools that help facilitate jQuery development with visual studio? Do you think they generated the html somewhere else and just copied it in? Example Script block: <script id="HRPanel" type="text/html"> <table cellpadding='0' cellspacing='0' class="atable"><thead class="mHeader"><tr><th>Name</th><th>Description</th><th>Other</th></thead><tbody> <# for(var i=0; i < hrRows.length; i++) { var r = HRRows[i]; #> <tr><td><#=r.Name#></td><td><#=r.Description#></td><td class="taRight"><#=r.Other#></td></tr> <#}#> </tbody><tfoot><th></th><th></th><th></th></tfoot></table> </script> Then in a separate location (js file) you would see something like this. $("#HRPanel").html($("#HRPanel").parseTemplate({ HRRows: response.something.bah.bah }));

    Read the article

  • linq2sql: singleton or using, best practices

    - by zerkms
    what is the preferred practice when linq2sql using (in asp.net mvc applications): to create "singleton" for DataContext like: partial class db { static db _db = new db(global::data.Properties.Settings.Default.nanocrmConnectionString, new AttributeMappingSource()); public static db GetInstance() { return _db; } } or to retrieve new instance when it needed within using: using (db _db = new db()) { ... } the usage of using brings some limitations on code. so I prefer to use singleton one. is it weird practice?

    Read the article

  • Best practices for TDD BDD with code that uses external services / api

    - by adam
    I'm using a twitter gem which basically accesses twitter and lets me grab tweets, timeline etc. Its really good but I have a lot of my code that uses the stuff it returns and I need to test it. The things the gem returns aren't exactly simple strings, there pretty complex objects (scary as well) so im left scratching my head. So basically I'm looking for an answer, book, blog, open-source project that can show me the rights and wrongs of testing around external services. answers that are either not language centric or ruby/rails centric would most greatly be appreciated.

    Read the article

  • Good practices for a robust FTP script

    - by dutch
    What are the things a script should do to ensure that files have been FTPed correctly? Following are the things I have in mind: 1) use high level scripting language like python or perl instead of shell script for a more comprehensive functionality and error handling 2) check that the file exists at the destination after FTP 3) check destination file size. This is a little bit difficult because file size will change if the source and destination are running different OS. Any tips on how to go about this?

    Read the article

  • Compact Framework best practices: Building a GUI

    - by Ciaran
    I'm maintaining a Windows CE app built with the .NET Framework that has about 45 forms. There are 5 'sections' which lead to the function you want. The application is 100% full screen and it is important that it can't be minimized. Since there are so many forms, it's difficult to keep track of which form should be displayed after one is closed. For this, I'm setting the form owner property before showing it, and showing the owner when closing it. I've also been advised that it is best to instantiate all forms when the application loads, and not dispose them to save processing time. I'm not sure about this. My question is, what is the best way to go about showing, hiding forms where you want any 1 form to be in front, full screen all time?

    Read the article

  • Favorite Drupal tips or best practices?

    - by Mike Crittenden
    Just wondering what tips or tricks you guys might have to share. As always with posts like this, please only one tip per post so they can be voted on independently. I'll start: however you do your theming, you can use the mothership theme as a base theme for your theme to inherit from so that your markup will be a lot cleaner and less verbose.

    Read the article

  • best practices - multiple functions vs single function with switch case

    - by Amit
    I have a situation where I need to perform several small (but similar) tasks. I can think of two ways to achieve this. First Approach: function doTask1(); function doTask2(); function doTask3(); function doTask4(); Second Approach: // TASK1, TASK2, ... TASK4 are all constants function doTask(TASK) { switch(TASK) { case TASK1: // do task1 break; case TASK2: // do task2 break; case TASK3: // do task3 break; case TASK4: // do task4 break; } } A few more tasks may be added in future (though the chances are rare. but this cannot be ruled out) Please suggest which of the two approaches (or if any other) is a best practice in such a situation.

    Read the article

  • Ajax message best practices

    - by hhj
    Say I need to use ajax to asynchronously ask the server for an xml file containing relevant data. What is the best practice on what this message should look like? Should it be a string like get_data or something similar? Should it be xml? I don't really need long polling since its a one-time (or close to it) request. Thanks.

    Read the article

  • Data Access Layer, Best Practices

    - by labratmatt
    I'm looking for input on the best way to refactor the data access layer (DAL) in my PHP based web app. I follow an MVC pattern: PHP/HTML/CSS/etc. views on the front end, PHP controllers/services in the middle, and a PHP DAL sitting on top of a relational database in the model. Pretty standard stuff. Things are working fine, but my DAL is getting large (codesmell?) and becoming a bit unwieldy. My DAL contains almost all of the logic to interface with my database and is full of functions that look like this: function getUser($user_id) { $statement = "select id, name from users where user_id=:user_id"; PDO builds statement and fetchs results as an array return $array_of_results_generated_by_PDO_fetch_method; } Notes: The logic in my controller only interacts with the model using functions like the above in the DAL I am not using a framework (I'm of the opinion that PHP is a templating language and there's no need to inject complexity via a framework) I generally use PHP as a procedural language and tend to shy away from its OOP approach (I enjoy OOP development but prefer to keep that complexity out of PHP) What approaches have you taken when your DAL has reached this point? Do I have a fundamental design problem? Do I simply need to chop my DAL into a number of smaller files (logically divide it)? Thanks.

    Read the article

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