Search Results

Search found 458 results on 19 pages for 'destroyer of evil'.

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

  • Should I catch exceptions thrown when closing java.sql.Connection

    - by jb
    Connection.close() may throw SqlException, but I have always assumed that it is safe to ignore any such exceptions (and I have never seen code that does not ignore them). Normally I would write: try{ connection.close(); }catch(Exception e) {} Or try{ connection.close(); }catch(Exception e) { logger.log(e.getMessage(), e); } The question is: Is it bad practice (and has anyone had problems when ignoring such exeptions). When Connection.close() does throw any exception. If it is bad how should I handle the exception. Comment: I know that discarding exceptions is evil, but I'm reffering only to exceptions thrown when closing a connection (and as I've seen this is fairly common in this case). Does anyone know when Connection.close() may throw anything?

    Read the article

  • C: Pointers to any type?

    - by dragme
    I hear that C isn't so type-safe and I think that I could use that as an advantage for my current project. I'm designing an interpreter with the goal for the VM to be extremely fast, much faster than Ruby and Python, for example. Now I know that premature optimization "is the root of all evil" but this is rather a conceptual problem. I have to use some sort of struct to represent all values in my language (from number over string to list and map) Would the following be possible? struct Value { ValueType type; void* value; } I would store the actual values elsewhere, e.g: a separate array for strings and integers, value* would then point to some member in this table. I would always know the type of the value via the type variable, so there wouldn't be any problems with type errors. Now: Is this even possible in terms of syntax and typing?

    Read the article

  • Best PHP framework for jQuery?

    - by Radagaisus
    I've read all the answers on stackoverflow for similar questions but no one really laid down an explanation: why is zend/symfony/kohana/cakePHP the best for jQuery? what is the difference? I'm writing a snazzy ultra-cool web 2.0 app with google maps and facebook connect integration plus a bunch of other APIs. Almost everything will be AJAX vis JSON. For me PHP is a burden, an unnecessary evil. I need database control, almost always via JSON. I need user authentication. This is all. Nothing fancy. And I need it to scale. Most of all I need it to work effortlessly with jQuery, I need it to be jQuery's BFF, and I need to know why it is so. Thank you very much EDIT: The candidates right now are Yii, CodeIgniter and MongoDB.

    Read the article

  • Database table design vs. ease of use.

    - by Gastoni
    I have a table with 3 fields: color, fruit, date. I can pick 1 fruit and 1 color, but I can do this only once each day. examples: red, apple, monday red, mango, monday blue, apple, monday blue, mango, monday red, apple, tuesday The two ways in which I could build the table are: 1.- To have color, fruit and date be a composite primary key (PK). This makes it easy to insert data into the table because all the validation needed is done by the database. PK color PK fruit PK date 2.- Have and id column set as PK and then all the other fields. Many say thats the way it should be, because composite PKs are evil. For example, CakePHP does no support them. PK id color fruit date Both have advantages. Which would be the 'better' approach?

    Read the article

  • Algorithm to match natural text in mail

    - by snøreven
    I need to separate natural, coherent text/sentences in emails from lists, signatures, greetings and so on before further processing. example: Hi tom, last monday we did bla bla, lore Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. list item 2 list item 3 list item 3 Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid x ea commodi consequat. Quis aute iure reprehenderit in voluptate velit regards, K. ---line-of-funny-characters-####### example inc. 33 evil street, london mobile: 00 234534/234345 Ideally the algorithm would match only the bold parts. Is there any recommended approach - or are there even existing algorithms for that problem? Should I try approximate regular expressions or more statistical stuff based on number of punctation marks, length and so on?

    Read the article

  • How to avoid automatic renaming of sub signature parameters in visual basic 6.

    - by systempuntoout
    In Visual basic 6, i declare a sub like this: Private Sub test1(ByRef XmlFooOutput As String) ... End Sub after that, i declare another sub like the following one: Private Sub test2(ByRef xmlFooOutput As String) ... End Sub automagically, the first method is transformed in: Private Sub test1(ByVal xmlFooOutput As String) ... End Sub so the XmlFooOutput parameter is transformed in xmlFooOutput. This is a pretty dangerous feature because, method like those could be mapped to different XSL presentation files that read XML values through Xpath. So when test1 parameter is renamed, XSL bound to test1 method goes broken because Xpath point to XmlFooOuput but the correct value is now in xmlFooOutput. Is it possible to remove this weird feature? I'm using microsoft visual basic 6.0 (SP6). This question has some duplicate: http://stackoverflow.com/questions/1064858/stop-visual-basic-6-from-changing-my-casing http://stackoverflow.com/questions/248760/vb6-editor-changing-case-of-variable-names from what i see, there's no practical solution to disable this Intellisense evil feature.

    Read the article

  • Net Neutrality FAIL [closed]

    - by leeand00
    I know I'll get into all kinds of trouble for bringing this up on SO, but considering that nearly all of us programmers depend on the Internet to get our jobs done, I really think it's worth looking into today's failure of our right to use the Internet by way of Lobbying ISPs. Although something tells me there will be retribution for the actions of the ISPs/tel cos/cable and their lobbyist since, lets face it...ISPs/Telcos didn't invent the Internet. I'm not going to be the one to do it, but um I think somebody already has...as everybody I talked to was having Internet connection problems today at work. Just thought this might be relevant to all of our jobs...in the U.S.A. at least. If you work at an Big evil ISPs, by all means...try and close this question. If you don't...and your just a chap who enjoys your Internet access...please RT this: Contact The Democrats Who Are Against Net Neutrality (Full List W/ Contact Info) http://bit.ly/aMSV0W #NetNeutralityFAIL net-neutrality

    Read the article

  • Code crashing compiler: main() returning a struct instead of an int

    - by AndrejaKo
    Hi! I'm experimenting with a piece of C code. Can anyone tell me why is VC 9.0 with SP1 crashing for me? Oh, and the code is meant to be an example used in a discussion why something like void main (void) is evil. struct foo { int i; double d; } main (double argc, struct foo argv) { struct foo a; a.d=0; a.i=0; return a.i; } If I put return a; compiler doesn't crash.

    Read the article

  • How Transport for London Website Works

    - by Subhen
    Hi, Here let me clarify , I have no intentions to peep in to or any evil intention towards tfls database and other related information. But , ofcourse Millions of users are greatly beniftted the way it serves the information. http://journeyplanner.tfl.gov.uk/ So , If we want to create some site like tfl, journeyplanner , what are the basic things we need to keep in mind. Which Architecture We should use? Can We create this website using ASP.NET(Should be able to)? Is TFL integrating it's website with google maps or any other GPS Edit: While you enter the Zip/Pin code or Station name , it creates a map automatically from source to destination and calcculates the distance also. My Question here is , How do they calculate the distance , do they keep help of Maps or GPS or they created there own webservic?

    Read the article

  • AS3 Accessing Variables of Parent Class From Child

    - by TheDarkIn1978
    i'm trying to assign a parent's variable from the parent's child //Parent public class Main extends Sprite { public var selectedSquare:Sprite; public function Main() { //inits and adds new Square child class to display list } ... ------- //Child public function dragSquare(evt:MouseEvent):void { Sprite(parent).selectedSquare = this; //evil doesn't work! parent.addChild(this); this.startDrag(); } i'm receiving this error, but i'm casting parent from displayObjectContainer to a Sprite so i have no idea why it's not working. 1119: Access of possibly undefined property selectedSquare through a reference with static type flash.display:Sprite.

    Read the article

  • How to program three editions Light, Pro, Ultimate in one solution

    - by Henry99
    I'd like to know how best to program three different editions of my C# ASP.NET 3.5 application in VS2008 Professional (which includes a web deployment project). I have a Light, Pro and Ultimate edition (or version) of my application. At the moment I've put all in one solution with three build versions in configuration manager and I use preprocessor directives all over the code (there are around 20 such constructs in some ten thousand lines of code, so it's overseeable): #if light //light code #endif #if pro //pro code #endif //etc... I've read in stackoverflow for hours and thought to encounter how e.g. Microsoft does this with its different Windows editions, but did not find what I expected. Somewhere there is a heavy discussion about if preprocessor directives are evil. What I like with those #if-directives is: the side-by-side code of differences, so I will understand the code for the different editions after six months and the special benefit to NOT give out compiled code of other versions to the customer. OK, long explication, repeated question: What's the best way to go?

    Read the article

  • typeof === "undefined" vs. != null

    - by Thor Thurn
    I often see JavaScript code which checks for undefined parameters etc. this way: if (typeof input !== "undefined") { // do stuff } This seems kind of wasteful, since it involves both a type lookup and a string comparison, not to mention its verbosity. It's needed because 'undefined' could be renamed, though. My question is: How is that code any better than this approach: if (input != null) { // do stuff } As far as I know, you can't redefine null, so it's not going to break unexpectedly. And, because of the type-coercion of the != operator, this checks for both undefined and null... which is often exactly what you want (e.g. for optional function parameters). Yet this form does not seem widespread, and it even causes JSLint to yell at you for using the evil != operator. Why is this considered bad style?

    Read the article

  • Where is the bottleneck in this code?

    - by Mikhail
    I have the following tight loop that makes up the serial bottle neck of my code. Ideally I would parallelize the function that calls this but that is not possible. //n is about 60 for (int k = 0;k < n;k++) { double fone = z[k*n+i+1]; double fzer = z[k*n+i]; z[k*n+i+1]= s*fzer+c*fone; z[k*n+i] = c*fzer-s*fone; } Are there any optimizations that can be made such as vectorization or some evil inline that can help this code? I am looking into finding eigen solutions of tridiagonal matrices. http://www.cimat.mx/~posada/OptDoglegGraph/DocLogisticDogleg/projects/adjustedrecipes/tqli.cpp.html

    Read the article

  • C++ get method - returning by value or by reference

    - by HardCoder1986
    Hello! I've go a very simple question, but unfortunately I can't figure the answer myself. Suppose I've got some data structure that holds settings and acts like a settings map. I have a GetValue(const std::string& name) method, that returns the corresponding value. Now I'm trying to figure out - what kind of return-value approach would be better. The obvious one means making my method act like std::string GetValue(const std::string& name) and return a copy of the object and rely on RVO in performance meanings. The other one would mean making two methods std::string& GetValue(...) const std::string& GetValue(...) const which generally means duplicating code or using some evil constant casts to use one of these routines twice. #Q What would be your choice in this kind of situation and why?

    Read the article

  • Structure of open source project's repository

    - by hokkaido
    I'm in the beginning of starting a small open source project. When cloning the main repository one gets a complete build environment with all the libraries and all the tools needed to make an official installer file, with correct version numbers. I like the fact that anyone who wants to contribute can clone the repository and get started with anything they want. But I'm thinking this makes it to easy for Evil People to create malicious installers and release into the wild. How should it be structured? What do you recommend including in the repository, versus keeping on the build server only?

    Read the article

  • How to prevent a specific directory from running Php, Html, and Javascript languages?

    - by Emily
    Hi, Let's say i have an image uploader script, i want to prevent the upload directory from executing Php or even html by only showing it as plain text, i've seen this trick in many websites but i don't know how they do it. Briefly, if i upload evil.php to that directory, and i try to access it i will only see a plain text source , No html or php is executed. ( but i still want the images to appear normally ofcourse) I know i can do like that by header("content-type:text/plain"); but that's will not be helpful, because what i want, is to set the content-type:text/plain automatically by the server for every thing outputed from the upload directory except images. Note: i'm running php 5.3.2/Cent OS and the latest cPanel. Thanks

    Read the article

  • How do I validate that my the openid.op_endpoint when a request is completed.

    - by Sam Saffron
    I have an Open ID based authentication system on my site. Occasionally users will have an account registered under [email protected] and they will attempt to login using the google open id provider https://www.google.com/accounts/o8/id, in this case I would like to automatically associate the account and log them in. When the process is done I get a payload from somewhere claiming that openid.op_endpoint=https://www.google.com/accounts/o8/id. My question: Can I trust openid.op_endpoint to be correct? Can this be spoofed somehow by a malicious openid provider? For illustration, lets say someone types in http://evil.org as their openid provider, can I somehow end up getting a request back that claims openid.op_endpoint is google? Do I need to store extra information against the nonce to validate? The spec is kind of tricky to understand

    Read the article

  • DRY vs Security and Maintainability with MVC and View Models

    - by Mystere Man
    I like to strive for DRY, and obviously it's not always possible. However, I have to scratch my head over a concept that seems pretty common in MVC, that of the "View Model". The View Model is designed to only pass the minimum amount of information to the view, for both security, maintainability, and testing concerns. I get that. It makes sense. However, from a DRY perspective, a View Model is simply duplicating data you already have. The View Model may be temporary, and used only as a DTO, but you're basically maintaing two different versions of the same model which seems to violate the DRY principal. Do View Models violate DRY? Are they a necessary evil? Do they do more good than bad?

    Read the article

  • Double use of variables?

    - by Vaccano
    I have read that a variable should never do more than one thing. Overloading a variable to do more than one thing is bad. Because of that I end up writing code like this: (With the customerFound variable) bool customerFound = false; Customer foundCustomer = null; if (currentCustomer.IsLoaded) { if (customerIDToFind = currentCustomer.ID) { foundCustomer = currentCustomer; customerFound = true; } } else { foreach (Customer customer in allCustomers) { if (customerIDToFind = customer.ID) { foundCustomer = customer; customerFound = true; } } } if (customerFound) { // Do something } But deep down inside, I sometimes want to write my code like this: (Without the foundCustomer variable) Customer foundCustomer = null; if (currentCustomer.IsLoaded) { if (customerIDToFind = currentCustomer.ID) { foundCustomer = currentCustomer; } } else { foreach (Customer customer in allCustomers) { if (customerIDToFind = customer.ID) { foundCustomer = customer; } } } if (foundCustomer != null) { // Do something } Does this secret desires make me an evil programmer? (i.e. is the second case really bad coding practice?)

    Read the article

  • difference in using virtual and not using virtual

    - by numerical25
    In C++, whether you choose to use virtual or not, you can still override the base class function. The following compiles just fine... class Enemy { public: void SelectAnimation(); void RunAI(); void Interact() { cout<<"Hi I am a regular Enemy"; } private: int m_iHitPoints; }; class Boss : public Enemy { public: void Interact() { cout<<"Hi I am a evil Boss"; } }; So my question is what is the difference in using or not using the virtual function. And what is the disadvantage.

    Read the article

  • Are C++ Templates just Macros in disguise?

    - by Roddy
    I've been programming in C++ for a few years, and I've used STL quite a bit and have created my own template classes a few times to see how it's done. Now I'm trying to integrate templates deeper into my OO design, and a nagging thought keeps coming back to me: They're just a macros, really... You could implement (rather UGLY) auto_ptrs using #defines, if you really wanted to. This way of thinking about templates helps me understand how my code will actually work, but I feel that I must be missing the point somehow. Macros are meant evil incarnate, yet "template metaprogramming" is all the rage. So, what ARE the real distinctions? and how can templates avoid the dangers that #define leads you into, like Inscrutable compiler errors in places where you don't expect them? Code bloat? Difficulty in tracing code? Setting Debugger Breakpoints?

    Read the article

  • C++ return type overload hack

    - by aaa
    I was bored and came up with such hack (pseudocode): 1 struct proxy { 2 operator int(); // int function 3 operator double(); // double function 4 proxy(arguments); 5 arguments &arguments_; 6 }; 7 8 proxy function(arguments &args) { 9 return proxy(args); 10 } 11 int v = function(...); 12 double u = function(...); is it evil to use in real code?

    Read the article

  • Should member variables of global objects be made global as well?

    - by David Wong
    I'm developing plugins in Eclipse which mandates the use of singleton pattern for the Plugin class in order to access the runtime plugin. The class holds references to objects such as Configuration and Resources. In Eclipse 3.0 plug-in runtime objects are not globally managed and so are not generically accessible. Rather, each plug-in is free to declare API which exposes the plug-in runtime object (e.g., MyPlugin.getInstance() In order for the other components of my system to access these objects, I have to do the following: MyPlugin.getInstance().getConfig().getValue(MyPlugin.CONFIGKEY_SOMEPARAMETER); , which is overly verbose IMO. Since MyPlugin provides global access, wouldn't it be easier for me to just provide global access to the objects it manages as well? MyConfig.getValue(MyPlugin.CONFIGKEY_SOMEPARAMETER); Any thoughts? (I'm actually asking because I was reading about the whole "Global variable access and singletons are evil" debates)

    Read the article

  • In Perl, can I limit the length of a line as I read it in from a file (like fgets)

    - by SB
    I'm trying to write a piece of code that reads a file line by line and stores each line, up to a certain amount of input data. I want to guard against the end-user being evil and putting something like a gig of data on one line in addition to guarding against sucking in an abnormally large file. Doing $str = <FILE> will still read in a whole line, and that could be very long and blow up my memory. fgets lets me do this by letting me specify a number of bytes to read during each call and essentially letting me split one long line into my max length. Is there a similar way to do this in perl? I saw something about sv_gets but am not sure how to use it (though I only did a cursory Google search). Thanks.

    Read the article

  • Need help in sorting the programming buzz-words

    - by cwap
    How do you sort out the good buzz from the bad buzz? - I really need your help here :) I see a lot of buzz-words nowadays, both here on SO and in school. For example, we had a teacher who everyone respected, who said "be careful about gold-plating and death-by-interfacing". Now, everyone and their mama cries whenever I'm creating an interface.. Another example would be here on SO where lately "premature optimization is the root of all evil", so everytime someone asks a perfomance question, he'll get that sentence thrown in his face. A few months ago I remember it was all about NHibernate in here, etc., etc... These things comes and goes, but only the good buzz stays. Now, how do you seperate the good from the bad? By reading blogs from respected persons? By trying to come to a conclusion on your own, and then try to convince others that you're right? By simply ignoring it?

    Read the article

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