Search Results

Search found 8959 results on 359 pages for 'bad decisions'.

Page 151/359 | < Previous Page | 147 148 149 150 151 152 153 154 155 156 157 158  | Next Page >

  • Limitations in running Ruby on windows7

    - by orkutscraps
    n the installation documentation to RoR it mentions that there are many limitations to running Ruby on Rails on Windows7, and in some cases, whole libraries do not work. How bad are these limitations, should I always default to Linux to code / run RoR, and is Iron Ruby expected to fix these limitations or are they core to the OS itself?

    Read the article

  • What are the things Java got wrong?

    - by Alon
    I read a lot of blogs and see people all the time talking about bad things in the java programming language; a lot of them are about annotations and generics that were added to the language in 1.5 release. What are the things in the language or the API that you don't like or would design differently?

    Read the article

  • Assignment in conditional operator

    - by DuoSRX
    I've seen a lot this kind of code recently : if ($foo = $bar->getFoo()) { baz($foo); } Is this considered good or bad practice ? For example, Netbeans IDE give a notice if you use this kind of code : Possible accidental assignment, assignments in conditions should be avoided What do you think ?

    Read the article

  • Why does my table values return nil when i clearly initialized them?

    - by user3717078
    players = {} function newPlayer(name) players[name]={x = 200, y = 100} --assign each player their x and y coordinates, which is x: 200 and y: 100 end function checkPosition(name?) -- Do i need a parameter? if players[name].x == 200 and players[name].y == 100 then --says players[name].x is a nil value print("good") else print("bad") end end Error: attempt to index ? (a nil value) Current Situation: The code above says players[name].x is a nil value, I would like to know why since i thought i assigned it in the function newPlayer.

    Read the article

  • limit PHP script to one domain per license

    - by Mac Os
    what is the best way to make my php code working on one domain and sure i will encode the whole code by ioncube i want function like function domain(){ } if($this_domain <> domain()){ exit('no'); } or $allowed_hosts = array('foo.example.com', 'bar.example.com'); if (!isset($_SERVER['HTTP_HOST']) || !in_array($_SERVER['HTTP_HOST'], $allowed_hosts)) { header($_SERVER['SERVER_PROTOCOL'].' 400 Bad Request'); exit; } now i want know the best way to do that may be will user strpos

    Read the article

  • Using intermediate array for hashCode and equals

    - by Basilevs
    As its a pain to handle structural changes of the class in two places I often do: class A { private B bChild; private C cChild; private Object[] structure() { return new Object[]{bChild, cChild}; } int hashCode() { Arrays.hashCode(structure); } boolean equals(Object that) { return Arrays.equals(this.structure(), ((A)that).structure()); } } What's bad about this approach besides boxing of primitives? Can it be improved?

    Read the article

  • (android) rows of buttons that take up the entire width of the screen

    - by user558043
    I am trying to make 3 rows of 4 buttons each that will take up the entire width of the screen. I have tried Linear Layout but have trouble adding a second row and from what I have read nesting Linear Layouts is bad practice. I tried to use relative layout several times but I cannot manage to get the buttons to fill the width of the screen because it ignores layout_weight, I then tried nesting linear layout in relative layout but layout_weight is still ignored. What is the best way to accomplish this?

    Read the article

  • How to return a const QString reference in case of failure?

    - by moala
    Hi, consider the following code: const QString& MyClass::getID(int index) const { if (i < myArraySize && myArray[i]) { return myArray[i]->id; // id is a QString } else { return my_global_empty_qstring; // is a global empty QString } } How can I avoid to have an empty QString without changing the return type of the method? (It seems that returning an empty QString allocated on the stack is a bad idea) Thanks.

    Read the article

  • Is it OK to put a standard, pure C header #include directive inside a namespace?

    - by mic_e
    I've got a project with a class log in the global namespace (::log). So, naturally, after #include <cmath>, the compiler gives an error message each time I try to instantiate an object of my log class, because <cmath> pollutes the global namespace with lots of three-letter methods, one of them being the logarithm function log(). So there are three possible solutions, each having their unique ugly side-effects. Move the log class to it's own namespace and always access it with it's fully qualified name. I really want to avoid this because the logger should be as convenient as possible to use. Write a mathwrapper.cpp file which is the only file in the project that includes <cmath>, and makes all the required <cmath> functions available through wrappers in a namespace math. I don't want to use this approach because I have to write a wrapper for every single required math function, and it would add additional call penalty (cancelled out partially by the -flto compiler flag) The solution I'm currently considering: Replace #include <cmath> by namespace math { #include "math.h" } and then calculating the logarithm function via math::log(). I have tried it out and it does, indeed, compile, link and run as expected. It does, however, have multiple downsides: It's (obviously) impossible to use <cmath>, because the <cmath> code accesses the functions by their fully qualified names, and it's deprecated to use in C++. I've got a really, really bad feeling about it, like I'm gonna get attacked and eaten alive by raptors. So my question is: Is there any recommendation/convention/etc that forbid putting include directives in namespaces? Could anything go wrong with diferent C standard library implementations (I use glibc), different compilers (I use g++ 4.7, -std=c++11), linking? Have you ever tried doing this? Are there any alternate ways to banish the math functions from the global namespace? I've found several similar questions on stackoverflow, but most were about including other C++ headers, which obviously is a bad idea, and those that weren't made contradictory statements about linking behaviour for C libraries. Also, would it be beneficial to additionally put the #include <math.h> inside extern "C" {}?

    Read the article

  • a good resource or book for architecting object-oriented software

    - by Ygam
    I have looked at a couple of books and all I have looked at were just discussing the technicalities of OOP. By technicalities I mean, here's a concept, here's some code, now get working. I have yet to see a book that discusses the architectural process, what are the ways of doing this, why doing this is bad, how to actually incorporate design patterns in a real-world project, etc. Can you recommend a good resource or book? I am mainly programming with PHP but a language-agnostic book/resource would do :)

    Read the article

  • What happens inside the try block?

    - by dontWatchMyProfile
    Example: @try { // 1) do bad stuff that can throw an exception... // 2) do some more stuff // 3) ...and more... } @catch (NSException *e) { NSLog(@"Error: %@: %@", [e name], [e reason]); } If 1) throws an exception, is the block immediately canceled like a return in a function or a break in a loop? Or will 2) and 3) be processed no matter what happens in 1)?

    Read the article

  • How to save memory when reading a file in Php ?

    - by coolboycsaba
    I have a 200kb file, what I use in multiple pages, but on each page I need only 1-2 lines of that file so how I can read only these lines what I need if I know the line number? For example if I need only the 10th line, I don`t want to load in memory all the lines, just the 10th line. Sorry for my bad english!

    Read the article

  • What is the preferred syntax for initializing a dict?

    - by daotoad
    I'm putting in some effort to learn Python, and I am paying close attention to common coding standards. This may seem like a pointlessly nit-picky question, but I am trying to focus on best-practices as I learn, so I don't have to unlearn any 'bad' habits. I see two common methods for initializing a dict: a = { 'a': 'value', 'another': 'value', } b = dict( a='value', another='value', ) Which is considered to be "more pythonic"? Which do you use? Why?

    Read the article

  • Passing around an ElementTree

    - by PulpFiction
    Hello. In my program, I need to make use of an ElementTree object in various functions in my program. More specifically, I am doing this: tree = etree.parse('somefile.xml') I am passing this tree around in my program. I was wondering whether this is a good approach, or can I do this: Create a global tree (I come from a C++ background and I know global is bad) Create the tree again wherever required. Or is my approach ok?

    Read the article

  • Setting the size of a ContentPane (inside of a JFrame)

    - by Jim
    Hello, I want to set the size of a JFrame such that the contentPane is the desired size. JFrame.setSize() doesn't take the window decorations into account, so the contentPane is slightly too small. The size of the window decorations are platform and theme specific, so it's bad news to try to manually account for them. JFrame.getContentPane().setSize() fails because it's managed. Ideas? Thanks!

    Read the article

  • PHP turn off errors - in one file only

    - by Industrial
    Hi! I am well aware about error_reporting(0); & ini_set('display_errors', "Off"); to make error messages go away. What would be an appropriate way to do this - for a specific file or part of code only? Surpressing errors with @'s seems like a bad idea since it apparently slows the code down... Thanks!

    Read the article

  • IE firing anything else but click

    - by shabunc
    I just wonder is there's any way to fire any event via IE's event-triggering implementation - fireEvent. I've tried to use it but failed with all event except click. The only reason i've get interested with this issue it curiousity, thus, any answers like "just do not trigger events, it is a bad idea" - all such answers would be considered, well...not full))) thanks in advance

    Read the article

  • MySQL: how to index an "OR" clause

    - by JoséMi
    I'm executing the following query SELECT COUNT(*) FROM table WHERE field1='value' AND (field2 = 1000 OR field3 = 2000) There is one index over field1 and another composited over field2&field3. I see MySQL always selects the field1 index and then makes a join using the other two fields which is quite bad because it needs to join 146.000 rows. Suggestions on how to improve this? Thanks

    Read the article

  • Sequential coupling in code

    - by dotnetdev
    Hi, Is sequential coupling (http://en.wikipedia.org/wiki/Sequential_coupling) really a bad thing in code? Although it's an anti-pattern, the only risk I see is calling methods in the wrong order but documentation of an API/class library with this anti-pattern should take care of that. What other problems are there from code which is sequential? Also, this pattern could easily be fixed by using a facade it seems. Thanks

    Read the article

< Previous Page | 147 148 149 150 151 152 153 154 155 156 157 158  | Next Page >