title: Would be good to include your freelancer account in your Resume / CV when applying for a job?

text: I've been working as a **freelancer** for about two years in vWorker. Any person can visit a coder's profile, and see in how many projects the coder has worked on, (if the coders allows) see how much the coder obtained in each project, ratings, feedbacks, etc. Would be good to include a freelancer account in your Resume / CV when applying for a job?   Is it something you would do if you have finished several projects there?


title: Why do people put '\n' at the beginning of strings?

text: Very often I get into C code where `printf` format strings start with `\n`: printf( "\nHello" ); This in my opinion is an annoying thing that offers no advantages (rather many disadvantages!) with respect to printing `"Hello\n"`:   * If the first printed line begins with `'\n'`, program output will begin with a (useless) empty line   * If the last printed line doesn't end with `'\n'`, program output won't end with a new line (useful when reading the output on a terminal)   * On most terminals (on line buffered streams in general), output gets flushed when a `'\n'` is encountered, so a line not ending with `'\n'` could be shown on screen much time after it's been actually `printf`'d (or maybe never, if the stream never gets flushed, for instance if the program crashes) So, why do people does like this?


title: Scheme and Functional programming is to "Structure and Interpretation of Computer Programs" as Prolog and Logic programming is to what book?

text: I'm looking for some advice how to get started with Logic programming, and I am really enjoying working through the Scheme book "Structure and Interpretation of Computer Programs." Is there a similar book that is geared toward Prolog? Or, if there is a better language to study than Prolog for Logic programming I am interested in hearing your opinions on that as well.


title: Nested languages code smell

text: Many projects combine languages, for example on the web with the ubiquitous SQL + server-side language + markup du jour + JavaScript + CSS mix (often in a single function). Bash and other shell code is mixed with Perl and Python on the server side, `eval`ed and sometimes even passed through `sed` before execution. Many languages support runtime execution of arbitrary code strings, and in some it seems to be fairly common practice. In addition to advice about **security** and **separation of concerns** ,   1. what **other issues** are there with this type of programming,   2. what can be done to **minimize it** , and   3. is it ever **defensible** (except in the "PHB on the shoulder" situation)? **Edit:** To clarify, this is _not_ about using more than one language for the job - That's a _good thing_ for any but the simplest projects. The issue is mixing languages _in the same file_ , such as magic strings for SQL, Bash & Perl `eval`, and the like.


title: Learning C# quickly

text: I just got a position at a big, well-known C#/.NET company. The thing is that I don't know any C# or .NET at all (they know that) and I want to learn as much as I can before I start, to not waste time (and money). How do I learn C#/.NET quickly and efficiently? Resources? Great tutorials? Videos? EDIT: I forgot to mention that I have a couple of years experience with Java. So I am not new to programming - just new to .NET. UPDATE: Thank you for all your replies. I have ordered "Essential C# 4.0" and until then, I will go through some of the guides / tutorials and the general documentation at MSDN.


title: Should testers approve releases, or just report on tests?

text: Does it make sense to give signoff authority to testers? Should a test team   1. Just test features, issues, etc, and simply report on a pass/fail basis, leaving it up to others to act on those results, or   2. Have authority to hold up releases themselves based on those results? In other words, should testers be required to actually sign off on releases? The testing team I'm working with feels that they do, and we're having an issue with this because of "testing scope creep" -- the refusal to approve releases is sometimes based on issues explicitly not addressed by the release in question.


title: Continuous integration testing server: hosted, own desktop, or own server

