instruction
stringlengths
34
19.9k
Is this good or bad design to add, by default, ID field in every table in a database, even when you don't see currently to usage of this ID (For instance in a MxN table) ?
Consider an USB device that is receiving data over a wireless network and an application running on the PC is reading this data. Now, on many languages (consider C# DataReceived), we have event handling mechanisms to detect if Data has arrived or not. My question is, how is this event detecting mechanism implemented? I...
I would like to put a program together to calculate the number of 60' pieces would be needed from a list of shorter pieces. For example, I sell rebar cut to length from our standard length of 60'-0". Now the length the customer requires are as follows: 343 pc @ 12.5' 35 pc @ 13' 10 pc @ 15' 63 pc @ 15.5'....... Ther...
Update: We are a very small team (3 people) and thus I (Scrum Master) and the Product Owner are also developers doing some coding. We are aware of this situation and we are actively trying to recruit some new talents. But it's hard! Meanwhile... we need to adapt... so my question: The Product Owner complains about ha...
I started a programming blog earlier this year, and since I started it some things have changed. Some changes are due to technology changing, some changes are due to my code libraries improving, and some (ok, probably most) are due to me changing as I learn more. I want to go back and completely re-write certain blog p...
I'm interested in adopting a tool/scripting language to automate some daily tasks connected with fighting forum spammers. A brief overview of these tasks: analyze new registrations and posts on a phpBB forum, and delete or deactivate spammers using a website/community that collects such spam reports. Typically such au...
I'm looking for the most efficient / standard way of passing data between client-side JavaScript code and C# code behind an ASP.NET application. I've been using the following methods to achieve this but they all feel a bit of a fudge. To pass data from JavaScript to the C# code is by setting hidden ASP variables and tr...
After coding for many years as a solo programmer, I have come to feel that most of the time there are many benefits to write private member functions with all of the used member variables included in the parameter list, especially development stage. This allow me to check at one look what member variables are used and ...
Is browser fingerprinting a sufficient method for uniquely identifying anonymous users? What if you incorporate biometric data like mouse gestures or typing patterns? The other day I ran into the Panopticlick experiment EFF is running on browser fingerprints. Of course I immediately thought of the privacy repercussion...
I was reading Ben Cherry's "JavaScript Module Pattern: In-Depth", and he had some example code that I didn't quite understand. Under the Cross-File Private State heading, there is some example code that has the following: var _private = my._private = my._private || {} This doesn't seem to be different from writing som...
I don't know whether this question is reasonably answerable (and therefore will be closed), but I will take my chances: What are the possible problems (and solutions), one might encounter, when developing query mechanism for key/value store/database (like redis for example)? All the values will consist only of JSON doc...
I'm working on a thick client graph displaying and manipulation application. I'm trying to apply the MVC pattern to our 3D visualization component. Here is what I have for the Model, View, and Controller: Model - The graph and it's metadata. This includes vertices, edges, and the attributes of each. It does not cont...
Consider this example: I have a website. It allows users to make posts (can be anything) and add tags that describe the post. In the code, I have two classes that represent the post and tags. Lets call these classes Post and Tag. Post takes care of creating posts, deleting posts, updating posts, etc. Tag takes care of...
I wrote a fair amount of code for a startup, but I haven't signed a contract before doing so. The only document that I signed with them does not mention the fact that I have to pass the rights on the code to them, and after a consulting with a lawyer it seems that I own the full rights. Now I want to preemptively corre...
I am using Entity Framework as my ORM in an ASP.Net application. I have my database already created so ended up generating the entity model from it. What is a good way to organize files/classes in the data access layer. My entity framework model is in a class library and I was planning on adding additional classes per ...
Some open source licenses don't allow its usage in commercial products, but I bet some people/companies use it anyways. Is it possible to prove that a closed source, commercial product illegally incorporates open source code? If so, how? Example: Say Microsoft just gets the Linux kernel, slaps a new GUI on top of it an...
We're writing a requirements document for our client and need to include the use cases of the system. We're following this template: ID Description Actors Precondition Basic Steps Alternate Steps Exceptions Business validations/Rules Postconditions In the Basic Steps section, should we include steps that the system p...
Possible Duplicate: Functional Programming vs. OOP How to write manageable code with functional programming? In OOP, your basic unit of organization for code is the class. A frequently used methodology in Java, C# and similar languages is to organize your code around having one file for each class with the file name...
Say you have a document with an essay written. You want to parse this essay to only select certain words. Cool. Is using a regular expression faster than parsing the file line by line and word by word looking for a match? If so, how does it work? How can you go faster than looking at each word?
I little bit new to the CodeIgniter framework and this is my first project with this framework. During a chat on StackOverflow somebody said that we need to make controllers tiny as possible. Currently I have a default controller named home with 1332 lines of codes (and increasing) and a model named Profunction with 13...
For reference - http://en.wikipedia.org/wiki/Single_responsibility_principle I have a test scenario where in one module of application is responsible for creating ledger entries. There are three basic tasks which could be carried out - View existing ledger entries in table format. Create new ledger entry using create...
I'm trying to convert a Fortan77 program to C#. I have a subroutine with about 650 lines of code and horrific GOTO statements all over the place. I'm having a lot of trouble even starting to visualise the flow of the subroutine to figure out what it does. Is there anybody with experience in this sort of thing who could...
I have some computer science students in a compulsory introductory programming course who see a programming language as a set of magic spells, which must be cast in order to achieve some effect (instead of seeing it as a flexible medium for expressing their idea of solution). They tend to copy-paste code from previous,...
What are the consequences of allowing multiple inheritance in a programming language? What characteristics of multiple inheritance create an environment such that the use of multiple inheritance tends to result in source code that violates one or more principles of Object Oriented Programming and quality software engin...
Recently I've been working on refactoring parts of the code base I'm currently dealing with - not only to understand it better myself, but also to make it easier for others who are working on the code. I tend to lean on the side of thinking that self-documenting code is nice. I just think it's cleaner and if the code s...
This is a minor niggle, but every time I have to code something like this, the repetition bothers me, but I'm not sure that any of the solutions aren't worse. if(FileExists(file)) { contents = OpenFile(file); // <-- prevents inclusion in if if(SomeTest(contents)) { DoSomething(contents); } e...
I have been happily using JQuery for the last 2 years and have been quite sucessful creating some really cool functionality with it...so I am very comfortable with it. I also beleive the future of the web will continue on the current client-side path. However... The next challenge seems to be coming in the form of var...
I think we've all been there: You hear of someone say "hey, wouldn't it be nice if platform X had feature Y?" You look around (on SO!), the feature really doesn't exist, even though it probably would be useful in many contexts. So it's pretty generic. Your mind wanders for a bit. "How tough would it be? Well, it'd prob...
If asked a series of technical questions in a programming interview, does it look bad to admit when you don't know the answer to a question? In other words, does admission make you look incompetent or ill prepared? Or, is it assumed that no one will know the answer to every question? Does admitting it instead of tak...
I'm working on a small educational project on MVC 3, and I'm facing a small problem, when attempting to handle validation in my application through a wizard. I tried to get benefit from the ability of MVC3 to deliver content of a different view using the same URL, when handling an [HttpPost] method on a page. I my case...
I have just completed my Master's degree in Computer Science and have gotten my first job interview as a developer. I do not have much experience in large scale development projects, but I am hoping my university education counts for something. I am wondering, what materials should I bring that would impress my interv...
What are the relative merits (or demerits) for implementing an Erlang-style "Continuation" pattern in C#. I'm working on a project that has a large number of Lowest priority threads and I'm wondering if my approach may be all wrong. It would seem there is a reasonable upper limit to the number of long-running threads ...
As a C & Objective-C programmer, I'm a bit paranoid with the compiler warning flags. I usually try to find a complete list of warning flags for the compiler I use, and turn most of them on, unless I have a really good reason not to turn it on. I personally think this may actually improve coding skills, as well as poten...
I keep hearing about the desperate recruiting efforts of companies in tech hubs such as SF and NYC. However, every time I'm contacted by a startup I'm told the position is on-site and working remotely isn't possible. Let me clarify that these are tech startups. They should be very comfortable with the idea of using tec...
I'm currently new to freelancing as a programmer and need to work out what some of the "norms" are without making myself look like an amateur. I've already won some work from a local company doing C# development and quoting an hourly rate for work that i am doing from my office. However on one upcoming project I've bee...
I am new to jQuery and mobile apps development. I know the features of jQuery Mobile. I want to know where and why to use it. Can I use jQuery Mobile if I am developing a native app?
I come from php community and just started learning Python. I have to create server-side scripts that manipulate databases, files, and send emails. Some of it I found hard to do in python, comparing to php, like sending emails and querying databases. Where in php you have functions like mysql_query(), or email(), in p...
I am a lone developer and maintain a SVN server for source control. So far, I haven't followed anything specific while committing my changes. I was just reviewing my previous commits, and couldn't make any sense of my comments. What do you put in comments while committing your checkins?
The best thing I like about ASP.NET MVC, is that you can directly call a server method (called action), from the client. This is so convenient, and so straightforward, that I really like to implement such a model in ASP.NET WebForms too. However, in ASP.NET WebForms, to call a server method from the client, you should ...
I currently work with Zend Framework, but I also know about CodeIgniter and Kohana. I've just wonder that should I stick to a framework or depend on my purposes? Because I think I cannot master everything.
Possible Duplicate: How important is studying algorithms and theory is to becoming a great programmer? Today I learned the fast sort Algorithm. I doubt I will ever implement my own version though as C# has its own built in Sort method for lists and arrays. How important is learning Algorithms for high level language...
I'm learning CSS "seriously" for the first time, but I've found that the way you deal with multiple CSS classes in CSS and HTML quite inconsistent. For example, I learned that if I want to declare multiple CSS classes with a common style applied to them, I write: .style1, .style2, .style3 { color: red; } Then, if ...
I am a C# software developer. I was recently approached by a client to develop a multiplayer board game (max 4 players). I fiddled around with WCF, WPF and EF 4.1 to get something going but I keep running into small stumbling blocks. It certainly does appear that integrating all these technologies into one solution ...
I'm trying to refactor my application into MVC, but I'm stuck on the M part. In a database-backed app, the model is implemented in the app code, right? But then, what is in the database -- is that not also the model? (I'm not using the database as a simple object store -- the data in the DB is an enterprise asset).
When documenting software I traditionally write a plain text file (like a README.txt) which works well, but unfortunately cannot contain images like HTML can. Unfortunately images must be stored as separate files with a normal HTML document (using <a href=".../foo.png">) which give unnecessary clutter. The "Save a sin...
there are a couple of discussion on SO about setter methods returning "this" type. And looks like java 7 had the proposal of void methods returning this. But this proposal could not make it to java 7 features. I could not find if this proposal is moved on to java 8 or future or have been completely discarded. Is it? R...
Velocity Template Language's set directive requires a variable on the left hand side. This doesn't work. #set ( $entries.add("d") ) Even though I have no use for the return value of add("d"), I have to assign it to a variable. #set ( $x = $entries.add("d") ) I want to communicate that the variable is necessary, but...
All. I am creating some libraries for other teams in my company. They all have different logging mechanisms. I want to provide trace information of what my libraries are doing. What should I to achieve this? Thanks
I'm probably over-thinking this and it might not matter in the scope of things, but I'm wondering how people build up initial versions of their projects in source control? I'm talking about when you start with nothing but an idea, so no forking an existing project or anything. When do you do your commits before having...
I have an interface called Cell. In the start of the code, I read input data from which I can come to know the implementing class (not as a class object but I can know for example the string). And after that I need to call the constructor for the implementing class to initialize an object. What would be the best way to...
So my professor was giving back some feedback on a project I've been working on. He docked a few marks for this code: if (comboVendor.SelectedIndex == 0) { createVendor cv = new createVendor(); cv.ShowDialog(); loadVendors(); } This is in a combobox "index changed" handler. It's used when the user wants to creat...
I am part of a software deveopment team. Originally there were just 2 of us, and two applications. To ease our job we create a set of libraries, handling stuff like GUI, database access, calculation, business rules etc, so that we can reuse them in our applications without implementing them twice. Now the team grew, 6...
I have an ASP.NET C# application that needs to go off and iterate through a directory of .xml files and do some processing on the data inside them. This is easy enough, but i need to display the result after each .xml is processed, how can this be done? What im really asking here is how do you process a lot of data in...
I have a set of steps that need to run sequentially over a list of data. However each step only operates on a single piece of data at a time. Because of this, I can run the steps asynchronously. For example I have two pieces of data, and two steps. When step one is done processing the first piece of data, it passes it...
TL;DR: I need to develop an app which should look kind of the same on desktop and as a website incarnation. Since I am a web dev and have never developed for desktop, I want to use a language that can embed a webkit view so I can use the same HTML/JS front-end for both usages, and minimize the learning curve for GUI at...
Please feel free to suggest a better name or way of explaining this question - I wasn't quite sure what to call it. The situation is one that may just come under the heading of "be organized" but I often find myself passing around either big blobs of data or many smaller sub-blobs (blob in the non-technical meaning of ...
I want to know the rules of naming (AlwaysCapitalize, _underscore, firstSmallLetter, etc...) for each of Namespaces, Classes, Interfaces, Exceptions, Data Members, Methods, Variables, etc.... also I would like to know: Are they standards? Do they differ According to the access modifiers? (public, private.....) What ab...
To the best of my understanding the schedule for the project is derived using the effort estimates for the individual tasks (in person hours), and the number of relevant resources used for the particular task. As discussed in this question, we are starting a project using a new platform, featuring a brand new API and...
I have been working at the same software company for more than ten years. As a result, I have implemented a large code base using various object-oriented programming languages. I was a beginner programmer when I first started my career and I didn't know much about good interface and class design principles. I would li...
I've seen many companies using certification services such as Brainbench when evaluating candidates. Most times they use it as a secondary screen prior to interview or as a validation to choose between candidates. What is your experience with Brainbench scores? Did you try the tests yourself, and if so do you feel the ...
Microsoft technologies keep getting better but they do so on the expense of adding one more abstraction layer every time. In the early stages we used to play with C# code and SQL procedures to perform CRUD operations. Then generics came along with ADO.NET, DataSets, Entities. Next, LINQ came offering LINQ to SQL, to XM...
I have a number of large text files that I need to manipulate in a highly performant manner. I've decided to look into using Memory Mapped files in C# (.NET 4). However, I can't find any examples of or guidance on how to read/write to a memory mapped file that, underneath, is bound to a text file. Can anyone shed some ...
I'm frustrated by the lack of concrete explanations on how to go from being able to script (bash, awk) and write simple applications (c, php, python) to designing and developing larger, more complicated software. It seems that on one side there are programming language books and on the other side there are the software...
I want to learn multiple technologies. Currently I have knowledge of core Java, C, and PHP. I want to know the approach which should be followed to learn multiple things. I know if you know the core concepts of the behavior of programming language, any programming language can be learned. I want to make command on such...
It's not a secret to anyone that managers can and often will impose the programming language that will be used for a project. Being a programmer myself, I have never been able to understand this. But now I think I do: I've just had a revelation when Joel Spolsky said on the podcast that they should use QuickBooks becau...
recently I hired a freelancer to develop an iPhone application for my website, this application will get information from the DB of the website, normally I should give to him the access to the DB to take the information needed. The question is, how to let him take the information needed without safely, i.e preventing t...
We currently use Subversion and TeamCity, we're going to move to using Mercurial (specifically Kiln as we're FogBugz users). Obviously this will result in changes - hopefully improvements - in our development patterns (all two of us!) but the one issue I'm stuggling with is how to structure things so that we still enjo...
Among the reasons for a developer to publish a self-written library as open source library, there is definitely fame. Now when it comes to Boost Libraries, they are available and promoted in a very anonymous and impersonalized form. The name of the author will be readable in the documentation and source files, but be ...
Our library extends another (third-party) library. When we create a child class in our library, and want to throw exceptions, should those exceptions extend the exceptions from the parent class or from our own namespace? For example: class Their_Exception extends Exception {} class Their_Class {} class Their_Class_Exc...
Recently starting my first job as a software developer, I was a little thrown to be told that I did not have to follow any naming conventions in my code. Code written by groups working on other, larger projects followed naming conventions, but since I was brought in to write a new, stand-alone, application, the feeling...
I'm in the process of creating a grammar for a scripting language but as I'm working on it I started to wonder what makes a language good in the first place. I know the goals for my script but there are always 1000 different ways to go about doing things. Goals: Easy to use and understand (not my grandma could do it e...
As I've written about in other questions here, the project that I'm working on now has no software process. That means no documentation (including hard copy requirements or specification), no source control, no bug database, bugs are "fixed" (hopefully) and new code is added at the same time, and no formal testers - we...
Since this question seems to be pretty subjective, I'm posting it here. Let's say you're writing your own version of Stackoverflow using ASP.NET MVC, so there are classes like Question, Answer, User, etc. Since you're lazy, you decided to use entity framework. So, all the classes mentioned above have navigation propert...
I'm looking for an approach to the following problem: I have a reusable library. It contains a controller class, in the MVC sense. Let's say it's called UserAdministrationController, and it's for editing users. This class requires an object implementing IUserStorage, for storing its data. The library doesn't need to kn...
I heard about Domain Driven Development from a developer in the area. He talked it up like it was just about the silver bullet to changing requirements. I read the wiki. Still not too clear. What is "3D" in practical terms? Is it really that amazing that now UML class diagramming is just obsolete?
Nearly a year ago, I started writing a game. I was just messing around at the time, but now I'm pretty serious about it. As it's grown, it's taken on the responsibilities of a major game engine, as well as the game logic of an actual game. At some point, I decided I should break the two out, and designate a game and a ...
There is an utility we have which is used to upload files (and perform other operations on the file) to a network shared location. The file size tends to vary from a few mb to 500 mb. A suggestion has come up that we should maybe support multi-threading when uploading the files to the shared location - not required to ...
I am a beginner Java programmer, and have tried searching for a way to set up a login system with my Java application. The application is a game and I do not want people to just upload it to a website so others can down load and play. I want to use something like MySQL to make the user authenticate in order to use the...
See https://softwareengineering.stackexchange.com/questions/109817/superior-refusing-to-use-subversion My question is similar, but here are the main differences in my scenario: We are starting a new project from scratch, using PHP and web tech. There would be no down time in development as we would be adopting it from...
I have recently moved to a new company where I am tasked (in part) with evaluating the existing code base and coming up with patterns and best practices. Our development team consists of around 20 programmers and we have nearly as many projects. The bulk of the code is done in C# and SQL (Stored Procedures). Naturally,...
I was reading Code Complete and in the chapter on layout and style, he was predicting that code editors would use some sort of rich text formatting. That means, instead of code looking like this Procedure ResolveCollisions { Performs a posteriori collision resolution through spatial partitioning algoritm } ( CurrentM...
When I was originally learning about SQL I was always told, only use triggers if you really need to and opt to use stored procedures instead if possible. Now unfortunately at the time (a good few years ago) I wasn't as curious and caring about fundamentals as I am now so never did ask to the reason why. What's the co...
I have a personal project - a web application I wanted to develop - but I'm confused on which route to take. I know a little programming, and have dabbled in Pascal, C, HTML, CSS and Actionscript (for Flash). And I don't mind learning a new language (PHP, Python, mySQL, etc). I am not under any time constraint. About ...
I have been coding on and off on C and to a certain extent on C++ since my college days(2003), but I never had the opportunity to work with a hard core programming responsibility, which could have taught me "industrial grade coding" better and what is needed really for solving real life problems. To me it looks like I ...
I am a team lead dealing with a programmer with a Bachelors Degree in Computer Science. He has a couple of years of experience and is still a code monkey. Having observed him for quite a while, he is very slow in programming even fizzbuzz style questions. For other stuff, he tries to make do with just tinkering with co...
I read something on this site saying that Qt's GUI being a big problem that stop programmers from using Qt. They say the problem is that the GUI don't look native, and they are inconsistent. I personally use Windows, and from what I can see (some tree view and table view), they look pretty good and very native-looking ...
Imagine I've written a game and I want to make it free software. Am I also required to make the game server software free software because the game uses it to connect to other players to play against? Imagine I've written a stock ticker and I wish to make it free software. Can I charge for the subscription to the stock...
I recently learned of a program called Total Commander. It's a Windows Explorer replacement and has its own stuff to copy files. To check whether the files are identical, instead of calculation a CRC, it literally checks every single byte, one at a time, on both the original and the copy. My question is: Is this necess...
I have the following situation where I have a base class and multiple polymorphics derived classes: #include <iostream> class Base { public: virtual void foo() = 0; }; class Derived1 : public Base { public: virtual void foo() { std::cout << "Derived1::foo()\n"; }; }; class Derived2 : public B...
I have the following problem: Given n chips [note: these are VLSI chips] out of which majority of chips are good, we need to find one good chip. The only test that we can apply is on a pair of chips that answers if both chips are good or both are bad. The second part is to find a good chip if some tests might produ...
I'm developing a NES emulator as a hobby, in my free time. I use C++ because is the language I use mostly, know mostly and like mostly. But now that I made some advance into the project I realize I'm not using almost any specific features of C++, and could have done it in plain C and getting the same result. I don't...
I'm starting a hobby project and I'm in the middle of designing its architecture. I would like to make my program plugin-based (never done anything like that before), to make it extensible. Now I'm trying to grasp how such an architecture is created conceptually. Now, this wikipedia article about Plugins says that the ...
We have a small webdesign firm, and count with one designer. We can currently not afford too much expansion in the design area, so that means that the designer creates the main design of a website (which often means: the homepage), and the programmers then work with this to make it into a website. In general, this work...
I'm wondering what are the specific differences in the terminology we use for grouping related parts of code. I've sometimes seen the terms used interchangeably: many OO languages even use the keyword "function" to define a method. (Why?) If you wanted to be precise, what are the specific meanings of each? Or is it jus...
So, I'm a computer science major and I'm also a huge fan of the no-longer-on-TV show, Numb3rs. Now, whenever I talk with my friends they also ask me quite a few questions about programming and computers (and how they work). Now, on Numb3rs, they (Charlie, and occasionally Amita or Larry) often went on short, but well ...
Think JSFiddle. LINQPad is pretty sweet for fast C# with similar options. Is there anything like LINQPad that runs in a browser?
do you know of any algorithms which give an exact solution for the Traveling Purchaser Problem. I can only find heuristic and probabilistic approaches. I do have implemented a genetic algorithm so far, which by its nature does not terminate by itself an does not always yield the optimal result. Thus I'm looking for an ...
Today Javascript application of a relevant size become more and more common, and as the need arises, certain patterns are identified to manage the code complexity. I try to follow good advice, but I have some trouble in organizing the view layer of an application I am writing. While the other layers are nicely decouple...
I had a job process that was executing a lot of IO to read and write temporary files. Now I want to (need to) reduce the quantity of IO executions. So I want to create a sort of circular buffer that is going to be filled up with a data from a text file within first thread. The consumer (reading) thread will fetch d...
It's not uncommon to hear of decoupling the UI from program logic, or database design/access from program logic...or even program logic from itself. However, I've never heard of an approach to generalizing or abstracting away the details of threading tasks to the logic (aside from Tymeac, an Android-specific package). ...