Search Results

Search found 525 results on 21 pages for 'readability'.

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

  • Why not port Linux kernel to Common Lisp?

    - by rplevy
    Conventional wisdom states that OS kernels must be written in C in order to achieve the necessary levels of performance. This has been the justification for not using more expressive high level languages. However, for a few years now implementations of Common Lisp such as SBCL have proven to be just as performant as C. What then are the arguments against redoing the kernel in a powerfully expressive language, namely Common Lisp? I don't think anyone (at least anyone who knows what they are talking about) could argue against the fact that the benefits in transparency and readability would be tremendous, not to mention all the things that can't be done in C that can be done in Lisp, but there may be implementation details that would make this a bad idea.

    Read the article

  • Python Naming Conventions for Dictionaries/Maps/Hashes

    - by pokstad
    While other questions have tackled the broader category of sequences and modules, I ask this very specific question: "What naming convention do you use for dictionaries and why?" Some naming convention samples I have been considering: # 'value' is the data type stored in the map, while 'key' is the type of key value_for_key={key1:value1, key2,value2} value_key={key1:value1, key2,value2} v_value_k_key={key1:value1, key2,value2} Don't bother answering the 'why' with "because my work tells me to", not very helpful. The reason driving the choice is more important. Are there any other good considerations for a dictionary naming convention aside from readability?

    Read the article

  • Does IsolatedStorageFileStream.Lock work under SIlverlight4?

    - by Noah
    Silverlight uses an IsolatedStorageFileStream to open files. The IsolatedStorageFileStreamunder NET.4 claims to support the Lock Method (Inherited from FileStream) The following code IsolatedStorageFile isf; IsolatedStorageFileStream lockStream = new IsolatedStorageFileStream( "my.lck", FileMode.OpenOrCreate, isf ); lockStream.Lock( 0, 0 ); generates the following error, wrapped for readability, under VS2010 and Silverlight 4 'System.IO.IsolatedStorage.IsolatedStorageFileStream' does not contain a definition for 'Lock' and no extension method 'Lock' accepting a first argument of type 'System.IO.IsolatedStorage.IsolatedStorageFileStream' could be found (are you missing a using directive or an assembly reference?)

    Read the article

  • Code Alignment In SQL SERVER 2005

    - by user294488
    I am using SQL SERVER MANAGEMENT STUDIO. I want to know the shortcuts for easily aligning the T-SQL Queries and codes in a beautiful format for easy readability and understandablility. Please Let me know how to align the code without using any SQL SERVER FORMATTING / ALIGNING Tools. It is Urgent, Waiting for your kind reply at the earliest possible. Please do give your valuable tips to align the same, right now to align the code i mean to make the code right and left aligned i m using the TAB and SPACE BAR key which becomes very difficult when the length of code is increasing.

    Read the article

  • Style: Dot notation vs. message notation in Objective-C 2.0

    - by groundhog
    In Objective-C 2.0 we got the "dot" notation for properties. I've seen various back and forths about the merits of dot notation vs. message notation. To keep the responses untainted I'm not going to respond either way in the question. What is your thought about dot notation vs. message notation for property accessing? Please try to keep it focused on Objective-C - my one bias I'll put forth is that Objective-C is Objective-C, so your preference that it be like Java or JavaScript aren't valid. Valid commentary is to do with technical issues (operation ordering, cast precedence, performance, etc), clarity (structure vs. object nature, both pro and con!), succinctness, etc. Note, I'm of the school of rigorous quality and readability in code having worked on huge projects where code convention and quality is paramount (the write once read a thousand times paradigm).

    Read the article

  • Shortcut "or-assignment" (|=) operator in Java

    - by Dr. Monkey
    I have a long set of comparisons to do in Java, and I'd like to know if one or more of them come out as true. The string of comparisons was long and difficult to read, so I broke it up for readability, and automatically went to use a shortcut operator |= rather than negativeValue = negativeValue || boolean. boolean negativeValue = false; negativeValue |= (defaultStock < 0); negativeValue |= (defaultWholesale < 0); negativeValue |= (defaultRetail < 0); negativeValue |= (defaultDelivery < 0); I expect negativeValue to be true if any of the default<something> values are negative. Is this valid? Will it do what I expect? I couldn't see it mentioned on Sun's site or stackoverflow, but Eclipse doesn't seem to have a problem with it and the code compiles and runs.

    Read the article

  • How to get the same UITableViewCell layout as in the Address Book app?

    - by Romain
    Hi, I currently have a custom UITableViewCell which contains a few labels, and an image. The "main" label is used to display people's names. Currently, I'm styling it in bold text. What I'd like to do (to gain some space and readability), is to mimic the Address Book app cell style, that is: first name in light text, and family name in bold text. Is there a way to do this using the same UILabel? Or, should I use 2 different UILabels? How should I layout them, without knowing their sizes? Thanks in advance for your assistance!

    Read the article

  • Java: where should I put anonymous listener logic code?

    - by tulskiy
    Hi, we had a debate at work about what is the best practice for using listeners in java: whether listener logic should stay in the anonymous class, or it should be in a separate method, for example: button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // code here } }); or button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { buttonPressed(); } }); private void buttonPressed() { // code here } which is the recommended way in terms of readability and maintainability? I prefer to keep the code inside the listener and only if gets too large, make it an inner class. Here I assume that the code is not duplicated anywhere else. Thank you.

    Read the article

  • Building big, immutable objects without constructors having long parameter lists

    - by Malax
    Hi StackOverflow! I have some big (more than 3 fields) Objects which can and should be immutable. Every time I run into that case i tend to create constructor abominations with long parameter lists. It doesn't feel right, is hard to use and readability suffers. It is even worse if the fields are some sort of collection type like lists. A simple addSibling(S s) would ease the object creation so much but renders the object mutable. What do you guys use in such cases? I'm on Scala and Java, but i think the problem is language agnostic as long as the language is object oriented. Solutions I can think of: "Constructor abominations with long parameter lists" The Builder Pattern Thanks for your input!

    Read the article

  • Anonymous Methods / Lambda's (Coding Standards)

    - by Mystagogue
    In Jeffrey Richter's "CLR via C#" (the .net 2.0 edtion page, 353) he says that as a self-discipline, he never makes anonymous functions longer than 3 lines of code in length. He cites mostly readability / understandability as his reasons. This suites me fine, because I already had a self-discipline of using no more than 5 lines for an anonymous method. But how does that "coding standard" advice stack against lambda's? At face value, I'd treat them the same - keeping a lambda equally as short. But how do others feel about this? In particular, when lambda's are being used where (arguably) they shine brightest - when used in LINQ statements - is there genuine cause to abandon that self-discipline / coding standard?

    Read the article

  • Idiomatic ruby for temporary variables within a method

    - by Andrew Grimm
    Within a method, I am using i and j as temporary variables while calculating other variables. What is an idiomatic way of getting rid of i and j once they are no longer needed? Should I use blocks for this purpose? i = positions.first while nucleotide_at_position(i-1) == nucleotide_at_position(i) raise "Assumption violated" if i == 1 i -= 1 end first_nucleotide_position = i j = positions.last while nucleotide_at_position(j+1) == nucleotide_at_position(j) raise "Assumption violated" if j == sequence.length j += 1 end last_nucleotide_position = j Background: I'd like to get rid of i and j once they are no longer needed so that they aren't used by any other code in the method. Gives my code less opportunity to be wrong. I don't know the name of the concept - is it "encapsulation"? The closest concepts I can think of are (warning: links to TV Tropes - do not visit while working) Chekhov'sGun or YouHaveOutlivedYourUsefulness. Another alternative would be to put the code into their own methods, but that may detract from readability.

    Read the article

  • How powerful is the <script> tag in ASP.NET ?

    - by MarceloRamires
    I'm new at web development with .NET, and I'm currently studying a page where I have both separated codebehinds (in my case, a .CS file associated to the ASPX file), and codebehind that is inside the ASPX file inside tags like this: <script runat="server"> //code </script> Q1:What is the main difference (besides logical matters like organization, readability and ETC), what could be done in one way that could not be done in another? What is each mode best suited for ? Q2:If I'm going to develop a simple page with database connection, library imports, access to controls (ascx) and image access in other folders.. which method should I choose ?

    Read the article

  • Building big, immutable objects without using constructors having long parameter lists

    - by Malax
    Hi StackOverflow! I have some big (more than 3 fields) Objects which can and should be immutable. Every time I run into that case i tend to create constructor abominations with long parameter lists. It doesn't feel right, is hard to use and readability suffers. It is even worse if the fields are some sort of collection type like lists. A simple addSibling(S s) would ease the object creation so much but renders the object mutable. What do you guys use in such cases? I'm on Scala and Java, but i think the problem is language agnostic as long as the language is object oriented. Solutions I can think of: "Constructor abominations with long parameter lists" The Builder Pattern Thanks for your input!

    Read the article

  • Is there any JavaScript Library to intelligently truncate strings?

    - by j0ker
    I need to truncate strings in a side menu to make the fit into a div without a linebreak. The divs have a fixed width. I'm looking for a library to do that for me. If a string is too long to fit into the div, it should be truncated like: <div>This string is too long</div> == <div>This string is...ong</div> As you can see, the string is not only truncated by an ellipsis but the last three letters are also visible. This is meant to increase readability. The truncation should not care about spaces. Does anyone know of a library that includes such functionality? We're mainly using jQuery throughout the project. Thanks in advance!

    Read the article

  • Know any unobstrusive, simple GUI guidelines or design recommendations for notifications?

    - by Vinko Vrsalovic
    Hello again. I'm in the process of designing and testing various ideas for an application whose main functionality will be to notify users of occurring events and offer them with a choice of actions for each. The standard choice would be to create a queue of events showing a popup in the taskbar with the events and actions, but I want this tool to be the less intrusive and disrupting as possible. What I'm after is a good book or papers on studies of how to maximize user productivity in these intrinsically disruptive scenarios (in other words, how to achieve the perfect degree of annoying-ness, not too much, not too little). The user is supposedly interested in these events, they subscribe to them and can choose the actions to perform on each. I prefer books and papers, but the usual StackOverflow wisdom is appreciated as well. I'm after things like: Don't use popups, use instead X Show popups at most 3 seconds Show them in the left corner Use color X because it improves readability and disrupts less That is, cognitive aspects of GUI design that would help users in such a scenario.

    Read the article

  • Should I use `!IsGood` or `IsGood == false`?

    - by chills42
    I keep seeing code that does checks like this if (IsGood == false) { DoSomething(); } or this if (IsGood == true) { DoSomething(); } I hate this syntax, and always use the following syntax. if (IsGood) { DoSomething(); } or if (!IsGood) { DoSomething(); } Is there any reason to use '== true' or '== false'? Is it a readability thing? Do people just not understand Boolean variables? Also, is there any performance difference between the two?

    Read the article

  • Python datetime not including DST when using pytz timezone

    - by Jesper
    If I convert a UTC datetime to swedish format, summertime is included (CEST). However, while creating a datetime with sweden as the timezone, it gets CET instead of CEST. Why is this? >>> # Modified for readability >>> import pytz >>> import datetime >>> sweden = pytz.timezone('Europe/Stockholm') >>> >>> datetime.datetime(2010, 4, 20, 16, 20, tzinfo=pytz.utc).astimezone(sweden) datetime(2010, 4, 20, 18, 20, tzinfo=<... 'Europe/Stockholm' CEST+2:00:00 DST>) >>> >>> datetime.datetime(2010, 4, 20, 18, 20, tzinfo=sweden) datetime(2010, 4, 20, 18, 20, tzinfo=<... 'Europe/Stockholm' CET+1:00:00 STD>) >>>

    Read the article

  • Singleton class design in C#, are these two classes equivalent?

    - by Oskar
    I was reading up on singleton class design in C# on this great resource and decided to go with alternative 4: public sealed class Singleton1 { static readonly Singleton1 _instance = new Singleton1(); static Singleton1() { } Singleton1() { } public static Singleton1 Instance { get { return _instance; } } } Now I wonder if this can be rewritten using auto properties like this? public sealed class Singleton2 { static Singleton2() { Instance = new Singleton2(); } Singleton2() { } public static Singleton2 Instance { get; private set; } } If its only a matter of readability I definitely prefer the second version, but I want to get it right.

    Read the article

  • How do you handle descriptive database table names and their effect on foreign key names?

    - by Carvell Fenton
    Hello, I am working on a database schema, and am trying to make some decisions about table names. I like at least somewhat descriptive names, but then when I use suggested foreign key naming conventions, the result seems to get ridiculous. Consider this example: Suppose I have table session_subject_mark_item_info And it has a foreign key that references sessionSubjectID in the session_subjects table. Now when I create the foreign key name based on fk_[referencing_table]__[referenced_table]_[field_name] I end up with this maddness: fk_session_subject_mark_item_info__session_subjects_sessionSubjectID Would this type of a foreign key name cause me problems down the road, or is it quite common to see this? Also, how do the more experienced database designers out there handle the conflict between descriptive naming for readability vs. the long names that result? I am using MySQL and MySQL Workbench if that makes any difference. Thanks!

    Read the article

  • How do you get average of sums in SQL (multi-level aggregation)?

    - by paxdiablo
    I have a simplified table xx as follows: rdate date rtime time rid integer rsub integer rval integer primary key on (rdate,rtime,rid,rsub) and I want to get the average (across all times) of the sums (across all ids) of the values. By way of a sample table, I have (with consecutive identical values blanked out for readability): rdate rtime rid rsub rval ------------------------------------- 2010-01-01 00.00.00 1 1 10 2 20 2 1 30 2 40 01.00.00 1 1 50 2 60 2 1 70 2 80 02.00.00 1 1 90 2 100 2010-01-02 00.00.00 1 1 999 I can get the sums I want with: select rdate,rtime,rid, sum(rval) as rsum from xx where rdate = '2010-06-01' group by rdate,rtime,rid which gives me: rdate rtime rid rsum ------------------------------- 2010-01-01 00.00.00 1 30 (10+20) 2 70 (30+40) 01.00.00 1 110 (50+60) 2 150 (70+80) 02.00.00 1 190 (90+100) as expected. Now what I want is the query that will also average those values across the time dimension, giving me: rdate rtime ravgsum ---------------------------- 2010-01-01 00.00.00 50 ((30+70)/2) 01.00.00 130 ((110+150)/2) 02.00.00 190 ((190)/1) I'm using DB2 for z/OS but I'd prefer standard SQL if possible.

    Read the article

  • NSNumberFormatter to display custom labels for 10^n (10000 -> 10k)

    - by Michele Colombo
    I need to display numbers on a plot axis. The values could change but I want to avoid too long numbers that will ruin the readability of the graph. My thought was to group every 3 characters and substitute them with K, M and so on (or a custom character). So: 1 - 1, 999 - 999, 1.000 - 1k, 1.200 - 1.2k, 1.280 - 1.2k, 12.800 - 12.8k, 999.999 - 999.9k, 1.000.000 - 1M, ... Note that probably I'll only need to format round numbers (1, 10, 1000, 1500, 2000, 10000, 20000, 30000, 100000, ...). Is that possibile with NSNumberFormatter? I saw that it has a setFormat method but I don't know how much customizable it is. I'm using NSNumberFormatter cause the graph object I use wants it to set label format and I want to avoid changing my data to set the label.

    Read the article

  • Pros and cons of ways of storing an unsigned int without an unsigned int data type

    - by fields
    I have values that are 64-bit unsigned ints, and I need to store them in mongodb, which has no unsigned int type. I see three main possibilities for storing them in other field types, and converting on going in and out: Using a signed int is probably easiest and most space efficient, but has the disadvantage that they're not human readable and if someone forgets to do the conversion, some of them will work, which may obscure errors. Raw binary is probably most difficult for inexperienced programmers to deal with, and also suffers from non-human-readability. A string representation is the least space efficient (~40 bytes in unicode vs 8 bytes per field), but then at least all of the possible values will map properly, and for querying only a conversion to string is required instead of a more complicated conversion. I need these values to be available from different platforms, so a single driver-specific solution isn't an option. Any major pros and cons I've missed? Which one would you use?

    Read the article

  • The cost of nested methods

    - by Palimondo
    In Scala one might define methods inside other methods. This limits their scope of use to inside of definition block. I use them to improve readability of code that uses several higher-order functions. In contrast to anonymous function literals, this allows me to give them meaningful names before passing them on. For example: class AggregatedPerson extends HashSet[PersonRecord] { def mostFrequentName: String = { type NameCount = (String, Int) def moreFirst(a: NameCount, b: NameCount) = a._2 > b._2 def countOccurrences(nameGroup: (String, List[PersonRecord])) = (nameGroup._1, nameGroup._2.size) iterator.toList.groupBy(_.fullName). map(countOccurrences).iterator.toList. sortWith(moreFirst).head._1 } } Is there any runtime cost because of the nested method definition I should be aware of? Does the answer differ for closures?

    Read the article

  • Idiomatic usage of filter, map, build-list and local functions in Racket/Scheme?

    - by Greenhorn
    I'm working through Exercise 21.2.3 of HtDP on my own and was wondering if this is idiomatic usage of the various functions. This is what I have so far: (define-struct ir (name price)) (define list-of-toys (list (make-ir 'doll 10) (make-ir 'robot 15) (make-ir 'ty 21) (make-ir 'cube 9))) ;; helper function (define (price< p toy) (cond [(< (ir-price toy) p) toy] [else empty])) (define (eliminate-exp ua lot) (cond [(empty? lot) empty] [else (filter ir? (map price< (build-list (length lot) (local ((define (f x) ua)) f)) lot))])) To my novice eyes, that seems pretty ugly because I have to define a local function to get build-list to work, since map requires two lists of equal length. Can this be improved for readability? Thank you.

    Read the article

  • How to stop ReSharper from showing error on a lambda expression where Action is expected?

    - by carlmon
    In Silverlight, System.Windows.Threading's Dispatcher.BeginInvoke() takes an Action<T> or a delegate to invoke. .NET allows me to pass just the lambda expression. but ReSharper sees it as an error, saying "Cannot resolve method 'BeginInvoke(lambda expression)'": Dispatcher.BeginInvoke(() => { DoSomething(); }) The error goes away if I explicitly create the Action around the expression like this: Dispatcher.BeginInvoke(new Action<object>(o => { DoSomething(); })); I prefer the least amount of code in this case for the best readability. Is there a way to disable this specific ReSharper error notification? I tried some of the options, but could not find it. Thanks, Carl

    Read the article

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