Search Results

Search found 1604 results on 65 pages for 'standards'.

Page 10/65 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • how to give meaningful id to the things in database

    - by gcc
    There are a lot of manuals. I am trying to create an database to hold information of these documents. But, there is a small problem. How can I give meaningful id to the manuals? Are there any standard or logic behind the giving meaningful id to the documents? If there is no standard, can you tell me how I should do that? example: table : manual id | manual name EDIT: Not Meaningful ID 1 or M1 or foo 2 C2 bar 3 P123 name ... ... ... (i) (ii) (iii) (i) Not meaningful for me because if some item deleted, there can be gap. ex 1 33 100. (ii) random character can be confusing when one try to give a name to new manual (iii) Why giving name is not preferred is because finding a name to the manual as ID is hard after 500 manuals. Meaningful : New ID * Can be easily produced even if after 1000 manuals * Should not be so complicated

    Read the article

  • Why do most of us use 'i' as a loop counter variable?

    - by kprobst
    Has anyone thought about why so many of us repeat this same pattern using the same variable names? for (int i = 0; i < foo; i++) { // ... } It seems most code I've ever looked at uses i, j, k and so on as iteration variables. I suppose I picked that up from somewhere, but I wonder why this is so prevalent in software development. Is it something we all picked up from C or something like that? Just an itch I've had for a while in the back of my head.

    Read the article

  • How to name a method that both performs a task and returns a boolean as a status?

    - by Limbo Exile
    If there is a method bool DoStuff() { try { // doing stuff... return true; } catch (Exception ex) { return false; } } should it rather be called IsStuffDone()? Both names could be misinterpreted by the user: If the name is DoStuff() why does it return a boolean? If the name is IsStuffDone() it is not clear whether the method performs a task or only checks its result. Is there a convention for this case? Or an alternative approach, as this one is considered flawed? For example in languages that have output parameters, like C#, a boolean status variable could be passed to the method as one and the method's return type would be void.

    Read the article

  • Fun programming or something else?

    - by gion_13
    I've recently heard about android's isUserAGoat method and I didn't know what to think. At first I laughed my brains out, than I was embarrassed for my lack of professionalism and tried to look into it and see if it makes any normal sense. As it turns out it is a joke (as stated here) and it appears that other languages/apis have these sort of easter eggs implemented in their core. While I personally like them and feel they can be a fresh breath sometimes, I think that they also can be both frustrating and confusing (and you begin to ask yourself : "can users be goats?" or "I get it! "goat" is slang for.... wait.."). My question is are there any other examples of these kind of programming jokes and what are their intends? Should they be considered harmless or not (how do programmers feel about it) ? Do they reach their goal (if any other than to laugh) ? Where do you draw a line between a good joke and a disaster? (what if the method was called isUserStupid?)

    Read the article

  • Is it wrong to use a boolean parameter to determine behavior?

    - by Ray
    I have seen a practice from time to time that "feels" wrong, but I can't quite articulate what is wrong about it. Or maybe it's just my prejudice. Here goes: A developer defines a method with a boolean as one of its parameters, and that method calls another, and so on, and eventually that boolean is used, solely to determine whether or not to take a certain action. This might be used, for example, to allow the action only if the user has certain rights, or perhaps if we are (or aren't) in test mode or batch mode or live mode, or perhaps only when the system is in a certain state. Well there is always another way to do it, whether by querying when it is time to take the action (rather than passing the parameter), or by having multiple versions of the method, or multiple implementations of the class, etc. My question isn't so much how to improve this, but rather whether or not it really is wrong (as I suspect), and if it is, what is wrong about it.

    Read the article

  • "static" as a semantic clue about statelessness?

    - by leoger
    this might be a little philosophical but I hope someone can help me find a good way to think about this. I've recently undertaken a refactoring of a medium sized project in Java to go back and add unit tests. When I realized what a pain it was to mock singletons and statics, I finally "got" what I've been reading about them all this time. (I'm one of those people that needs to learn from experience. Oh well.) So, now that I'm using Spring to create the objects and wire them around, I'm getting rid of static keywords left and right. (If I could potentially want to mock it, it's not really static in the same sense that Math.abs() is, right?) The thing is, I had gotten into the habit of using static to denote that a method didn't rely on any object state. For example: //Before import com.thirdparty.ThirdPartyLibrary.Thingy; public class ThirdPartyLibraryWrapper { public static Thingy newThingy(InputType input) { new Thingy.Builder().withInput(input).alwaysFrobnicate().build(); } } //called as... ThirdPartyLibraryWrapper.newThingy(input); //After public class ThirdPartyFactory { public Thingy newThingy(InputType input) { new Thingy.Builder().withInput(input).alwaysFrobnicate().build(); } } //called as... thirdPartyFactoryInstance.newThingy(input); So, here's where it gets touchy-feely. I liked the old way because the capital letter told me that, just like Math.sin(x), ThirdPartyLibraryWrapper.newThingy(x) did the same thing the same way every time. There's no object state to change how the object does what I'm asking it to do. Here are some possible answers I'm considering. Nobody else feels this way so there's something wrong with me. Maybe I just haven't really internalized the OO way of doing things! Maybe I'm writing in Java but thinking in FORTRAN or somesuch. (Which would be impressive since I've never written FORTRAN.) Maybe I'm using staticness as a sort of proxy for immutability for the purposes of reasoning about code. That being said, what clues should I have in my code for someone coming along to maintain it to know what's stateful and what's not? Perhaps this should just come for free if I choose good object metaphors? e.g. thingyWrapper doesn't sound like it has state indepdent of the wrapped Thingy which may itself be mutable. Similarly, a thingyFactory sounds like it should be immutable but could have different strategies that are chosen among at creation. I hope I've been clear and thanks in advance for your advice!

    Read the article

  • Vocabulary: Should I call this apply or map?

    - by Carlos Vergara
    So, I'm tasked with organizing the code and building a library with all the common code among our products. One thing that seems to happen all the time and I wanted to abstract is posted below in pseudocode, and I don't know how to call it (different products have different domain specific implementations and names for it) list function idk_what_to_name_it ( list list_of_callbacks, value common_parameter ): list list_of_results = new list for_each(callback in list_of_callbacks) list_of_results.push(callback(common_parameter)) end for_each return list_of_results end function Would you call this specific construct a list ListOfCallbacks.Map( value value_to_map) method or would it better be value Value.apply(list list_of_callbacks) I'm really curious about this kind of thing. Is there a standard guide for this stuff?

    Read the article

  • Where to find common database abbreviations in Spanish

    - by jmh_gr
    I'm doing a little pro bono work for an organization in Central America. I'm ok at Spanish and my contacts are perfectly fluent but are not techincal people. Even if they don't care what I call some fields in a database I still want to make as clean a schema as possible, and I'd like to know what some typical abbreviations are for field / variable names in Spanish. I understand abbreviations and naming conventions are entirely personal. I'm not asking for the "correct" or "best" way to abbreviate database object names. I'm just looking for references to lists of typical abbreviations that would be easily recognizable to a techincally competent native Spanish speaker. I believe I am a decent googler but I've had no luck on this one. For example, in my company (where English is the primary language) 'Date' is always shortened to 'DT', 'Code' to 'CD', 'Item' to 'IT', etc. It's easy for the crowds of IT temp workers who revolve through on various projects to figure out that 'DT' stands for 'Date', 'YR' for 'Year', or 'TN' for 'Transaction' without even having to consult the official abbreviations list.

    Read the article

  • How to incoporate Taiwan into ISO 3166-1?

    - by Misha
    I received a rather heartfelt e-mail from a user on our site explaining that Taiwan wasn't a province of China and that they wouldn't register until this was changed. Our site is made from a dozen or so valued contributors so we are going to change it. See issue here: http://www.iso.org/iso/country_codes/iso_3166-faqs/iso_3166_faqs_specific.htm. I found the lines to edit in my CMS, but we have valued users from both China and Taiwan. I was wondering the most politically neutral way to amend my country codes. What should the entries for China and Taiwan say?

    Read the article

  • In C and C++, what methods can prevent accidental use of the assignment(=) where equivalence(==) is needed?

    - by DeveloperDon
    In C and C++, it is very easy to write the following code with a serious error. char responseChar = getchar(); int confirmExit = 'y' == tolower(responseChar); if (confirmExit = 1) { exit(0); } The error is that the if statement should have been: if (confirmExit == 1) As coded, it will exit every time, because the assignment of the confirmExit variable occurs, then confirmExit is used as the result of the expression. Are there good ways to prevent this kind of error?

    Read the article

  • When is it appropriate to use colour in a command-line application?

    - by marcoms
    Currently I have a command-line application in C called btcwatch. It has a -C option that it can receive as an argument that compares the current price of Bitcoin with a price that was stored beforehand with -S. Example output with this option is: $ btcwatch -vC # -v = verbose buy: UP $ 32.000000 USD (100.000000 -> 132.000000) sell: UP $ 16.000000 USD (100.000000 -> 116.000000) The dilemma is whether to use colour for the UP or DOWN string (green and red, respectively). Most command-line applications I know of (apart from git) stay away from colour in their output. In my desire for btcwatch to look and be quite "standard" (use of getopt, Makefiles, etc), I'm not sure if colour would look out of place in this situation.

    Read the article

  • When creating a library for a simple program, what must I do to protect others from its lack of thread safety?

    - by DeveloperDon
    When creating a library for a simple program, is it more cost effective to make it thread safe or is there a way to detect the program's use in a multithreaded program and ASSERT() or otherwise determine (preferably at compile or link time) that it may create problems. Related help for this question would be automated tool support for finding potential problems with thread safety, programming language features that enforce it,

    Read the article

  • Is it reasonable to null guard every single dereferenced pointer?

    - by evadeflow
    At a new job, I've been getting flagged in code reviews for code like this: PowerManager::PowerManager(IMsgSender* msgSender) : msgSender_(msgSender) { } void PowerManager::SignalShutdown() { msgSender_->sendMsg("shutdown()"); } I'm told that last method should read: void PowerManager::SignalShutdown() { if (msgSender_) { msgSender_->sendMsg("shutdown()"); } } i.e., I must put a NULL guard around the msgSender_ variable, even though it is a private data member. It's difficult for me to restrain myself from using expletives to describe how I feel about this piece of 'wisdom'. When I ask for an explanation, I get a litany of horror stories about how some junior programmer, some-year, got confused about how a class was supposed to work and accidentally deleted a member he shouldn't have (and set it to NULL afterwards, apparently), and things blew up in the field right after a product release, and we've "learned the hard way, trust us" that it's better to just NULL check everything. To me, this feels like cargo cult programming, plain and simple. A few well-meaning colleagues are earnestly trying to help me 'get it' and see how this will help me write more robust code, but... I can't help feeling like they're the ones who don't get it. Is it reasonable for a coding standard to require that every single pointer dereferenced in a function be checked for NULL first—even private data members? (Note: To give some context, we make a consumer electronics device, not an air traffic control system or some other 'failure-equals-people-die' product.) EDIT: In the above example, the msgSender_ collaborator isn't optional. If it's ever NULL, it indicates a bug. The only reason it is passed into the constructor is so PowerManager can be tested with a mock IMsgSender subclass.

    Read the article

  • Is Reading the Spec Enough?

    - by jozefg
    This question is centered around Scheme but really could be applied to any LISP or programming language in general. Background So I recently picked up Scheme again having toyed with it once or twice before. In order to solidify my understanding of the language, I found the Revised^5 Report on the Algorithmic Language Scheme and have been reading through that along with my compiler/interpreter's (Chicken Scheme) listed extensions/implementations. Additionally, in order to see this applied I have been actively seeking out Scheme code in open source projects and such and tried to read and understand it. This has been sufficient so far for me understanding the syntax of Scheme and I've completed almost all of the Ninety-nine Scheme problems (see here) as well as a decent number of Project Euler problems. Question While so far this hasn't been an issue and my solutions closely match those provided, am I missing out on a great part of Scheme? Or to phrase my question more generally, does reading the specification of a language along with well written code in that language sufficient to learn from? Or are other resources, books, lectures, videos, blogs, etc necessary for the learning process as well.

    Read the article

  • Long lines of text in source code [closed]

    - by ale
    Possible Duplicate: Is the 80 character limit still relevant in times of widescreen monitors? I used to set a vertical line set at 80 characters in my text editor and then I added carriage returns if the lines got too long. I later increased the value to 135 characters. I started using word wrap and not giving myself a limit but tried to keep lines short if I could because it took a lot of time shortening my lines. People at work use word wrap and don't give themselves a limit.. is this the correct way? What are you meant to do ? Many thanks.

    Read the article

  • using "IS" is better or checking for "NOT NULL"

    - by BDotA
    In C#.NET language: This style of coding is recommended or the one below it? if (sheet.Models.Data is GroupDataModel) { GroupDataModel gdm = (GroupDataModel)sheet.Models.Data; Group group = gdm.GetGroup(sheet.ActiveCell.Row.Index); if (group!=null && controller != null) { controller.CheckApplicationState(); } } or this one: var gdm = sheet.Models.Data as GroupDataModel; if (gdm != null) { Group group = gdm.GetGroup(sheet.ActiveCell.Row.Index); if (@group!=null && controller != null) { controller.CheckApplicationState(); } }

    Read the article

  • How to pronounce "std" as in "std::vector"

    - by Lex Fridman
    In C++, the STL (standard template library) includes a namespace std that contains the many data structures and algorithms that we all know and love. I've always pronounced this namespace just like sexually transmitted diseases: S T D. But then I listened to this excellent series of lectures by Stephan T. Lavavej and he pronounces it "stood". Which is the "correct" pronunciation or at least what is that most commonly used one?

    Read the article

  • Should Equality be commutative within a Class Hierachy?

    - by vossad01
    It is easy to define the Equals operation in ways that are not commutative. When providing equality against other types, there are obviously situations (in most languages) were equality not being commutative is unavoidable. However, within one's own inheritance hierarchy where the root base class defines an equality member, a programmer has more control. Thus you can create situations where (A = B) ? (B = A), where A and B both derive from base class T Substituting the = with the appropriate variation for a given language. (.Equals(_), ==, etc.) That seems wrong to me, however, I recognize I may be biased by background in Mathematics. I have not been in programming long enough to know what is standard/accepted/preferred practice when programming. Do most programmers just accept .Equals(_)may not be commutative and code defensibly. Do they expect commutativity and get annoyed if it is not. In short, when working in a class hierarchy, should effort me made to ensure Equality is commutative?

    Read the article

  • How should I get my code ready for OpenSourcing it and putting it on GitHub?

    - by Sempus
    In a few weeks, my project is going to be finished and I want to start getting my code ready for other people to use it. I am going to be posting everything to GitHub so people can tweak it and hopefully make it better. I guess what I'm asking is, what would be the best way to make sure my code is sufficiently documented and worded right for other people to use? I know you should always comment everything and I'm going to be putting in the @params feature for every method, but are there any other tips in general?

    Read the article

  • Does (should?) changing the URI scheme name change the semantics?

    - by Doug
    If we take: http://example.com/foo is it fair to say that: ftp://example.com/foo .. points to the same resource, just using a different mechanism for resolving it (and of course possibly a different representation, but perhaps not)? This came to light in a discussion we were having surrounding some internal tooling with Git. We have to process some Git repositories, and they come to use as "git@{authority}/{path}" , however the library we're using to interface with them doesn't support the git protocol. I suggested that we should make the service robust in of that it tries to use HTTP or SSH, in essence, discovering what protocols/schemes are supported for resolving the repository at {path} under each {authority}. This was met with some criticism: "We don't know if that's the same repository". My response was: "It had better be!" Looking at RFC 3986, I see this excerpt: URI "resolution" is the process of determining an access mechanism and the appropriate parameters necessary to dereference a URI; this resolution may require several iterations. To use that access mechanism to perform an action on the URI's resource is to "dereference" the URI. Which makes me think that the resolution process is permitted to try different protocols, because: Although many URI schemes are named after protocols, this does not imply that use of these URIs will result in access to the resource via the named protocol. The only concern I have, I guess, is that I only see reference to the notion of changing protocols when it comes to traversing relationships: it is possible for a single set of hypertext documents to be simultaneously accessible and traversable via each of the "file", "http", and "ftp" schemes if the documents refer to each other with relative references. I'm inclined to think I'm wrong in my initial beliefs, because the Normalization and Comparison section of said RFC doesn't mention any way of treating two URIs as equivalent if they use different schemes. It seems like schemes named/based on IP protocols ought to have this notion, at least?

    Read the article

  • Best way to rename existing unique field names in database?

    - by Rajdeep Siddhapura
    I have a database table that contains id, filename, userId id is unique identifier filename should also be unique table may contain 10000 records When a user uploads a file it should be entered in database with given rules: If there is no record with same filename, it should be added as it is (Ex. foobar.pdf) If there is record with same filename, it should be added as uploadedName(2).ext (foobar(2).pdf) If there are n records with same base filename (foobar), it should be added as uploadedName(n+1).ext (foobar(20).pdf) Now if foobar(2).pdf is uploaded, it should be added as foobar(2)(2).pdf & so on This pattern needs to be followed because the file is already being uploaded at client side using ajax before sending the details to server and the file hosting service follows the above rules to name the files. My solution: maintain a file that contains all the names and the number of times it has occurred. if a filename that exists in file is entered, increase occurrence count and new name is generated, else add to it to file if the new name generated is in database, add it to file and generate new name

    Read the article

  • Force Browser Mode=IE8 and document mode=IE8 Standards

    - by Dennis Cheung
    I have a internal website hosted on IIS. I added the following meta code and also add http-header that the page should in IE8 Browser mode and document mode. <meta http-equiv="X-UA-Compatible" content="IE=8" > We tested it on Visual Studio and and it works very well. However, after we publish the code to another IIS server, one developer reported that the page render in "IE8 Comatiblity" Browser Mode which causes some JavaScript to fail. There are more then 4 people working on the same windows server 2003 (RDP sessions). We use the same version of IE (same IE actually). Everyone get "IE8" Browser Mode but one person gets "IE8 Compatibility" Browser Mode. What else can make a specific user's IE load the page in a mode other than IE8 mode? PS. We checked the compatibility list in the IE; it is empty.

    Read the article

  • Proper Way to Create Standards-Compliant Webpage Structure

    - by Sakamoto Kazuma
    I have been working through projects involving packages that do all the web design stuff for me for the past few years. I will admit that I have not been able to focus any on actual web design. I was wondering what the standard is these days for website layouts. Are layout-tables looked down upon now? Or are all layouts done with div tags and controlled through CSS? Are frames even used anymore? Note I am not talking about chart-table tables when I say layout tables.

    Read the article

  • Which doctype should I use for GWT 2.0?

    - by David
    I think I should use <!DOCTYPE html> for my new GWT application; I understand that doing so will put my application into standards-compliant mode. Am I correct? Are there any disadvantages to using this doctype? Does GWT work properly in standards-compliant mode? I'm wary because the GWT tutorial still uses the HTML 4.01 transitional doctype.

    Read the article

  • Show EPS file in IE8 with standards modes set to IE8

    - by runrunraygun
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"> With this set my EPS files are not rendered in ABCpdf, but set to EmulateIE7 and they work fine. I know EPS aren't a standard web format but they are embedded into a PDF using a bit of ABCpdf magic. Because IE8 isn't even trying to show them they are not appearing on the PDF as they previously were. <embed style="abcpdf-tag-visible: true;width:40px;height:40px;" id="C:\myfile.eps" src="myfile.eps">

    Read the article

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