text: For testing, I am planning to run a continuous integration testing. There are mainly two options: hosted, or own desktop/server. I will break it into 3 options I have:   1. Hosted:     * Economical, $10-20/month for a small app     * Less setup, the CI company manage all hardware and software   2. Desktop:     * I could just buy a simple, cheap desktop as a test server (about $500).   3. Used server:     * My current office is offloading some old Dell rack server (Probably dual core Xeon, which I can purchase for $50 or less Please advise me which best serves me for a small team of 2-3 developers. Thanks.


title: How are open source repositories managed for popular languages?

text: I'm a developer that creates Open Source code for a small language (LabVIEW), and am currently sharing this in several places. The vendor of LabVIEW has a certification process for Open Source libraries (mixed with commercial/closed libraries), but it's rather lengthy. I was wondering how more popular languages manage large repositories of libraries (for instance Debian, or python-works) of Open Source libraries, are those strictly controlled and monitored for quality or can anyone contribute?   * How would one set up the process for a centralized repository and accept incoming code?   * Are there different levels of quality/trustworthy?    * Is it allowed to rely on libraries outside the repository?


title: How do you organize your projects?

text: Do you have any particular style of organizing projects? For example, currently I'm creating a project for a couple of schools here in Bolivia, this is how I organized it:               TutoMentor (Solution)     TutoMentor.UI   (Winforms project)     TutoMentor.Data (Class library project)      How exactly do you organize your project? Do you have an example of something you organized and are proud of? Can you share a screenshot of the Solution pane? In the UI area of my application, I'm having trouble deciding on a good schema to organize different forms and where they belong. * * * **Edit:** What about organizing different forms in the .UI project? Where/how should I group different form? Putting them all in root level of the project is a bad idea.


title: How to Implement Complex Form Data?

text:
I'm supposed to implement a relatively complex form that looks like follows, but has at least four more pages requiring the user to fill in all necessary information for the tracks: ![](http://www.mediafire.com/convkey/b441/1hnp8lxbu49ar2ufg.jpg) This data will need to be sent to the server, which is implemented using Dropwizard. I'm looking for best practices on how to upload and send such a complex form with potentially dozens of songs to the server. The simplest available solution I have seen is a simple _multipart/form-data_ request with the following form schema (Source): Client
File Upload with Jersey
          <form action="rest/file/upload" method="post" enctype="multipart/form-data">
         Select a file : <input type="file" name="file" size="45" />
             <input type="submit" value="Upload It" />     </form>                     Server               @POST     @Path("/upload")     @Consumes(MediaType.MULTIPART_FORM_DATA)     public Response uploadTrack(final FormDataMultiPart multiPart) {         List<FormDataBodyPart> artists = multiPart.getFields("artist");              StringBuffer output = new StringBuffer();         for (FormDataBodyPart artist : artists)             output.append(artist.getValueAs(String.class));              List<FormDataBodyPart> tracks = multiPart.getFields("track");         for (FormDataBodyPart track : tracks)             writeToFile(track.getValueAs(InputStream.class), "Foo");              return Response.status(200).entity(output.toString()).build();     }      Then I have also read about file uploads via Ajax or Formdata (Mozilla HttpRequest) which allows for Posts in the formats _application/x-www-form- urlencoded_ , _multipart/form-data_ , or _text/plain_. I don't know which approach, if any, is best. An ideal solution would be to utilize Jackson to convert a json string into my data objects, but I don't get the impression that this is possible with binary data.


title: Dev Server vs Local Development

text: On the past 2 projects I've worked, teams prefer a local development environment over a development server. The one project lead stated that local was better since it didn't require an internet connection. But, this seems assumed when developing. Which is usually better?


title: Department organization of "source code", "projects", and "processes/work-instructions"?

text: How do you organize your software assets (source code and resources), your "active" and "past" projects, and your Software Department processes/work- instructions (including source code conventions, rules, and reviews process)? For example, one approach would be to use "Trac" with databases for "Software Assets" and "Software Process". Another would be to have databases for "Project A", "Project B", and "Software Process". Is your source code "by-project", or "by-all-in-department", or "by-product"?


title: How to design software when using BDD?

text: I'm working on a project right now and it's my first project using BDD. Up till now, the user stories have proven themselves a very valuable weapon to understand requirements and to specify the solution in a comprehensive, easy to understand language. My question is this: now that my user stories are complete, how do I design my solution? I understand that I derive behavior tests from my user stories, and I have to do UI design, but am I supposed to use good ol' UML? I'm under the impression that when using user stories, UML is left out; is this correct?


title: What is the first published reference to test-first programming?

text: I am rereading Refactoring by Martin Fowler. In Chapter 4, Building Tests, I came across the following passage. > In fact, one of the most usefull times to write tests is before you start > programming. When you need to add a feature, begin by writing the test. This > isn't as backward as it sounds. By writing the test you are asking yourself > what needs to be done to add the function. Writing the test also > concentrates on the interface rather than the implementation (always a good > thing). It also means you have a clear point at which you are done coding-- > when the test works. While I am an advocate of test-driven development now, I did not remember having been introduced to the concept when I originally read this book nearly 5 years ago. According to Amazon.com, this book was originally published on July 8, 1999. Is this the first published reference to test-first programming or is there something even earlier?


title: Preventing password hashing algorithm from overloading CPU

text: These days password hashing algorithms are designed to be slow. While it prevents black hats from guessing the password (at least partially), it also gives additional work for the server. I can imagine that, if someone wanted to make server run extremely slowly, they could simply send many log-in requests which would lead to many password hash calculations therefore dramatically increasing CPU usage. What is the common practice for preventing such attacks? And how is it called?


title: Sharing buffer between multiple threads

text: I had a job process that was executing a lot of IO to read and write temporary files.   Now I want to (need to) reduce the quantity of IO executions. So I want to create a sort of circular buffer that is going to be filled up with a data from a text file within first thread. The consumer (reading) thread will fetch data from this buffer. The problem is that there could be multiple consumers that need to read from same one buffer. For buffer implementation I prefer not to use any existing wrappers (simple array, where i just "play" with indices is enough). I also don't want to create a separate buffer for every reader. And ofcourse I want to avoid any deadlocks and unnecessary blockings. **UPDATE**   Right now I am using circular buffer (an array and 2 indices) The question is how to implement such buffer that can be accessed by multiple consumers where each consumer can read from it interdependently from other consumers (one costumer may read faster than the other one). **IMPORTANT UPDATE**   The first thread don't know (and should not know) about it's consumers!!! It should write data to a buffer, when data ends it should raise a flag.


title: When to start writing Exception Handling, Logging

text: When do you start writing your Exception Handling Code? When do you start writing Logging Statements. For the purpose of elaborating this question, let us assume that we are on .NET platform with log4net logging but feel free to answer in a generic way. Solution: A Windows Forms Project. Projects: UI, BusinessRules, DataHandlers So, do you go about writing your DataHandlers which does your Data Manipulations such as Create, Read, Update, Delete first. Then follow it up with your Business Rules And then your UI or any other permutation of the above. Test your Application for Functionality. And _then_ start writing your Exception Handling Code and _finally_ your Logging code? When is a right time to start writing your Exception Handling code? PS: In the book Clean Code, they say Write your **try-catch-finally** block first. That, prompted me to ask this question.


title: Services or Shared Libraries?

text: I work in an environment where we have several different web applications, where each of them have different features but still need to do similar things: authentication, read from common data sources, store common data, etc. Is it better to build the shared functionality into a set of services, to be called by the web apps, or is it better to make a shared library, which the webapps include? The services or libraries would need to access various databases, and it seems like keeping that access in a single place (service) is a good idea. It would also reduce the number of database connections needed. A service would also keep the logic in a single place, but then it could be argued that a shared library can do the same thing. Are there other benefits to be gained from using services over shared libraries?


title: Why Perl is appropriate language for CGI?

text: I heard many people around still saying Perl is great language for CGI. But i think it is not as much as popular as now growing languages such as Python, Ruby. Is there any solid reason for Perl still being the appropriate language for CGI.


title: Objects of different programming languages

text: Apparently, there are some resemblance between objects in JavaScript and dictionaries in Python. Each language defines an object a little different (and there is some logic that all definitions to be the same as in physics). How are objects alike and how do they differ between JavaSscript, Python and PHP?


title: How do you call one program from another?

text: What I'm wondering is how running programs communicate with each other, and if someone could post some sample code for how to do this, so I can try it out myself, just for educational purposes. For example, I've worked with databases before, and in my code I always have to "establish a connection to the database." The database service has to be running before I start my program, or else it will fail. What exactly is going on with that connection and how does it work?


title: Why was C# made with "new" and "virtual+override" keywords unlike Java?

text: In Java there are no `virtual`, `new`, `override` keywords for method definition. So the working of a method is easy to understand. Cause if _DerivedClass_ extends _BaseClass_ and has a method with same name and same signature of _BaseClass_ then the overriding will take place at run-time polymorphism (provided the method is not `static`).               BaseClass bcdc = new DerivedClass();      bcdc.doSomething() // will invoke DerivedClass's doSomething method.      * * * Now come to C# there can be so much confusion and hard to understand how the `new` or `virtual+derive` or new + virtual override is working. I'm not able to understand why in the world I'm going to add a method in my `DerivedClass` with same name and same signature as `BaseClass` and define a new behaviour but at the run-time polymorphism, the `BaseClass` method will be invoked! (which is not overriding but logically it should be). In case of `virtual + override` though the logical implementation is correct, but the programmer has to think which method he should give permission to user to override at the time of coding. Which has some _pro-con_ (let's not go there now). So why in C# there are so much space for _un_ -logical reasoning and confusion. So may I reframe my question as in which real world context should I think of use `virtual + override` instead of `new` and also use of `new` instead of `virtual + override`? * * * **EDIT** After some very good answers especially from Omar, I get that C# designers gave stress more about programmers should think before they make a method, which is good and handles some rookie mistakes from Java. Now I've a question in mind. As in Java if I had a code like               Vehicle vehicle = new Car();     vehicle.accelerate();      and later I make new class `SpaceShip` derived from `Vehicle`. Then I want to change all `car` to a `SpaceShip` object I just have to change single line of code               Vehicle vehicle = new SpaceShip();     vehicle.accelerate();      This will not break any of my logic at any point of code. But in case of C# if `SpaceShip` does not override the `Vehicle` class' `accelerate` and use `new` then the logic of my code will be broken. Isn't that a disadvantage?


title: Do Rails Join Models Get Controllers?

text: I have a rails app where my users can buddy up with other users. Since that relationship can have a status (approved/rejected/pending), I decided to go with a join model (`UserRelationship`) so now I have the attribute. To handle state for that join model, I have a controller (`UserRelationshipsController`) with actions/RESTful endpoints for changing the state of the relationship. Is this bad practice? If so, where should I handle state-changes for the relationship? In the User model?


title: Storing user uploaded images / files in multi server env

text: In a multi server system, e.g. a load balancer, multiple web servers and a database server, where do you store the files / images users upload when each web server will need access? Before now I've just used a single web server, or maybe one web server and a MySQL database server. But if you have multiple web servers I guess you have a range of options for making sure resources like images and other user files are shared, such as:   * Storing them on the database server   * Or a server specifically for them   * Maybe mounting the same directory   * Or using a tool like rsync to synchronize the user uploads directories on each web server Or maybe you have a different solution? or there's a de-facto way of doing this that I'm not aware of?


title: Find second largest element in a array?

text: The problem is to solve it in **n+logn−2** (base 2) no of comparisons. My algorithm is taking some extra space less then (O(n*n)). How can i reduce this extra space without increasing the complexity.                   comparisionarray=[][] (2D array )              //a function to find the largest.         findlargest(a,b)            if(len(a)==1 and  len(b)==1)               append b to array at ath index in comparisonarray.               append b to array at bth index comparisionarray.               return max(a,b)            else               return max(findlargest(1stHalfof(a),2ndHalfof(a)),findlargest(1stHalfof(b),2ndHalfof(b))              input= input_array()         largest=findlargest(1stHalfof(input),2ndHalfof(input))         subarray=[array at index largest in comparisionarray]         2ndlargest=findlargest(1stHalfof(subarray),2ndHalfof(subarray))         print(2ndlargest)      **Edit:** It can be done in minimum **n+logn−2** comparisons. That is the only condition . This answer on math.stackexchange.com proves it. It has been generalized for nth largest element Seems that there is a solution at this link stackoverflow. But i am not sure about the extra space and time complexity.


title: Using OpenID to log into multiple domains: Is this plan feasable?

text: For example:   * We're running a two community sites on two domains (call them `example.com` and `example.net`).   * We want to be able to expand that to more domains later.   * We want to allow multiple types of login (OpenID, Facebook, Twitter, standard username/password).   * We want someone who's logged into one site to automatically be logged into the other(s). In other words, it's a bit similar to the StackExchange network. In this case, would this plan work?   * Set up `example.com` and `example.net` (and any later additions) as OpenID relying parties, which accept OpenID login from `id.example.org` only.   * Set up `example.com` and `example.net` to do an OpenID reply-immediate request the first time you visit them, so that if you're logged into `id.example.org` you're immediately and automatically logged into the site you're visiting. They should set a cookie if you're not logged in, to save them doing this on every page request.   * Set up `id.example.org` as an OpenID provider and consumer. It should also consume Facebook and other identity providers, and allow standard username/password access. (Multiple login methods could be attached to one account.)   * On logout, simply change the authentication tokens in the database. The user will still have cookies, but they'll be meaningless. Thus can the user be signed out of all sites simultaneously. Multiple authentication tokens can be stored against one user at one time (and should be different for each site), so that the user can sign out in one browser but still be signed in in another. Signing out always signs out for all sites. The only problem I can see with the above is this:   * Someone visits `example.com`. A "not-logged-in" cookie is set.   * Zie then goes onto `example.net`. Ditto.   * Zie then signs in, and continues browsing on `example.net`.   * Zie then goes back to `example.com` and, because of the "not-logged-in" cookie, is not checked against `id.example.org` and is therefore not logged in.   * However, as soon as zie clicks the "log in" button, zie is logged in. I don't think this is a major problem. On the whole, I think it's a pretty good system. I'd just like to see it reviewed. Are there any problems I haven't foreseen? Would it be buggy or slow? StackExchange uses a very different method. I assume they have a good reason for that?


title: Passing data between hundreds of objects in java

text: Currently, I'm working with a group on building a model. This model simulates interactions between many "agents" in a region. Agents can be any entity such as a city, a farmer, a business etc. Each agent is represented by its own object within java. Each agent will need to be able to interact with all of the other agents, and therefore, needs to have access to information about the other agents. So, for example, lets say we have 1 city object interacting with 99 farmer objects. The city needs to know for instance, the total land that each of the 99 farmers owns in order to perform some sort of calculations. So, my question is, what is the most performance efficient way of completing something like this? There may even be 500-1000 or more agents in the future, and each agent may need to access many variables from the other agents. Would you potentially set up a table within mysql for each agent and have them access eachother's information that way? Or can something be set up directly within java that allows the agents to access each other's information. I'm looking to possibly multithread this model in the future too. In any case, I want the most performance efficient way of completing this.


title: Spec Writing Management

text: I simply cannot imagine writing software without a spec. No matter how sketchy or high level it is, spec is important to explain to the clueless programmers on what are the functionalities of the program. But the problem with spec is that it is somewhat a second class citizen in the whole software development cycle; when the development picks up the steam, it is neglected. But when dispute arises, the developers and testers and sales will scramble to find the spec to justify their grounds. Either one or more scenarios will happen:   1. The spec cannot be recovered, no one knows where is the spec    2. Different versions of the spec emerge from different sources; it takes great difficulties to find out which version is the latest version, or whether there _is_ a latest version available.   3. The spec is incomplete, some parts of the documents it refers to are missing. So spec management is important, and it's equally important that everyone has only One Single Source of Spec. How do you manage your specs? I tried to get everyone to use Google Docs but everyone objected. Everyone is just too attached and enamored with Microsoft Word, which is-- in their opinion-- very easy to use, very easy to insert image, very easy to type equation and whatnot. How to convince them that MS Word is just terrible for sharing?


title: How do I simplify a compiler/interpreter?

text: Recently I wrote an interpreter for operations on sparse matrices (a "sparse matrix calculator") in lex/yacc. The language is still very bare bones and doesn't even include control structures or parameterized subroutines, yet it is already at several thousand lines of code, and that's not including the matrix classes. In particular, the yacc file is close to two thousand lines in length. Because of this I'm finding it quite difficult to work on. Is this normal or is there a way I can simplify things? If you want to review my code, it can be found at: http://sourceforge.net/projects/msci/files/libpetey/


title: Where did the estimation rule of thumb originate that time spent will be one-third in each of the following: design, implementation, and testing?

text: I'm looking for a reference to the following. I commonly hear that one-third of a projects time will be spent in design, one-third in implementation, and one-third in testing. The three phases of development seems to be derived from the waterfall model. But, where did the time division originate (1/3, 1/3, 1/3)? Is there a paper or book that this is from?


title: Memory management scheme for custom memory allocator

text: I am in the process of implementing a small memory manager. The users of this memory pool will always access the memory bytes via handles. So a memory allocation/deallocation is done with two APIs:               Handle Allocate(size_t numBytes);     void Free(Handle handle);      The allocation/deallocation deals with opaque handles. To actually access the bytes, the user must then map/unmap the memory:               void * Map(Handle handle, int mappingFlags);     void Unmap(Handle handle, void ** ptr);      Mapping flags: are read-only, write-only and read-write. The average size of the memory blocks should be between 1KB to 1MB, with some eventual very big block in the neighbourhood of 10MB. The memory pool starts of as one big pre-allocate block. The manager must then handle variable size allocations. When the pool is depleted, the manager can try to ask the system for another big block. My questions: 1) I'm not sure which memory management scheme would be best employed in the scenario. 2) I think it would be possible to implement a memory defragmentation scheme, thanks to the handles. Am I right?


