Search Results

Search found 15316 results on 613 pages for 'coding style'.

Page 74/613 | < Previous Page | 70 71 72 73 74 75 76 77 78 79 80 81  | Next Page >

  • Does CSS have a "start over" feature?

    - by Rick Wayne
    I'm using calendar_date_select (henceforth CDS) in a Rails application, and have a stupid question. When I embed the CDS component in the middle of an already-CSS-styled page, all manner of things go ugly-wrong with it (spacing, fonts, etc.). Clearly the elements inside the CDS have inherited unwanted stuff from the styles already working in the containing page. Now, I could use a combination of, say, Safari's CSS debugging and analyze what's wrong element-by-element. But that's (A) tedious, and (B) might load up my component's styles with tons of container-defeating special cases. If nothing else, I'm certain to change the containing page's styles in the future and would have to maintain the special cases. My question: Is is possible to have a DIV in a page that essentially backs out all the existing styling? Is there a simple one-liner that will do this? Failing that, can it be done on an element-by-element basis? E.g. I know what tags the CDS generates, so I could list each of them: { p: "#--NOTHING--#"; a: "#--NOTHING--#"; } where #--NOTHING--# is the Magic Turn Off All Inherited Styles incantation. http://code.google.com/p/calendardateselect/ Thanks, peeps.

    Read the article

  • Thoughts on try-catch blocks

    - by John Boker
    What are your thoughts on code that looks like this: public void doSomething() { try { // actual code goes here } catch (Exception ex) { throw; } } The problem I see is the actual error is not handled, just throwing the exception in a different place. I find it more difficult to debug because i don't get a line number where the actual problem is. So my question is why would this be good? ---- EDIT ---- From the answers it looks like most people are saying it's pointless to do this with no custom or specific exceptions being caught. That's what i wanted comments on, when no specific exception is being caught. I can see the point of actually doing something with a caught exception, just not the way this code is.

    Read the article

  • 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

  • Javascript: Inline function vs predefined functions

    - by glaz666
    Can any body throw me some arguments for using inline functions against passing predefined function name to some handler. I.e. which is better: (function(){ setTimeout(function(){ /*some code here*/ }, 5); })(); versus (function(){ function invokeMe() { /*code*/ } setTimeout(invokeMe, 5); })(); Strange question, but we are almost fighting in the team about this

    Read the article

  • Should commit messages be written in present or past tense?

    - by user68759
    So which is it that you think is better and more intuitive? Fixed the XXX bug in YYY Fix the XXX bug in YYY Fixes the XXX bug in YYY Fixing the XXX bug in YYY Please provide your rationales. Note I am asking from your general perspective, meaning you should not try to associate this with your preferred svn/cvs tools or programming languages, but rather think of it as something that should/can be applied to any tools and programming languages.

    Read the article

  • Catching specific vs. generic exceptions in c#

    - by Scott Vercuski
    This question comes from a code analysis run against an object I've created. The analysis says that I should catch a more specific exception type than just the basic Exception. Do you find yourself using just catching the generic Exception or attempting to catch a specific Exception and defaulting to a generic Exception using multiple catch blocks? One of the code chunks in question is below: internal static bool ClearFlags(string connectionString, Guid ID) { bool returnValue = false; SqlConnection dbEngine = new SqlConnection(connectionString); SqlCommand dbCmd = new SqlCommand("ClearFlags", dbEngine); SqlDataAdapter dataAdapter = new SqlDataAdapter(dbCmd); dbCmd.CommandType = CommandType.StoredProcedure; try { dbCmd.Parameters.AddWithValue("@ID", ID.ToString()); dbEngine.Open(); dbCmd.ExecuteNonQuery(); dbEngine.Close(); returnValue = true; } catch (Exception ex) { ErrorHandler(ex); } return returnValue; } Thank you for your advice EDIT: Here is the warning from the code analysis Warning 351 CA1031 : Microsoft.Design : Modify 'ClearFlags(string, Guid)' to catch a more specific exception than 'Exception' or rethrow the exception

    Read the article

  • Placement of service methods

    - by mhp
    Let's assume I have two service classes with the following methods: GroupService createGroup() deleteGroup() updateGroup() findGroup() UserService createUser() deleteUser() updateUser() findUser() Now, I am thinking about the aesthetics of theses classes. Imagine we want to implement a method which search for all user of a specific group. Which service class is responsible for such a method? I mean, the return value is a user (or maybe a collection of users) but the parameter (which means the name of the group) is a group. So which service class is the better place to put this method in?

    Read the article

  • Do you use ASCII art to decorate your code?

    - by CiNN
    Do you use ASCII art to decorate your code? .-"""-. ' \ |,. ,-. | |()L( ()| | license goes here |,' `".| | |.___.',| ` .j `--"' ` `. / ' ' \ / / ` `. / / ` . / / l | . , | | ,"`. .| | _.' ``. o | `..-'l | `.`, | `. | `. __.j ) |__ |--""___| ,-' `"--...,+"""" `._,.-' mh www /n n\ /\ |/^\| / \ warning notes | , | ^||^ \_/ || _U_ || /` `''-----'P3 / |. .|''-----"|| \'| | || \| | || E | || /#####\ || /#####\ || ||| || ||| || ||| || ||| gem || molom Ll /~~~\/~~\/~~~\/~~~\/~~\/~~~\ /~~~\/~~\/~~~\/~~~\/~~\/~~~\ | /\/ /\/ /\ || /\/ /\/ /\ | | /\ \/\ \/\ || /\ \/\ \/\ | \ \/ /\/ /\/ /\ \/ /\/ /\/ / function name \ \/\ \/\ \/ /\ \/\ \/\ \/ / \ \/\ \/\ \/ \ \/\ \/\ \/ \/ /\/ /\/ / \/ /\/ /\/ / ,_/\ \/\ \/\ \__/\ \/\ \/\ \______________________/ /\/ /\/ /\__/ /\/ /\/ /\_, (__/\__/\__/\____/\__/\__/\________________________/\__/\__/\____/\__/\__/\__)

    Read the article

  • Override GWT Styling

    - by KevMo
    I had a beautiful pure HTML mockup for a webpage that I am now recreating in GWT. I'm attempting to use the same css in my GWT app, but that's not working well for me. GWT styles seem to override mine. I know I can completely disable the GWT styles, however I would prefer to have the styling for the GWT components that I'm adding (tab panel, button, etc). Is there a way to disable GWT styling, and only enable it for components that I choose?

    Read the article

  • using KVO to filter an NSTableView using NSPredicate (with arrays)

    - by KingRufus
    My UI is not updating when I expect it to. The application displays "projects" using a view similar to iTunes -- a source list on the left lets you filter a list (NSTableView) on the right. My filters update properly when they are examining any simple field (like name, a string), but not for arrays (like tags). I'm removing a tag from one of my objects (from an NSMutableArray field called "tags") and I expect it to disappear from the list because it no longer matches the predicate that is bound to my table's NSArrayController. ProjectBrowser.mm: self.filter = NSPredicate* srcPredicate = [NSPredicate predicateWithFormat:@"%@ IN %K", selectedTag, @"tags"]; Project.mm: [self willChangeValueForKey:@"tags"]; [tags removeAllObjects]; [self didChangeValueForKey:@"tags"]; I've also tried this, but the result is the same: [[self mutableArrayValueForKey:@"tags"] removeAllObjects]; Interface Builder setup: a ProjectBrowser object is the XIB's File Owner an NSArrayController (Project Controller) has its Content Array bound to "File's Owner".projects Project Controller's filter predicate is bound to "File's Owner".filter NSTableView's column is bound to "Project Controller".name

    Read the article

  • Silverlight 4 business application themes

    - by David Brunelle
    Hi, We are starting a new SilverLight 4 Business Application project and are looking for theme. All we can find on the web are Navigation Application themes, which when applied to business application project, don't work. Most even have compilation errors. Is there a place on the web to get theme specifically for that project or is there a way to translate navigation application theme into business application theme? Thank you

    Read the article

  • What is wrong with accessing DBI directly?

    - by canavanin
    Hi everyone! I'm currently reading Effective Perl Programming (2nd edition). I have come across a piece of code which was described as being poorly written, but I don't yet understand what's so bad about it, or how it should be improved. It would be great if someone could explain the matter to me. Here's the code in question: sub sum_values_per_key { my ( $class, $dsn, $user, $password, $parameters ) = @_; my %results; my $dbh = DBI->connect( $dsn, $user, $password, $parameters ); my $sth = $dbh->prepare( 'select key, calculate(value) from my_table'); $sth->execute(); # ... fill %results ... $sth->finish(); $dbh->disconnect(); return \%results; } The example comes from the chapter on testing your code (p. 324/325). The sentence that has left me wondering about how to improve the code is the following: Since the code was poorly written and accesses DBI directly, you'll have to create a fake DBI object to stand in for the real thing. I have probably not understood a lot of what the book has so far been trying to teach me, or I have skipped the section relevant for understanding what's bad practice about the above code... Well, thanks in advance for your help!

    Read the article

  • When I'm iterating over two arrays at once, which one do I use as the limit?

    - by Martijn Courteaux
    Hi, I'm always struggling with something like the following Java example: String breads[] = {"Brown", "White", "Sandwich"}; int count[] = new int[breads.length]; for (int i = 0; i < ****; i++) { // Prompt the number of breads } ****: which array.length should I choose? I can choose between breads.length and count.length I know it would be the same result, but I don't know which one I shoud choose. There are many other examples where I get the same problem. I'm sure that you have encountered this problem as well in the past. What should you choose? Are there general agreements? Thanks

    Read the article

  • Does malloc() allocate a contiguous block of memory?

    - by user66854
    I have a piece of code written by a very old school programmer :-) . it goes something like this typedef struct ts_request { ts_request_buffer_header_def header; char package[1]; } ts_request_def; ts_request_buffer_def* request_buffer = malloc(sizeof(ts_request_def) + (2 * 1024 * 1024)); the programmer basically is working on a buffer overflow concept. I know the code looks dodgy. so my questions are: Does malloc always allocate contiguous block of memory ?. because in this code if the blocks are not contiguous , the code will fail big time Doing free(request_buffer) , will it free all the bytes allocated by malloc i.e sizeof(ts_request_def) + (2 * 1024 * 1024), or only the bytes of the size of the structure sizeof(ts_request_def) Do you see any evident problems with this approach , i need to discuss this with my boss and would like to point out any loopholes with this approach

    Read the article

  • PHP Commercial Project Function define

    - by Shiro
    Currently I am working with a commercial project with PHP. I think this question not really apply to PHP for all programming language, just want to discuss how your guys solve it. I work in MVC framework (CodeIgniter). all the database transaction code in model class. Previously, I seperate different search criteria with different function name. Just an example function get_student_detail_by_ID($id){} function get_student_detail_by_name($name){} as you can see the function actually can merge to one, just add a parameter for it. But something you are rushing with project, you won't look back previously got what similar function just make some changes can meet the goal. In this case, we found that there is a lot function there and hard to maintenance. Recently, we try to group the entity to one ultimate search something like this function get_ResList($is_row_count=FALSE, $record_start=0, $arr_search_criteria='', $paging_limit=20, $orderby='name', $sortdir='ASC') we try to make this function to fit all the searching criteria. However, our system getting bigger and bigger, the search criteria not more 1-2 tables. It require join with other table with different purpose. What we had done is using IF ELSE, if(bla bla bla) { $sql_join = JOIN_SOME_TABLE; $sql_where = CONDITION; } at the end, we found that very hard to maintance the function. it is very hard to debug as well. I would like to ask your opinion, what is the commercial solution they solve this kind of issue, how to define a function and how to revise it. I think this is link project management skill. Hope you willing to share with us. Thanks.

    Read the article

  • Pomodoro technique & other ways to increase personal productivity

    - by Jayson
    I recently came across the Pomodoro Technique as a way to increase productivity, get in the zone, and in general feel a sense of accomplishment at setting some short programming goals and achieving them. So far I have enjoyed it and the sense of accomplishment I get after seeing a bunch of short goals add up at the end of the day to a lot of work done on a programming project. What other ideas, similar or not, add a little variety to achieving goals, personal productivity, get in the programming zone, and so forth? What ideas or techniques are expressed formally, such as those in the Pomodoro paper, rather than trite maxims?

    Read the article

  • Gracefully avoiding NullPointerException in Java

    - by Yuval A
    Consider this line: if (object.getAttribute("someAttr").equals("true")) { // .... Obviously this line is a potential bug, the attribute might be null and we will get a NullPointerException. So we need to refactor it to one of two choices: First option: if ("true".equals(object.getAttribute("someAttr"))) { // .... Second option: String attr = object.getAttribute("someAttr"); if (attr != null) { if (attr.equals("true")) { // .... The first option is awkward to read but more concise, while the second one is clear in intent, but verbose. Which option do you prefer in terms of readability?

    Read the article

  • Generic CSS templates anywhere (not layout)?

    - by TruMan1
    I am looking for a place where I can download a bunch of CSS stylesheets to change the appearance of my titles, links, paragraphs, etc. I am not an artist, so I am hoping to leverage other people's skills in choosing the right fonts, colors, sizes, etc. I do not want to include layout because then it won't be as generic. Does anyone know where I can get something like this?

    Read the article

  • How to name variables on the fly in R?

    - by Maiasaura
    Is it possible to create new variable names on the fly? I'd like to read data frames from a list into new variables with numbers at the end. Something like orca1, orca2, orca3... If I try something like paste("orca",i,sep="")=list_name[[i]] I get this error target of assignment expands to non-language object Is there another way around this?

    Read the article

  • Better Java method Syntax? Return early or late? [closed]

    - by Gandalf
    Duplicate: Should a function have only one return statement? and Single return or multiple return statements? Often times you might have a method that checks numerous conditions and returns a status (lets say boolean for now). Is it better to define a flag, set it during the method, and return it at the end : boolean validate(DomainObject o) { boolean valid = false; if (o.property == x) { valid = true; } else if (o.property2 == y) { valid = true; } ... return valid; } or is it better/more correct to simply return once you know the method's outcome? boolean validate(DomainObject o) { if (o.property == x) { return true; } else if (o.property2 == y) { return true; } ... return false; } Now obviously there could be try/catch blocks and all other kinds of conditions, but I think the concept is clear. Opinions?

    Read the article

< Previous Page | 70 71 72 73 74 75 76 77 78 79 80 81  | Next Page >