title: Is it true that first versions of C compilers ran for dozens of minutes and required swapping floppy disks between stages?

text: Inspired by this question. I heard that some very very early versions of C compilers for personal computers (I guess it's around 1980) resided on two or three floppy disks and so in order to compile a program one had to first insert the disk with "first pass", run the "first pass", then change to the disk with "second pass", run that, then do the same for the "third pass". Each pass ran for dozens of minutes so the developer lost lots of time in case of even a typo. How realistic is that claim? What were actual figures and details?


title: How to get better at testing your own code

text: I am a relatively new software developer, and one of the things I think I should improve is my ability to test my own code. Whenever I develop a new functionality, I find it really difficult to follow all the possible paths so I can find bugs. I tend to follow the path where everything works. I know this is a well known issue that programmers have, but we don't have testers at my current employer and my colleagues seem to be pretty good at this. At my organization, we do neither test-driven development nor unit testing. It would help me a lot but it's not likely that this will change. What do you guys think I could do in order to overcome this? What approach do you use when testing your own code?


title: Why do XSLT editors insert tab or space characters into XSLT to format it?

text: All XSLT editors I've tried till now add tab or space characters to the XSLT to indent it for formatting. This is done even in places within the XSLT where these characters are significant to the XSLT processor. XSLT modified for formatting in this way can produce output very different to that of the original XSLT if it had no formatting. To prevent this, _xsl:text_ elements or other XSLT must be added to a sequence constructor to help separate formatting from content, this additional XSLT impacts on maintainability. Formatting characters also adversely impact on general usability of the tool in a number of ways (this is why word-processors don't use them I guess) and add to the size of the file. As part of a larger project I've had to develop a light-weight XSLT editor, it's designed to format XSLT properly, but without tab or space characters, just a dynamic left-margin for each new line. The XSLT therefore doesn't need additional elements to separate formatting tab or space characters from content. The problem with this is that if XSLT from this editor is opened in other XSLT editors, characters will be added for formatting reasons and the XSLT may therefore no longer behave as intended. Why then do existing XSLT editors use tabs or spaces for formatting in the first place? I feel there must be valid reasons, perhaps historical, perhaps practical. An answer will help me understand whether I need to put compatibility options in place in my XSLT editor somehow, whether I should simply revert to using tabs or spaces for both XSLT content and formatting (though this seems like a backwards step to me), or even whether enough XSLT users might be able to persuade their tools vendors to include alternative formatting methods to tabs or spaces. **Note:** I provided an XSLT sample demonstrating formatting differences in this answer to the question: _Tabs versus spaces—what is the proper indentation character for everything, in every situation, ever?_


title: What do you think of opening brace comments in source code?

text: I have developed a habit of writing comments in my code by putting the comments on the same line as the opening brace, after the brace. I've found that this saves vertical space. It also leaves a hint why something was done, but I'm wondering if it's readable for others. Example:               void DoSomeInterestingImageManipulation(char *pImage)     {//This will convert the image to formatABC which allows x% space savings for storage         if(pImage && pImage[0] == 0xFF)         {//Process the extra case where image internal format needs decompression             ++pImage;             //...             //...             //...         }              //Proceed normally         *pResult = Foo(pImage);     }      Do you consider it easier to read or harder to read?


title: Managing SQL Stored Procedures' Version

text: I am working with a team of 5 persons. We are using SQL Server as our database. Since long time I want to store the Stored Procedures in SVN so that the versions can be maintained. Is there any tool which can be used as a plugin with SQL Server Management Studio and allows checkin from there.


title: Software Optimization vs. Hardware Optimization - what has the bigger impact?

text: I was wondering how software optimization and hardware optimization compare when it comes to the impact they have on speed and performance gains of computers. I have heard that improving software efficiency and algorithms over the years has made huge performance gains. Obviously both are extremely important, but what has made the bigger impact in the last 10, 20 or 30 years? And how do hardware changes affect the software changes? How much of software optimization is a direct result of hardware improvements and how much is independent of the hardware? To be clear, I am asking about software optimizations at the level of compilers and operating systems. Obviously using better high level-algorithms will result in the largest speed ups (think: quick-sort vs. bubble-sort), but this question is about the underlying reason why computers are faster today, in general.


title: How to remove the boundary effects arising due to zero padding in scipy/numpy fft?

text: I have made a python code to smoothen a given signal using the Weierstrass transform, which is basically the convolution of a normalised gaussian with a signal. The code is as follows:               #Importing relevant libraries       from __future__ import division       from scipy.signal import fftconvolve        import numpy as np           def smooth_func(sig, x, t= 0.002):            N = len(x)            x1 = x[-1]            x0 = x[0]                   # defining a new array y which is symmetric around zero, to make the gaussian symmetric.           y = np.linspace(-(x1-x0)/2, (x1-x0)/2, N)            #gaussian centered around zero.           gaus = np.exp(-y**(2)/t)               #using fftconvolve to speed up the convolution; gaus.sum() is the normalization constant.           return fftconvolve(sig, gaus/gaus.sum(), mode='same')      If I run this code for say a step function, it smoothens the corner, but at the boundary it interprets another corner and smoothens that too, as a result giving unnecessary behaviour at the boundary. I explain this with a figure shown in this image This problem does not arise if we directly integrate to find convolution. Hence the problem is not in Weierstrass transform, and hence the problem is in the fftconvolve function of scipy. To understand why this problem arises we first need to understand the working of fftconvolve in scipy.   The fftconvolve function basically uses the convolution theorem to speed up the computation. In short it says:               convolution(int1,int2)=ifft(fft(int1)*fft(int2))        If we directly apply this theorem we dont get the desired result. To get the desired result we need to take the fft on a array double the size of max(int1,int2). But this leads to the undesired boundary effects. This is because in the fft code, if size(int) is greater than the size(over which to take fft) it zero pads the input and then takes the fft. This zero padding is exactly what is responsible for the undesired boundary effects. _**Can you suggest a way to remove this boundary effects?_** I have tried to remove it by a simple trick. After smoothening the function I am compairing the value of the smoothened signal with the original signal near the boundaries and if they dont match I replace the value of the smoothened func with the input signal at that point.   It is as follows:               i = 0      eps=1e-3     while abs(smooth[i]-sig[i])> eps: #compairing the signals on the left boundary         smooth[i] = sig[i]         i = i + 1     j = -1          while abs(smooth[j]-sig[j])> eps: # compairing on the right boundary.         smooth[j] = sig[j]         j = j - 1      There is a problem with this method, because of using an epsilon there are small jumps in the smoothened function. _**Can there be any changes made in the above method to solve this boundary problem?_**


title: What is the point of using the private access modifier for C# class members?

text: From MSDN... > The access level for class members and struct members, including nested > classes and structs, is private by default. If class members are private by default then why use the private access modifier for them? I see it all the time in code examples and open source projects including the ASP.NET MVC source. I even use it in my own projects but I'm left wondering why.


title: Multiple projects - similar platforms or as different as possible?