title: What is the appropriate approach to study an api when it is not well documented and there are no good tutorials around?

text: I am a student and I like to develop applications at my own level. While building an application I am the only one in my team. After analyzing the application I choose a library/api to use for the project. For example,these days I am working on a chat application based on XMPP protocol.For that I am using smack api. These third party api's are usually not very well documented nor they have good tutorials before one can start working with the api. These are unlike java api and other popular api's which are very well documented and there are very good tutorials to polish the concepts before one can actually start writing the code for the application. My point is, it takes me a lot of time to implement a simple concept when I am using api of the like of smack. For example it has been quite a time and I have been unable to make one user read another user's status ! There are still many problems. What kind of approach should I follow so that I could maximize my output ? The point is even not maximizing the output but understanding that how the api works.


title: Using a function's return value as an if condition, good practice?

text: Do you think it is a good practice to use function return values as if conditions? I'm coding in PHP atm but it holds for many other languages.               if(isTheConditionMet($maybeSomeParams))     {     }      or               $res = isTheConditionMet($maybeSomeParams);     if($res)     {     }      I can't think of a situation where the first one creates a problem, can it? EDIT: Assume return value is not going to be used after condition is evaluated.


title: How to present code in academic work?

text: Actually, I'm writing my undergrad thesis, that consists in analysing the BitTorrent algorithm and see its application on Transmission client as an example of implementation. Reading through its code, written in C, you can see many layers of functions               static const char*     tr_metainfoParseImpl (const tr_session  * session,                           tr_info           * inf,                           bool              * hasInfoDict,                           int               * infoDictLength,                           const tr_variant     * meta_in)     {       int64_t i;       size_t len;       const char * str;       const uint8_t * raw;       tr_variant * d;       tr_variant * infoDict = NULL;       tr_variant * meta = (tr_variant *) meta_in;       bool b;       bool isMagnet = false;            /* info_hash: urlencoded 20-byte SHA1 hash of the value of the info key        * from the Metainfo file. Note that the value will be a bencoded        * dictionary, given the definition of the info key above. */       b = tr_variantDictFindDict (meta, TR_KEY_info, &infoDict);       if (hasInfoDict != NULL)         *hasInfoDict = b;            if (!b)         {           /* no info dictionary... is this a magnet link? */           if (tr_variantDictFindDict (meta, TR_KEY_magnet_info, &d))             {             (...)      `tr_metainfoParseImpl()` is the function called after we add a .torrent by file or magnet link. It calls `tr_variantDictFindDict()` to find some string "info" somewhere in the metadata dictionary, in order to get information about that torrent file. Algoritmically, it has no value to me, since I want to emphasize other aspects of BitTorrent algorithm other than string search, although I want to leave its caller line there just to illustrate it's happenning. The function `tr_variantDictFindDict()` and its child are               bool // func1     tr_variantDictFindDict (tr_variant       * dict,                             const tr_quark     key,                             tr_variant      ** setme)     {       return tr_variantDictFindType (dict, key, TR_VARIANT_TYPE_DICT, setme);     }          static bool // func2     tr_variantDictFindType (tr_variant      * dict,                             const tr_quark    key,                             int               type,                             tr_variant     ** setme)     {       return tr_variantIsType (*setme = tr_variantDictFind (dict, key), type);     }      As we can see, although this may exist for code engineering reasons, algorithmically it has no value. So, I'm looking for reasonable, feasible, practical ways to avoid showing this kind of code in my work. Using the code above as an example, I thought some options:   1. put the relevant part of func1 caller function, showing the line calling func1, and after that showing func2 callee (in which will have the another relevant part of code.   2. putting func1 caller code and func2 callee "side by side", as if they were in one big function   3. literate programming from the beginning Please, feel free to share your experiences with this situation. Also, please change the SX site if needed, although I looked for the best SX site to ask this question and this one seemed legit.


title: When is the best time to do self learning in relation with software management?

text: It all started from here. I have been following Software Estimation: Demystifying the Black Art (Best Practices (Microsoft)). The third chapter says that in Software Management:   * You cannot give too much time to software developers, if you give it to them, then it is likely that extra time given to them will be filled by some other tasks (in other words, the developers will eat that time :)) Parkinson's Law   * You can also not squeeze the time from their schedule because if you do that, it is likely that they will develop poor quality product, poor design and will hurt you in the long run, there will be a panic situation and total chaos in the project, lots of rework etc. My question is related to the first point. If you don't give enough time then will the typical software engineer learn his/her skills? The market is always coming with new technologies, you need to learn them. Even with the existing familiar technologies there are always best practices and dos and don'ts.


title: Function points measure for a business applications framework. Is that possible?

text: So, my boss wants to have a complexity measure for a framework developed internally in our company. Is that possible? As far as I know, functions points do not apply to software that doesn't have persistence per se, and also doesn't have GUI's (it's a framework, built in C#, useful for crafting business applications, and it's used only internally). Also, function points tend to get less useful as the target software being assesed gets more complex. If it is possible to do this, could someone give me some guidance? If not, how do I convince my boss to stop asking this? Is there a better metric for valuing such a complex software?


title: How to design (just the outline) an enterprise class PHP application

text: For the last year or so, I have been working on a very large application. I am currently on version 17 of it, and every time, I start over with some of the code from before. But now, this is starting to become unmanageabley large. When I do the design for the application, I generally start with a Word document, outlining all the classes, with the functions, descriptions for each, their dependencies, default configuration data, and how each component augments the rest of the application. But with that method, within a few hours, I can easily reach 20-30 pages of documentation, and the nice simple outline of the software because so complex in itself, using that as the template to write the code to becomes difficult. So, now, I am trying to describe the application in an XML format, built on an XSD that contains the structure of how the classes will be laid out. But, this is also demonstrating its problems. At this stage, everything ahead of the base application has been designed (the database er diagrams, the functionality, etc), but the main problems lies in the design of the underlying software that runs it all. So, can anyone recommend what path I should go down, either with specific ways to lay out a Word document for easy reading, an XML pattern that would do the same, or some other software package that can do this for me and help guide me through the development? Any help would be greatly appreciated, mainly because once this part has been cracked, my application can finally be built and completed. Thanks


