Search Results

Search found 7833 results on 314 pages for 'happy coding'.

Page 4/314 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • More elegant way to avoid hard coding the format of a a CSV file?

    - by dsollen
    I know this is trivial issue, but I just feel this can be more elegant. So I need to write/read data files for my program, lets say they are CSV for now. I can implement the format as I see fit, but I may have need to change that format later. The simply thing to do is something like out.write(For.getValue()+","+bar.getMinValue()+","+fi.toString()); This is easy to write, but obviously is guilty of hard coding and the general 'magic number' issue. The format is hard-coded, requires parsing of the code to figure out the file format, and changing the format requires changing multiple methods. I could instead have my constants specifying the location that I want each variable to be saved in the CSV file to remove some of the 'magic numbers'; then save/load into the an array at the location specified by the constants: int FOO_LOCATION=0; int BAR_MIN_VAL_LOCATION=1; int FI_LOCATION=2 int NUM_ARGUMENTS=3; String[] outputArguments=new String[NUM_ARGUMENTS]; outputArguments[FOO_LOCATION] = foo.getValue(); outputArgumetns[BAR_MIN_VAL_LOCATION] = bar.getMinValue(); outptArguments[FI_LOCATOIN==fi.toString(); writeAsCSV(outputArguments); But this is...extremely verbose and still a bit ugly. It makes it easy to see the format of existing CSV and to swap the location of variables within the file easily. However, if I decide to add an extra value to the csv I need to not only add a new constant, but also modify the read and write methods to add the logic that actually saves/reads the argument from the array; I still have to hunt down every method using these variables and change them by hand! If I use Java enums I can clean this up slightly, but the real issue is still present. Short of some sort of functional programming (and java's inner classes are too ugly to be considered functional) I still have no obvious way of clearly expressing what variable is associated with each constant short of writing (and maintaining) it in the read/write methods. For instance I still need to write somewhere that the FOO_LOCATION specifies the location of foo.getValue(). It seems as if there should be a prettier, easier to maintain, manner for approaching this? Incidentally, I'm working in java at the moment, however, I am interested conceptually about the design approach regardless of language. Some library in java that does all the work for me is definitely welcome (though it may prove more hassle to get permission to add it to the codebase then to just write something by hand quickly), but what I'm really asking is more about how to write elegant code if you had to do this by hand.

    Read the article

  • iPhone/Cocoa Coding Standards

    - by greypoint
    Are there any generally-accepted coding standards (naming, casting etc) that apply specifically to iPhone/Cocoa/Objective-C? I know Microsoft has published similar standards as they relate to .Net and C# but haven't run across anything related to the iPhone world.

    Read the article

  • Java coding style

    - by folone
    How do you keep yourself coding to standards? There is stylecop and resharper for C#. Are there any tools/eclipse plugins for code analisys in Java? Which of them do you use?

    Read the article

  • Is my javascript coding style following best-practice?

    - by Blankman
    What is the 'best practise' with regard to coding style. Should I use _ for private members? Should I use this._privateMember? Please re-write my code in proper style if its wrong: (function()){ var _blah = 1; someFunction = function() { alert(_blah); }; someOtherFunction = function { someFunction(); } }();

    Read the article

  • PHP Coding styles return; in switch/case

    - by ArneRie
    Hi , we're trying to implement new coding style guidelines for our team, the php codesniffer is printing an warning on switch case statements when no "break" is found like: switch ($foo) { case 1: return 1; case 2: return 2; default: return 3; } is there any good reason to use : switch ($foo) { case 1: return 1; break; } ?? the break is never reached ?

    Read the article

  • Consolidating coding styles: Funcs, private method, single method classes

    - by jdoig
    Hi all, We currently have 3 devs with, some, conflicting styles and I'm looking for a way to bring peace to the kingdom... The Coders: Foo 1: Likes to use Func's & Action's inside public methods. He uses actions to alias off lengthy method calls and Func's to perform simple tasks that can be expressed in 1 or 2 lines and will be used frequently through out the code Pros: The main body of his code is succinct and very readable, often with only one or 2 public methods per class and rarely any private methods. Cons: The start of methods contain blocks of lambda rich code that other developers don't enjoy reading; and, on occasion, can contain higher order functions that other dev's REALLY don't like reading. Foo 2: Likes to create a private method for (almost) everything the public method will have to do . Pros: Public methods remain small and readable (to all developers). Cons: Private methods are numerous. With private methods that call into other private methods, that call into... etc, etc. Making code hard to navigate. Foo 3: Likes to create a public class with a, single, public method for every, non-trivial, task that needs performing, then dependency inject them into other objects. Pros: Easily testable, easy to understand (one object, one responsibility). Cons: project gets littered by classes, opening multiple class files to understand what code does makes navigation awkward. It would be great to take the best of all these techniques... Foo-1 Has really nice, readable (almost dsl-like) code... for the most part, except for all the Action and Func lambda shenanigans bulked together at the start of a method. Foo-3 Has highly testable and extensible code that just feels a bit "belt-&-braces" for some solutions and has some code-navigation niggles (constantly hitting F12 in VS and opening 5 other .cs files to find out what a single method does). And Foo-2... Well I'm not sure I like anything about the one-huge .cs file with 2 public methods and 12 private ones, except for the fact it's easier for juniors to dig into. I admit I grossly over-simplified the explanations of those coding styles; but if any one knows of any patterns, practices or diplomatic-manoeuvres that can help unite our three developers (without just telling any of them to just "stop it!") that would be great. From a feasibility standpoint : Foo-1's style meets with the most resistance due to some developers finding lambda and/or Func's hard to read. Foo-2's style meets with a less resistance as it's just so easy to fall into. Foo-3's style requires the most forward thinking and is difficult to enforce when time is short. Any ideas on some coding styles or conventions that can make this work?

    Read the article

  • C# coding standards for private member variables [closed]

    - by Sasha
    I saw two common approaches for coding standards for private member variables: class Foo { private int _i; private string _id; } and class Foo { private int m_i; private string m_id; } I believe the latter is coming from C++. Also, many people specify type before the member variable: double m_dVal -- to indicate that is is a nonconstant member variable of the type double? What are the conventions in C#?

    Read the article

  • Merry Christmas and Happy new year everyone and bye bye we meet again soon as possible

    - by anirudha
    few days ago i plan that i enjoy this cold days with my family so i decide that i go their and enjoy Christmas even i am Hindus no problem. so those days i stop everything relate to my daily technical life routine. because on Christmas and  new year i never meet you so Merry Christmas  and Happy new year to all [ friends , relative and all guys who know me or  even not] bye bye take care i come again as soon as possible.

    Read the article

  • Happy 10th Anniversary to AskTom!

    - by jenny.gelhausen
    Happy Anniversary to Tom Kyte's AskTom.oracle.com! Ten years of nuturing and advising the Oracle Database community is certainly a milestone to celebrate. With your first question being asked and answered in early 2000 about Oracle 7.3 on a Sun 5.5.1 machine - we recognize and appreciate the value of AskTom's informaton and insight to the industry. Well done and THANK YOU Tom! the Database Insider Team

    Read the article

  • Google I/O 2012 - YouTube API + Cloud Rendering = Happy Mobile Gamers

    Google I/O 2012 - YouTube API + Cloud Rendering = Happy Mobile Gamers Jarek Wilkiewicz, Danny Hermes YouTube is one of the top destinations for gamers. Many console developers already incorporate video recording and uploading directly into their titles, but uploading to YouTube from a mobile game presents a unique set of challenges. Come and learn how the YouTube API combined with cloud computing can help enable video uploads in your mobile game. For all I/O 2012 sessions, go to developers.google.com From: GoogleDevelopers Views: 100 0 ratings Time: 57:05 More in Science & Technology

    Read the article

  • SQL Server: avoiding hard coding of database name in cross-database views

    - by codeulike
    So, lets say you have two SQL Server Databases on the same server that reference each others tables in their Views, Functions and Stored Procedures. You know, things like this: use database_foo create view spaghetti as select f.col1, c.col2 from fusilli f inner join database_bar.dbo.conchigli c on f.id = c.id (I know that cross-database views are not very good practice, but lets just say you're stuck with it) Are there any good techniques to avoid 'hard coding' the database names? (So that should you need to occasionally re-point to a different database - for testing perhaps - you don't need to edit loads of views, fns, sps) I'm interested in SQL 2005 or SQL 2008 solutions. Cheers.

    Read the article

  • Question about best practices and Macros from the book 'C++ Coding Standards'

    - by Victor T.
    From Herb Sutter and Andrei Alexandrescu's 'C++ Coding Standards', Item 16: Avoid Macros under Exceptions for this guideline they wrote: For conditional compilation (e.g., system-dependent parts), avoid littering your code with #ifdefs. Instead, prefer to organize code such that the use of macros drives alternative implementations of one common interface, and then use the interface throughout. I'm having trouble understanding exactly what they mean by this. How can you drive alternate implementations without the use of #ifdef conditional compile macro directives? Can someone provide an example to help illustrate what's being proposed by the above paragraph? Thanks

    Read the article

  • What coding standards do you follow?

    - by Mark Szymanski
    I was just curious what coding standards people followed. I for one use the following: Brackets ALWAYS go on the next line. For instance: int main() { //Blah... } I never use code folding. (Yes my IDE's do support it (Xcode and Eclipse). Put related functions/methods single-spaced, otherwise double space. Here is an example: int foo = 0; printf("%d",foo); those are related while these are not: printf("Hello, World!"); return(0); I don't put else statements on the same line as the closing bracket for the preceding if statement. Most of the time in Java if a program needs multiple try catch statements I will just put the whole thing in one try catch.

    Read the article

  • Common coding style for Python?

    - by Oscar Carballal
    Hi, I'm pretty new to Python, and I want to develop my first serious open source project. I want to ask what is the common coding style for python projects. I'll put also what I'm doing right now. 1.- What is the most widely used column width? (the eternal question) I'm currently sticking to 80 columns (and it's a pain!) 2.- What quotes to use? (I've seen everything and PEP 8 does not mention anything clear) I'm using single quotes for everything but docstrings, which use triple double quotes. 3.- Where do I put my imports? I'm putting them at file header in this order. import sys import -rest of python modules needed- import whatever import -rest of application modules- <code here> 4.- Can I use "import whatever.function as blah"? I saw some documents that disregard doing this. 5.- Tabs or spaces for indenting? Currently using 4 spaces tabs. 6.- Variable naming style? I'm using lowercase for everything but classes, which I put in camelCase. Anything you would recommend?

    Read the article

  • Happy Holidays

    - by peggy.chen
    Happy Holidays from the Oracle Enterprise 2.0 Product Marketing Team! AC_FL_RunContent = 0; if (AC_FL_RunContent == 0) { alert("This page requires AC_RunActiveContent.js."); } else { AC_FL_RunContent( 'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0', 'width', '500', 'height', '315', 'src', 'http://www.oracle.com/us/e-cards/ecard15-english-188059', 'quality', 'high', 'pluginspage', 'http://www.macromedia.com/go/getflashplayer', 'align', 'middle', 'play', 'true', 'loop', 'true', 'scale', 'showall', 'wmode', 'window', 'devicefont', 'false', 'id', 'ecard15_english', 'bgcolor', '#000000', 'name', 'ecard15_english', 'menu', 'true', 'allowFullScreen', 'false', 'allowScriptAccess','always', 'movie', 'http://www.oracle.com/us/e-cards/ecard15-english-188059', 'salign', '' ); //end AC code }

    Read the article

  • Happy New Year from Oracle Technology Network!

    - by Cassandra Clark
    Happy New Year from the Oracle Technology Network team! All year long we have been working hard to bring you new member only offers and discounts. This month our partners have extended their offers an extra month in case you missed taking advantage of them due to the holidays. Visit the OTN Member Benefit Page today! Get discounts on Oracle Press, Packt Publishing, Manning, Apress, O'Reilly and CRC Press books. We also have discounts on Oracle products (Weblogic Server this month), fun wallpapers to download, discounts on industry events (QCon London) and on the Dr. Dobb's DVD release 6. If you'd like to see any offers/discounts added please respond in the comment section or take the OTN Membership Survey before it closes at the end of this month.

    Read the article

  • Happy Birthday Java EE 6+GlassFish 3!

    - by reza_rahman
    It has been almost exactly three years since Java EE 6 and GlassFish 3 were announced. It's worth pausing a moment to take stock of what has happened since. Both Java EE 6 and GlassFish 3 have been game changers. EE 6 has brought Java EE back in the limelight. To see evidence of that look at presentations like these from independents like Bert Ertman and Paul Bakker: JavaOne 2011: Migrating Spring Applications to Java EE 6 from ertmanb Likewise, the GlassFish community has proven to be a powerful disruptive force in the Java application server landscape. It's impact is evident from this percent growth rate chart from indeed.com of major Java application servers: Please join us in wishing both GlassFish and Java EE a very happy birthday and many more to come with Java EE 7, GlassFish 4 and Oracle's capabale stewardship...

    Read the article

  • What is a Coding Dojo?

    - by huwyss
    Recently i found out that there is a thing called "coding dojo". The point behind it is that software developers want to have a space to learn new stuff like processes, methods, coding details, languages, and whatnot in an environment without stress. Just for fun. No competition. No results required. No deadlines.Some days ago I joined the Zurich coding dojo. We were three programmers with different backgrounds.We gave ourselves the task to develop a method that takes an input value and returns its prime factors. We did pair programming and every few minutes we switched positions. We used test driven development. The chosen programming language was Ruby.I haven't really done TDD before. It was pretty interesting to see the algorithm develop following the testcases.We started with the first test input=1 then developed the most simple productive program that passed this very first test. Then we added the next test input=2 and implemented the productive code. We kept adding tests and made sure all tests are passed until we had the general solution.When we improved the performance of our code we saw the value of the tests we wrote before. Of course our first performance improvement broke several tests.It was a very interesting experience to see how other developers think and how they work. I will participate at the dojo again and can warmly recommend it to anyone. There are  coding dojos all over the world.Have fun!

    Read the article

  • How do you overcome your own coding biases when handed legacy code?

    - by Bryan M.
    As programmers, we often take incredible pride in our skills and hold very strong opinions about what is 'good' code and 'bad' code. At any given point in our careers, we've probably had some legacy system dropped in our laps, and thought 'My god, this code sucks!' because it didn't fit into our notion of what good code should be, despite the fact that it may have well been perfectly functional, maintainable code. How do you prepare yourself mentally when trying to get your head around another programmer's work?

    Read the article

  • How is your working time distributed between coding and thinking?

    - by mojuba
    ...in percentage. For example 60/40 or 90/10 or 100/0. My hypothesis is that the bigger the proportion of time you spend thinking the smaller your code can be as a result (and the less time will be needed to write it down). Think more, write less, in other words. Do you think it is true? As a side note, I think in typical software companies thinking is not part of the culture anyway: you are usually supposed to be sitting there at your computer typing something. You will almost definitely be noticed by your managers if you wander about with a blank look thinking over your next steps with your code. Too bad.

    Read the article

  • Happy Chinese New Year!

    - by Shaun
    Today is Dec the 29th in Chinese Traditional Calendar, that means on Thursday (3rd of Feb) we will have the Chinese New Year! For those who doesn’t know about the Chinese New Year please visit the wikipedia site. This is the most important holiday not only for the Chinese in China, but the Chinese all around the world. Here I would like to say: ????. (Chun Jie Kuai Le, Happy Chinese New Year). OK I have 3 news with my celebration: The new windows azure developer portal had been published for a while and the windows azure team wants to get to know how do we think about it. Here is a survey avaiable you can send your feedback. PS, please refer to my previous blog for the features of this new site. The latest Window Azure Platform Training Kit Jan Update had been released that you can download here. There is a demo and a hands-on lab about the Windows Phone 7 application with Windows Azure avaiable which should be interesting. If you have heard about the new feature for SQL Azure named SQL Azure Federation, you might know that it’s a cool feature and solution about database sharding. But for now there seems no similar solution for normal SQL Server and local database. I had created a library named PODA, which stands for Partition Oriented Data Access which partially implemented the features of SQL Azure Federation. I’m going to explain more about this project after the Chinese New Year but you can download the source code here.   Hope this helps, Shaun All documents and related graphics, codes are provided "AS IS" without warranty of any kind. Copyright © Shaun Ziyan Xu. This work is licensed under the Creative Commons License.

    Read the article

  • Unity 3D coding language, C# or JavaScript [on hold]

    - by hemantchhabra
    Hello to the gaming community. I am a budding game designer, learning to code for the first time in my life. I did learned c++ in school, 8 years back, so I sort of understand the logic when people are doing coding and I can suggest them the right route also, but to an extent I can't code. I am beginning to learn coding for Unity 3D. Which one do you suggest is more versatile and easier to work on for future, because I am a game designer not a coder, I would do coding until I don't have anyone else to code for me. It should be easy and fast to learn, functional and universal to apply, and innovative at the same time. C# or JavaScript ? Thank you for your time Ps- if you could suggest me steps to learn and tutorials to look for, that would be just awesome.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >