Search Results

Search found 4835 results on 194 pages for 'practice'.

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

  • Good practice : compare a value with a boolean?

    - by NLemay
    Most of the time, I prefer to write this : if(isWelcome() == true){} if(isWelcome() == false){} instead of this if(isWelcome()){} if(!isWelcome()){} Because I feel that it is easier to read (but I do understand that it doesn't make sense). I would like to know if there is a common agreement about this practice. What most developer do? And I'm wondering if the compiler is doing the extra comparaison, or if it understand that it is useless.

    Read the article

  • best practice when referring to a program's name in C

    - by guest
    what is considered best practice when referring to a program's name? i've seen #define PROGRAM_NAME "myprog" printf("this is %s\n", PROGRAM_NAME); as well as printf("this is %s\n", argv[0]); i know, that the second approach will give me ./myprog rather than myprog when the program is not called from $PATH and that the first approach will guarantee consistence regarding the program's name. but is there anything else, that makes one approach superior to the other?

    Read the article

  • Spring @Transactional Annotation Best Practice

    - by Thomas Einwaller
    We are currently discussing the Best Practice for placing the @Transactional annotations in our code. Do you place the @Transactional in the DAO classes and/or their methods or is it better to annotate the Service classed which are calling using the DAO objects? Or does it make sense to annotate both "layers"?

    Read the article

  • Good practice of using list of function in Python

    - by riskio
    I am pretty new to python and I discovered by myself that I can create a list of function and call with a for loop. example: def a(args): print "A" def b(args): print "B" def c(args): print "C " + str(args) functions = [a,b,c] for i in functions: i(1) So, my question is: is there any good practice or elegant way to use list of functions and what is a good use of all this? (do have a particular name the "list of functions"?) thank you

    Read the article

  • Best Practice: Direct SQL Access vs. Web Service

    - by phsr
    With respect to an application that has both a web and desktop client version: What is the best practice for the desktop client which needs access to a SQL Server? What are the benefits of connecting to the database from the application vs using a web service? Which one provides better security? What type of scope would call for one vs the other (enterprise intranet vs. web app, etc) Are there any other considerations that are necessary when choosing on platform?

    Read the article

  • Best practice for secure socket connection.

    - by LnDCobra
    What is the best practice for a secure socket connection (without SSL). I will be moving sensitive data (logins/passwords/accounts) across TCP Socket connection, and wondering if there is a good/fast way of Encrypting/Decrypting and avoiding malicious injection.

    Read the article

  • Best practice for Python & Django constants

    - by Dylan Klomparens
    I have a Django model that relies on a tuple. I'm wondering what the best practice is for refering to constants within that tuple for my Django program. Here, for example, I'd like to specify "default=0" as something that is more readable and does not require commenting. Any suggestions? Status = ( (-1, 'Cancelled'), (0, 'Requires attention'), (1, 'Work in progress'), (2, 'Complete'), ) class Task(models.Model): status = models.IntegerField(choices=Status, default=0) # Status is 'Requires attention' (0) by default. EDIT: If possible I'd like to avoid using a number altogether. Somehow using the string 'Requires attention' instead would be more readable.

    Read the article

  • Assert a good practice or not ?

    - by rkenshin
    Is it a good practice to use Assert for function parameters to enforce their validity. I was going through the source code of Spring Framework and I noticed that they use Assert.notNull a lot. Here's an example public static ParsedSql parseSqlStatement(String sql) { Assert.notNull(sql, "SQL must not be null");} Here's Another one public NamedParameterJdbcTemplate(DataSource dataSource) { Assert.notNull(dataSource, "The [dataSource] argument cannot be null."); this .classicJdbcTemplate = new JdbcTemplate(dataSource); } public NamedParameterJdbcTemplate(JdbcOperations classicJdbcTemplate) { Assert.notNull(classicJdbcTemplate, "JdbcTemplate must not be null"); this .classicJdbcTemplate = classicJdbcTemplate; } Thank you

    Read the article

  • Best practice for storing global data in PHP?

    - by user281434
    Hi I'm running a web application that allows a user to log in. The user can add/remove content to his/her 'library' which is displayed on a page called "library.php". Instead of querying the database for the contents of the users library everytime they load "library.php", I want to store it globally for PHP when the user logs in, so that the query is only run once. Is there a best practice for doing this? fx. storing their library in an array in a session? Thanks for your time

    Read the article

  • Mutex names - best practice?

    - by Argalatyr
    Related to this question, what is the best practice for naming a mutex? I realize this may vary with OS and even with version (esp for Windows), so please specify platform in answering. My interest is in Win XP and Vista. EDIT: I am motivated by curiousity, because in Rob Kennedy's comment under his (excellent) Answer to the above-linked Question, he implied that the choice of mutex name is non-trivial and should be the subject of a separate question. EDIT2: The referenced question's goal was to ensure only a single instance of an app is running.

    Read the article

  • Ruby on Rails protect_from_forgery best practice

    - by randombits
    I'm currently working on building a RESTful web api with ruby on rails. I haven't bothered putting a proper authentication scheme into the API yet as I'm ensuring that tests and the basic behavior of the API is working all locally first. Upon testing non-HTTP GET type requests such as HTTP POST/DELETE/PUT, stuff chokes because protect_from_forgery is on by default. How does this work when I'm working in practice since essentially the idea is in a RESTful API that there is no state. The client does not have a session or a cookie associated with the server. Each request is an atomic, self-executed request. The user will supply some credentials to ensure they are who they say they are, but other than that, does protect_from_forgery make sense at this point? Should it remain enabled?

    Read the article

  • What is best practice with SQLite and Android ?

    - by PHP_Jedi
    What is considered "best practice" when executing queries on a sql-lite db within an android app. Is it safe to run inserts, deletes and select queries from an AsyncTask's doInBackground ? Or should I use the UI Thread ? I suppose that db queries can be "heavy" and should not use the UI thread as it can lock up the app - resulting in an ANR. If I have several AsyncTasks, should they share a connection or should they open a connection each ? Any best practices in this area on android?

    Read the article

  • Best practice to use MS Excel as a database

    - by Ying
    In office, it is popular to use MS Excel to store data. In most cases, the data is structured, which means it is suitable for a database. I know peole prefer MS Excel for it is easy to change the data structure and data value. So I have an idea to use MS Excel as a database IF people follow a general rule to store data. In other words, by a best practice to use MS Excel as a database. I have thought to use MS Access to store data, but it is expensive and not popular as MS Excel. I don't mind to buy such a solution, especially when it is for .Net platform. Any ideas or suggestions are welcome.

    Read the article

  • Best practice for making code portable for domains, subdomains or directores

    - by Duopixel
    I recently coded something where it wasn't known if the end code would reside in a subdomain (http://user.domain.com/) or in a subdomain (http://domain.com/user), and I was lost as to the best practice for these unknown scenarios. I could thinks of a couple: Use absolute paths (/css/styles.css) and modrewrite if it ends up being /user Have a settings file and declare a variable with the path (<? php echo $domain . "/css/styles" ?>) Use relative paths (../css/styles.css). What is the best way to handle this?

    Read the article

  • Best practice No1: inline search layout across browsers

    - by Sixfoot Studio
    Ok, I have managed to fix my version of this example using a multitude of hacks and I would like to see how others would tackle this problem making this cross-browser compatible without too many hacks. <div class="searchDiv"> <img src="Images/left.gif" class="left" height="19" width="3" /> <input id="TextBox" type="text" class="searchField" /> <img src="Images/right.gif" height="19"width="3" class="right" /> <a href="" class="submit">Submit</a> <img src="Images/box-arrow.gif" class="linkArrow" width="8" height="14" /> </div> I am using a Transitional DTD in my example. Based on the everyone else's CSS examples, comments and answers I will make the final vote. I'd love to see more of these scenarios come up so that people have a library of "best practice" methods which they can find on SO. Good luck

    Read the article

  • Typical practice for redistributing third party source code with your source code

    - by bglenn
    I'm releasing an application I wrote as an open-source project by creating a public source-code repository. I use a third-party library which is also open-source and freely redistributable. I'm not versioning the third-party library, but should I include it in my repository for the convenience of those cloning the repository or should I expect them to download the third-party library on their own? To be clear, I'm not asking if I should version the third-party code or if I can redistribute it, but whether it is standard practice to include third-party source code as a convenience.

    Read the article

  • SVN best practice - checking out root folder

    - by Stephen Dolier
    Hi all, quick question about svn checkout best practice. Once the structure of a repository is set up, ie trunk, branches, tags, is it normal to have the root checked out to our local machines. Or should you only check out the trunk if that's what you are working on or a branch if we so choose to create one. The reason i ask is that every time someone creates a branch or tag we all get a copy when we do an update. btw, we're recently migrated from vss.

    Read the article

  • Sequence numbers best practice

    - by Abdullah Jibaly
    What's the best practice or well known methods to implement sequence numbers for business entities such as invoices, purchase orders, job numbers, etc? I want to be able to save the latest value in the database and be able to set it programatically. Is it OK to use a table for this purpose that has a SEQUENCE_NAME, SEQUENCE_NUMBER tuple? I know some databases have a first class sequence type but others (eg, MySQL) do not so it's not something I want to rely on. If a table is used to hold these sequences what is the right way to get and increment them in a synchronized fashion to ensure no data inconsistencies arise?

    Read the article

  • Enclosing service execution in try-catch: bad practice?

    - by Sorin Comanescu
    Hi, Below is the usual Program.cs content for a windows service program: static class Program { /// <summary> /// The main entry point for the application. /// </summary> static void Main() { ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new MyService() }; ServiceBase.Run(ServicesToRun); } } Is it a bad practice to enclose the ServiceBase.Run(...) in a try-catch block? Thanks.

    Read the article

  • Best practice for installing python modules from an arbitrary VCS repository

    - by fmark
    I'm newish to the python ecosystem, and have a question about module editing. I use a bunch of third-party modules, distributed on PyPi. Coming from a C and Java background, I love the ease of easy_install <whatever>. This is a new, wonderful world, but the model breaks down when I want to edit the newly installed module for two reasons: The egg files may be stored in a folder or archive somewhere crazy on the file system. Using an egg seems to preclude using the version control system of the originating project, just as using a debian package precludes development from an originating VCS repository. What is the best practice for installing modules from an arbitrary VCS repository? I want to be able to continue to import foomodule in other scripts.

    Read the article

  • Django/Python best practice template_dict

    - by fredrik
    Hi, After just been coding for about 6-9 months. I probably changed my coding style a number of times after reading some code or read best practices. But one thing I haven't yet come a cross is a good why to populate the template_dict. As of now I pass the template_dict across a number of methods (that changes/modifies it) and returns is. The result is that every methods takes template_dict as first argument and the returns it and this in my eyes doesn't seems to be the best solution. An idea is to have a method that handles all the changes. But I'm curios if there's a best practice for this? Or is it "do what you feel like"-type of thing? The 2 things I think is pretty ugly is to send as an argument and return it in all methods. And the just the var name is written xxx number of times in the code :) ..fredrik

    Read the article

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