title: Can I use the concept of 'tags' (derived from StackExchange sites) in a personal project?

text: I have a small personal project that I expect will be viewed by, at most, about 5 people. 'Tags', as used on this site and StackOverflow, would be helpful. Can I explicitly use something called a Tag in my personal project where the purpose/function is essentially the same?


title: Why aren't more desktop apps written with Qt?

text: As far as I know and have understood in my experience with Qt, it's a very good and easy to learn library. It has a very well designed API and is cross- platform, and these are just two of the many features that make it attractive. I'm interested to know why more programmers don't use Qt. Is there a deficiency which speaks against it? Which feature makes other libraries better than Qt? Is the issue related to licensing?


title: Senior Interview LINQ questions

text: I'm preparing a LINQ section in interview questions for senior programmers. What are the most interesting questions in LINQ to include? And why?


title: Proper way to "say" Big-O notation?

text: What is the proper way to convey an algorithm complexity in Big-O notation in speech? Dose "the total number of operations is big oh of N log N" sounds strange? What's generally accepted: "It have "order log n" space complexity"? "It is guaranteed to run in n log n time"?


title: Recurring Problem - need instruction to run only once inside code which executes multiple times

text: Hello I find in programming I come across this problem usually (especially when dealing with certain frameworks) where I would like once piece of code to execute once and only once however the provided method e.g (something like an onComplete function) that I wish to place this instruction in will in reality execute multiple times. I am just wondering does anybody know of the best way that would get around this problem, one programmer friend of mine told me to use a flag (boolean) to check whether or not this code has already run but I feel like this is not a suitable solution and I would not like to introduce global variables for the sake of checking a condition once and only once. Has anybody ever come across a problem like this before, I am wondering is there any good practice out there to keep in mind when dealing with code like this. Thanks


There is a module in our telecoms equipment which is written in C. I think the code in this module has a bad smell because it has a number of symptoms:   * When new features are added to this module, some original features go wrong. And some weird problems were finally orientated to the buffer overflow of this module.   * It is difficult to add new code to the module. Although the unit tests and integration tests covers new code, errors and flaw concealed in the original code come to the surface.   * By means of code review, we found the quality of the code is extremely bad. But the module was tested for many rounds, the errors concealed in the surface of the code were found by the QA engineers. Other problems hidden deeper were difficult to find. _as well as a virus in the body._ (easy to bring misunderstanding, delete it) We summarize the status quo lay in these reasons:   * The original code has corrupted because of the loose process monitoring, in fact, many self testings are ignored or partial executed.   * The first programmer of this module was lack of the programming ability and the team leader didn't find the problem and risk in time.   * Many improvement approaches stay in the plan phase due to the team leader's suspicion. The project came to a new version. Some team leaders want to change this situation and we discussed the procedure many times. Everyone has agreed to revise the module but we have to decide between:   * rewriting the module. It means throwing all the code of the module to the trash can and rewriting the code without changing its interface.   * refactoring the module. This means one step at a time. we need retain all the code at the beginning and build a solid set of tests for the code. Then we dig into the code and revise a small piece of it, and relying on the tests to tell us whether we introduce a bug. This process is repeated until the refactoring complete. I agree with rewriting because we already have some rewriting experiences in our systems which were proven to be the best choices. The project manager wishes to refactor the module on account of the limited time available required to complete the detailed design, coding, code review, unit tests and integration testing which is three months. He thinks the time scales are too tight to do a full rewrite. Should this code be rewritten or refactored? EDIT: As Joel said in Things You Should Never Do, Part I > The idea that new code is better than old is patently absurd. I agree with this viewpoint. But I have some puzzles that some rewriting cases in our project proved to be wise choice. Maybe it relies on the new programmer who is more outstanding than the previous programmer or the testing is more sufficient.


title: To Gather Requirements, from those who don't want to give time for interviewing?

text: Actually, I'm A Fresh CS graduate,who want to build a System for his Dad's Road Transport business. However,the issue is whenever I go to ask to him about : what are people involved in his business? whats their routine work? or how their business actually works? then he avoids my questions, and says, just give me system by utilizing your knowledge, to ease my transporting business,and rest all you think. So, I had brainstormed about it, but I still feel the need of viewpoint of my dad,as he is actually in that business. Hence, how can I get business requirements form him ?


title: A place for putting code samples in projects

text: Every now and then I get or write some minimal code samples to achieve tasks. What's the usual practice for storing these samples (which could prove useful later on) ? Have a separate source folder or create a separate project ?


title: Design question on best option to store data on remote computers

text: I'm making a windows forms application which I want to install on a few computers that are all connected together on a network. Each of these computers have access to a number of servers on which various tasks are carried out etc. I want each instance of the application in use to be able to store and retrieve data regarding the separate remote servers (this data can be edited by everyone using the application on their computer). The application needs to be able to retrieve data from the servers when the user clicks an update button. The user can then edit and update that data if necessary. I think the main options for storing the data are as follows:   * Store data all in one place in a database   * Have a folder on each of the servers and save XML files to it with the data Which would be the best approach in this scenario and why? Are there any better alternatives? Note: I would usually opt for the database approach but I want to store data in an alternative way because using a database would require selecting one of the servers to host the database, which doesn't make sense as to which one would have that stored on it and not the other servers, albeit only one database would be needed by the application.


title: What does "extreme" in "extreme programming" (XP) refers to?

text: "Extreme" suggests that it has very different from normal, very aggressive, exceeding limits, but in my opinion regular releases, pair programming, unit testing, collaboration with customers are quite normal and acceptable. What does extreme mean?


title: RESTful API Call Method Names, C#

text: I am working on some old code that works with a REST api in c#. The method names (what method to invoke on the API side) is being passed in as hard-coded strings. Would a static class be the best solution to force the user to pass in values that I want (so they don't make a mistake and mistype something, etc)?


title: What are some ways to be more productive with Emacs?

text: I've used Emacs quite a bit, and I'm comfortable with the most basic commands/shortcuts, but I know Emacs has a lot more to offer than what I'm using. What are some of the lesser known features of emacs that can help me become a more productive programmer?


title: Why are Java servers so scarce and costly?

text: I think "why PHP over Java" has been already discussed in other questions, the question I have is: What makes LAMP/WAMP stacks so cheap and abundant vs a Glassfish one? What are the prime factors behind this trend? Also, Why has no java based light weight stack come up as a competitor?


title: How should I organize a file with many functions in it?

text: I am writing a web app using PHP and JQuery. I have a file full of functions to access the database. I have function names like `createUser`, `createRole`,`getUserByLogin`, `setSOMETHING`... Is there an accepted convention, or a compelling reason to choose how to organize this file? (alpha by name, grouped by creators, getters, setters..., by the table they reference,...)


title: How to use Blend sample data as real data?

text: I am trying to do some design in Blend 4. The sample data function of Blend is nice to have during design time, but it could be much more better to see the design in browser. Can anyone help me to use sample data created by Blend as real data (see same data in browser) also ? Thanks in advance.


title: Best thing to do about projects supporting multiple versions of Visual Studio?

text: I have an open source project that works on .Net 2.0 and up. The thing is though that I prefer to use Visual Studio 2012, which forces the solution and project files to only work with VS2010/2012. What exactly should I do? I don't want for my users to have to create a solution from scratch if they don't have access to VS2010, but yet, I also don't want to attempt to keep 3 different project files in sync(VS2005, VS2008, and VS2010/2012) What is the usual solution for this?


title: Justifying deficiencies in design

text: I would like some input on how to handle clients and third party vendors that ask me about the deficiencies in my design. For example. It turns out I need a data field in a webservices response. This response has been signed off on weeks ago and I get questions like " _Why haven't you identified this field X weeks ago?_ ". Of course the answer is that all software development is iterative and this requirement wasn't on my radar at that point in time. I'm not prescient. I would like a business-y way of deflecting these questions. Any advice? **Update** : To clarify, this shortcoming is completely on me. How do I then own up to this mistake cleanly, without sounding too apologetic?


title: Why can't a compiler avoid importing a header file twice by its own?

text: New to C++! So I was reading this: http://www.learncpp.com/cpp- tutorial/110-a-first-look-at-the-preprocessor/ > **Header guards** > > Because header files can include other header files, it is possible to end > up in the situation where a header file gets included multiple times. So we make preprocessor directives to avoid this. But I'm not sure - why can't the compiler just... **not** import the same thing twice? Given that header guards are optional (but apparently a good practice), it almost makes me think that there are scenarios when you do want to import something twice. Although I can't think of any such scenario at all. Any ideas?


title: Why doesn't Python have a "flatten" function for lists?

