instruction
stringlengths
34
19.9k
I was considering taking up the challenge of learning C++ for designing Metro apps and that's when I came across C++/CX. Can Metro apps be coded in C++ 11? Do they require C++/CX to work? And what exactly is C++/CX? Is it possible to create a Metro app using only C++, or is C++/CX required? Also, how does C++/CLI tie i...
Many years ago, I wrote a small Access 2003 database for a non-profit to track the donations they received. They recently wrote me asking for some new features (I was shocked it was still in use, honestly) and I'm wondering if I could rewrite the application with a newer technology/framework. Here are the machine specs...
Some (at least Mono's and .NET's) garbage collectors have a short term memory area which they scan often, and a secondary memory area which they scan less often. Mono calls this a nursery. To find out which objects can be disposed of, they scan all objects starting from roots, the stack and the registers and dispose al...
I'd never heard of this before, so shame on me, but programs like UPX can compress my files by 80% which is totally sweet, but I have no idea what the the disadvantages are in doing this. Or even what the compressor does. Website linked above doesn't say anything about dynamically linking DLLs but it mentions about...
This is my first time choosing a hosting company. It is for a web site made in asp.net mvc3. So I was thinking choosing a provider would be easy since I found this page http://www.microsoft.com/web/Hosting/Home which contains hosting offers. Now hours later, I am still searching. The reason is that as soon as I start i...
When we think about maintaining a software solution holistically, we have to think about things like non-code change control and configuration management, in addition to the actual source code. For example, for maintaining a large web application, tracing: "Make the following (manual) configuration change to the farm,...
I'm currently thinking about an interface to a class I'm writing. This class contains styles for a character, for example whether the character is bold, italic, underlined, etc. I've been debating with myself for two days whether I should use getters/setters or logical names for the methods which change the values to t...
I have been working on an open source Museum Collections Management web application that is to be used to keep track of a museum's accessioned, donated, loaned or otherwise acquired artefacts. This involved designing and creating a rather large database (in relation to my previous experiences), which stores all kinds ...
I'm trying to come up with a personal workflow. I've put together a flowchart of the hypothetical lifespan of a release: one developer pushing to a public github repo + a friend helping with some feature and fixing a bug. Is this a reasonable approach to version control? The main idea is to keep the public repo tidy: ...
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...
Linux OS developers : do they unit test their code ? If yes : since this OS is coded in C, how do they manage to write effectively unit tests in this language ? what are the "zones" in OS where unit testing is easier to write ? where is it harder ? where is it valuable ?
While I'm a professional programmer, I've never been formally trained in software engineering. As I'm frequently visiting here and SO, I've noticed a trend for writing unit tests whenever possible and, as my software gets more complex and sophisticated, I see automated testing as a good idea in aiding debugging. Howeve...
In real world networking software following c/s model, there are always proxy server processes between clients and server processes dealing with business logic, why we need proxy to isolate the logic part and clients? What's the benifit of this architecture?
I had an idea for a website. After much coding and thinking out the idea, I've got it to a decent stage. If I were someone else, potentially a more commercially-minded person, I might want to sell it, or slather it with ads. However, I've fallen somewhat in love with open-source, and I'd like to host the project on Git...
With the some most common languages (Java, C#, Java, etc) it sometimes seems that you are working at odds with the language when you want to fully TDD your code. For example, in Java and C# you will want to mock any dependencies of your classes and most mocking frameworks will recommend that you mock interfaces not cla...
In our CI environment we build all the cs projects and then build the deployment projects. The deployment projects do an extra step of compiling the aspx & ascx files and often catch errors that would normally be caught at run time. 1) Is there a name for this step or process? 2) Can I get it in the regular project b...
I've always liked physics, and I've always liked coding, so when I got the offer for a PhD position doing numerical physics (details are not relevant, it's mostly parallel programming for a cluster) at a university, it was a no-brainer for me. However, as most physicists, I'm self taught. I don't have broad background ...
Joel Spolsky characterized C++ as "enough rope to hang yourself". Actually, he was summarizing "Effective C++" by Scott Meyers: It's a book that basically says, C++ is enough rope to hang yourself, and then a couple of extra miles of rope, and then a couple of suicide pills that are disguised as M&Ms... I don't have...
I have grown into using a principle for designing and consuming interfaces that says basically, "ask for only what you need." For instance, if I have a bunch of types that can be deleted, I'll make a Deletable interface: interface Deletable { void delete(); } Then I can write a generic class: class Deleter<T exte...
I work in c++ mostly as a hobby (I'm still in school and therefor don't have a real job). The IDEs generate the makefile for me and so I'm wondering if it's worth learning how to make them myself. By "worth learning" I mean, should I drop everything and learn how to write them before continuing to learn c++? Is learnin...
What are the conventions for item batch identifiers in inventory management systems? For example: A retail supermarket can order 'Item X' from either 'Supplier A' or 'Supplier B'. When it completes an order for the item from either supplier, it needs to store the record of the receipt. Inventory quantity for the item i...
I'm working with a local file which I always extract from a password protected archive (RAR), do some modifications/additions to it and overwrite the old file inside the archive with the new file (I don't overwrite the archive. I overwrite the file inside it). The RAR is password protected for certain confidentiality r...
function select($select = '*') { if( is_string($select) ) { $select = explode(',', $select) ; } foreach($select as $s) { $s = trim($s) ; if($s != '') { $this->aSelect[] = $s ; } } return $this ; } In PHP,...
In a production web application, my fellow programmers used StringBuffer everywhere. Now I am taking care of application development and corrections. After reading StringBuilder and StringBuffer I have decided to replace all the StringBuffer code with StringBuilder because we don't need thread safety in our data beans....
I have a following method to find index of a book object which have a book name: +(NSInteger)indexXXX:(NSString *)bookName XXX:(NSArray *)books { for (NSInteger i = 0; i < books.count; i++) { NSDictionary *book = [books objectAtIndex:i]; if ([[book objectForKey:@"bookName"] isEqualToString:bookName]) { ...
I'm working on a rails application, and I've been pulling functionality out of my rails code and into pure ruby classes in lib/. I've found myself often writing classes like this: class MailchimpIntegration def subscribe_email(email, fname, lname) Gibbon.list_subscribe(:id => NEWSLETTER_LIST_ID, :email_addres...
Assume you are presented with an embedded system application to program, in C, on a multi-core environment (think a Cavium or Tilera) and need to choose between two environments: Code the application under Linux in SMP mode or code the application under a thin bare metal executive (something like a very minimal RTOS), ...
I've been programming C++ for a year now. I've gone through the language features and I've written good programs with it, so I decided to move on to OpenGL. At first it seemed confusing. As I kept going through tutorials it appeared to be easier, but I can't remember the names of classes, methods, arguments, etc. In fa...
I've read several articles on SRP and cohesion, and they seem to contradict each other as far as low coupling is concerned. Articles on cohesion argue that putting closely related responsibilities together in a class Highly_Cohesive_Class reduces coupling, while articles on SRP would argue that we'd reduce coupling by...
I started building an app in 3 layers (DAL, BL, UI) [it mainly handles CRM, some sales reports and inventory]. A colleague told me that I must move to service layer pattern, that developers came to service pattern from their experience and it is the better approach to design most applications. He said it would be much ...
I'm trying to learn implementing TDD with mocking/fake objects. One of the questions I have is how to initialize a dependency in an application which implements TDD? An example from this article Beginning Mocking With Moq 3 shows: public class OrderWriter { private readonly IFileWriter fileWriter; public Orde...
Currently I'm working as a freelancer, and for the first time a faced a client who wants the source code too. This client owns a software development company, and wants to have rights over the source code, but that I keep my rights too. That means that they can use my code to make similar applications using my code for...
Could older C++ compilers (e.g. VS2008 and gcc3.4) link with external libraries written in C++11? My thought is that the C++11 .lib files are just byte code at this stage, and it shouldn't bother the older compilers how it was generated, as long as it is somehow resolvable and callable. I'm developing a small library w...
While writing a Perl statement like if ( $foo >= X && $foo <= Y ) yet again, I wondered why many programming languages do not support the more comfortable form if ( X <= $foo <= Y ) and what this is called. I came up with "3-legged comparison" but no results when searching for it. By the way there is also the "element...
We have a C program which uses a .h header file to describe the custom-made data structure we use. The data structure must follow the design in the functional specification. There is some diagram to describe the member of the data structures and it would be described a ANS.1 abstract syntax, and then the asn file would...
I am trying to assign scores to phone's specifications to calculate a final rating score for each phone. However, when I was scoring based on megapixels, I found that one of the phones 'A' has a 41MP camera. But all other phones have 8MP or less, which is pretty good for a phone. Right now, when I grade relatively wrt...
It seems to me it would be very useful to use Javascript for general server side scripting tasks as it has more or less the same features as Perl and Python. But AFAIK there are no generally available Javascript interpreters for the major machine architectures. I guess the other problem may be lack of libraries but sur...
If I have a function in my code that goes like: class Employee{ public string calculateTax(string name, int salary) { switch (name) { case "Chris": doSomething($salary); case "David": doSomethingDifferent($salary); case "Scott"...
Using the Repository pattern, is it proper to return an IQueryable of a data set (table), for generic usage? It is very handy in many cases, especially when using external libraries that leverage that interface, for example some plugins that sort/filter and bind to ui elements. However, exposing an IQueryable sometimes...
I currently have the following HTML code <time datetime="2012-08-23"> 23. August 2012 </time> I have that because I felt the "23. August 2012" format was easier for website visitors to read than <time>2012-08-23</time> Both of those HTML5 examples validate at w3, but the first one is obviously redundant, and ...
We already have a WCF API with basichttpbinding. Some of the calls have complex objects in both the response and request. We need to add RESTful abilities to the API. at first I tried adding a webHttp endpoint, but I got At most one body parameter can be serialized without wrapper elements If I made it Wrapped it was...
Is it Ok if Domain Object cross Service-Boundary? Everyone recommend that only DTO should be returned by Services. I am creating simple CRUD application. Is it ok if my service methods return Domain object instead of flat DTO objects. It will save me from lots of mapping related setup. Is there any alternative approa...
I have been reading up on memento pattern from various sources of the internet. Differing information from different sources has left me in confusion regarding why this pattern is actually needed. The dofactory implementation says that the primary intention of this pattern is to restore the state of the system. Wiki s...
I began work at a company 2 months ago as a PHP developer. I stepped in to somewhat of a kludge, but I've yet to find a company that isn't... The development stable is currently two developers (including myself) who will act as the interim CTO while the company seeks out a replacement CTO. The company is a news site th...
I'm doing a function point count for a large website. Does the main website menu count as an External Input? I'm doing a function point count as described in this article. If so, since you only click on one menu item at a time, I assume the number of DETs == 1?
I'm new to OpenGL and found that there are a lot of libraries to do that in C, and I also found that glx is most friendly with Linux X Server, I just want to do basic stuff, and I cannot find any tutorials for GLX. Is GLX a bad thing? I just want to do some small graphical things without installing many libraries and g...
I'm the admin assistant of the CTO and our organization has recently experienced a lot of growth. Within six months, we have merged with another organization and our Dev team has grown from 8 to 16, with another 8 people in QA. What we're dealing with now is a highly technical individual, with little patience, man...
This is something I'm having a hard time getting my head around. I think I might be making it more complicated than it is. What I'm trying to do is develop a method to store users in a database with varying levels of access, throughout different applications. I know this has been done before, but I don't know where to...
Watching all those screencasts (and listening all those podcasts) with more-or-less famous hackers/programmers I hear that many of those use emacs/vi(m) for their daily work. Now, I myself tried using both emacs and vim, and I honestly cannot understand why would anybody use these for any kind of serious development. T...
I have been having problems wrapping my brain around how to properly utilize the modular extension for Codeigniter. From what I understand, modules should be entirely independent of one another so I can work on one module and not have to worry about what module my teammate is working on. I am building a frontend and a ...
I have these classes class Match { int MatchID, int Team1ID, //used to reference Team int Team2ID, ... other fields } Note: Match actually have 2 teams which means 2 TeamID class Team { int TeamID, string TeamName } In my view I need to display List<Match> showing the TeamName. So I added another field ...
I have an unpaid internship for a very new startup company with little tech experience that's trying to be a Groupon clone. They're currently using Wordpress and I've been trying to decide what web framework to push them towards, since I'll have to learn that language and implement it as well. Is ASP.Net MVC a realisti...
How many bytes an array occupies in Java? Assume It's a 64bit machine and also assume there are N elements in an array, so all these elements would take up 2*N, 4*N or 8*N bytes for different types of array. And a lecture in Coursera says that it would occupy 2*N+24, 4*N+24 or 8*N+24 bytes for a N element array and the...
I am using the combination of spring, spring-security, struts and iBatis in my application. Now I am looking to migrate the struts UI to GWT. The new combination must be spring, spring-security, GWT and iBatis. I applied a layered approach to develop my application. In Controller/UI layer i am using Struts. I want to r...
I see lots of SOA books surrounding Java and have always had the subliminal notion that Java is the "right" language for robust/enterprisey SOA, even though I know what SOA involves and that it is perfectly possible using other languages & frameworks. What exclusive traits Java has that other languages/platforms don't...
Given that programmers are authors and write code to express abstract thoughts and concepts, and good code should be read by other programmers without difficulties and misunderstandings, should a programmer take writing lessons to write better code? Abstracting concepts and real world problems/entities is an important ...
So the project I've been working on is now going to be frozen indefinitely. It is possible that if and when the project unfreezes again, it won't be assigned to me or anybody from the current team. Actually, we inherited the project after it had been frozen before, but there was nothing left by the prior team to help u...
Who decided (and based on what concepts) that switch construction (in many languages) has to use break in each statement? Why do we have to write something like this: switch(a) { case 1: result = 'one'; break; case 2: result = 'two'; break; default: result = 'not dete...
Is it important for managers to give devs regular feedback on how they're doing and vice versa? I say vice versa because I consider employees to be responsible to their manager, and managers to be responsible to their employees. Everyone seems to think this is a good idea but in practice I rarely see it happen because ...
In F# it is necessary to use the rec keyword. In Haskell there is no need to explicitly tell if a given function is recursive or not. Given the role of recursion in functional programming, the F# design seems rather odd to me. Is it a good language design decision or does it only exist for historical reason or becau...
Are there version control and project management tools which "work well" with freelancing jobs, if I want to keep my customer involved in the project at all times? What concerns me is that repository hosting providers have their fees based on the "number of users", which I feel is the number which will constantly incre...
Following this query on memento pattern, I have tried to put my understanding to test. Memento pattern stands for three things: Saving state of the "memento" object for its successful retrieval Saving carefully each valid "state" of the memento Encapsulating the saved states from the change inducer so that each state...
I have the same web application running on several different servers. Now I want a central place to administer everything in one web interface. What is the best way to do this? Should I provide a REST interface on every web application and let the admin application make all the calls? This seems like a common problem...
Is it sane to let a read method on a file object to be const? For example size_t read(void* buffer,size_t length) const; The read method does not change the contents of the file, but updates the file pointer which is invisible behind a handle.
I currently am working on a project which has one large style sheet for about 20 pages. The style sheet contains some styles which are specific for certain pages. I'd like to break the style sheet up so there is one style sheet for each page with one master style sheet that handles everything generic. The reason I want...
I am considering writing a new software product. Performance will be critical, so I am wary of using an interpreted or language or one that uses a emulation layer (read java). Which leads me to thinking of using C (or C++) however these are both rather long in the tooth. I haven't used either for a long time. I figured...
I was reading Why do we have to use break in switch?, and it led me to wonder why implicit fall-through is allowed in some languages (such as PHP and JavaScript), while there is no support (AFAIK) for explicit fall-through. It's not like a new keyword would need to be created, as continue would be perfectly appropriate...
The log files in question are metrics log files. One of them is a project file produced by SourceMonitor, to which I regularly add checkpoints to chart the progress of projects.
I am in the process of designing a small library, where one of my design goals is that the API should be as close to the domain language as possible. While working on the design, I've noticed that there are some cases in the code where a more intuitive, readable attribute/method call requires some functionally unnecess...
I'm a beginner and have only little knowledge in programming. Would it be good if I directly learn C++ from books which cover new C++11 or should I study through the old best C++ books? Should I have little knowledge about C++ before learning C++11? or I can start directly from there? Would it cause problem if I direct...
Clean Code suggests avoiding protected variables in the "Vertical Distance" section of the "Formatting" chapter: Concepts that are closely related should be kept vertically close to each other. Clearly this rule doesn't work for concepts that belong in separate files. But then closely related concepts should not be se...
I'm new to Workflow developement, and I don't think I'm really getting the "big picture". Or perhaps to put it differently, these tools don't currently "click" in my head. So it seems that companies like to create business drawings to describe processes, and at some point someone decided that they could use a state mac...
I'm pretty bad with naming things. The only name I can every generically come up with is 'helper'. Say, if I have a header file that contains helping functions for manipulating paths, I tend to put it inside my "helper" directory and call it "path-helper.hpp" or something like that. Obviouslly, that's a bad naming conv...
I have a betting type site where I publish a number (between 0-100) that is encrypted. Then after a period of time, I would review what the number is and prove it with a key to decrypt the encrypted number to prove that I'm not cheating. I also want it to be easily verifiable by an average user. What encryption algor...
Been struggling with this on an architectural level. I have an object which can be commented on, let's call it a Post. Every post has a unique ID. Now I want to comment on that Post, and I can use ID as a foreign key, and each PostComment has an ItemID field which correlates to the Post. Since each Post has a unique ID...
I had a dozen interviews in my life (I'm about to graduate) and I wonder why I was only once asked to read and explain some code. Roughly, 90% jobs are mostly about maintaining existing systems. IMO ability to read someone else's code is an important skill. Why don't interviewers check it?* *Among my friends I am the o...
There used to be very good reasons for keeping instruction / register names short. Those reasons no longer apply, but short cryptic names are still very common in low-level programming. Why is this? Is it just because old habits are hard to break, or are there better reasons? For example: Atmel ATMEGA32U2 (2010?): TIF...
Ok so in a programming test I was given the following question. Question 1 (1 mark) Spot the potential bug in this section of code: void Class::Update( float dt ) { totalTime += dt; if( totalTime == 3.0f ) { // Do state change m_State++; } } The multiple choice answers for this questi...
Our company has hired five new junior developers to help me to developer our product. Unfortunately the new features and incoming bug fixes usually require deeper knowledge than a recently graduated developer usually has (threading/concurrency, debugging performance bottlenecks in a complex system, etc.) Delegating (an...
Intuitively it seems appropriate that the development environment (and all test environments) be as close to the production build as possible. Are there any documented arguments in support of this intuition?
This is my first ever DFD that I made after my fair share of learning but I have no way of verifying whether it is correct or not. Although I have taken utmost care to make sure it is right, I may be wrong. Here is the scenario: Bebop Records is a mail-order company that distributes CDs and tapes at discount prices ...
Ok so I'm musing over a little side project I want to start. Essentially its a multi-session web based FTP client. Multi-session in that you can log into several FTP servers at the same time and perform operations like moving a file from one FTP server to another. I'm doing this mainly to brush up on the new webdev tec...
I've been a web developer for almost 10 years and I've gotten into the habit of trying not to use JavaScript whenever possible. I'm not talking about building web apps here, but database driven websites. Is this a good/respected approach?
I'm reading about ASP.NET (VB.NET) and I want to built my professionally website. I'm wondering though; I'm still using the basics so I'm really just a novice, but how much should I rely on Visual Studio to create my elements? Should I make my own text boxes and have my own login routine, or should I just use ASP.NET'...
I'm reading up on JSF. One thing that I noticed is that tags such as h:inputText and h:inputTextarea auto-generate a random name. Is there any way to over-ride this?
Is it safe to use LAST_INSERT_ID() in a system using MySQL like Point Of Sale when there are multiple users using the system at the same time?
At my workplace, we face a challenge in that "agile" too often has meant "vague requirements, bad acceptance criteria, good luck!" We're trying to address that, as a general improvement effort. So, as part of that, I am proposing that we generate design documents that, above and beyond the user story level, accurately...
The C2 wiki has a discussion of Empirical Evidence for Object-Oriented Programming that basically concludes there is none beyond appeal to authority. This was last edited in 2008. Discussion here seems to bear this out: questions on whether OO is outdated, when functional programming is a bad choice and the advantages ...
I know the Ruby on Rails framework is only for web development and not suitable for desktop application development. But if a ruby programmer wants to develop a desktop application, is it suitable and preferable to do it with Ruby only (not jRuby, as most of the tutorials are for jRuby)? If yes, please provide some goo...
so, suppose you have some fields and methods marked protected (non-virtual). presumably, you did this because you didn't mark them public because you don't want some nincompoop to accidentally call them in the wrong order or pass in invalid parameters, or you don't want people to rely on behaviour that you're going to ...
I'm looking for a light-weight code review process. A couple of requirements, the reviewer must be able to do the review alone at the time of his/her choosing (not tied to check-ins), the reviewer must be able to easily find the target code, the review has to leave some document showing what was reviewed. I know there ...
We all know the story of the personal computer as a consumer-oriented product. But I just thought that real end user solution should have appeared before that time. So a product that was probably expensive, but allowed using it as a service charging for it, for example computer-terminal for transport time-table access ...
Can anyone name any usefull strategy/architectural pattern for allocating actions between different controllers when using MVC pattern for developing web application? I am now developing web app using asp.net Mvc3 framework and still can't figure out how to manage actions and controllers. One approach is to create sing...
In order not to redo things several times I wanted to factorize common stuff. For Instance, let's say we have a cow and a horse. The cow produces milk, the horse runs fast, but both eat grass. public class Herbivorous { protected int Quantity; public void EatGrass(int quantity) { var evt= Build.GrassE...
Am about to start coding using microsoft .Net technologies, am just worried about the license, so if I compile my code using the .Net compiler "not visual studio" can I distribute, sell or use my product freely or I should have some sort of "microsoft license", same thing for sql server express installed(depolye) with ...
In "The Clean Code Talks -- Unit Testing", Miško Hevery mentions that "as little work as possible should be done in constructors [to make classes more easily testable]'. It got me thinking about the way I have implemented my user authentication mechanism. Having delved into MVC development through CodeIgniter, I design...
Asking a job seeker to show some code is a fairly common practice for a software company. However, would it be acceptable for the candidate to ask the interviewer to show him a small piece of code that he thinks is well written?
Are there any FTP programs out there that do a file comparison as well, so I can select the local and remote files and see what actually changed? I didnt find any when I googled. But it doesnt seem like a very advanced use case to me. Surely many others would have felt the need for it.. right?
I'm looking to see if there is a particular name for this style of programming a certain kind of behavior into a program. Said program runs in real time, in an update loop, and the program uses the State design pattern to do some work, but it's the specific way it does the work that I want to know about. Here's how it'...
An interesting point came up on another thread about alleged misappropriation of a GPL project. In this case the enterprise software was used by some large companies who essentially took the code, changed the name, removed the GPL notices and used the result. The point was - if the company did this and only used the s...