instruction
stringlengths
34
36.1k
I'm a junior C# developer, I learned at home and now I got my first job :) I want to buy these books. But what is the correct order to read these books? Code Complete: A Practical Handbook of Software Construction Clean Code: A Handbook of Agile Software Craftsmanship Pragmatic Programmer
I've been having a discussion lately with some colleagues about the best way to approach a new project, and thought it'd be interesting to get some external thoughts thrown into the mix. Basically, we're redeveloping a fairly large site (written in PHP) and have differing opinions on how the platform should be setup. R...
In CSS, what is the difference between visibility:hidden and visibility:collapse They are given to be separate in W3Schools, but I see no difference in their output. I have tried it in Google Crome.
I have this idea for a database: it would hold everything I "need to remember", and allow future coding projects to access the information. These future projects include a day-planner and historical analysis of what I've been up to. The things I need to remember break down in to two main categories: Events and Tasks. ...
When I (re-)build large systems on a desktop/laptop computer, I tell make to use more than one thread to speed up the compilation speed, like this: $ make -j$[ $K * $C ] Where $C is supposed to indicate the number of cores (which we can assume to be a number with one digit) the machine has, while $K is something I var...
Given that mobile app analytics reporting can cost a customer data traffic that, unlike a web app, use of the mobile app may otherwise not require, should a mobile app provide a user accessible setting to allow customers to opt out of app analytics collection or reporting? If and where should a customer be notified tha...
Persistence Ignorance is an application of single responsibility principle, which in practice means that Domain Objects (DO) shouldn't contain code related to persistence, instead they should only contain domain logic. a) I assume this means that the code which contacts lower layers ( ie persistence layers ) lives out...
Here's what is given: public interface Request {} // there are 20 subclasses of Request public class CreateUserRequest implements Request { @NotEmpty public String userName; } // request processor is a thing that aimed to process requests public interface RequestProcessor<TRequest extends Request> { boolean pro...
I'm building some software for OS X that isn't distributed through the Mac App Store. My software allows users to download different modules uploaded by various people too. How can I create a software patcher to patch my software, as well as update modules that users might be uploading when necessary? I've looked a bit...
I'm developing a simple website for a client. I have read about phpDocumentor and DocBlocks, and I thought that documenting my classes and functions will be very useful. I'm almost sure I will not generate any documentation for the site, since it's a pretty simple website, and guess what? It doesn't have an API... But ...
The scenario: A system needs to produce a variety of artifacts to present to end-users during the normal course of business. Examples of these artifacts would be permits, invoices, or receipts -- imagine any online app that gives you one of those "print this page for your records" pages. I'm working on a system that ...
In my childhood I used to program on an MK-61 Soviet calculator. It had four operating registers (X, Y, Z, T) and 15 storage registers. A program could have 105 steps. As I recall it, it had commands like: Swap X and Y registers Shift registers (Z to T, Y to Z, X to Y) Copy from storage register (1..15) to X Copy from...
My goal is to check commit data that don't meet certain requirements and then reject either the commit being created or pushed to the remote repository. The problem of doing a pre-commit hook is that it's hard to deploy to many people who have to manually update their pre-commit hook file. As well, Git does not allow y...
So I found this very interesting library in Google Code site. It turns out it is advertised as "LGPL", which is good enough for me. However, in the README file of the library the author contradicts himself saying it is not available for commercial purposes. I'm guessing that when you sign up to create your project in G...
When drawing up a backlog, I have several requirements that apply to a great many user stories, i.e. aspects of the application like error handling and feedback. How do I include these (without using an #include directive in each user story )? Should I treat error presentation as a feature, then have user stories for t...
I am building an API platform. I have already ensured that the platform always returns JSON responses. My question is Should my API platform enforce the rule that all requests must be JSON? What are the benefits of making all requests to be JSON? I understand the benefits of making all responses to be JSON as this me...
I am a C++ coder by tradition. Over the last 12 months or so I have been doing a lot of C# coding, and have been pleasantly surprised by C#'s pragmatic approach (once I stopped trying to code it as if it was "C++ with garbage collection"). We have recently had some graduates in and when helping one of them I realised ...
I'm developing a Roleplaying character viewer/manager programme for a locap LARP system. The Characters have access to skills that are layed out in a tree-like structure. There are a lot of skills, and potentially a lot per character. I know I can just import the Java swing library to get access to a tree, but I feel l...
I know that Senior Developer doesn't use only one language and only one platform or IDE. Can you advise how to mix different styles of programming to make efficient code? For example, best mixing is Perl + Objective-C. $ObjectiveCLongNameOfVariablesAndMethods are worst for Perl-style, but good for iOS-team. [self meth...
When the company I work in hired new managers, they offered us to overview someone's code on every meeting. We have meetings every two weeks, so each time one of developers was to show his/her code on the projector, and others were going to discuss it. I thought this would be great: each developer would be more careful...
I am learning LINQ to SQL (and planning to learn Entity Framework). Initially I used a abstraction layer to convert LINQ to SQL entities into a domain objects. Later I discovered the “Inheritance Mapping” option and removed the abstraction layer and started to use ORM entities directly as domain objects. After some t...
I have been working with Silverlight 5 application for a while. I liked this technology and I was captivated to the point to get certified in Silverligt development. However, Html5 gained momentum this point, a new wave of thinking about new applications. Now, i am considering whether to develop in Sl or html5. I have...
Is it better to check for allowed domain values on the frond end or let the database engine handle the domain integrity. For example If you have a data entry form for employee, is it better to check for allowed values on the data entry form before submitting the data to the database assuming network IO is not a big iss...
Part of one of my applications has contracts and contract_types tables, wherein a type may have many contracts but a contract may only be of one type. Now a new wrinkle has been introduced: a contract may change type over time (although it can, thankfully, still only be of one type at any one time). The simplest soluti...
I wonder is it possible or is there a tool to generate annotated POJOs from a table.To make it clear,for example,Person table has fields like ,id,name,surname etc and i wanna to generate a POJO named Person with mappings made with annotations.
I knew double or float value can be not only normal value(-1.3, 0, 1.0, 2.3) but also NAN and INFINITY in Objective-C. Is there other special values except for NAN and INFINITY for double/float value in Objective-C?
I have been programming in higher level languages (Python, C#, VBA, VB.NET) for around 10 years and I have completely zero understanding on what's going on, "under the hood." I am wondering what are the benefits of learning assembly, and how will it aid me as a programmer? Can you please provide me with a resource that...
Background: Currently an intern at a company and working on repurposing older programs (still in use, but for different departments) for use in testing new hardware. The new hardware is different in terms of register layout and firmware interface from the older iterations of hardware. I have been given free reign on ho...
Is there anything that can be done for a single general purpose application to affect the power consumption of the device it is running on? I am not familiar with how optimizations to individual applications may affect power consumption in a general way, can someone explain if different approaches to writing applicatio...
I have an embedded database (SQLite), it stores information about events and page views, its purpose is to track the user journey inside my application. I need to provide support for optional custom properties on my events and page views. In code this is not a problem, however I am torn between two solutions for stori...
I have been using an agile methodology (SCRUM) for about three years now and I see certain advantages to it, especially in the short-term feedback at many levels (from customers having early access to implemented features, from testers that can test features as soon as they are implemented, from other developers that c...
I'm facing problem in gsoap , if two user go to register at a same time then database is locked, i think its threading problem , how to handle it, please insist me. I am running multiple threads in background. every 5 seconds sending data to server.
I was reading Agile Manifesto Principles. Everything seems clear and reasonable except for one point: Simplicity--the art of maximizing the amount of work not done--is essential. I dont understand this. Does this mean that the work that wasn't done should be somehow exaggerated? If so, it doesn't really make sence...
I've been working on software to modify a game's resource files, and I'm planning on releasing it in open source. I'm perfectly fine with releasing my code under gpl v3. However, I'm afraid that that would deter others from writing extensions for my software, as I have had others offer to do so - the community which ...
Ok, I understand the normal conventions of using verbs with functions and nouns with classes. What about interfaces? Is there any methodology when coming up with interface names that may not be that obvious? Just to make it clear, I'm not talking about whether to put an "I" in front of the name or if to use camelCase o...
Hi and thanks for looking! Background I have a project wherein I need to abstract meaning from a passage of text to determine what the text is seeking and then match that text to a list of search results. Now, I have some context with this and the following scenario is very close, but doesn't violate my NDA with the cl...
We recently experienced a deployment issue where it turned out that the version objects were not in sync in one of the environments. We have a large database group and different teams have different responsibilities and ownerships - I might code on schema X, Y, Z but I also will have dependancies on objects owned by o...
I have to learn OpenGL and get a basic OpenGL app built, and I have a few questions: What are specific things programmers need to know to program in these frameworks? How does the shader language in 2.0 affect using these libraries? Are there any compelling reasons to start with 1.x before 2.0?
Been building a WP7 app and now I need it to communicate to a WCF service I made to make changes to an SQL database. I am a little concerned about security as the user name and password for accessing the SQL database is in the App.Config. I have read in places that you can encrypt the user name and password in the conf...
I have designed a small library for work that consists of a few exposed classes. These can basically be thought of as a server class and client class. But now that I am writing all the test cases and examples, I am questioning myself on whether the classes should be used in a class or inherited. I know about the compos...
I was wondering if this license is: self defeating just a clone of an existing, better established license practical any more "corporate-friendly" than the GPL too vague/open ended and finally, if there is a better license that achieves a similar effect? I wanted a license that would (in simple terms) be as flexible...
Smalltalk supports a syntax feature called "message cascades". Cascades are being adopted by the Dart Programming language. As far as I know, C# doesn't support this. Were they ever considered during the design of the language? Is it conceivable that they could appear in a future version of the language?
I am using cppcms to create a blog like application and I'm trying to write a permission system, although I'm confused as to what would be the most efficient and manageable method. At the moment, I have a table with permission id, user id, permission type (int) and permission value (an optional parameter, of sorts). Fo...
I started learning PHP and I was able to get myself familiar with it. Now, I want to explore other programming languages like PERL so that I can compare it myself to PHP. Will I be confused to learn two language? Or are there any disadvantages?
I am using following function to autoload classes, it works fine if i am using only one directory called 'classes' however when i try to use Smarty lib also it fails and give me the error Fatal error: Class 'Database' not found in /home/... for ex: require_once(DOC_ROOT."/libs/Smarty.class.php"); function __autoload($...
I'm working on a website for a photographer, the whole code is just a few files, and whole repository is a few MBs without the actual photographs. But, when I add the actual photographs to git and commit, then the repository jumps to 75 MBs. Considering the photos will be updated, the size of the repository is going to...
Edit: I admit to being unclear when I first wrote the question. I suppose I wasn't sure of the issue myself, the comments and answers provided up to now helped me focus on the issue, thank you to all involved. This edit is a total rewrite of the question. End editorial comment On a dynamic website we have two systems -...
I'm pretty new to TDD approach and my first experiments say that writing 1 line of functional code means writing about 2-3 lines of testing code. So, in case I'm going to write 1000 LOC, the whole codebase including tests is going to be something like ~3500 LOC. Is this considered normal? What is the ratio in code you ...
I'm using Foursquare to get a List of Restaurants nearby inside an iOS app. The Result is stored in an Array which consists of Dictionaries and regarding how deep the Data is, each Dictionary contains also an Array with Dictionaries and so on. The Result should be shown inside a UITableView. Should I create a Class tha...
Trying to be a better programmer I have an application that keeps track of Roles and Permissions, I had classes for Role and Permission which were just value objects. class Role { int RoleID string RoleName } class Permission { int PermissionID string PermissionName } If I wanted to get the permissions for a ...
I'm currently planning a Windows service. It will be a multi-threaded application which will continuously check for database records and process them. My first thoughts were to set a number of max available threads and create new thread for each process. This works OK but since I'm creating a new thread for every new p...
What are the various ways of acheiving this ? Can someone please guide me? I have to code a website for a friend (designer). The friend wants me to use core php and not any framework like codeigniter (something I really like and am comfortable with !) . I had a look at a couple of roll your own MVC frameworks guides, b...
When using an event based component I often feel some pain at maintenance phase. Since the executed code is all split around it can be quite hard to figure what will be all the code part that will be involved at runtime. This can lead to subtle and hard to debug problems when someone adds some new event handlers. Edi...
I'm developing a program to generate LARP characters in java and I've hit a snag. Initially I had planned to use a decorator to iterate through the potential 'roles' (effectively classes), and then from that work out the costs for each skill depending on the combination of roles and store that in the character. I.e you...
I need to work with 4-5 programmers on a fairly average PHP application using codeigniter. We're in 5 different locations in one city, and all of the programmers are all not too well educated and I'm assuming that most of them have never used any version control system. Can you recommend some very very easy-to-get-into...
What is preventing hardware manufacturers from creating a device that will allow the user to select their OS? A phone similar to a PC or a mac that can have linux, windows or mac OS installed. Are there any regulations preventing this?
It is common to use idioms such as: x/60.0 to force a floating-point division when x is an integer in languages which do not have distinct operators for integer and decimal division. Is this an accepted idiom or is it preferrable to cast x to a floating-point type? I believe it is a concise and clear idiom- it might b...
I am writing a system where both the system owner and myself are developers, and we are currently the only source of 'requests' or requirements for the system, which I would like to capture in user stories tied to features{1}. My urgent priority now is to get a managaeble backlog captured. How should I go about capturi...
I'm about to start the process of migrating a program from one component to another. Most of the core functionality will be the same but I'll need to change database calls, etc. I'm sure there will be a few quirks somewhere. Naturally, there will be many errrrrrors, some of which Ill miss completely. Would it be bet...
I'm going to be teaching a class that covers a broad brush of estimation techniques. I intend to cover absolute estimation techniques based on SLOC (e.g. Function Points, COCOMO II etc.) and relativistic ones like T-shirt sizing, story-point estimation etc. I was wondering what would be some good exercises to conduct i...
My background is as follows. I've been programming since I was young, worked in BASIC, then Asm for M68K, then C, C++, and now I've spent the past 5 years in .NET becoming a rather good .NET developer. Somewhere along the line, I realized I have no clue how the internet works, I don't know how TCP/IP works, I have no...
Recently I asked a question about whether or not I should refactor my code. the responses I received were most definitely in the camp of going through with the refactoring due to the presence of a God File. However, now I'm pushing towards what I fear is Ravioli code. I will have around 6-7 ".c" modules (which I find p...
I am using Entity Framework at my work and faced some problems. Usually I hear about creating tiny Edmx´s files containing tables related to some Domain ie.: Help Desk Edmx, HR Edmx, etc. Instead of load all tables in one big Edmx, what would be much simpler, but for performance considerations(at design and build time ...
After a system has gone through many migrations, and evolved enough for a second version, does it make sense to keep the old migrations around? I mean, old versions will use them to upgrade to the new one, sure, but should a fresh install have its database go through all the "historical" changes before arriving at the ...
I have a personal project that doesn't have robust testing. I had a bit of TDD going on at the beginning, but it quickly became counterproductive as the project details changed dramatically over time. So a lot of previously written tests have become useless. Now that the project solidified a bit, I dont' think big chan...
I was wondering whether using (almost) empty derived classes to give additional semantics to a class hierarchy was a good idea (or practice) ? Because a (not so short) example is always better than a long speech, let's assume we're writing a class hierarchy for SQL generation. You want to represent a data manipulation ...
Simply spoken, one of my c# classes got too big and I'm currently splitting this class in several subclasses by clustering semantically related methods (actually actions, which do side effects). So, to give you an example: class ViewModel { // a lot of properties bound to view (MVVM pattern) public Property 1 //bou...
I am currently getting involved in a startup, I am the only developer involved at the moment, and the other guys are leaving all the tech decisions up to me at the moment. For my day job I work at a software house that uses Microsoft tech on a day to day basis, we utilise .NET, SqlServer, Windows Server etc. However, I...
I need to rebuild an old huge website and probably to port everyting to ASP.NET and jQuery and I would like to ask for some suggestion and tips. Actually the website uses: Ajax (client site with prototype.js) ASP (vb script server side) SQL Server 2005 IIS 7 as web server This website uses hundred of stored procedure...
I'm not sure how the locks will work with multi processors/cores, I'm going to use shared memory in my application or FIFO, what worries me is the locks, I have a server with 2-CPU, how the lock will be able to lock a variable on one CPU while the another operation went to the 2nd CPU for the same variable? I'm in Linu...
Many web sites ask users to enter their email address twice, sometimes taking the trouble to disable copy-pasting. What is the logic behind this? Is this e.g. a security measure?
The system I am developing is designed to have multiple organizations, with users and roles for each organization. Some organizations can interact, some can not, and generally organizations are not allowed to see or modify each others data with some exceptions. I have a model class A that manipulates the data storag...
I work with a team of programmers as the business analyst. We just released version 2.0 of our product and are working on the next version to be released in 3 months (it's an internal software product). Unfortunately version 2.0 has some issues that they have had to fix and we're going to deploy those fixes in a coup...
I'm having performance issues on a Rails 3.1.0 application, now I've done dome changes on my queries with AR and so but views still takes too many time to render, I've divided the views, loops and so, on many partials that are rendered dynamically inside views and inside other partials. So it's a bad practice to have a...
I'm developing a piece of software (a WordPress plugin) in PHP and Javascript and CSS. The PHP code must be licensed under GPL, but CSS and Javascript can be under another license (as far as I've understood). I'm thinking about writing a more permissive version of the AGPL license, and use it, for Javascript and CSS. ...
For my next project, I'm looking to document my Object Oriented design in simple text before jumping the gun to code it up. I want to do this for two reasons. I want to give proper thought to my design and possibly revise it several times. I haven't exactly decided which language I want to implement my project in. I'...
I am designing a COBOL program that does 2 things. 1 reads specific rows from a table, and inserts a new row based on the original. 2 reads different rows from the same table, and updates those rows. Is it bad standards to have 2 initialization procedures? I need to declare 2 SQL cursors, one for each task. So I was th...
If you are building a web application, and you have a user management component, is it recommended to do: class UserAdminView extends View { } or class UserAdminUpdateView extends View { } What about controllers? Thoughts?
How do you name your iterators when you return a begin and an end iterator from a class? Without it sounding clunky, that is. Example: typedef std::vector<Idea> Ideas_Type; Ideas_Type::const_iterator GetIdeasBegin() const; Ideas_Type::const_iterator GetIdeasEnd() const; Should it be GetIdeasBeginIter? IdeasBegin?
Early in my programming career I was in love with pointer twiddling, lean code, doing everything with as little layers of abstraction as possible and so on. The code was very C like I would say, close to metal and clever. Time has passed, I have a lot more experience, and I'm noticing my attitude towards the code has c...
I'm very familiar with xUnit frameworks and I try to implement unit tests on every project I start. Somewhere along the way, I realize that I'm writing the same tests over and over again, and then I run into a really difficult to test method or a test involving remote resources, and then I give up for a while. I end up...
The other day I reviewed code someone on my team wrote. The solution wasn't fully functional and the design was way over complicated-- meaning stored unnecessary information, built unnecessary features, and basically the code had lots of unnecessary complexity like gold plating and it tried to solve problems that do no...
I have a very big file delimited by some sequence of characters '*L*I*N*E'. The file will be of the order of 250G. And each line comes around 600bytes to 1000 bytes. I will be performing the following operations on the file, Read the file line by line and for each line, I will be giving it to a parser which will do som...
I'm bootstrapping my own project, it has a registration/login area (via devise with RoR, properly hashed and salted of course). As I'm using subdomains and I need to access them with iframes (it's justified, really!) I'd need one of those expensive certificates that cover subdomains. As I'm doing this out of my own tim...
I created a sessionful web service using WCF, and in particular I used the NetTcpBinding binding. In addition to methods to initiate and terminate a session, other methods allow the client to send to one or more tasks to be performed (the results are returned via callback, so the service is duplex), but they also allow...
Recently I was talking with a colleague who mentioned that his company was working on adding the MVC design pattern as a PHP extension. He explained that they wrote C code for adding Controllers, Models and Views to the language constructs to increase performance. Now I know that MVC is an architectural design pattern ...
I have a class created in some namespace, like SomeNameSpace.SubNameSpace.StaticClassName Here is a code snippet from other code file where I want to use this class many more times, so I created a property in the code file like this //Just to provide an Alias for long name "SomeNameSpace.SubNameSpace.StaticClassName.Pr...
For definitions and examples of "state", see: http://en.wikipedia.org/wiki/Program_state , http://en.wikipedia.org/wiki/Finite_state_machine , http://en.wikipedia.org/wiki/State_diagram A diagram showing a very easy example, notice how the current state changes how the turnstile operates when the same input (inserting ...
This morning I found a note on my desk with some tips from a higher up developer who had been looking over some HTML/CSS I had put together. One of his suggestions was for me to "stay away from context-based class and ID names like 'left' or 'right.' Never use colors as names. Stick to semantic names based on the conte...
I'm a Rails developer and I prefer Mercurial over Git. However, I know that the Rails community is very pro-Git. So my question is it possible that my choice of version control system would turn back some developers?
I'm writing a Genetic Program that I need some advice on for crossover operations. The GP is attempting to find the best solution for a matrix that has hard row constraints and softer column constraints. For a given solution in the population, the rows contain a random combination of object type ids from a fixed set. T...
I have many classes in my application responsible for behaviour- views, controllers, models, network- often the state of one class or system depends on another and I'm finding that classes that are primarily responsible for the behaviour for one system inevitably become dependees or dependers of other systems or classe...
It occurs to me that there's not a heck of a lot of difference between $>python module.py And: $>javac module.java $>java module.class The former compiles to an intermediate language (python bytecode) and executes the program. The latter breaks the steps up, first compiling to the intermediate language (jvm bytecode) ...
From Less is Exponentially More If C++ and Java are about type hierarchies and the taxonomy of types, Go is about composition.
I found a question (code cowboy on the team), but it was more related to "Ninja Coder" then the problem that I have. I have a team member who is a pure living example of "Cowboy Coder". I do understand that one can't change people, but is a way to make him stop behaving like a "Cowboy Coder"? He refuses to listen to ...
I have always found it more logic to validate input instead of filtering it. How to appropriately filter data depends on the situation, so IMO it should be done in output or when saving to a database. But I see that some frameworks provide automatic XSS filters for incoming POST and GET data. What is the logic behind t...
Is it possible to write an open source project that uses generated code from CodeSynthesis XSD (C++/Tree) and then link it to a third-party library that is licensed under the GPL version 3? Some background information: CodeSynthesis XSD is licensed under the GPL version 2 but with an extra FLOSS exception (http://www.c...
So I read up on the ordering of your includes, and this guy suggested you include your local header first so as to make sure it doesn't have prerequisites. Ok, I get that. I'm on board. The whole compartmentalization thing is good. But I've got this file, file.c which includes it's file.h, which declares functions to ...
In the PEAR standards there is no reference to HTML, if its allowed or not. http://pear.php.net/manual/en/standards.sample.php But I see some people use HTML tags like <kbd> and stuff.. So is HTML allowed? Will it break some doc parsers?
We're working on a large product which has been in production for about 5 years. The codebase is.. erm.. working. Not really well but it is working. New features are thrown into production and tested with a small QA. Bugs are fixed, etc. But no one, except me, is writing unit-tests. No one uses the power of "tracking" ...