text: Erlang and Ruby both come with functions for flattening arrays. It seems like such a simple and useful tool to add to a language. One could do this:               >>> mess = [[1, [2]], 3, [[[4, 5]], 6]]     >>> mess.flatten()     [1, 2, 3, 4, 5, 6]      Or even:               >>> import itertools     >>> mess = [[1, [2]], 3, [[[4, 5]], 6]]     >>> list(itertools.flatten(mess))     [1, 2, 3, 4, 5, 6]      Instead, in Python, one has to go through the trouble of writing a function for flattening arrays from scratch. This seems silly to me, flattening arrays is such a common thing to do. It's like having to write a custom function for concatenating two arrays. I have Googled this fruitlessly, so I'm asking here; is there a particular reason why a mature language like Python 3, which comes with a hundred thousand various batteries included, doesn't provide a simple method of flattening arrays? Has the idea of including such a function been discussed and rejected at some point?


title: Which one is more reliable in a large project, COCOMO or FP?

text: I have estimated the cost of a product by COCOMO, then I estimated it by FP too. the results were so different from each other! The cost estimated by FP was about two times more than the estimated cost by Cocomo. which one is more reliable as this product belongs to a large project. shoud I skip the FP result?


title: Good continuous-integration solutions for Haskell projects

text: I am looking for a good CI solution for a haskell project. Ideally something that will work with git. Really basic need (so far) build and run tests after each check in. Some basic reporting would be great too, but it does not need to be anything real fancy. It should also support running javascript tests in a browser. (via Selenium or the like) What have people been using for this?


title: Simplified Interfaces or Object Abstraction

text: i've been facing a common situation at work that has happened quite often when handling objects. The situation goes like this: You have to realted classes A and B, class A has an instances of class B. Now, imagine that we want to call methodB of class B, but we only have access to an intance of class A. What's the best approach to this situation and why:               Ainstances->getClassBInstance()->methodB();      or               Ainstances->methodB()      where methodB is implemented as follows:               function methodB()     {       return self.getClassBInstance()->methodB()     }


title: Struggling as a programmer. Need some advice

text: I've been a developer now for a number of years. I'm pretty good at what I do and can "get the job done". But, there is a difference between "getting the job done" and "doing the job properly". Let's use an example. Recently I developed a web site from scratch. The website runs fine and I've had no issues. Looking through the code I thought to myself that I could have done it better. I could have cut down on my MySQL queries. I could have used MVC making it easier to extend (it does need extending now). I decided to rewrite the project using CodeIgniter. I like the framework. But I then got sidetracked because to cut down on my MySQL queries I had to learn advanced joins. And this is the problem. Whenever I do a job properly I'm in a constant learning wheel. And topics such as advanced MySQL joins take time to learn, and then time to implement. I don't work for a company. I do everything alone. So I'd imagine if I was working as a PHP developer for a company there would be separate teams handling the SQL. Being solo it's difficult. And sometimes, although my knowledge is advanced I find myself asking question, after question. I probably have a lot of pride in my work. But if I had to work for a company handling complete projects I could imagine projects taking a while because I'd have to learn more and more to satisfy my pride and to ensure I'm doing things "correctly". I do plan on getting a job after the new year. I need the job security. Which is why I'm asking this question. What advice can you give in terms of self development and self improvement? Should I worry less? Or maybe look for a job as a PHP developer when I won't be handling SQL queries directly?


title: Reference wind directions to texture space?

text: I have a 2D array filled with a simple class:               class Tile     {         boolean N,E,S,W;     }      I also have a tilesheet representing all possible outcomes except all false (12 + crossroad). Now i need to reference all these possibilities to texture space on my sheet. Apart from having an if statement for each and every outcome is there a more efficient way i cannot currently think off?


title: How is dependency inversion related to higher order functions?

text: Today I've just seen this article which described the relevance of SOLID principle in F# development- F# and Design principles – SOLID And while addressing the last one - "Dependency inversion principle", the author said: > From a functional point of view, these containers and injection concepts can > be solved with a simple higher order function, or hole-in-the-middle type > pattern which are built right into the language. But he didn't explain it further. So, my question is, how is the dependency inversion related to higher order functions?


title: How to provide SaaS integration with enterprise systems (from the SaaS provider perspective)?

text: I'm doing some general research for a potential SaaS project. The solution we are considering creating will need data integration capabilities with various enterprise systems. I understand that SaaS adds complexity to enterprise integration since it lives in the cloud and outside of the firewall. I've read a few articles that describe approaches for enterprises to integrate data with SaaS solutions. Integration approaches range from the primitive FTP transfers, custom point to point integration, to a vast and growing range of commercial solutions (appliance, cloud-based, and EAI). These articles are focused on the customer perspective. In other words they are intended to help enterprises better understand their options for integrating with SaaS providers. **Can anyone provide some insight and advice from the SaaS provider perspective when it comes to making their solution as easily integratable as possible?** I assume the SaaS provider needs to create and publish web services API's and RESTful interfaces. Any other advice or resources would be most appreciated. PS: I realize saying "need to integrate with various enterprise systems" is incredibly vague.


title: Resources for CSQA Exam

text: This year I'm basically going to attend for the Certified Software Quality Analyst (CSQA) examination. I'm attending the classes for it, even though I'm reading the books and notes provided by the teachers, I need to know some good resources for CSQA examination. The resources that will be provided will be good if it contains some tips, the way they ask question, and it will act as a good CSQA examination references. Thanks in advance..


title: Should an object update itself?

text: I'm working on Ruby on Rails. There is a feature in our app where doctors can "claim" cases for themselves. I can either have the doctor perform the action and update the plate, or I can have the doctor send itself to the plate and have the plate update itself. Should objects update itself? It just seems cleaner to me, but I'm not sure. Or maybe I'm overthinking? First case, doctor only:               def claim(plate)       plate.claimed = true       plate.doctor_id = id       plate.save     end      This is the second case (doctor sends itself to the plate):                 #doctor       def claim(plate)         plate.claimed_by(self)       end            #plate       def claimed_by(doctor)         self.claimed = true         self.doctor_id = doctor.id         self.save       end


title: How to create a Semantic Network like wordnet based on Wikipedia?

text: I am an undergraduate student and I have to create a Semantic Network based on Wikipedia. This Semantic Network would be similar to Wordnet(except for it is based on Wikipedia and is concerned with "streams of text/topics" rather than simple words etc.) and I am thinking of using the Wikipedia XML dumps for the purpose. I guess I need to learn parsing an XML and " _some other things_ " related to NLP and probably Machine Learning, but I am no way sure about anything involved herein after the XML parsing.   * Is the starting step: XML dump parsing into text a good idea/step? Any alternatives?   * What would be the steps involved after parsing XML into text to create a functional Semantic Network?   * What are the things/concepts I should learn in order to do them?   * I am not directly asking for book recommendations, but if you have read a book/article that teaches any thing related/helpful, please mention them. This may include a refernce to already existing implementations regarding the subject. Please correct me if I was wrong somewhere. Thanks! EDIT: The final product should be like a complete Semantic Network (like Conceptnet or Cyc etc.), So I can't use things like Semantic Mediawiki. (On a second thought, it seems like I should have asked this question on linguistics and not here... )


title: How do functional languages handle a mocking situation when using Interface based design?

text: Typically in C# I use dependency injection to help with mocking;               public void UserService     {       public UserService(IUserQuery userQuery, IUserCommunicator userCommunicator, IUserValidator userValidator)       {         UserQuery = userQuery;         UserValidator = userValidator;         UserCommunicator = userCommunicator;       }            ...            public UserResponseModel UpdateAUserName(int userId, string userName)       {          var result = UserValidator.ValidateUserName(userName)          if(result.Success)          {            var user = UserQuery.GetUserById(userId);            if(user == null)            {               throw new ArgumentException();               user.UserName = userName;               UserCommunicator.UpdateUser(user);            }          }          ...       }            ...     }          public class WhenGettingAUser     {       public void AndTheUserDoesNotExistThrowAnException()       {          var userQuery = Substitute.For<IUserQuery>();          userQuery.GetUserById(Arg.Any<int>).Returns(null);          var userService = new UserService(userQuery);          AssertionExtensions.ShouldThrow<ArgumentException>(() => userService.GetUserById(-121));       }     }      Now in something like F#: if I don't go down the hybrid path, how would I test workflow situations like above that normally would touch the persistence layer without using Interfaces/Mocks? I realize that every step above would be tested on its own and would be kept as atomic as possible. Problem is that at some point they all have to be called in line, and I'll want to make sure everything is called correctly.


title: Security using jsonp

text: I'm writing an app that will make available a set of api functions that require cross site scripting to work. I'll be utilizing jsonp which will allow other developers to consume these services for their web applications.   * What security concerns should I consider to protect my server data?   * What security concerns should other developers take when consuming my services via jsonp?


title: Are there standard strategies for defining job flow and dependencies?

text: I'm working on a project that involves the chaining of separate jobs into a single master job, though there may be parallel paths in the chain leading up to the final output. Job and chain details will be stored in a database. Eventually what I want to end up with is a GUI in which blocks representing the individual jobs can be moved around and chained up, with the system definition stored in the DB for execution. This will be implemented as C# on top of SQL Server. I don't want to reinvent the wheel if I can help it. I'm certain there must be some good patterns out there, particularly for how to represent the flow and dependencies in DB tables, but have been unable to find anything that fits the bill. More than anything, I'm curious if there are any effective schemas people have used to define the jobs, dependencies, etc. Does anyone know of any commonly used strategies?


