Search Results

Search found 20065 results on 803 pages for 'practice problems'.

Page 96/803 | < Previous Page | 92 93 94 95 96 97 98 99 100 101 102 103  | Next Page >

  • Why is it a good practice to wrap all primitives and Strings?

    - by Amogh Talpallikar
    According to Jeff Bay's Essay on Object Callisthenics, One of the practices is set to be "Wrap all primitives and Strings" Can anyone elaborate on this ? In languages where we already have wrappers for primitives like C# and Java. and In languages where Collections can have generics where you are sure of what type goes into the collection, do we need to wrap string's inside their own classes ? Does it have any other advantage ?

    Read the article

  • Is sticking to one language on a particular project a good practice?

    - by Ans
    I'm developing a pipeline for processing text that will go into production. The question I keep asking myself is: should I stick to one language for the project when I'm looking for a tool to do a particular task (e.g. NLTK, PDFMiner, CLD, CRFsuite, etc.)? Or is it OK to mix and match languages on the project? So I pick the best tool regardless of what language it's written in (e.g. OpenNLP, ParsCit, poppler, CFR++, etc.) and warp (wrap) my code around it? Note, I am not asking about should a developer stick to just one language for their career.

    Read the article

  • Will Google treat this JavaScript code as a bad practice?

    - by Mathew Foscarini
    I have a website that provides a custom UX experience implemented via JavaScript. When JavaScript is disabled in the browser the website falls back to CSS for the layout. To make this possible I've added a noJS class to the <body> and quickly remove it via JavaScript. <body class="noJS layout-wide"> <script type="text/javascript">var b=document.getElementById("body");b.className=b.className.replace("noJS","");</script> This caused a problem when the page loads and JavaScript is enabled. The body immediately has it's noJS class removed, and this causes the layout to appear messed up until the JavaScript code for layout is executed (at bottom of the page). To solve this I hide each article via JavaScript by adding a CSS class fix which is display:none as each article is loaded. <article id="q-3217">....</article> <script type="text/javascript">var b=document.getElementById("q-3217");b.className=b.className+" fix";</script> After the page is ready I show all the articles in the correct layout. I've read many times in Google's documentation not to hide content. So I'm worried that the Google will penalize my website for doing this.

    Read the article

  • is it a bad practice to call a View from another View in MVC?

    - by marcos.borunda
    I have some plain Views, they don't have any logic behind them (there is no action or controller behind them), their only propouse is to alert the user about something like "We have sent you an email to confirm your account", "You have no access to this resource", etc... These views are really simple, and calling them through a Controller/Action seems to be too much overhead, but somehow I feel like it is not quite correct. What do you think? How do you handle this kind of situations?? I guess this question will apply to any MVC Framework, but in my case I'm using the ASP.NET MVC 3 framework.

    Read the article

  • What's the best practice for linking to/from guest posts on other blogs?

    - by sam
    When writing a guest blog for a site, I include a link back to my site - an inbound link. If I were to write a post on my blog publicising my guest post, that would mean there were reciprocal links, thus cancelling each other out, correct? If I made the link (on my blog) back to the guest post nofollow, would that cancel the effect, meaning I still get link juice from the guest post? Further down the line if the site I posted on as a guest wanted to write a post for my site, what is the best way for me to prevent re-introducing the reciprocal link problem?

    Read the article

  • Is inline SQL still classed as bad practice now that we have Micro ORMs?

    - by Grofit
    This is a bit of an open ended question but I wanted some opinions, as I grew up in a world where inline SQL scripts were the norm, then we were all made very aware of SQL injection based issues, and how fragile the sql was when doing string manipulations all over the place. Then came the dawn of the ORM where you were explaining the query to the ORM and letting it generate its own SQL, which in a lot of cases was not optimal but was safe and easy. Another good thing about ORMs or database abstraction layers were that the SQL was generated with its database engine in mind, so I could use Hibernate/Nhibernate with MSSQL, MYSQL and my code never changed it was just a configuration detail. Now fast forward to current day, where Micro ORMs seem to be winning over more developers I was wondering why we have seemingly taken a U-Turn on the whole in-line sql subject. I must admit I do like the idea of no ORM config files and being able to write my query in a more optimal manner but it feels like I am opening myself back up to the old vulnerabilities such as SQL injection and I am also tying myself to one database engine so if I want my software to support multiple database engines I would need to do some more string hackery which seems to then start to make code unreadable and more fragile. (Just before someone mentions it I know you can use parameter based arguments with most micro orms which offers protection in most cases from sql injection) So what are peoples opinions on this sort of thing? I am using Dapper as my Micro ORM in this instance and NHibernate as my regular ORM in this scenario, however most in each field are quite similar. What I term as inline sql is SQL strings within source code. There used to be design debates over SQL strings in source code detracting from the fundamental intent of the logic, which is why statically typed linq style queries became so popular its still just 1 language, but with lets say C# and Sql in one page you have 2 languages intermingled in your raw source code now. Just to clarify, the SQL injection is just one of the known issues with using sql strings, I already mention you can stop this from happening with parameter based queries, however I highlight other issues with having SQL queries ingrained in your source code, such as the lack of DB Vendor abstraction as well as losing any level of compile time error capturing on string based queries, these are all issues which we managed to side step with the dawn of ORMs with their higher level querying functionality, such as HQL or LINQ etc (not all of the issues but most of them). So I am less focused on the individual highlighted issues and more the bigger picture of is it now becoming more acceptable to have SQL strings directly in your source code again, as most Micro ORMs use this mechanism. Here is a similar question which has a few different view points, although is more about the inline sql without the micro orm context: http://stackoverflow.com/questions/5303746/is-inline-sql-hard-coding

    Read the article

  • Is it a good practice to wrap all primitives and Strings?

    - by Amogh Talpallikar
    According to Jeff Bay's Essay on Object Callisthenics, One of the practices is set to be "Wrap all primitives and Strings" Can anyone elaborate on this ? In languages where we already have wrappers for primitives like C# and Java. and In languages where Collections can have generics where you are sure of what type goes into the collection, do we need to wrap string's inside their own classes ? Does it have any other advantage ?

    Read the article

  • What's the best practice for async APIs that return futures on Scala?

    - by Maurício Linhares
    I have started a project to write an async PostgreSQL driver on Scala and to be async, I need to accept callbacks and use futures, but then accepting a callback and a future makes the code cumbersome because you always have to send a callback even if it is useless. Here's a test: "insert a row in the database" in { withHandler { (handler, future) => future.get(5, TimeUnit.SECONDS) handler.sendQuery( this.create ){ query => }.get( 5, TimeUnit.SECONDS ) handler.sendQuery( this.insert ){ query => }.get( 5, TimeUnit.SECONDS ).rowsAffected === 1 } } Sending the empty callback is horrible but I couldn't find a way to make it optional or anything like that, so right now I don't have a lot of ideas on how this external API should look like. It could be something like: handler.sendQuery( this.create ).addListener { query => println(query) } But then again, I'm not sure how people are organizing API's in this regard. Providing examples in other projects would also be great.

    Read the article

  • Is it a bad practice to store large files (10 MB) in a database?

    - by B Seven
    I am currently creating a web application that allows users to store and share files, 1 MB - 10 MB in size. It seems to me that storing the files in a database will significantly slow down database access. Is this a valid concern? Is it better to store the files in the file system and save the file name and path in the database? Are there any best practices related to storing files when working with a database? I am working in PHP and MySQL for this project, but is the issue the same for most environments (Ruby on Rails, PHP, .NET) and databases (MySQL, PostgreSQL).

    Read the article

  • Is there an established or defined best practice for source control branching between development and production builds?

    - by Matthew Patrick Cashatt
    Thanks for looking. I struggled in how to phrase my question, so let me give an example in hopes of making more clear what I am after: I currently work on a dev team responsible for maintaining and adding features to a web application. We have a development server and we use source control (TFS). Each day everyone checks in their code and when the code (running on the dev server) passes our QA/QC program, it goes to production. Recently, however, we had a bug in production which required an immediate production fix. The problem was that several of us developers had code checked in that was not ready for production so we had to either quickly complete and QA the code, or roll back everything, undo pending changes, etc. In other words, it was a mess. This made me wonder: Is there an established design pattern that prevents this type of scenario. It seems like there must be some "textbook" answer to this, but I am unsure what that would be. Perhaps a development branch of the code and a "release-ready" or production branch of the code?

    Read the article

  • Best practice for marking a bug as resolved in Bugzilla ?

    - by Vincent B.
    I am wondering what is the best way to handle the situation of marking a bug as resolved and providing a version of component/product in which this fix can be found. Context For a project I am working on, we are using Bugzilla for issue tracking, and we have the following: A product "A" with a version number like vA.B.C.D, This product "A" have the following components: Component "C1" with a version number like vA.B.C.D, Component "C2" with a version number like vA.B.C.D, Component "C3" with a version number like vA.B.C.D. Internally we keep track of which component versions have been used to generate the product A version vA.B.C.D. Example: Product "A" version v1.0.0.0 has been produced from component "C1" v1.0.0.3, component "C2" v1.3.0.0 and component "C3" v2.1.3.5. And Product "A" version v1.0.1.0 has been produced from component "C1" v1.0.0.4, component "C2" v1.3.0.0 and component "C3" v2.1.3.5. Each component is a SVN repository. The person in charge of generating the product "A" have only access to the different components tags folder in SVN, and not the trunk of each component repository. Problem Now the problem is the following, when a bug is found in the product "A", and that the bug is related to Component "C1", the version of product "A" is chosen (e.g. v1.0.0.0), and this version allow the developer to know which version of component "C1" has the bug (here it will be v1.0.0.3). A bug report is created. Now let's say that the developer responsible for component "C1" corrects the bug, then when the bug seems to be fixed and after some test and validation, the developer generates a new tag for component "C1", with the version v1.0.0.4. At this time, the developer of component "C1" needs to update the bug report, but what is the best to do: Mark the bug as resolved/fixed and add a comment saying "This bug has been fixed in the tags v1.0.0.4 of C1 component" ? Keep the bug as assigned, add a comment saying "This bug has been fixed in the tags v1.0.0.4 of C1 component, update this bug status to resolved for the next version of the product that will be generated with the newest version (v1.0.0.4 of C1)" ? Another possible way to deal with this problem. Right now the problem is that when a product component CX is fixed, it is not sure in which future version of the product A it will be included, so it is for me not possible to say in which version of the product it will be solved, but it is possible to say in which version of the Component CX it has been solved. So when do we need to mark a bug as solved, when the product A version include the fixed version of CX, or only when CX component has been fixed ? Thanks for your personal feedback and ideas about this !

    Read the article

  • Are very short or abbreviated method/function names that don't use full words bad practice or a matter of style.

    - by Alb
    Is there nowadays any case for brevity over clarity with method names? Tonight I came across the Python method repr() which seems like a bad name for a method to me. It's not an English word. It apparently is an abbreviation of 'representation' and even if you can deduce that, it still doesn't tell you what the method does. A good method name is subjective to a certain degree, but I had assumed that modern best practices agreed that names should be at least full words and descriptive enough to reveal enough about the method that you would easily find one when looking for it. Method names made from words help let your code read like English. repr() seems to have no advantages as a name other than being short and IDE auto-complete makes this a non-issue. An additional reason given in an answer is that python names are brief so that you can do many things on one line. Surely the better way is to just extract the many things to their own function, and repeat until lines are not too long. Are these just a hangover from the unix way of doing things? Commands with names like ls, rm, ps and du (if you could call those names) were hard to find and hard to remember. I know that the everyday usage of commands such as these is different than methods in code so the matter of whether those are bad names is a different matter.

    Read the article

  • Is it common practice to hire third parties to do code reviews for contractors?

    - by blueberryfields
    I recently observed some contract offers which included a "code review by third party" clause - the contract would not pay out fully until the code review was completed and it received a pass. I was surprised, especially considering that these were fairly simple, and small-scale contracts (churning out vanity apps for the iPhone). Is this kind of third-party code review a common thing to run into when contracting out as a programmer?

    Read the article

  • Is it good practice to use functions just to centralize common code?

    - by EpsilonVector
    I run across this problem a lot. For example, I currently write a read function and a write function, and they both check if buf is a NULL pointer and that the mode variable is within certain boundaries. This is code duplication. This can be solved by moving it into its own function. But should I? This will be a pretty anemic function (doesn't do much), rather localized (so not general purpose), and doesn't stand well on its own (can't figure out what you need it for unless you see where it is used). Another option is to use a macro, but I want to talk about functions in this post. So, should you use a function for something like this? What are the pros and cons?

    Read the article

  • Apt-get saying "Unable to correct problems, you have held broken packages."

    - by YatharthROCK
    TL;DR: sudo apt-get install ... saying "Unable to correct problems, you have held broken packages." The problem I was trying to get the WebApps feature for PP and QQ following this blog post. I ran the sudo add-apt-repository ppa:webapps/preview command to add the repository, but i got a connection error. Since I know my current ISP gives a shaky connection, I tried again and sure enough, it worked. Then I ran sudo apt-get install unity-webapps-preview, but I realized we had to update apt-get first, so I hit Ctrl + C to stop it. Then I ran sudo apt-get update which worked w/o a fuss, but when I ran sudo apt-get install unity-webapps-preview again later, it showed an error message. Here's the dump: Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: unity-webapps-preview : Depends: xul-ext-unity but it is not going to be installed Depends: xul-ext-websites-integration but it is not going to be installed Depends: xul-ext-webaccounts but it is not going to be installed E: Unable to correct problems, you have held broken packages. I think this might be because of me interrupting the earlier command. It hadn't got a chance to output anything, though — I stopped it pretty fast. What I tried I have tried running a number of commands:- sudo apt-get install --fix-broken sudo apt-get autoclean sudo apt-get autoremove sudo apt-get -f install sudoapt-get install ppa-purgeandsudo ppa-purge ppa:webapps/preview` Even after running sudo apt-get upgrade after every try, none of them worked. Research I tried searching Google, looking at a couple of forums and searching on AU, but to no avail. Help would be appreciated.

    Read the article

  • git in non-distributed, independent, lone programming ...best practice(s) ?

    - by explorest
    I am currently studying the git documentation to get a hang of distributed version control workflow and use of git command line. I want to first start using git with small, personal, pet projects so to gain experience before doing it on large scale (i.e., bigger projects, team dev). What areas of the git system should I, as a lone player, devote most of my study time to... what parts should I leave for the larger scale work later on. In other words what features of the git system will fully be grasped in team work only, and therefore should not be too involved with at an individual level?

    Read the article

  • How well do free-to-open-source-projects policies work in practice?

    - by Steve314
    In comparison with an open source license and requesting donations, is a free-for-open-source-projects (or free for non-commercial developers) closed source and otherwise commercial project likely to get more license fees? Or just to alienate potential users? Assume the project has value to programmers - I'm looking for generalizations here, though specific examples comparing existing projects will be very interesting. What I have in mind involves code generating programming utilities. And one issue I can think of, either way, is a near total inability to enforce any license restrictions. After all, I can't go around the internet demanding that everyone show me their source code just in case!

    Read the article

  • Is good practice to optimize FPS even when it's above the lower limit to give illusion of movement?

    - by rraallvv
    I started over 50 FPS on the iPhone, but now I'm bellow 30 PFS, I've seen most iPhone games clamped to either 60 or 30 FPS, even when 24 or less would give the illusion of movement. I've concidered my limit to be a little bit over 15 FPS, in fact my physics simulation is updated at that rate (15.84 steps/s) as that is the lowest that still give fluid movement, a bit lower gives jerky motion. Is there a practical reason why to clamp FPS way above the lower limit? Update: The following image could help to clarify I can independently set the physic simulation step, frame rate, and simulation interval update. My concern is why should I clamp any of those to values greater than the minimum? For instance to conserve battery life I could just to choose the lower limits, but it seems that 60 or 30 FPS are the most used values.

    Read the article

  • How is Sencha Touch performing on Android in practice ?

    - by Vidar Vestnes
    Hi I'm just about to start a project using Sencha Touch, and just done some minor testing on my HTC desire device. All tutorial videos at Vimeo seems to be using an iPhone emulator running on a Mac. Im not sure how fast this emulator is compared to a real iPhone device or even an real Android device, but from what i have experienced, it seems that my HTC desire is not performing that nicly as this emulator. All animations (sliding, fading, etc) seems abit laggy. You can easily notice that the FPS is much less than on the Vimeo videos. HTC desire is a relativly new and modern Android 2.2 phone, running with decent hardware, so im wondering if Sencha Touch is "ready" for the Android platform. Anybody with practical experience with Android and Sencha Touch ?

    Read the article

  • What does "GPL with classpath exception" mean in practice?

    - by Thilo
    Oracle seems to license all their Java-related open source code under the GPL with a classpath exception. From what I understand, this seems to allow to combine these libraries with your own code into products that do not have to be covered by the GPL. How does this work? What are examples of how I can and cannot use these classes? Why was this new license used as opposed to the LGPL, which seems to allow for pretty much the same things, but is better established and understood? What are the differences to the LGPL?

    Read the article

  • Best algorithm/practice when creating a search mechanism for your database?

    - by Alex Hope O'Connor
    I have been designing a database where it is very important to provide users with a good search mechanism. So I was wondering what some of the best practices are for using keywords to search over multiple database tables and return the relevent records? Some other things I am curious about: The users location, if they provide an address The speed of the algorithm Additional Information: I am using C# and LINQ-To-SQL.

    Read the article

  • Is writing comments inside methods not a good practice?

    - by Srini Kandula
    A friend told me that writing comments inside methods is not good. He said that we should have comments only for the method definitions(javadocs) but not inside the method body. It seems he read in a book that having comments inside the code means there is a problem in the code. I don't quite understand his reasoning. I think writing comments inside the method body is good and it helps other developers to understand it better and faster. Please provide your comments.

    Read the article

  • In practice, what are the key differences between Heroku and webfaction? [closed]

    - by jdotjdot
    I've been building and hosting webapps, mainly in Django and Flask, for some time now. Mainly, I've been hosting them on Heroku, because of the free tier and the ease of git-enabled application updating. I have seen that a lot of Django users prefer Webfaction. I looked through their offerings, and they seem to me like a standard web hosting service. Questions: Why might be webfaction considered a good hosting service for Django apps? If Heroku is generally called a "Platform-as-a-Service," what does that make Webfaction? Does it have any important similiarities/distinctions from Heroku that I might somehow be missing?

    Read the article

  • Is it bad practice to output from within a function?

    - by Nick
    For example, should I be doing something like: <?php function output_message($message,$type='success') { ?> <p class="<?php echo $type; ?>"><?php echo $message; ?></p> <?php } output_message('There were some errors processing your request','error'); ?> or <?php function output_message($message,$type='success') { ob_start(); ?> <p class="<?php echo $type; ?>"><?php echo $message; ?></p> <?php return ob_get_clean(); } echo output_message('There were some errors processing your request','error'); ?> I understand they both achieve the same end result, but are there benefits doing one way over the other? Or does it not even matter?

    Read the article

  • Is it a good practice to use branches to maintain different editions of the same software?

    - by Tamás Szelei
    We have a product that has a few different editions. The differences are minor: different strings here and there, very little additional logic in one, very little difference in logic in the other. When the software is being developed, most changes need to be added to each edition; however, there are a few that don't and a few that needs to differ. Is it a valid use of branches if I have release-editionA and release-editionB (..etc) branches? Are there any gotchas? Good practices? Update: Thanks for the insight everyone, lots of good answers here. The general consensus seems to be that it is a bad idea to use branches for this purpose. For anyone wondering, my final solution to the problem is to externalize strings as configuration, and externalize the differing logic as plugins or scripts.

    Read the article

< Previous Page | 92 93 94 95 96 97 98 99 100 101 102 103  | Next Page >