text: When working on multiple projects simultaneously (for the sake of simplicity let's say half time each on two projects), which is better? Should the two projects   * Use the same language? Same/similar frameworks?   * Use entirely different languages? Additionally, is it best if they are target for similar platforms, or different (web v. desktop v. mobile v. utility library for internal use)? The first responses that come to mind are   * They should be similar, and play to the strengths of the developer to help him handle managing both of them   * They should be as different as possible to help the developer keep organized Since I've never done this in a professional setting, I was hoping more experience programmers could shed some light on the best way to go about doing this. **EDIT** :   This question is assuming the existence of multiple other projects, each of which is underway (I think some underway and some brand new with no design decisions yet made would be too broad for one question). When choosing between existing projects for a second project, should a developer consider how similar his new project is to his current project, and how should that affect the decision?


title: Learning to program in C (coming from Python)

text: If this is the wrong place to ask this question, please let me know. I'm a Python programmer by occupation. I would love to learn C. Indeed, I have tried many times, but I always get discouraged. In Python, you write a few lines and the program does wonders. In C, I can't seem to be able to do anything useful. It seems to be very complicated to even connect to the Internet. Do you have any suggestions on what I can do to learn C? Are there are any good websites? Any cool projects? Thanks


title: Extending user registration in Django site that uses both site admin tables and my own module?

text: I'm writing a Django site that registers a particular type of user and this is done by the resources that come with the framework, the site administration. The issue: I'd like to create a new model with a foreign key to an admin site table and loaded from a excel cvs that augments the data from the user registration form. I'd like to do this in a database agnostic way without sql. Just using models, urls, forms, template language etc. I do not know how to check the contents of the user registration form against the new table? **forms.py**               from django import forms     from django.contrib.auth.models import User     from django.contrib.auth.forms import UserCreationForm     from django.core.mail import send_mail     #     # Called by register_user view.     #     class MyRegistrationForm(UserCreationForm):         email = forms.EmailField(required=True)              class Meta:             model = User             fields = ('username',                        'password1', 'password2',                        'email', 'first_name', 'last_name',)              def save(self, commit=True):                  # create and load user object             user = super(MyRegistrationForm, self).save(commit=False)             user.email = self.cleaned_data['email']             user.first_name = self.cleaned_data['first_name']             user.last_name = self.cleaned_data['last_name']                         if commit:                 user.save()                 send_mail('Your Provider Enrollment Registration',                           'You are now an authenticated provider!',                            'donfox1@mac.com',                           [user.email], fail_silently=False)                              return user      **models.py**               class NPIdata(models.Model):         '''          NPI data is associated with admin site User accounts.         '''         NPI = models.IntegerField(max_length=10)         lastname = models.CharField(max_length = 20)         firstname = models.CharField(max_length = 20)         Credential = models.CharField(max_length = 15)         user = models.ForeignKey(User)


title: Can I use silverlight for building SocialNetworking applicaiton?

text: I am wondering: how feasible it would be to start developing a social networking website entirely based on silverlight; This has been fairly discussed over the years in favor of HTML. Has something changed with silverlight improvements over the years? What about:               * Performance       -- active users       -- technology used, MVVM + MEF (possibility of lags, server memory overflow...)     * Security       --- WCF Ria Services & EF      What are your thoughts on this subject?


title: How to comment on a PEP?

text: Proposals for new Python features are collected in documents called PEPs (Python Enhancement Proposals). There's a master list at http://www.python.org/dev/peps/ which links to (for example):   * Labeled break and continue http://www.python.org/dev/peps/pep-3136/   * Asynchronous IO support http://www.python.org/dev/peps/pep-3153/   * Remove Backslash Continuation http://www.python.org/dev/peps/pep-3125/ It's great that proposals are published publicly for the community to read. However, how is the community supposed to participate? The pages don't allow comments. It strikes me as weird the Python developers would make proposals public then deliberately exclude the community from discussion. Have I missed something? In particular, I'd like to read other people's comments on http://www.python.org/dev/peps/pep-0453/ and add my own. * * * For comparison, Ruby feature proposals are made as posts to its bug tracker. You can read everyone's comments below, and add your own (after making an account)   * Refinements and nested methods https://bugs.ruby-lang.org/issues/4085   * Frozen string syntax https://bugs.ruby-lang.org/issues/8579   * Exception#cause to carry originating exception along with new one https://bugs.ruby-lang.org/issues/8257 Nodejs feature requests are plain GitHub issues, which is probably the most inclusive. It's very easy to join GitHub and post a comment.   * https://github.com/joyent/node/issues?labels=feature-request


title: Interaction between programs

text: I am writing an interactive program in which it takes speech input from the user for a specific list of commands. The list of commands will be stored locally in a graph and based on the usage their weight will be modified. The speech input is taken and processed into text and then it's executed by bash scripts. I am thinking what I should use to interact (synchronize) between the speech recognition engine and then the list and the bash program. I am using C++ and Bash on a Unix system. I thought of `mutex` but the problem is what if the user gives multiple inputs then I'll have to buffer it and then process it sequentially and that will make the system slower. The bash script is used to call the system utility commands as requested by the user. Should I only use C++ or Bash too? I am thinking of storing the graph in a binary format. Is this the best way to store the graph? Please suggest alternatives.


title: How to convince my company (operating in the financial sector) to switch from PHP to Java

text: My company is in the financial sector and it is using PHP as programming language. I am a PHP developer myself. I am leading a big project started from almost scratch. I can see how PHP is not the best candidate for building robust platforms. I want to convince my company to _gradually_ switch to Java (which I have experience with). I was trying to find as many supporting arguments as possible. Can you help with this? So far I have found these:   * Most of the competitors are using Java (anyway not PHP)   * Most financial companies use Java rather than PHP   * On average, Java developers are better prepared (on average!)   * The compilation process catches a lot of problems before the software runs in production   * Strong typing makes everything more robust as contracts between interfaces is well defined Any other points I am missing? Thanks!


title: Best Practice Method for Including Images in a DataGrid using MVVM

text: All, I have a WPF `DataGrid`. This `DataGrid` shows files ready for compilation and should also show the progress of my compiler as it compiles the files. The format of the `DataGrid` is               Image|File Path|State     -----|---------|-----        *    |C:\AA\BB |Compiled     &    |F:PP\QQ  |Failed     >    |G:HH\LL  |Processing     ....      The problem is the image column (the *, &, and > are for representation only). I have a `ResourceDictionary` that contains hundreds of vector images as `Canvas` objects:               <ResourceDictionary xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"                           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">     <Canvas x:Key="appbar_acorn" Width="48" Height="48" Clip="F1 M 0,0L 48,0L 48,48L 0,48L 0,0">         <Path Width="22.3248" Height="25.8518" Canvas.Left="13.6757" Canvas.Top="11.4012" Stretch="Fill" Fill="{DynamicResource BlackBrush}" Data="F1 M 16.6309,18.6563C 17.1309,8.15625 29.8809,14.1563 29.8809,14.1563C 30.8809,11.1563 34.1308,11.4063 34.1308,11.4063C 33.5,12 34.6309,13.1563 34.6309,13.1563C 32.1309,13.1562 31.1309,14.9062 31.1309,14.9062C 41.1309,23.9062 32.6309,27.9063 32.6309,27.9062C 24.6309,24.9063 21.1309,22.1562 16.6309,18.6563 Z M 16.6309,19.9063C 21.6309,24.1563 25.1309,26.1562 31.6309,28.6562C 31.6309,28.6562 26.3809,39.1562 18.3809,36.1563C 18.3809,36.1563 18,38 16.3809,36.9063C 15,36 16.3809,34.9063 16.3809,34.9063C 16.3809,34.9063 10.1309,30.9062 16.6309,19.9063 Z "/>     </Canvas>     </ResourceDictionary>      Now, I want to be able to include these in my image column and change them at run-time. I was going to attempt to do this by setting up a property in my View Model that was of type `Image` and binding this to my View via:               <DataGrid.Columns>         <DataGridTemplateColumn Header=""                                  Width="SizeToCells"                                  IsReadOnly="True">             <DataGridTemplateColumn.CellTemplate>                 <DataTemplate>                     <Image Source="{Binding Canvas}"/>                 </DataTemplate>             </DataGridTemplateColumn.CellTemplate>         </DataGridTemplateColumn>     </DataGrid.Columns>      Where in the View Model I have the appropriate property. Now, I was told this is not 'pure' MVVM. I don't fully accept this, but I want to know if there is a better way of doing this. Say, binding to an enum and using a converter to get the image? Any advice would be appreciated.


title: Reasoning behind the syntax of octal notation in Java?

text: Java has the following syntax for different bases:               int x1 = 0b0101; //binary     int x2 = 06;     //octal     int x3 = 0xff;   //hexadecimal      Is there any reasoning on why it is `0` instead of something like `0o` like what they do for binary and hexadecimal? Is there any documentation on why they went this route?


title: For in-house programmers (non-project managers), do you normally receive project instructions written out in advance?

text: I'm fairly new to working as a programmer, at least working as a regular employee in-house for a company. I often become frustrated with my company's management style as they basically just pick out whatever random tasks catches the lead developer's fancy that day, or the day before, and give me the task (with tasks usually lasting less than 1 day). A lot of the tasks I have now are fairly small and are for adding enhancements to a web application, fixing bugs, etc. I am bothered, however, by the fact that they don't plan ahead so as to give me an written outline of projects a few days in advance so that if, for example, I am rusty on something I can at least familiarize myself with it on my own time or at least have a more relaxed approach to the job so that everything doesn't have to be so reactionary on my part (where I can mull things during off-time over before starting work on them, etc) I guess I'm just curious if this is the norm or if most development jobs value clearly laid out specifications for tasks and are able to prepare them somewhat in advance. I would be interested to hear anyone's experience / opinions, etc. Thanks


title: Where to find open source volunteers?

text: We have an open source Java project (REMPL) and actively looking for volunteers. What is the best way to find them? Junior programmers are OK for us.


title: A good tool set for ASP.NET development

text: What are some good (or must have) ASP.NET development/debugging tools in addition to Visual Studio IDE? So far the only trick in my pocket is .NET Reflector, that has come in handy before. (I would limit browsers add-ons to IE if possible, since I'm working on a corporate intranet and using FF is not always an option).


title: Is it good practice to use NoStackTrace in scala?

text: I came across the `NoStackTrace` mixin for Exceptions in scala. Is it good practice to use it, or should it be considered "internal" to scala and left alone?


title: Is a 'God' ViewModel desired in WPF

text: My application has user controls within user controls. Please see a screen shot of one of the most beautiful applications of all time (UC = user control): ![enter image description here](http://i.stack.imgur.com/EEvpd.png) All the properties live in the MainWindow code behind, there are none in my UserControls. To bind to my properties I use               DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorLevel=1,AncestorType=Window}}"      This works fine but, it does mean all binding properties are in my MainWindow code behind (or the MainWindow ViewModel). Is this desired in a MVVM (or should I say WPF) approach, in that all the children share the same ViewModel?


title: Should one check for null if he does not expect null?

text: Last week, we had a heated argument about handling nulls in our application's service layer. The question is in the .NET context, but it will be the same in Java and many other technologies. The question was: should you always check for nulls and make your code work no matter what, or let an exception bubble up when a null is received unexpectedly? On one side, checking for null where you are not expecting it (i.e. have no user interface to handle it) is, in my opinion, the same as writing a try block with empty catch. You are just hiding an error. The error might be that something has changed in the code and null is now an expected value, or there is some other error and the wrong ID is passed to the method. On the other hand, checking for nulls may be a good habit in general. Moreover, if there is a check the application may go on working, with just a small part of the functionality not having any effect. Then the customer might report a small bug like "cannot delete comment" instead of much more severe bug like "cannot open page X". What practice do you follow and what are your arguments for or against either approach? Update: I want to add some detail about our particular case. We were retrieving some objects from the database and did some processing on them (let's say, build a collection). The developer who wrote the code did not anticipate that the object could be null so he did not include any checks, and when the page was loaded there was an error and the whole page did not load. Obviously, in this case there should have been a check. Then we got into an argument over whether every object that is processed should be checked, even if it is not expected to be missing, and whether the eventual processing should be aborted silently. The hypothetical benefit would be that the page will continue working. Think of a search results on Stack Exchange in different groups (users, comments, questions). The method could check for null and abort the processing of users (which due to a bug is null) but return the "comments" and "questions" sections. The page would continue working except that the "users" section will be missing (which is a bug). Should we fail early and break the whole page or continue to work and wait for someone to notice that the "users" section is missing?


title: Should a method validate its parameters?

text: Say you are designing a Square root method sqrt. Do you prefer to validate the parameter passed is not a negative number or do you leave it up to the caller to make sure the param passed is valid. How does your answer vary if the method/API is for 3rd party consumption or if it is only going to be used for the particular application you are working on I have been of the opinion that a method should validate its parameter, however, Pragmatic Programmer in its Design by Contract section (chapter 4) says it's the caller responsibility to pass good data (pg 111 and 115) and suggests using Assertions in the method to verify the same. I want to know what others feel about this.


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

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


title: suggesting large changes/a rewrite as an intern

text: **The context:**   * it's an internal project (that I don't think a lot of people use)   * it's old   * we're updating it **The issues:**   1. it abuses the mvc framework (no use of models, business logic in views, etc)   2. what we're being asked to do is small, but because of the low cohesion we have two options:      1. continue to botch things     2. move large chunks of code around or rewrite the thing **The solutions (I see):**   1. continue working with it, ignore best practices in favor of being done soon and not introducing new bugs by refactoring/rewriting   2. refactor/rewrite I guess my question is really: if I want to make large changes to this project, how do I do propose that without insulting anyone? Or would it be better for me to simply go with the flow even if that means (metaphorical) duct-tape sometimes?


title: How significant is the impact of the type system (static/dynamic) on the overall design of programs?

text: Coming from Java, I've never used a language with dynamic typing. I'm very used to the static-typing way of thinking. My question is, how much does the use of dynamic typing as opposed to static typing influence the overall design of programs written using languages with that kind of typing? **Does the kind of typing (static/dynamic) influence the design of programs significantly?** Working with a dynamically-typed language, would you structure your application differently than working with a statically-typed language? **Or is it merely a language characteristic that affects mainly local implementation details, but doesn't affect overall designs?**


title: C API in C++ with RAII, two alternatives to implement error handling (Exceptions)

text: I have an API written in C, which produces a result by returning a pointer to allocated memory.   For using it with C++ (C++11) I've wrapped the function calls in objects, which keep the result in a `std::shared_ptr`. So far so good. However, the C library features _two_ functions for every operation. One produces possibly an error, the other never. Let's call them   `some_pod * do_it_with_error(Parameter ..., Error **)`   and   `some_pod * do_it_without_error(Parameter ...)` I can pass in the address of an `Error *` pointer to the first function and if there's an error it won't be `NULL` afterwards. For solving this I thought of two different implementations.   First, I could SFINAE for choosing between the `with_error` and `without_error` functions, like so:               template<typename NoThrow = void>     struct do_it {       public:         void operator()(...)         {           Error * error = NULL;           m_result = std::shared_ptr<some_pod>(do_it_with_error(..., &error));           if (error) {             throw(MyExceptionWithError(error));           }         }       private:         std::shared_ptr<some_pod> m_result;     };          template<>     class do_it<std::nothrow_t> {       public:         void operator()(...) noexcept         {           if (! m_result) {             m_result = std::shared_ptr<some_pod>(do_it_without_error(...));           }         }       private:         std::shared_ptr<some_pod> m_result;     };      Usage:               do_it<> di_error;     try {       di_error(...); // might throw     } catch (...) {}          do_it<std::nothrow_t> di_no_error;     di_no_error(...); // won't throw for sure      However, since the result is wrapped in a `std::shared_ptr` there will also be a `get()` method:               const std::shared_ptr<some_pod> & get(void) { return m_result; }      For error checking I could just implement a another method `check`.   The default implementation would now look like this:               struct do_it {       public:         // will never throw         const std::shared_ptr<some_pod> &         get(void) noexcept         {           if (! m_result) {             m_result = std::shared_ptr<some_pod>(do_it_without_error(...));           }           return m_result;         }              // might throw         do_it &         check(void)         {           if (! m_result) {             Error * error = NULL;             m_result = std::shared_ptr<some_pod>(do_it_with_error(..., &error));             if (error) {               throw ...;             }           }           return *this;         }            private:         std::shared_ptr<some_pod> m_result;     };      Usage:               do_it di_error;     try {       auto result = di_error.check().get();     } catch (...) {}     do_it di_no_error;     di_no_error.get();      So, both implementations seem to be equally good (or bad) to me.   How could I decide which one to use.   What are the Pros and Cons?


title: Find common functionalities or functions between 2 programs

text: I've been facing a problem recently, in which I want to optimize two programs. For that, I wanted to create some kind of "Common Interface" which I could reuse between my two programs. However, the code of these are approximately 1000 lines, and I don't want to spend a big amount of time checking if this or that function is the same as this one and whatsoever. So I used BOUML to check the similarities between class diagrams. But I wonder if there is a global way to do such a study ?


title: how to express alternative flows in activity diagram

text: I want to express the below events in an activity diagram:   * An alternative flow, such as "at step x of basic flow, user clicks cancel instead of ok".   * An alternative entry to the use case, such as "instead of click the bold button, use can press Ctrl-B".   * An error, such as "when user clicks save, the system is unable to save the file to disk." How can I do these? Thank you.


title: Under which circumstances (if any) does it make sense to work for a startup, for free?

text: I've been bumping around the startup world for a while, and most startups I've seen seem to have (amongst other things) two things in common:   1. A lack of money   2. An inability to, reliably, hire good quality developers This means that, for startups, the ideal hire is someone who is free - where they can wait until they've both raised money and found out that the hire is worth his price tag. When (if ever) is this a win win situation? For you, as a programmer or software developer, when would this make sense?


title: How would you teach C# delegate to a newbie?

text: I was reviewing Andrew Troelsen book on C# 4.0. The part that explains delegates starts as smooth as:               public class SimpleMath     {         //declare delegate         public delegate int BinaryOp(int x, int y);              public static int Add(int x, int y)         {         return x + y;         }     }          class Program     {         static void Main(string[] args)         {         //create delegate which points to Add method         BinaryOp b = new BinaryOp(SimpleMath.Add);              //Invoke Add method using delegate         Console.WriteLine("10 + 10 is {0}", b(10,10));         Console.ReadLine();         }     }      than gets as complicated as               public class Car     {         public int CurrentSpeed {get;set;}         public int MaxSpeed {get;set;}         private bool carIsDead {get;set;}         public Car() {MaxSpeed=10;}         public Car(int maxSpeed, int currentSpeed)         {             MaxSpeed = maxSpeed;             CurrentSpeed = currentSpeed;         }         //declare delegate         public delegate void CarEngineHandler(string msgForCaller);         //define member of this delegate         private CarEngineHandler listOfHandlers;         //add registration function for the caller         public void RegisterWithCarEngine(CarEngineHandler methodToCall)         {             listOfHandlers = methodToCall;         }              public void Accelerate(int delta)         {                 if (carIsDead)                 {                         if (listOfHandlers!=null)                                 listOfHandlers("Sorry, the car is dead");                 }                 else {                         CurrentSpeed+=delta;                         if (10== (MaxSpeed - CurrentSpeed) && listOfHandlers!=null)                         {                                 listOfHandlers("Gonna blow!");                         }                         if (CurrentSpeed >= MaxSpeed)                                 carIsDead = true;                         else                                 Console.WriteLine("Current Speed = {0}", CurrentSpeed);                 }         }     }      If we try to pick that content and teach somebody else, we are going to find a hard time, since it becomes tricky. How would you teach C# delegates in a way he/she is able to understand clearly when to use them?


title: Debugging, performance tracing, profiling, tools, etc. - suite?

text: My client is looking to standardize on its "helper" tools suite of applications to aid developers of a very large .NET project in debugging, profiling, finding memory leaks and performance bottlenecks, etc. kinds of issues All developers use VS2010, target .NET 4.0, and support a large distributed system: Winform UI client (CAB framework), SQL2008 Backened, CSLA app-tier with Dataportal & remoting, and there is a large job-processing layer with Compute cluster pack (CCP) as well as a few dozen other peripheral technologies. To give you an idea of the size, the system is probably north of 5M lines of code, has about 100 developers around the world and has been in development & production support for the last 5 years with this same team size. Over the years, client did not have a single strategy that revolved around profiling tools of kinds. Client bought the tools when programmers said: "oh, this looks nice to trouble-shoot this particular problem I'm having".. So, now the client wants to standardize on a suite of tools. What has worked so far: Ants for memory profiling. dotTrace for performance profiling. There is currently a serious consideration being given to CA Wiley for production monitoring. VS2010 profiling has been deemed not good enough and not working well enough within the current system. Can anyone recommend a single suite of tools that would be a good substitute for ALL the tools mentioned above? Integration with VS2010 is a must. All sorts of bells & whistles and ease-of-use and ability to drill-down into deepest levels to find the weirdest problems is required. Thank you for your suggestions


title: When there is no API

text: When it is necessary to integrate with a web application, and an API is unavailable, is it a viable solution to simulate a web browser interacting with the web application as a real user would interact with it? UPDATE Some context. Web App belongs to a vendor/partner. Their timeline for building a proper API will not meet our needs. Scraping for data is the least used part. Full CRUD for interacting with the app is required. As a developer, I can see that it will work, but I want to be able to address concerns that others may raise about this approach. Would you base a mission critical business application on this approach? Why or why not?


title: What's the difference between college-level and corporate programming?

text: I have just completed my Bachelors degree in IT field. I have deep interest in coding and really want to be a professional in it. Now, apart from college courses, I have been learning programming(C#) on my own (college level programming is too basic). Now I feel I need a little more time to be close to professional programmer. But some of my seniors say that corporate world programming is too different from bookish programming, hence there is no point in wasting time. (They are not programmers themselves, this may be probably what they heard). Would I benefit by reaching an advance level of C#? or as mediocre level is sufficient to break interviews, higher levels do not matter to firms because they rely on their training purely to teach how things work in corporate world and learning more won't help me much? Please if there are some professional programmers who can help, I promise this is something which about every student interested in programming want to ask at my stage. "How do you actually change from learner to professional in field of programming?" - keep learning until you are perfect or joining a firm is must once basics are covered?


title: Unique Value Object vs Entity

text: Trying to convert some entities into value objects I am stuck in a case where what seems a value object must be unique within an aggregate. Suppose we have a **Movie** entity which makes the root of an aggregate. This **Movie** entity is related with some set of **AdvertisementEvent** objects with the role of displaying an advertisement at certain timestamp. The **AdvertisementEvent** contains a link to some **Banner** that must be displayed, the coordinates and some effect filters. Since **AdvertisementEvent** is just a _collection of configuration parameters_ I am not sure if I should care about its identity and treat it like just a large value object. However I do care that within a **Movie** there must be only one **AdvertisementEvent** at a certain timestamp, probably even _around_ the timestamps. I find hard to split my doubts in multiple independent questions, so there they go:   1. Does a _collection of configuration parameters_ sounds like a value object?   2. Am I mixing the concept of uniqueness of **AdvertisementEvent** within **Movie** and transactional integrity rule?   3. Does _any_ of the choices in point (2) implies that **AdvertisementEvent** must be a member of the aggregate made by **Movie**?   4. Is my **AdvertisementEvent** object an Entity, a Value Object or an Event Object? (I used the _Event_ suffix in the name to highlight my confusion)   5. Are large value objects like this a design smell? I guess that I am not dealing with an Event in the sense of DDD because it is not something that just _happens_. The real DDD event should be something more like _AdvertisementEventReached_


title: Internship along with Google Summer of Code?

text: I am wondering about how much time Google Summer of Code typically takes. I do have an internship lined up for this summer, but GSoC seems like quite an awesome experience. I also really want to get into Open Source development. It states in the FAQ that it's not a good idea to attempt both, but it doesn't give any specifics. I'm wondering if it's feasible to do both. Or would I be better off by trying to work on open source in my spare time? Thanks for all your help!


title: What are benefit/drawbacks of classifying defects during a peer code review

text: About 3 months ago, our engineering group rolled out Review Board to be used for all peer code reviews. Today, I had a discussion with one of the people involved in that process and found out that we are already looking for a replacement (possibly something commercial) because of several missing features. One of the features that is apparently asked by many people is the ability to classify/categorize each code review comment (i.e. is it a style issue, coding convention, resource leak, logic error, crash... whatever). For those teams that regularly practice code review, is this categorization a common practice? Do you do it? have you done it in the past? Is it good/bad? On one hand, it gives the team some more metrics and possibly will indicate more specific areas where developers may potentially need to be trained in (at least that seems to be the argument). Are there other benefits? And on the other hand, and this is my concern, is that it will slow down code review process that much more. As a team lead, I've done a fairly large share of reviews, and I've always liked the ability, to highlight a chunk of code, hammer off a comment and move on as fast as possible. Although I haven't tried it personally, I have a feeling that expanding that combo box every time and scrolling/searching for the right category would feel like something is tripping you. Also if we start keeping metrics on this stuff, my other concern is that valuable code review meeting time will be spent on arguing whether something is a logic error or if it should be classified as a crash.


title: How can I help myself focus on a project when there is a more fun one I can work on?

text: I suffer from adult ADHD. Sometimes I get bored with projects or work items assigned to me at work because they aren't particularly interesting. I end up inventing more interesting work and working on that instead, not getting my assignments done on time. I do end up making useful software, but not what I committed to making. I know that I need to "suck it up" and "just do it", however the ADHD makes it difficult for me to choose what to think about. As a result, I get distracted often and don't deliver on time. Are there any techniques I should try to help stay on task, especially when there is more fun work I could be doing?


title: What is the (craziest, stupidest, silliest) thing a client/boss asked you to do?

text: See title, but I am asking from a technical perspective, not > Take my 40 year old virgin niece on a date or you're fired.


title: Designing a SQL-like encapsulation object for programmatic use

text: In the last few weeks, I have been working on a Data Mapping Library, which has involved lots of research, experimentation, crying, blaming the whiteboard for not being big enough, and more research. But now I have a full idea of what I'm trying to do. I have decided that before working on any data source adapters, I need to build a SQL expression library. The queries are not assembled with a string of text, but in the form of an instantiated object, containing multiple other objects associated with which part of the query it pertains to. As such, a `SELECT` query object will have objects for the `columns`, `table from`, `joins`, `where clause`, `group bys`, `having clause`, `order bys`, and `limit`. These objects are then passed to the data source adapter, which will take the input and turn it into a query (or use it in other ways) so that it can fetch the data in a common fashion. Although this is good enough for simple queries, when it comes to more complex queries, where the join reference, or a condition within the where clause is a nested select query (i.e. `SELECT * FROM tblA INNER JOIN (SELECT * FROM tblB WHERE foo = 'bar')`, or `SELECT * FROM tblA WHERE alice IN (SELECT * FROM tblB WHERE foo = 'bar')`), I am having trouble designing an interface where such a thing could be defined, which would later be passed to the adapter that could use it in whatever way it needs to. So, can anyone propose a design that would allow for such queries to be defined in abstract which could be interpreted into a sql query, or into a nosql programmatic interface function call? **EDIT** The design of the system is such that all the tables and columns are defined as objects (separately, but with named associations for linking). Here is an example of the coding I am hoping to be able to execute:               tblA::select()         ->where(new inCondition(                                'tblAfooCol',                                 tblB::select()->where(new isNullCondition('tblBbarCol'))                                )                )         ->fetch();      Now, instead of this being directly translated into SQL (which is very easy), I am trying to plan a way that this can be returned to the data source adapter (internally through the `fetch` function). So far, the system I have built can handle the commands for a single `SELECT` query being parsed, but it is when sub queries are used in conjunction with the query that will be passed to the adapter. I am having problems determining how to encapsulate the sub query so the adapter can process it itself. As said before, converting it directly into SQL works great, but if I want to use it with a special adapter that does not use SQL (i.e. an XML or MongoDB adapter), without a function to convert the SQL into commands (or if it is SQL, converting some of the syntax to a valid specification for that rmdbs) that can be used may become very processor intensive (only for certain queries) and cost quite a lot of performance.


title: Encryption Cannot Be Reversed?

text: I am under the impression that an encrypted string cannot be decrypted so the original value is lost forever. However, if the following string **always equals** "dominic" (my name), then can't there be some logical way to reverse it; being as it's not random nor is it based on the date/time, but there is a logical method to it?               0WrtCkg6IdaV/l4hDaYq3seMIWMbW+X/g36fvt8uYkE=      No matter what or how many times I encrypt "dominic" (string), it always equals as above. So, shouldn't there be some way to decrypt a string like that? Example of what I'm talking about:               public string EncryptPassword(string password)     {         return Convert.ToBase64String(             System.Security.Cryptography.SHA256.Create()             .ComputeHash(Encoding.UTF8.GetBytes(password)));     }


title: Recompiling dll's and adding more during run time - what are my options?

text: I want to compile custom functions during run time based on user written scripts. I'll give a hypothetical example that should demonstrate exactly what I need to do. This is the best way for me to describe the problem. I'd like a little input/ideas in how I can solve this. At the bottom I give you my ideas. I have 2 classes, one with public int x and y. Another with public int x,y,z. There can be more than one instance of each class running. The thing with these classes though (and here comes my problem) is that they need to be updatable via a user written and then compiled function during run time, that then gets added to a list of update functions that gets run once per cycle/event. Which could be at the touch of some button or something. Example: The user has written a script to update the public members of Class A. He has written A.X = B.Y + C.Z. The variables here are public, never private. This method needs to be compiled, and added to some list of functions to call each cycle. Obviously this method needs access to class B and C, as well as A. So pointers to those need to be passed in. The function returns nothing. When I say class A, B, and C. I mean these as some instances of any classes. 'A' could be class Q, while both B and C could be from class T. Or any other variation. These classes do not need recompilation/user written or anything like that. I just need help with coming up with options and how to compile a function that gets passed in some pointers and does something with them. But with all of that defined run time, what the function does, what gets passed into it, ect. \---- What I think I can do --- I'm jumping extremely far in knowledge but it is what I always do. So I am just switching from C# to C++ and have little to go on for now while I know little. So all i can do is guess solutions and research them. I'm guessing I could compile a late loading dll for each function, and I'm guessing the dll has to know something about the data structures passed into it so I think it could work to have them in a separate normal dll usable by any program. (The A,B, and C class thingies, or rather Q, and T classes which A,B,and C were instances of in my little demo). So now both the normal program and the dll functions knows all about the classes, and all I have to do is compile the dlls during runtime, load them, and somehow get a pointer to them that my main application has and can call with the appropriate arguments. Then if the user changes the script, the dll unloads, recompiles, loads again, and a new pointer is gotten? Any help is greatly appreciated. If you can help direct my learning/research I'll learn a lot faster and be able to implement this. Thank you so much!


title: Algorithm, AI, or intelligent agent suggestions for ingesting poorly-formatted & variable data from different document types

text: Thanks for looking! # Background I have been tasked with writing a program to normalize and ingest data from various sources to a common database. For the sake of simplicity, let's say that the program is for a public library system, and that they are wanting to maintain a database of all books currently lent out of their various branches. Let's further assume that the branches are not linked to a common network or database (silly, I know, but please bear with me). The task is to accept submitted data from the various branch managers, and then automate the process of normalizing that data and storing it into the common database. ## Variable raw data formats The **raw data** may be submitted in the form of a MS Excel file, a .csv, a tab-delimited file, a plain text file, possibly even just a simple email, a field delimited file, etc. ## Loosely related data contents The contents of the raw data files will _generally_ contain these fields:   1. Book ID   2. Book Title   3. Author   4. Is Checked Out?   5. Days Overdue   6. ISBN   7. Due date . . .and so on. The problem is that some of the submitted data files will have these fields in column headers and some will not (so will need to infer from data what the field is). Further, the field names will not always be consistent. One library branch may call the boolean field for whether a book is checked out "OnLoan", while another branch calls it "IsCheckedOut". ## Common data repository All of this data will be ingested to a common database with normalized data that has been cleaned up during the ingest process. So, hopefully, we have something like this in the final DB:   1. BranchId   2. BookId   3. Title   4. CheckedOut   5. ISBN   6. DueDate   7. DaysOverdue . . .and so on. ## Automation of Ingest Process Let's assume that there are thousands of branches and that they must each issue this report to the Library HQ once monthly. Obviously, my client can hire a bunch of data-entry people to do this job (in fact, that is how it is done today). The request from them however, is to automate as much of this as possible to cut data-entry costs. ## So here is my plan, please suggest or criticize away:   1. **Standardize the file submission process.** This will be handled by creating a web page with a file upload dialog, DONE!   2. **Determine the file type.** I will be using C# (not that language matters) and it has a pretty easy way of getting the file type but sometimes I will simply get a `.txt` that turns out to be tab or pipe-delimited _so I need an algorithm to detect this_. I am thinking of using a _Bayes Classifier_ or _Artificial Neural Network_ for this.   3. **Attempt to parse the data into memory.** Now I have hopefully determined if I have an excel file, a tab-delimited, a csv, etc. I will run the file through the correct parser to get it into memory but now need to determine if the **file has headers** or if I can **infer what the headers should be by the value**. For this I hope to again use a **Bayes Classification system** and perhaps calculate a **Levenshtein Distance** from the value to items in an array of known/standardized header names. But what about header inference from the data? How would I identify one column as containing due dates and one as containing ISBN numbers?   4. **Glean, clean and submit the values in each column.** If I am lucky enough to have gotten this far (I know what the headers are), then I need to loop through the values in each column and clean/normalize them. For example, some library branches may enter an ISBN value as "ISBN12-345-67-89" whereas another branch enters "123456789". I need to catch that difference and normalize them. Is this a case for just a plain ol' expert system or `if. . .then`? Is there a better way?   5. **Submit normalized data to database.** This step is not as trivial as it sounds because some library branches may report a book title as "Algorithms for Dummies" while another reports it as "Algorithms for Dummies, 1st Edition". Let's assume for a second that I don't have an ISBN to tie the two books together (though they are the same), **what method might be suitable for deducing that these books are the same and assigning them a common primary key int the related`Books` table**? # Many, Many thanks for your suggestions!!!


title: Is there any real-world practical problem where only the best (exact) solution algorithm or program will do?

text: _Please, if you feel that question is big and does not deserve your attention (tl;dr) do not downvote it or ask for closing it being based on that._ The problem 1.1-5 in the book of Thomas Cormen et al Introduction to algorithms is: "Come up with a real-world problem in which only the best solution will do. Then come up with one in which a solution that is “approximately” the best is good enough." I'm interested in its first statement. And I would like to develop my (mis)understanding of the question and ask to name a real-world problem where only the **exact** solution will work as opposed to a real-world problem where good-enough solution will be ok. So what is the difference between the exact and good enough solution. Consider some physics problem for example the simulation of the fulid flow in the permeable medium. To make the computer simulation happen some simplyfing assumptions have to be made when deriving a mathematical model. Otherwise the model becomes at least complex and unsolvable. Virtually any particle in the universe has its influence on the fluid flow. But not all particles are equal. Those that form the permeable medium are much more influental than the ones located light years away. Then the mathematical model needs to be solved and an exact solution can rarely be found unless the mathematical model is simple enough (wich probably means the model isn't close to reality). We take an approximate numerical method and after hours of coding and days of verification come up with the program or algorithm which is a solution. And if the model and an algorithm give results close to a real problem by some degree that is good enough soultion. Its worth noting the difference between exact solution algorithm and exact computation result. When considering real-world problems and real-world computation machines I believe all physical problems solutions where any calculations are taken can not be exact because universal physical constants are represented approximately in the computer. Any numbers are represented with the limited precision, at least limited by amount of memory available to computing machine. I can imagine plenty of problems where good-enough, good to some degree solution will work, like train scheduling, automated trading, satellite orbit calculation, health care expert systems. In that cases exact solutions can't be derived due to constraints on computation time, limitations in computer memory or due to the nature of problems. I googled this question and like what this guy suggests: there're kinds of mathematical problems that need exact solutions (little note here: because originally the question is taken from the book "Introduction to algorithms" the term "solution" means an algorithm or a program, which in this case gives exact answer on each input). But that's probably more of theoretical interest. So I would like to narrow down the question to: **Are there any real-world practical problems where only the best (exact) solution algorithm or program will do (but not the good-enough, suboptimal, you call it solution)?** I want to clarify my understanding of _"good enough"_. The _best_ solution **is** _good enough_ **but not every** _good enough_ solution **is** the _best_ (exact, fastest, etc..) one. So I’m asking for a kind of a problem for which no solutions can be considered good-enough unless the solution is the best. There are problems like breaking of cryptographic ciphers where only exact solution matters in practice and again in practice the process of deciphering without knowing a secret should take reasonable amount of time. Returning to the original question this is the problem where good-enough (fast-enough) solution will do. There's no practical need in instant crack though it's desired. So the quality of "best" can be understood in any sense: exact, fastest, requiring least memory, having minimal possible network traffic etc. And still I want this question to be theoretical if possible. In a sense that there may be example of computer X that has limited resource R of amount Y where the best solution to problem P is the one that takes not more than available Y for inputs of size N. But that's the problem of finding the particular solution for P on computer X which is... well, good enough. During formulation of this question I came to conclusion that we live in a world where it is required from programming solutions to practical purposes to be good enough. In rare cases (like shuttle maneuvering) very very good ones. I could not find any problems that require only the best solution. If there is such problem of practical interest solved or unsolved can you provide any example of it? Or does there exist any proof that no such problem can exist?


title: Dynamic form builder forms and database design?

text: Say your users can create their own web-based forms (textboxes, selects, etc) and publish them on the web for their users to fill out. Does anyone have a resource or any advice on how to architect the database to tie into the dynamic forms? For example, would you create a child table for each form, or different versions of a given form?


title: Should the domain model  include all the domain entities in my project?

text: I have currently reading Grails and I love it. In order to get hands on experience with Grails I decided to create a web application for some Management System. Ya as you can guess there are plenty of entities that goes into the domain model for my web application. Any how as a novice in Web development, I just thought of creating a homepage first of all. Now here comes the problem, I sat for an hour and drawn my domain model(for my homepage alone!). After that I had a doubt that whether we have to enter all the entities(i.e my whole web app entities like user, profile, tasks and their relationships etc) in Domain model first and then start coding or draw domain models for each page in our web app and at last connect all the domain models? Well, what I do is wrong? This is my first project that ever started in my life. Thanks for your advices.


title: is it realistic to make use of HTML5 local storage to store CSS, and JavaScript

text: The idea is to make use of HTML5 local storage to store frequently accessed CSS and JavaScript. For example (pseudo-code):               var load_from_cdn = true;     if (detect local storage)       {       if (cache of css, js found)       {          load the local storage cache          load_from_cdn = false;       }     }     if (load_from_cdn)     {        document.write('<script>...');     }      Is this possible or realistic? I do aware browser cache, there will be still some header access checking,   I assuming no HTTP access is better (in my _thinking_ ) PS : It seems that local storage only support **key-value pair** , can someone prove it ?   (best with some examples)


title: What is the correct definition of Moore's law

text: I see different sources that say the number of transistors will double every 24 months or every 18 months. Does anyone have a credible source?


title: Is it better to develop apps using a platform specific technology or web technologies?

text: I happened to read an interesting article the other day that talked about building mobile applications using Javascript and HTML5. One interesting point they brought out was how this approach worked across multiple platforms, different hardware (ex. screen size) and software (ex. iPhone, WP7, Mac, Windows). I also noticed something interesting posted on Microsoft's Build Website for their upcoming conference. They seem to put a lot of emphasis on HTML5 and JavaScript. It does seem ideal to develop a single application (of course it would still require minor modifications) and have it work on tablets, PCs, mobile devices, TVs or pretty much any internet-capable device. Is this a shifting trend? Obviously it's no fun learning a technology just to find out a year later that it's getting shut down. In my opinion it seems rather difficult as it stands to do certain functionality like animations or data-binding (my favorite!) with HTML5 and JavaScript when compared to Silverlight. In this case the tools alone make it a better choice (Expression Blend and Visual Studio 2010). I am concerned though because it has been getting easier to do things on the web that just a few years ago didn't seem possible. Is there still a place for technologies like Flash and Silverlight when it comes to developing applications or should we be aiming to gear our apps toward web-specific technologies such as HTML5, CSS3, and JavaScript?


title: Using a “spherical frustum” for 3D projection

text: I am currently writing a transformation from model space to clip space for use in OpenGL. From what i have seen, programmers typically use a traditional rectangular frustum to define the clipping boundaries in their model space. I personally had in mind a shape like a frustum, except the near and far planes are spheres centered at the apex of the frustum (the camera). So something that looks like this: ![Circular sector](http://i.stack.imgur.com/i05pA.png) The yellow region corresponds to OpenGL's clip space, and the two spheres (depicted as circles in this cross-section image) correspond to OpenGL's z=-1 (inner sphere) and z=1 (outer sphere). Is this a more realistic way to model the projection, or should i stick with the traditional rectangular frustum when designing my projection matrix?


title: Should internal code be shared with non-developers in an organisation?

text: Where I work, we have a lot of developers and an awful lot of code running our proprietary applications used by staff & customers alike. We also have a lot of smart support staff that like to understand the inner workings of our systems to better support our customers, and perhaps even submit a patch from time to time. Should we open up our code for our non-development staff to be able to read? What factors should we take into account when making this decision? I have come across a bunch of arguments and counter-arguments each way & would like to make a decision based on the experience of others as well as well- understood risks. Some arguments thus far:   * Passwords in VCS are exposed (solution: get rid of the passwords - they shouldn't be there to begin with)   * Code is open to white-box security attacks (counter-argument: this only keeps out the honest/lazy attackers)   * Support staff can ask developers "how" things work (counter: teach a man to fish, etc) Does anyone open their code to staff at their organisation? Has it caused any problems?


title: Guidance for Web XML Api's

text: I have to create an API for our application that is accessible over HTTP. I envision the API's responses to be simple XML documents. It won't be a REST API (not in the strict sense of REST). I am fairly new to this space - of course I've had to consume some Web API's in my work, but often they are already wrapped in language native libraries (i.e., TweetSharp). I'm looking for information to guide the design of an API. Are there any articles, blog posts, etc. that review and expound upon the design choices to be made in a Web API? Design choices would be things like how to authenticate, URL structure, when users submit should the URL they POST to determine the action being performed or should all requests go to a common URL and some part of the POST'd data is responsible for routing to a command, should all responses have the same document root or should errors have a different root, etc., etc. Ideally, such articles or blog posts would enumerate through the common variations for any given point of design and expound on the advantages and disadvantages, such that they would inform me to make my own decision (as opposed to articles that simply explain one single way to do something). Does anyone have any links or wisdom they can share?


title: Is it normal for a manager/developer to feel technically lesser than the architect or senior developers?

text: I am an average coder in my eyes but a good developer, in the past year I've felt that my technical knowledge of our products design is being questioned by our senior developers/architects, is this normal? should I focus more on the technical nitty gritty and design? I've been working with the same team and much the same project for the past 7 yrs, in the last 4 I was appointed manager/scrummaster. I spend 30% of my time managing the project tasks and quality, the rest I spend bug fixing, I usually leave the design tasks to our architect. Should I focus more on the design of the product? it does feel like I would gain more respect if I had the architects knowledge, however I doubt if this is even achievable in the long run. Is this a general issue for developers with all architects? And should senior developers be outstanding coders?


title: Is it inefficient to concatenate strings one at a time?

text: I recall back from my days of programming in C that when two strings are joined, the OS must allocate memory for the joined string, then the program can copy all the string text over to the new area in memory, then the old memory must manually be released. So if this is done multiple times as in the case of joining a list, the OS has to constantly allocate more and more memory, just to have it released after the next concatenation. A much better way to do this in C would be to determine the total size of the combined strings and allocate the necessary memory for the entire joined list of strings. Now in modern programming languages (C# for instance), I commonly see the contents of collections being joined together by iterating through the collection and adding all the strings, one at a time, to a single string reference. Is this not inefficient, even with modern computing power?


title: Constructive ways to answer "What was your most challenging project? and why?"

text: I am asked this question many times in the interviews. > What was your most challenging project -- and why? I get confused about which project to tell them and why some project would look challenging or non-challenging. What are they looking for in the answer? Any software is a challenge before it gets started and it becomes a normal software engineering task after it has finished. All softwares I made were challenging until they got finished. Do I misunderstood the word "challenge"? What's wrong in my thinking? What's an appropriate and constructive way to approach this question?


title: A single language to learn to develop desktop and mobile phone applications?

text: Is there a language that is capable of developing apps to cross platform OSs (win,*nix) and mobile apps (IOS, android) .. I'm a pro web developer but want to explore more environment to deploy my code into... Python ? Ruby ?


title: What is Object Services class purpose?

text: I'm reading a book on TDD: (btw this question has nothing to to with TDD) link to the book on amazon   Author often mentions/uses Service Classes For example we would have a Person Object Person would would have:   \- a "regular" class for deifining the entity **Person**   \- a data access class (lets say we have a db for data persistance) using for example a repository patter **PersonRepository**   \- a "service" class (PersonServices) **PersonServices** as author himself explains: > A PersonService class serves as the business domain class that works with > Person objects from a standpoint of enforcing business rules and using > Person in business work fl ows. My question would be is that a way to go with your classes? In the past I would put everything from **Person** class and **PersonServices** into one class. What type of functionality would go into **Servieces** classes for my objects? I'm not sure if I understand the quote above (maybe I'm missing the point?)


title: Design of active or passive class domain

text: Sorry if my (simplified) example is too broad. Given this model (written in C#):               class Ball     {     }      Let's assume that a ball can be launched. To implement this feature, I can define something like:               class Ball     {         void Launch();     }      or something like:               class BallLauncher     {         void Launch(Ball ball);     }      In which situations is better use first approach and which the second one? In fact, this example tries to simplify an actual real underlying model. In that model, I need to upload files (`Package`) to a repository. Then, I don't know if the repository should upload (physical copy) a package (files) to itself or it is the package who should upload itself to a repository.


title: Agile - Learning & Practicing Agile alone

text: I am learning new technologies and doing some small projects to practice these technologies alone. And I want to learn the agile methodolgy along the way but don't know if it's a good or bad idea to learn it alone and how far I can go with it. Another thing what good resources to learn it (books/articles)?


title: What is the best path for a CS graduate who wants to end up doing creative research-like development?

text: ## Background: This question came to mind after I ignorantly came to the conclusion that I was driven to go into game development, because it is the only place I can do creative development without the hinderance of clients wanting things tweaked, or security needing to be extreme, or deadlines pushing away research. I'm not talking about all cases, I'm talking about "in the end", where I've found my "final" kind of job. Game development I speak of here is indie development, where original intuitive design is important. As far as I know, this form of game development is the only way a person with only a bachelors can do research level development [AI, original UI (like voice commands / NLP), advanced graphical development]. With a phD I understand i could do any research, but I'm still unsure that is the path I wish to take. ## Question: What type of jobs or industry can allow someone with only a bachelors degree to do virtually unhindered creative research and development? This is subjective, so I'm mainly looking for opinions and RL accounts.


title: Self Debuggable systems

text: For example, in case of GDB it is possible to debug itself by itself. I have not been able to find any JVM that can debug itself or even allows debugging on source level. I was just wondering if someone can suggest on how the systems are made self debuggable. If you have references, please paste it here. I wanted to read on it in detail.


title: Where to put Administrative Features

text: Right now we have our administrative features located at www.mysite.com/admin. It is locked down by UN/PW but it still seems like an insecure place to have it. Is there a better place to put it? Perhaps at another domain?


title: Deprecation considered harmful?

text: I've just been compiling some of my own code with the `-std=c++0x` flag in GCC, as I want to vaguely keep up with what all the young folks are doing (provided they stay of my lawn), and I ended up with a load of warnings about `auto_ptr` being deprecated. Of course, I knew that `auto_ptr` was deprecated in C++0x, but... Isn't deprecation a waste of time and effort? Reasons for not deprecating (with auto_ptr as an example):   * there is an ocean of code out there that still needs to be supported, producing millions of warnings will only tempt people to turn warnings off.   * `auto_ptr` is a bit naff, but it does actually do what it says on the tin.   * if we really want to deprecate things, I nominate `printf()`. But just imagine the squeals that would ensue. `auto_ptr` doesn't have too many friends, but in at least my C++ code it is used more than `printf`, which isn't used at all.   * the committee have a bad record of getting this right - they deprecated static at namespace scope, and now it seems to have been undeprecated - I wouldn't be surprised if `auto_ptr` made a similar come-back   * lastly, whatever the committee say, the compiler implementers ignore them - they simply can't risk breaking their customers code, all they can do is issue irritating warnings. So my question - do you consider deprecation (of anything, not just auto_ptrs, and not just in C++) a good idea, and if so, why?


title: What defines a software architect?

text: At what point does a developer stops being simply a developer and turns into a software architect. Or in other words , whats the minimum job description of a software architect?


title: What Is The Relationship Between Software Architect and Team Member

text: I work for a small company which has less than 100 persons. Several months ago, this company offered me position of SA and I accepted. There are three teams in this company, and I work for one of them. This is the first time I work as a SA. During the past months, I find I don't have any power of management, I even can't let the team member do things (coding-related) in the way which is correct and more efficient. The team members argue with me on very very basic technical questions and I have to explain to them again and again. Though some members did take my advice, other members stubbornly program in their way which frequently proved wrong finally. Recently I feel a little tired and confused. I wonder what is correct relationship between a Software Architect and team members including the team leader? Besides, is software architect also leaded by the Team Leader?


title: Has there been any formal work comparing ease of maintenance at the programming language level?

text: Is there any formal work attempting to measure ease of maintenance for complex programs, comparing at the programming language level? Are there any formal measures for ease of maintenance, at any level? I'm looking for a method to obtain formal measurements of ease of maintenance (or any related work) for a pet project.


title: What is the name of λx.λf.fx (like reverse apply) in lambda calculus? Does the corresponding function have a standard name in programming?

text: What is the name of λx.λf.fx in lambda calculus? Does the corresponding function have a standard name in functional programming languages, like Haskell? In object oriented programming, is there a usual name for a method `foo` which takes a function as an argument, such that `x.foo(f)` returns `f(x)`?


title: Legal Requirements for Software Makers

text: Since the Legal site of Stack Exchange isn't ready quite yet, I figured this would be the best place to ask this question. What are, if any, the legal requirements (or online resources for finding this info out) that I must uphold if I wish to sell an application that acts as a Personal Account/Information Manager, which:   1. Stores (optionally, but preferably) personally identifiable information, and;    2. Stores (optionally) bank account information, such as existing and current balance, and transaction history, entered by the user. With regards to encryption, is there a legal standard of encryption that we as developers must use for securing this type of information?


title: What is upcasting/downcasting?

text: When learning about polymorphism you commonly see something like this               class Base { int prv_member; virtual void fn(){} }     class Derived : Base { int more_data;  virtual void fn(){} }      What is upcasting or downcasting? Is `(Derived*)base_ptr;` an upcast or downcast? I call it upcast because you are going away from the base into something more specific. Other people told me it is a downcast because you are going down a hierarchy into something specific with the top being the root. But other people seem to call it what i call it. When converting a base ptr to a derived ptr is it called upcasting or downcasting? and if someone can link to an official source or explain why its called that than great.


title: How do you handle ever-growing piles of issues to be resolved "somewhen"?

text: We're using JIRA to keep track of issues in our software projects. One effect we noticed is that we often create a new issue but we don't knw yet when/if the problem is going to be fixed at all. So we invented a fake 'Distant Future' milestone which such issues get assigned to. As it happens, the pile of issues assigned to this milestone keeps growing all the time so it seems this is not a good approach. There are so many of them by now that it became quite a lot of work to review all of them for validity. Some of them became invalid since the component they are related to you was removed. Some of them were duplicated by other issues. Some of them have such a poorly phrased description that nobody really knows what they are about anymore. How do other software development teams deal with issues which are valid, but which might not get fixed anytime. Do you bother recording them at all? Do you assign them to the next planned version and then look at them again as the next release approaches? Something else?


title: async & await - poll for alternatives

text: Now that we know what is in store for c#5, there is apparently still an opening for us to influence the choice of the two new keywords for 'Asynchrony' that were announced by Anders Heijsberg yesterday at PDC10.               async void ArchiveDocuments(List<Url> urls) {         Task archive = null;         for(int i = 0; i < urls.Count; ++i) {             var document = await FetchAsync(urls[i]);             if (archive != null)                 await archive;             archive = ArchiveAsync(document);         }     }      Eric Lippert has an explanation of the choice of the current two keywords, and the way in which they have been misunderstood in usability studies. The comments have several other propositions. _Please - one suggestion per answer, duplicates will be nuked._


title: Is 37Signals Basecamp a hype?

text: What's so unique about it? Heard great things about it, used it, found that beside the Google Apps Integration there's nothing really special about it. Maybe I just don't get it? So, what's your reason to use basecamp?


title: What's a good javascript library for drawing shapes and connections

text: What is a good javascript library (for use with Ruby on Rails) for drawing shapes and dynamic connections (lines connecting shapes that adjust as you move the shapes)?


title: What are some fun (and very easy) C++ programs for a 10 year old kid to write?

text: It might be a bit young to be learning C++, but I've been hired to tutor a ten year old and I will happily oblige! I'm struggling to think of some fun but easy programs to work on. Ideally, I'm looking for something that can be done with a basic understanding of if statements, while loops, variables, vectors, input, and output. I came up with the idea of writing a "Mad Libs" style program, where it asks the user for input (adjectives, nouns, etc) and then outputs a story with that input filled in. However, he didn't seem very interested in this idea since he does not like "Mad Libs". I feel like he might be particularly interested in writing a program that has a visible effect on his computer. For example, he loves figuring out key presses to do things like invert his computers color, etc. Any ideas for a fun/easy C++ program for a 10 year old?


title: What is your go-to application when you start learning a new language?

text: What "application" do you write to understand a programming language? I have used a calculator (regular + equation solver). But I think it's too easy. I am planning to learn Haskell and was curious, what is your "go-to application" when you start to learn a new programming language? One of my friend uses XML parser as his go-to application. Any other suggestions which will include comprehensive use of data structures and other important constructs?


title: Optimal buffer size for fread/fwrite

text: What buffer size should I choose for read/write files via POSIX fread/fwrite functions?


title: How to design a system that allows for multiple parallel extensions of the same "component"?

text: As a player, I found the following problems about creating and using "extensions" (aka mods) for games: > 1) Whenever the game is updated, all the mods break. > > 2) Most mods don't work with each other, so the player "has to choose" > > 3) If you ever de-install a mod, your "saved games" almost always become > unusable. I want to design a game in Scala/Java that does NOT exhibit those issues. I need help with point 2. I want to write it such that it is maximally extensible. My problem is I cannot nail down properly how I should do this, and since the whole design reside on top of the component/service/plugin architecture, than I can't move forward until I solved this problem. The design qualities I want to achieve are: > 1) For any "service", there should be a single object (at any given time) > that implements it. Since it is a cycle-based simulation, I can safely "swap > implementation" between the cycles. > > 2) It should be possible for a "third party" to create a "bundle" which > either modifies or more likely extends the functionality of a "service", and > "bind" it into the existing application at runtime, _without recompilation_. > > 3) It should be possible to load and unload those bundles at runtime, > because they will be used in a long-running server. > > 4) Developing extensions should be easily possible, even for a "junior" > programmer, without requiring extensive knowledge of some complex framework. > > 5) It should be possible for _several_ bundles to extend/modify the same > service at the same time, as long as they follow a certain set of rules > preventing most conflicts. I was first planning to use OSGi, but I can't really see how to get this to work. OSGi solution is to let many bundles register the same service and use a "filter" to choose one in the client code. Making the code aware that at any given time, there can be several objects that implements different variations of the same service, and that those instances can come and go, would make everything much too complicated and brittle. My plan was to register every service as a generic "handle", which the user of the service can use to get the real instance and cast to what they want. The handle content could change over time, but the handle object itself would be valid for the duration of the program, therefore bypassing the constant querying of the registry, with associated filtering. I think OSGi can solve 2 to 5, but only by using multiple instances of the same service, which is in contradiction to 1. I think that 1 an be achieved either by using composition, or by fusing all the different implementation of a service into a single object through byte-code manipulation. A look at Javaassist showed me that "rebasing" a class does not seem too difficult, if they all extend the same base-class and take the same constructor parameters. Composition, on the other hand, seem to put much more work on the hands of the third-party extensions developers, which is in contradiction to 4, and generally is a clunky solution at best. If I implement the byte-code manipulation strategy, than I have to basically do almost everything myself, and loose most of the benefits of OSGi. Also, I cannot really create the fused service until _all bundles_ have been activated, so they cannot register a "real" service instance at activation time, which is what OSGi is about (?). Do I even know from OSGi when it's "done"? Is the only way of achieving those designs goal to create my own component framework, or can I still do it using OSGi, or some other system? Reinventing the wheel at that level sound like a stupid (and time consuming) idea, but I can't see how to solve those problems with OSGi. Maybe another service/plugin framework can do it? Or by using a specific well-defined design strategy? UPDATE: It will a be an Internet Client-Server (Cluster) model running on OpenGL. I am mostly "framework unencumbered", that is, I can choose whatever fits my needs, but I want to stick to the JVM. OSGi is an attempt at standardizing "components" (called bundles) for the JVM.


title: two ways of doing the same thing, what is preferred?

text: I have some `context`   then I can do:   with `context.getError(Object): ErrorHolder` `holder.addError(error)` OR `context.setError(Object, error)` `setError` will probably have this implementation:   `context.getError(Object).addError(error)` what approach should I choose and why?


title: What is the difference between artificial intelligence (AI) and swarm intelligence?

text: I understand that when we try to implement swarm intelligence, it basically has multiple independent units communicating and with each other. What I am unsure of is if swarm intelligence an extension of artificial intelligence or if it is a discipline in and of itself.


title: Dividing database between MySQL and NoSQL

text: Mine is a typical website developed with LAMP stack. Due to scalability issues we are planning to incorporate NoSQL for the application. For the implementation, we are planning to implement hybrid solution: using NoSQL only for few of the high volume tables in database and keep on using MySQL for all the other. So, we are splitting the database in two with two different servers which use different database technology. We are weighing pros and cons for this approach. For example, with this approach we will have to depend on the web application to maintain data integrity. There will be 2 points of failure due to 2 DB servers, instead of one. Is it a usual practice? What are the pros and cons?


title: Can I build a closed source plugin for a LGPL library?

text: If I link a program dynamically to a LGPL library (here GTK+/GLib), I'm allowed to distribute the program on my own terms (non-copyleft). Now, the LGPL library provides loadable modules. Place a shared library (.so, .dll, .dylib) in a certain directory, and it will attempt to load it, using a well-defined interface. **Am I allowed to distribute the plugin module (dynamically loaded by the LGPL library) as closed-source, according to the terms of LGPL?** I'd take care that I don't use code from the LGPLed library in my plugin, and only include such headers that would be permitted by the license, and which I could as well use in a closed-source program ("3. Object Code Incorporating Material from Library Header Files."). * * * Disclaimer:   I am well aware that you shouldn't take legal advice from strangers on the internet. I am asking this mainly because I'm curious. No code has been written, and no business commitments have been made at this point. Before I do anything real I probably should ask a lawyer (but they're quite expensive for just satisfying your curiosity!). I do have confidence though that I can get a good answer - maybe someone has done exactly this thing and can report on their experience. Maybe there is a definite answer from the horse's mouth (FSF) that I overlooked. I'm writing this disclaimer so that you don't have to, so please don't tell me to ask my legal department (which I don't have as an individual). And if this rather belongs on Programmers.SE, please feel free to move. I posted this here because there might be some technical (linking) issues that are important.


title: Visual Studio Load Tests Virtual Users Simulation

text: I'm currently working on writing a load testing application that takes advantage of Load Test using Visual Studio 2010. The load test will simulate 20 users on the same machine, and I need some data to be shared in-memory between all simulated users. I was suprised I couldn't find documentation answering the following question: What seperates each virtual user's running context from the other? Does each virtual user runs the tests in its own process? Maybe in its own app domain? Or just on its own thread? I need to know because if each user is running tests in its own process then all the in-memory cache isn't shared and is created for each user instead of one time for all of them, which is bad for me.


title: English term for "Naive user test" or "idiot test"

text: In usability testing, it's common to select a set of users who have never used the software before. I've heard this process described by programmers as the "idiot test", or sometimes "naive user test" or "ignorant user test". Unfortunately all these terms have insulting connotations in English. Is there a term to describe this type of usability test that does not insult?


title: SOA Release management strategy

text: Currently I have been asked to propose an automated release management solution for a large oracle SOA project. All code is stored on SVN repository and it would be nice if I could suggest something that would build, deploy, run test cases and produced reports for all projects on trunk. I know that I could do that by creating ant or maven scripts, but I would like to know if there is an open source alternative that handles all these complex stuff, without the need of so much coding.


title: How do you effectively compete with an open source project?

text: A company with a solid open source project competing against a traditional closed-source product seems impossible to beat. I read this article wherein the author lays out this scenario: > Suppose one could divide a software market—say network management—between > two products. One did everything possible and cost $1 million, and the other > only did 10% as much, but was free and open. > > The price tag of the commercial solution would automatically filter out a > large number of users, and those people would have to turn to open source. > But some users would be satisfied with the 10% functionality and choose it > outright. > > For example, I have an original Macintosh computer on my desk. It runs a > word processor called MacWrite. It does everything, with the exception of > spell check, that I need a word processor to do. I can format paragraphs, > choose fonts, make text bold or italic, and even paste in pictures and > graphs. All in a "what you see is what you get" user interface. > > It takes up 76K of disk space. That's "K" as in "kilobyte." > > Compare that to Microsoft Word. I think the last time I installed just Word > it was around 30MB, many times larger than MacWrite, but I don't use it for > much more than I use MacWrite. Like me, many users are happy with basic > functionality. They don’t need all the bells and whistles. > > But back to my analogy. In the beginning, the commercial company would > probably ignore the open source project. It represents no threat to their > revenue stream, so why should they pay attention to an upstart? > > If this project is healthy and sustainable, however, in a year or so perhaps > it does 15%-20% of what the commercial product does. This should bleed a few > more users from their business, and maybe now they start to pay attention. > > Most likely, this attention would take the form of marketing against the > project. They would claim it is too small or too underpowered to take > seriously. And in the short run this would probably work. But the mere fact > that they acknowledged the project would pique interest. Some people would > determine for themselves that it was neither too small nor too underpowered > and would start using it. > > Another year or two goes by and now the project is up to 50% of the > functionality of the commercial product. People start joining the project in > droves. The commercial company now has to do something. What do they do? > They add more features. > > Remember, the commercial product already did 100% of what people needed. So > what kind of features could they add? Unnecessary ones. They might change > the look of the user interface or add features outside of network > management. In any case, this development will cost money, and that will > start to eat into the company's margins. > > Finally, with a healthy community and this influx of new users, the open > source project will eventually approach 80%-90% of what the commercial > product does. Having exhausted all avenues of generating revenue, the > commercial company still has one final option: put the screws to their > remaining customers. Find ways to charge them more, to eek out what they can > from their investment, which ultimately will drive their clients away. > > Farfetched? I don't think so. There are only two main requirements: > > First, find a market where open source provides a compelling alternative, > such as network management. > > Second, build a sustainable community around the open source project. It seems very plausible. If you were the closed-source company, how would you compete??


title: Why should I know concurrent programming?

text: Concurrent programming is quite difficult to me: even looking at a basic slide seems challenging to me. It seems so abstract. What are the benefits to knowing Concurrent programming concepts well? Will it help me in regular, sequential programming? I know there is a satisfaction to understanding how our programs work, but what else?


title: Objects as parameters: Is there a simple way that explain this?

text: I tried to understand how objects can be passed as parameters but it was difficult for me. How can we pass an object as a parameter to a method of another object? I need to understand the idea behind this. **updated:**               public class Student {}          public class Admin {              private ArrayList<Student> students;               public void enrollStudent(Student newStudent)           {            students.add(newStudent);         }     }