title: iOS developer interview question doubts

text: How deep should an iOS developer review data structure & algorithm when preparing for iOS job interview position? I know most people would just say there's no harm in reviewing it, but would like to get some insights based on your experience interview what are the percentage of the questions are related to data structure/algorithm and what percentage are iOS related?


title: Should I learn low-level principles if I plan to develop in high-level languages?

text: I am entering university next month and have some exemption exams today. One of which is Computer Organization: things like Boolean Algebra, Gates (AND, OR, NOT etc), Assembly Language are taught. I wonder why learn such low level stuff. Does it benefit me as a programmer, likely developing in much higher level languages like C#, Python, PHP etc?


title: Decoupling classes from the user interface

text: What is the best practice when it comes to writing classes that might have to know about the user interface. Wouldn't a class knowing how to draw itself break some best practices since it depends on what the user interface is (console, GUI, etc)? In many programming books I've come across the "Shape" example that shows inheritance. The base class shape has a draw() method that each shape such as a circle and square override. This allows for polymorphism. But isn't the draw() method very much dependent on what the user interface is? If we write this class for say, Win Forms, then we cannot re-use it for a console app or web app. Is this correct? The reason for the question is that I find myself always getting stuck and hung up on how to generalize classes so they are most useful. This is actually working against me and I'm wondering if I'm "trying too hard".


title: Why we don't import a package while we use String functions?

text: I asked myself why we didn't import a package while we use String functions such as `toUpperCase()`? How they get in there without importing packages?


title: What's the difference between a solution and platform architect?

text: I'm having trouble finding any information regarding the job title "platform architect". What is the difference between it and a solution architect?


title: Exposing business logic as WCF service

text: I'm working on a middle-tier project which encapsulates the business logic (uses a DAL layer, and serves a web application server [ASP.net]) of a product deployed in a LAN. The BL serves as a bunch of services and data objects that are invoked upon user action. At present times, the DAL acts as a separate application whereas the BL uses it, **but is consumed by the web application as a DLL**. Both the DAL and the web application are deployed on different servers inside organization, and since the BL DLL is consumed by the web application, it resides in the same server. The worst thing about exposing the BL as a DLL is that we lost track with what we expose. Deployment is not such a big issue since mostly, product versions are deployed together. Would you recommend migrating from DLL to WCF service? If so, why? Do you know anyone who had a similar experience?


title: Are big IT companies continuously firing or continuously expanding?

text: Today I just received my (almost-daily) mail from a big company career automated job search like the following:               Based on your search criteria the following openings are now available:     * Senior Software Engineer II - based in NY     * Principal Software Architect - based in NJ     * Software Engineer - based in LA      and I wondered: how come I'm receiving these ads so often? It doesn't seem they're always the same so (at least apparently) it doesn't seem they're always sending me the same jobs. Are big IT companies like this one firing people continuously, are they continuously expanding or are people continuously leaving from there (and in that case how come **that** many people are leaving)?


title: What exactly happens on a LAMP machine when I request a php file?

text: I am a .NET developer who has recently started working in a LAMP environment. I know that if I go to `www.somedomain.com/files/test.php`, then (1) DNS resolves the URL to my server (2) my server handles the request on a given port (3) the server looks in /files/test.php and somehow runs test.php and returns the output of the file to the client. But it would be really great to understand this process in much more detail. For instance, does Apache/nginx actually run the php file or does it pass it to the php interpreter? Does every php file run every time or does the server cache its output? It would be really helpful to know the major details/decisions that a LAMP environment makes during this process. Kind of like this answer, which explains in detail how SSL works... http://security.stackexchange.com/questions/20803/how-does-ssl- work/20847#20847


title: How to organize a Coding Dojo?

text: Over on stack overflow it was asked how to organize a coding dojo (http://stackoverflow.com/questions/4338567/how-to-organize-a-coding-dojo- event). I believe that may have been the wrong forum... I wonder the same thing: how is a Codeing Dojo organized? What is the structure of a meeting? How would one pick Katas? What do you plan ahead of time? I am interested in any ideas on this as well as links to any resource that may be outlining this.


title: How to get a legal advice for a open source project ?

text: I have a question about open source software. **Questions:** Where do you get legal advice from? Do you have to find a lawyer specialised in software issues right from the bat, or do you get legal advice from lawyers that may join the community later on? Is there any other way a newly created open source organization may seek advice on legal issues?


title: When to switch to mobile programming?

text: We're a team of developers working on some PC applications. But we have also witnessed a trend in the market towards writing more and more mobile sites and mobile applications. Is it time for developers to shift to mobile programming?


title: Designing a single look up entity

text: In almost every application you have this look up entity that provides a dynamic references. This are things like type, category, etc. These entities will always have               id, name, desc      So at first I designed different entities for each look up. Like               education_type, education_level, degree_type....      But on a second thought I decided to have on entity for each of these kinds of entities. But when I am done with the design and check the relation this entity will be referenced by almost all entities in the system and I don't believe that is appropriate. So What is your take on this? Can you give me some clear pros and cons?


title: Do activity diagrams always end in one endpoint?

text: For example an activity diagram for a simple program:   1. Get User data.   2. If User Exists DO something, ELSE do nothing.   3. End. I often see diagrams with multiple endpoints but also with just one. Should activity diagrams merge both ways to one final state, regardless of the previous paths?


title: Should we hire someone who writes C in Perl?

text: One of my colleagues recently interviewed some candidates for a job and one said they had very good Perl experience. Since my colleague didn't know Perl, he asked me for a critique of some code written (off-site) by that potential hire, so I had a look and told him my concerns (the main one was that it originally had no comments and it's not like we gave them enough time). However, the code works so I'm loathe to say no-go without some more input. Another concern is that this code basically looks exactly how I'd code it in C. It's been a while since I did Perl (and I didn't do a lot, I'm more a Python bod for quick scripts) but I seem to recall that it was a much more expressive language than what this guy used. I'm looking for input from real Perl coders, and suggestions for how it could be improved (and why a Perl coder _should_ know that method of improvement). You can also wax lyrical about whether people who write one language in a totally different language should (or shouldn't be hired). I'm interested in your arguments but this question is primarily for a critique of the code. The spec was to successfully process a CSV file as follows and output the individual fields:               User ID,Name , Level,Numeric ID     pax, Pax Morgan ,admin,0     gt,"  Turner, George" rubbish,user,1     ms,"Mark \"X-Men\" Spencer","guest user",2     ab,, "user","3"      The output was to be something like this (the potential hire's code actually output this):               User ID,Name , Level,Numeric ID:        [User ID]        [Name]        [Level]        [Numeric ID]     pax, Pax Morgan ,admin,0:        [pax]        [Pax Morgan]        [admin]        [0]     gt,"  Turner, George  " rubbish,user,1:        [gt]        [  Turner, George  ]        [user]        [1]     ms,"Mark \"X-Men\" Spencer","guest user",2:        [ms]        [Mark "X-Men" Spencer]        [guest user]        [2]     ab,, "user","3":        [ab]        []        [user]        [3]      Here is the code they submitted:               #!/usr/bin/perl          # Open file.          open (IN, "qq.in") || die "Cannot open qq.in";          # Process every line.          while (<IN>) {         chomp;         $line = $_;         print "$line:\n";              # Process every field in line.              while ($line ne "") {             # Skip spaces and start with empty field.                  if (substr ($line,0,1) eq " ") {                 $line = substr ($line,1);                 next;             }                  $field = "";             $minlen = 0;                  # Detect quoted field or otherwise.                  if (substr ($line,0,1) eq "\"") {                 $line = substr ($line,1);                 $pastquote = 0;                 while ($line ne "") {                     # Special handling for quotes (\\ and \").                          if (length ($line) >= 2) {                         if (substr ($line,0,2) eq "\\\"") {                             $field = $field . "\"";                             $line = substr ($line,2);                             next;                         }                         if (substr ($line,0,2) eq "\\\\") {                             $field = $field . "\\";                             $line = substr ($line,2);                             next;                         }                     }                          # Detect closing quote.                          if (($pastquote == 0) && (substr ($line,0,1) eq "\"")) {                         $pastquote = 1;                         $line = substr ($line,1);                         $minlen = length ($field);                         next;                     }                          # Only worry about comma if past closing quote.                          if (($pastquote == 1) && (substr ($line,0,1) eq ",")) {                         $line = substr ($line,1);                         last;                     }                     $field = $field . substr ($line,0,1);                     $line = substr ($line,1);                 }             } else {                 while ($line ne "") {                     if (substr ($line,0,1) eq ",") {                         $line = substr ($line,1);                         last;                     }                     if ($pastquote == 0) {                         $field = $field . substr ($line,0,1);                     }                     $line = substr ($line,1);                 }             }                  # Strip trailing space.                  while ($field ne "") {                 if (length ($field) == $minlen) {                     last;                 }                 if (substr ($field,length ($field)-1,1) eq " ") {                     $field = substr ($field,0, length ($field)-1);                     next;                 }                 last;             }                  print "   [$field]\n";         }     }     close (IN);


title: Where can I host my JSP+Java Web application?

text: My web application is currently written in JSP/Java, using an Oracle DB. I develop on Windows, and I use JDeveloper (Oracle's eclipse clone) and I use JDev's integrated WebLogic Server. I want to go live using a respectable Web hosting company. LAMP devs get all the girls, I'm stuck using WWOJ (Windows Weblogic Oracle Java). I can't find any hosts that use Oracle, and ones that run Tomcat are few and far between (short of a custom box on RackSpace). I'm switching to MySQL this week. I'm running Tomcat on my Windows box now, and using NetBeans. I can compile a .war now. I'm finally up to WTMJ :) Does anyone have experience with getting a Java project hosted? Or something with an Oracle backend? I feel like I'm lost out here.


title: Why do some compilers generate direct machine code?

text: I was taking this course - CMU 18-447, Computer Architecture at Carnegie Mellon to brush my knowledge and concepts. They say that most of the machine level details and implementations is taken care at the Instruction Set Architecture(ISA) level and is abstracted at that level. Some Intel processors even have hardware level translation layers that take the front level ISA that is exposed to the programmer and translate them further closer to the machine. Given such power is provided by the ISA/Processor itself, why do compilers generate direct machine code, or is it just a black box and internally it uses assemblers to convert them into direct machine code? I hear that JVM takes byte code and translate them directly to machine code(exe).Is this true or is my understanding wrong here?


title: Maximum tcp port number constant in java

text: Is there a public constant for the maximum TCP port number (65535) defined in java or a common library such as Apache Commons, that I could refer to from my code (instead of using the integer hardcoded)?


title: Embedded Tomcat Cluster

text: Can someone please explain with an example how an Embedded Tomcat Cluster works. Would a load balancer be necessary? Since we're using embedded tomcat, how would two separate jar files (each a standalone web application with their own embedded tomcat instance) know where eachother are and let eachother know their status, etc? Here is the code I have so far which is just a regular embedded tomcat without any clustering which would formulate one of the jar files mentioned above:               import javax.servlet.ServletException;     import javax.servlet.http.HttpServlet;     import javax.servlet.http.HttpServletRequest;     import javax.servlet.http.HttpServletResponse;     import java.io.File;     import java.io.IOException;     import java.io.Writer;          public class Main {            public static void main(String[] args)       throws LifecycleException, InterruptedException, ServletException {         Tomcat tomcat = new Tomcat();         tomcat.setPort(8080);              Context ctx = tomcat.addContext("/", new File(".").getAbsolutePath());              Tomcat.addServlet(ctx, "hello", new HttpServlet() {           protected void service(HttpServletRequest req, HttpServletResponse resp)            throws ServletException, IOException {             Writer w = resp.getWriter();             w.write("Hello, World!");             w.flush();           }         });         ctx.addServletMapping("/*", "hello");              tomcat.start();         tomcat.getServer().await();       }          }      Source: java dzone


title: Do any languages use =/= for the inequality operator?

text: Wikipedia says: > **Not equal** > > The symbol used to denote inequation — when items are not equal — is a > slashed equals sign "≠" (Unicode 2260). > > Most programming languages, limiting themselves to the ASCII character set, > use ~=, !=, /=, =/=, or <> to represent their boolean inequality operator. All of these operators can be found in this table, apart from `=/=`. I can find this equals-slash-equals used as a way of formatting ≠ in plaintext but not in any programming language. Has `=/=` been used as the inequality operator in any programming language?


title: How to process an endless XML data stream

text: There is an **endless data stream of XML messages** (and "heartbeats"), that I receive via a telnet connection and through a site-to-site VPN IPsec tunnel. I'm still pondering. **What is the best/most elegant solution to process the XML messages without losing any data, without redundance and with a (nearly) constant processing time?** A never-ending process/script? Writing the stream in file(s) and processing it/them periodically step by step? Or something completely different? The messages usually come every few seconds. Sometimes every second. Sometimes maybe every 10 seconds. It differs but not a lot. One XML message within the stream contains 45 rows. The messages should be stored afterwards. Note: The concrete structure of the XML messages and the infrastructure of the participating systems are negligible in my opinion.


title: What is the value of a let expression

text: From what I understand, every code in f# is an expression, including `let` binding. Say we got the following code:               let a = 5     printfn "%d" a      I've read that this would be seen by the compiler as               let a = 5 in     (          printfn "%d" a     )      And so the value of all this would be value of inner expression, which is value of `printf`. On the other hand, in f# interactive:               > let a = 5;;     val a : int = 5      Which clearly indicates that the value of let expression is the value bound to the identifier. **Q: Can anyone explain what is the value of a let expression? Can it be different in compiled code than in F# interactive?**


title: Global Texture Container

text: For my first large-ish endevor in Open-GL I'm making a simulator of sorts. I've got much of the basic functionality working, but recently ran into a problem. As I've since realized, I originally designed the program so that each object in the simulator had its own class which stored its position, texture, draw code, etc. This became a problem, however, when I began creating lots of objects of the same type, as I quickly realized that I wrote the classes to reload a new instance of the texture data for each instance of an object. To fix this I considered making a simple texture database class of sorts which would contain a pointer to a single instance of each objects texture data that each instance of the object would copy upon its creation. The problem here is that lots of different classes in the simulator create objects and I am hesitant to simply store the texture database class at the top of the program hierarchy and pass it down to every function that creates an object, as I feel that this will get very complex very fast. Instead I feel it would be better to have a global container class that would keep track of the texture pointers, but I'm not sure how I could store the pointers without instantiating an instance of the container which would require passing it all over the place. I'm hoping that there is a more elegant and simple solution that I'm overlooking, otherwise I'll try the way I've described. Alternatively, if it seems some restructuring of the simulator would be best, that isn't out of the question, but I'd appreciate any advice.


title: Mobile-first implementation or desktop-first?

text: When working with CSS media queries, I am unsure of whether I should program in a mobile-first style, or a desktop-first style. For example, let's say I'm given a design that consists of a set of blocks that are side-by-side. On desktop, I'll stick to spec, but on mobile, given the reduced screen area, two blocks stacked on top of one another would be better. Which is better, this (desktop-first):               div {         width: 50%;         display: inline-block;     }          @media all and (max-width: 600px) {         width: 100%;         margin: 0 auto;         display: block;     }      or this (mobile first)?               div {         width: 100%;         margin: 0 auto;         display: block;     }          @media all and (min-width: 600px) {         width: 50%;         display: inline-block;     }      Wordpress' latest theme follows the mobile-first method, by using `min-width`, but am I correct in assuming that older browsers without media query support would be unable to parse these directives, and load the "mobile" css? What are the advantages/disadvantages of both?


title: code contracts/asserts: what with duplicate checks?

text: I'm a huge fan of writing asserts, contracts or whatever type of checks available in the language I'm using. One thing that bothers me a bit is that I'm not sure what the common practice is for dealing with duplicate checks. Example situation: I first write the following function               void DoSomething( object obj )     {       Contract.Requires<ArgumentNullException>( obj != null );       //code using obj     }      then a few hours later I write another function that calls the first one. As everything is still fresh in memory, I decide not to duplicate the contract, since I know that `DoSomething` wil check for a null object already:               void DoSomethingElse( object obj )     {       //no Requires here: DoSomething will do that already       DoSomething( obj );       //code using obj     }      The obvious problem: `DoSomethingElse` now depends on `DoSomething` for verifying that obj is not null. So should `DoSomething` ever decide not to check anymore, or if I decide to use another function obj might not be checked anymore. Which leads me to writing this implementation after all:               void DoSomethingElse( object obj )     {       Contract.Requires<ArgumentNullException>( obj != null );       DoSomething( obj );       //code using obj     }      Always safe, no worries, except that if the situation grows the same object might be checked a number of times and it's a form of duplication and we all know that's not so good. What is the most common practice for situation like these?


title: How do you manage a complexity jump?

text: It seems an infrequent but common experience that sometimes you're working on a project and suddenly something turns up unexpectedly, throws a massive spanner in the works and ramps up the complexity a whole lot. For example, I was working on an application that talked to SOAP services on various other machines. I whipped up a prototype that worked fine, then went on to develop a regular front end and generally get everything up and running in a nice, fairly simple and easy to follow fashion. It worked great until we started testing across a wider network and suddenly pages started timing out as the latency of the connections and the time required to perform calculations on remote machines resulted in timed out requests to the soap services. It turned out that we needed to change the architecture to spin requests out onto their own threads and cache the returned data so it could be updated progressively in the background rather than performing calculations on a request by request basis. The details of that scenario are not too important - indeed it's not a great example as it was quite forseeable and people who have written a lot of apps of this type for this type of environment might have anticipated it - except that it illustrates a way that one can start with a simple premise and model and suddenly have an escalation of complexity well into the development of the project. What strategies do you have for dealing with these types of functional changes whose need arises - often as a result of environmental factors rather than specification change - later on in the development process or as a result of testing? How do you balance between avoiding the premature optimisation/ YAGNI/ overengineering risks of designing a solution that mitigates against possible but not necessarily _probable_ issues as opposed to developing a simpler and easier solution that is likely to be as effective but doesn't incorporate preparedness for every possible eventuality? Edit: Crazy Eddie's answer includes "you suck it up and find the least expensive way to implement the new complexity." That made me think of something that was implicit in the question but I didn't specifically raise. Once you hit that bump, and you incorporate the necessary changes. Do you do the thing that will keep the project as close to schedule as possible but may affect maintainability or do you go back to your architecture and rework it on a more detailed level that may be more maintainable but will push everything back during development?


title: Software management for 2 programmers

text: me and my very good friend do a small bussiness. We have company and we develop web apps using Scala. We have started 3 months ago and we have a lot of work now. We cannot afford to employ another programmer because we can't pay him now. Until now we try to manage entire developing process very simply. We use excel sheets for simple bug tracking and we work on client requests on the fly. We have no plan for next week or something similar. But now I find it very inefficient and useless. I am trying to find some rules or some methodology for small team or for only two guys. For example Scrum is, imo, unadapted for us. There are a lot of roles (ScrumMaster, Product Owner, Team...) and it seems overkill. Can you something advise me? Have you any experiences with software management in small teams? Is any methodology of current agile development fitten for pair of programmers? Is there any software management for simple bug tracking, maybe wiki or time management for two coders? thanks a lot for sharing.


title: Is this a specific pattern and what is its purpose?

text: I recently stumbled over the following C++ Code which confused me a bit:               class One {/*definition*/};     template<class Base > class Two : public Base {/*definition*/};     template<class Base > class Three : public Base {/*definition*/};     template<class Base > class Four : public Base {/*definition*/};     class Five : public Four < Three< Two < One > > > {/*definition*/};      I know the purpose of templates and more or less when and how to use them. Is there a name or a common pattern for a cascade of several templates? When would I use this pattern (instead of anything less complex)? P.S.: definition of class Five actually is empty.


title: Maximum flow and minimum cut undirected graph java

text: I need to implement an algorithm where I find the maximum flow and the minimum cut of an undirected graph and I cannot really find an algorithm for this. I have looked at the Ford Fulkerson algortihm but for that one it´s used for an directed graph. Anyone can help me to find an appropriate algorithm?


title: Slowly realising that I should have asked for a way higher salary

text: I've been working in this new company for almost half a year now and I'm beginning to realize that I made a terrible mistake when I proposed my salary. This is my first "real" job, previously I've been working freelance, and for a short amount of time for a small local IT company. When I moved here, I wasn't sure how much was I supposed to ask for. I did a lot of research and settled on amount about 20% higher than an average developers' starting salary in my country. Now I'm attending interviews (as a trainee so far) and I got to learn something more about salary capabilities of my employer. I learned that almost twice as much as I make would be "acceptable". That's because the company was started by an American fellow, and while we are based in a less wealthy country, more generous pay is acceptable. Additionally, I saw that I'm a better programmer than I thought I was (based on comparing my performance with others and reviews by others). I already did one thing towards this: some time after a new guy came in to work with me (paid the same as me), I realised that I'm clearly a better developer and I boldly asked for a raise (which I got, after being lectured that raises only happen during reviews). What do I do here? I'm at a loss.


title: Good unit-testing story for a unit test training

text: I have to advise a training on unit testing in my company. I would like to show a striking, real-life example of an unexpected regression not caught by compilation (of course) but detectable with unit testing. Something more like a seemingly valid change that in fact cause a regression in another part of the program. Would you share your unit testing epic-win stories ? (Target language is C++, networked distributed application, but any good example will do)


title: Casting from string to integer and the vica versa

text: I am trying to cast in Java from string to integer and the other way around but the compiler is complaining about this. My question is: Is this the matter of compiler or Java programming language doesn't support this kind of casting.


title: The Art of Computer Programming - To read or not to read?

text: There are lots of books about programming out there, and it seems Code Complete is pretty much at the top of most people's list of "must-read programming books", but what about _The Art of Computer Programming_ by Donald Knuth? I'm a busy person, between work and a young family I don't have a ton of free time, so I have to be picky about how I use it. I'm wondering - has anybody here read 'TAOCP'? If so, is it worth making time to read or would some other book or more on-the-side programming like pet projects or contributing to open source be a better use of my time in terms of professional development? DISCLAIMER - For those of you who sport "Knuth is my homeboy" t-shirts, don't get me wrong - I want to read it, but I'm just wondering if it should be right at the top of my priority list or if something else should come first.


title: What is a good design model for my new class?

text: I am a beginning programmer who, after trying to manage over 2000 lines of procedural php code, now has discovered the value of OOP. I have read a few books to get me up to speed on the beginning theory, but would like some advice on practical application. So,for example, let's say there are two types of content objects - an ad and a calendar event. what my application does is scan different websites (a predefined list), and, when it finds an ad or an event, it extracts the data and saves it to a database. All of my objects will share a $title and $description. However, the Ad object will have a $price and the Event object will have $startDate. Should I have two separate classes, one for each object? Should I have a 'superclass' with the $title and $description with two other Ad and Event classes with their own properties? The latter is at least the direction I am on now. My second question about this design is how to handle the logic that extracts the data for $title, $description, $price, and $date. For each website in my predefined list, there is a specific regex that returns the desired value for each property. Currently, I have an extremely large switch statement in my constructor which determines what website I am own, sets the regex variables accordingly, and continues on. Not only that, but now I have to repeat the logic to determine what site I am on in the constructor of each class. This doesn't feel right. Should I create another class Algorithms and store the logic there for each site? Should the functions of to handle that logic be in this class? or specific to the classes whos properties they set? I want to take into account in my design two things: 1) I will add different content objects in the future that share $title and $description, but will have their own properties, so, I want to be able to easily grow these as needed. 2) I will add more websites constantly (each with their own algorithms for data extraction) so I would like to plan efficienty managing and working with these now. I thought about extending the Ad or Event class with 'websiteX' class and store its functions there. But, this didn't feel right either as now I have to manage 100s of little website specific class files. Note, I didn't know if this was the correct site or stackoverflow was the better choice. If so, let me know and I'll post there.


title: What encryption algorithm/package should I use in a betting game?

text: I have a betting type site where I publish a number (between 0-100) that is encrypted. Then after a period of time, I would review what the number is and prove it with a key to decrypt the encrypted number to prove that I'm not cheating. I also want it to be easily verifiable by an average user. What encryption algorithm/technique/package should I use? I'm no expert on cryptography. There seems to be so many options out there and I'm not sure what to use. python friendly is a plus.


title: Should you use C# and F# together

text: I know you can use C# and F# together in the same project however i'm not sure if its a good idea to do so. It seems to me that mixing two very different coding styles (functional vs OO) could cause a lack of cohesion in the design. Is that correct?


title: How can we avoid having to build yet another CRM system from scratch

text: We are building an accounting web application. In our database, we store basic data about our customers, like phone number, their login informations, because these things are tied into our web application. Now we need a CRM system to do things like sending marketing mails to users who signed up, but never used the service, we also want a database of potential customers or partners, who we would like to contact some day etc. etc. Such functionality is basic in any CRM system and I would hate to have to implement all these features ourselves. At the same time, I cannot see how we could utilize a CRM solution like SalesForce without having to store some data in two places and with all the complications that that would lead to. What should we do? Is there any CRM system that can be put upon our PostgreSQL database and just utilize the data we have and store what we do not have?


title: Are design patterns generally a force for good or bad?

text: I've heard it argued that design patterns are the best thing since sliced bread. I've also heard it argued that design patterns tend to exacerbate "Second System Syndrome," that they are massively overused, and that they make their users think they're better designers than they really are. I tend to fall closer to the former camp, but recently I've been seeing designs where nearly every single interaction is replaced with an observer relationship, and everything's a singleton. So, considering the benefits and problems, are design patterns generally good or bad, and why?


title: Is the time spent customizing your dev machine environment worth it?

text: There are times when I am working on programming project and I get the itch to change some stuff in my environment (OSX or Linux). Vim might not being doing exactly what I want, so instead of doing it the round about way I've been doing for a couple months (sometimes years) I go and figure out the right way. Or I may be doing something long handed in bash and I say to myself why don't I figure out a better way. The thing is when I go off and do this hours can fly by. Sometimes I get stuck on trying to get what I want. I'll know I'm really close, so I don't give up. I usually always get it eventually, but its after hours of tinkering and googling. I hate the feeling of giving up and having to deal with something I know could work better. When I'm done I have a warm feeling knowing that my environment is a little more smooth and personalized, but I wonder could my time be better spent. Where do I draw the line? It seems with the all the UNIX-style tools there is an endless amount to learn. Always thought the sign of a superior programmer is someone who goes out of their way to make the computer bend to their will. Am I doing it right? I figure the bash shell, unix/linux, and vim will be around forever, so I see it as an investment. But then again I just spend 3 hours trying to get some stupid thing the vimperator firefox plugin to work right. So I wondering what this community think about this.


title: How to embed an article in the source code?

text: Sometimes, I notice typos in articles (blog posts) or books in source code that appears in the body of the article. It may be an indication that the code has been manually copied and pasted (e.g. missing braces ), or that something nasty happened to the text. How may I write an article inside the source code of a project ? I'm targetting Wordpress; I'm basically looking for a parser that would recognize two kinds of region: article and source code, and that would format them to whatever I want (stackoverflow question, LaTeX code or Wordpress article)