title: Custom error handling

text: I'm trying to figure out the best way to handle custom errors in my application. Option 1:               if(expr) {     } else {         $_SESSION['error'] = "Some message describing the error";     }      Option 2:               if(expr) {     } else {         $_SESSION['error'] = 2;     }      In option 1, the same error might be recycled in multiple situations. If I ever decide to change the message then I'll have to dig through my code and find every occurrence. In option 2, I give a numerical value which could reference a master list of errors. This seems to solve the problem associated with option 1 but makes the code harder to read. What should I do?


title: C++ name mangling and linker symbol resolution

text: The name mangling schemes of C++ compilers vary, but they are documented publicly. Why aren't linkers made to decode a mangled symbol from an object file and attempt to find a mangled version via any of the mangling conventions across the other object files/static libraries? If linkers could do this, wouldn't it help alleviate the problem with C++ libraries that they have to be re-compiled by each compiler to have symbols that can be resolved? List of mangling documentations I found:   * MSVC++ mangling conventions   * GCC un-mangler   * MSVC++ un-mangling function documentation   * LLVM mangle class


title: Issue with My.Settings using Visual Basic

text: For my A2 Computing project I have created a game using Visual Basic. For the leaderboard section, I have used the My.Settings feature to store the scores when the game closes, but only one or two actually save. My teacher doesn't know and I can't find anything helpful after a google search of the problem


title: How to camel-case where consecutive words have numbers?

text: Just wondering if anybody has a good convention to follow in this corner- corner-corner case. I really use Java but figured the C# folks might have some good insight too. Say I am trying to name a class where two consecutive words in the class name are numeric (note that the same question could asked about identifier names). Can't get a great example, but think of something like "IEEE 802 16 bit value". Combining consecutive acronyms is doable if you accept classnames such as `HttpUrlConnection`. But it seriously makes me throw up a little to think of naming the class `IEEE80216BitValue`. If I had to pick, I'd say that's even worse than `IEEE802_16BitValue` which looks like a bad mistake. For small numbers, I'd consider `IEEE802SixteenBitValue` but that doesn't scale that well. Anyone out there have a convention? Seems like Microsoft's naming guidelines are the only ones that describe acronym naming in enough detail to get the job done, but nobody has addressed numbers in classnames.


title: Modern analog of DDD (Data Display Debugger)

text: I if there are visual applications for debugging code in popular languages (like C, Pytho, Javascript). By visual I do not mean debugger with UI which is bundled with almost every IDE, I'm rather talking about a debugger that can visualize data and process of changing this data over time. E.g. imagine you're implementing a sort algorithm. It would be very cool to have an application that would save states of the array at each iteration and then would allow you easily go back and forth between states with good animation of insertion/deletion and move. I understand that there maybe no general utility for that. Insetead I expect some environment (like R or MatLab) that can be used to easily create such debugging applications.


title: Looking for feedback on my approach to implement an algorithm

text: We've recently worked with a mathematician to build us an algorithm. The algorithm will look at click data and will continuously update data associated with the user, the content, and the content's category and then pair the user with relevant content. With that said, I have never implemented an algorithm before but I'm guessing that our current environment (PHP, MySQL) is not entirely suitable for continuously crunching and updating data. **Looking for feedback on whether the following approach is on the right track?**   * Write algorithm in Java (or other compiled language) for best performance.   * Store user, content, and category data on a NoSQL server (or use memcache).   * Use Gearman (or equivalent) to submit click/user data to a job server.   * Run jobs on separate worker server that contains the algorithm.   * Update user, content, category data. If this is not on the right track, can you explain why would that be?


title: How does java resolve class names in a lot of jars?

text: Recently I found one of my Maven project have 100+ jar dependencies. FWIK a zip archive doesn't have index at all, so it should scan the whole zip to determine if it contains a specific path. But I found Java resolve class names against so many jars rather fast, why?


title: What would be a good set of first programming problems that would help a non-CS graduate to learn programming?

text: I'm looking at helping a friend learn programming (I'm NOT asking about the ideal first language to learn programming in). She's had a predominantly mathematical background (majoring in Maths for both her undergrads and graduate degree), and has had some rudimentary exposure to programming before (in the form of Matlab simulations/matrix operations in C etc) - but has never been required to design/execute complex projects. She is primarily interested in learning C/C++ - so, with respect to her background, what would be a set of suitable problems that would both engage her interest ?


title: Convert filenames to their checksum before saving to prevent duplicates. Is is a smart thing to do?

text: TL;DR:what the title says * * * I am developing some sort of image board in PHP. I was thinking of changing each image's filename to it's checksum prior to saving it. This way, I might be able to prevent duplicates.   I know this wouldn't work for two images that are the same but differ in size or level of compression or whatnot, but this method would allow for an early check.   What bugs me is that I never saw this method implemented anywhere, so I was wondering if there is a catch to it. Maybe it is just more efficient to keep the original filename and store the hash in DB? Maybe the whole method is just not useful and my question is moot?   What do you think? On a side note, I don't really get how hashes are calculated so I was wondering, **if** my first question checks out, if it would be possible to calculate the likeness that two images are similar by comparing hashes (levenshtein or something of the sort).


title: Why is Today() an example of an impure function?

text: It seems like, when reading something like this Wikipedia article about "pure functions", they list `Today()` as an example of an impure function but it seems pretty pure to me. Is it because there is no formal input argument? Why is the actual time of day not treated as the "input to the function" in which case if you gave it the same input, i.e. executed `today()` twice at the same time, or traveled back in time to execute it again (maybe a hypothetical :) ), the output would be the same time. `Today()` never gives you a random number. it always gives you the time of day. The Wikipedia article says "different times it will yield different results" but that's like saying for different `x` `sin(x)` will give you different ratios. And `sin(x)` is their example of a pure function.


title: Embedded Web Server Vs External Web Server

text: So I've thought of creating a web application in either Lisp or another functional language and was thinking of embedding the web server into the application (have my application handle the HTTP requests). I don't see any issues with that, however, I'm new to creating web applications (and in the grand scheme of things, programming as well). Is there any drawbacks to handling HTTP requests within your program instead of using a web server? Are there any benefits?


title: How to make an ASP.NET MVC site modular

text: I'm in the planning stage for an employee intranet system to be built with ASP.NET MVC 4. We'd like the site to consist of separate "modules", each of which provides a different feature: messaging, payroll changes, etc. I'd like these modules to be able to be enabled or disabled at compile time. The homepage will display some kind of navigation that will link to each module that is loaded. That's easy so far, but I don't want the navigation feature to have to know about the modules beforehand. In other words, I want the modules to be dynamically discoverable; I want to be able to write the code for a new module and then have a link added to the navigation bar with no code changes anywhere else in the source. Each module should have some way of registering itself with the navigation bar, and--more importantly--this should be done for each module as it's loaded. I believe that this precludes using MVC's Areas, since those are designed for the case when the layout of the site is known beforehand. MEF seems like it might be appropriate, although people seem to have had mixed success in combining MEF with MVC. Is MEF actually the way to go here, or is there a better way to accomplish what I need?


title: How to handle Real Time Data from a database perspective?

text: I have an idea in mind, but **it still confuses me the database area**. Imagine that **I want to show real time data** , and using one of the latest browser technologies ( _web sockets_ \- even using older browsers) it is very easy to show to all observables (user browser) what everyone is doing. **Remy Sharp** has an example about the simplicity about this. But I still don't get the database part, **how would I feed** , let's imagine (using Remy game Tron) that I want to save **the path for each connected user** in a database and if a client wants to see what is going on with a **5 sec delay** , he will see that, not only the 5 sec until that moment but **the continuation in time** ... how can I query a DB like that?               SELECT x, y FROM run WHERE time >= DATEADD(second, -5, rundate);      is not the recommended path right? and pulling this x in x time ... this is not real data feed correct? If can someone help me understand the Database point of view, I would greatly appreciate.


title: Is It Common For a Company to Have Their Own Definition of Job Titles such as Software Architect

text: Recently I am very confused about my position in the company. Months ago, this company offered me the position of Software Architect and I accepted. But about one year passed and I came to realize that this "Software Architect" title in this company is almost totally different from the one I used to know and the one I see people discussing here. Below are several items what a software architect is responsible for. They are from This Post:                  A Systems Architect should:        1. Specify the high-level architecture        2. Participate in code reviews        3. Approve technologies used        4. Assist the developers in their coding effort        5. Maintain and monitor the development schedule        6. Produce SA artifacts, such as UML diagrams, Gantt charts and the like.      But as a "Software Architect" in this company, I can only touch the 6th Item together with a lot of coding. So this title in my company is more like a Senior Developer rather than a Software Architect. My questions are:   1\. Is it common for a company in IT industry to have their own definition of Job Titles?   2\. If the answer to question 1 is No, then is it legal for a company to do that? **Update**   The reason why this issue became a problem recently is that, our General Manager seems to want me to be responsible for a project which is being developing by many members, but he **never** authorizes me to lead other team members or coordinate between teams (coordination among teams is a must especially when are developing software suites). Instead, he just came to me and blame me when the project didn't get progressed as expected. Though I designed all the interfaces and classes of some modules for other members to work and did lots of coding, pushing and guaranteeing the progress is beyond my responsibility especially when this Software Architect is not the usual one we see, I feel it is so unfair to me！


title: Is PHP "list()" language construct a bad convention?

text: PHP supports the `list()` language construct which, in short, allows you to return multiple values from a function and then attach them to different variable, eg:               function myBigReturn(){         return array("foo", "bar");     }     list($fooer, $barer) = myBigReturn();     echo $fooer; // echoes "foo"     echo $barer; // echoes "bar"      I have failed to find much info about such a language construct and I am curious - is usage of PHP `list()` construct considered a bad coding convention? Are there any serious articles/literature on this subject?


title: wpf and mvvm printing report startegy

text: I am developing a WPF application and I need some clarity on printing in WPF and MVVM (I am using MVVM-Light). I want to create standard looking reports for my application and I don't want to have to code each one from scratch. But I want to write this solution myself, without stuff like crystal reports etc. But I am open to other open source examples of course. 90% of my reports will be generated from datagrid itemsources. I want to have a report footer and header and then the "records" that get paged in a content section. **My idea is:** use Fixed document as report wrapper (with header and footer properties), use a listview for records in report content, and generate report to xps that gets opened in document viewer for user to review and print etc. But I have never created reports from WPF before and it looks like there are lots of options and no clear best practice. I am looking for some suggestions or advice on which direction to go from someone with some experience creating custom reports in WPF and keeping MVVM. What was you strategy?


title: Is there a pattern that will help with this data structure

text: I'm doing a java project. My main structure contains 2 lists with elements of type A the other type B. B itself contains a list of objects which may contain elements of A. It must be that when an element from list of A is removed it must be removed from all subelements in list B. also if an possible member of list A is added to a B it should also be added to A. And also I need some way to find the parent objects containing an A. So far I have a "working" implementation - using lots of loops. I am wondering - can you suggest patterns that will help me in this task? * * * more details. I think my main issue is boils down to that i have objects A that have multiple parents. And when I add/remove from one parent I need to adjust some other parents. I can't help but believe such a problem is solved already. * * * to clarify: I have a main `List<A>` , and each `B` contains a `List<A>` When a A is removed from the main list it must be removed from all B. But not when it is removed from a B. It's essential that all A used in the application are present in the main list.


title: What are the best resources for learning about concurrency and multi-threaded applications?

text: I realised I have a massive knowledge gap when it comes to multi-threaded applications and concurrent programming. I've covered some basics in the past, but most of it seems to be gone from my mind, and it is definitely a field that I want, and need, to be more knowledgeable about. What are the best resources for learning about building concurrent applications? I'm a very practical oriented person, so if said book contains concrete examples the better, but I'm open to suggestions. I personally prefer to work in pseudocode or C++, and a slant toward game development would be best, but not required.


title: what is the difference between Soak testing and Stress testing?

text: Can anybody explain the difference about soak and stress testing? I googled about them and found that both are about to test the software beyond its limits. Is it right for both testing strategies?


title: how should I design Objects around this business requirement?

text: This is the business requirement: " A Holiday Package (e.g. New York NY Holiday Package) can be offered in different ways based on the Origin city:   * From New Delhi to NY   * **From Bombay to NY**   * NY itself ( Land package ) (Bold implies default selection) **a.** and **b.** User can fly from either New Delhi or Bombay to NY.   **c.** NY is a Land package, where a user can reach NY by himself and is a standalone holidayPackage. " Let's say I have a class that represents **HolidayPackage** , **Destination** (aka City).               public class HolidayPackage{         Destination holidayCity;         ArrayList<BaseHolidayPackageVariant> variants;         BaseHolidayPackageVariant defaultVariant;     }          public abstract class BaseHolidayPackageVariant {         private Integer variantId;         private HolidayPackage holidayPackage;         private String holidayPackageType;     }          public class LandHolidayPackageVariant extends BaseHolidayPackageVariant{     }          public class FlightHolidayPackageVariant extends BaseHolidayPackageVariant{         private Destination originCity;     }      What data structure/objects should I design to support:   * options   * a default within those options Sidenote: A HolidayPackage can also be offered in different ways based on Hotel selections. I'd like to follow a design which I can leverage to support that use case in the future. This is the backend design I have in mind.


title: Training a company to use a DVCS coming from a CVCS mindset, is it as hard as one would think?

text: So, I'm preparing to consider the outcome of training a lot of people (>25) to use **Mercurial** coming from a centralized mindset. I've done it with **individuals** and had success with it, although the time invested in each one has been different and most of them have been both proactive and open to trying something new. I was wondering if there was someone here with experience giving such training to a large group of people **as I would like to find out what are the do's and don'ts... of course, this would be more oriented towards dealing with those resistant to change** , and a don't I can come to think of is telling them to avoid cheat-sheets mapping commands, as Joel Spolsky suggests.


title: Why is it so difficult to make C less prone to buffer overflows?

text: I'm doing a course in college, where one of the labs is to perform buffer overflow exploits on code they give us. This ranges from simple exploits like changing the return address for a function on a stack to return to a different function, all the way up to code that changes a programs register/memory state but then returns to the function that you called, meaning that the function you called is completely oblivious to the exploit. I did some research into this, and these kinds of exploits are used pretty much everywhere even now, in things like running homebrew on the Wii, and the untethered jailbreak for iOS 4.3.1 My question is why is this problem so difficult to fix? It's obvious this is one major exploit used to hack hundreds of things, but seems like it would be pretty easy to fix by simply truncating any input past the allowed length, and simply sanitizing all input that you take. **EDIT: Another perspective that I'd like answers to consider - why do the creators of C not fix these issues by reimplementing the libraries?**


title: Suggestions to improve small team workflow (CI / Deployment)

text: I'd like to improve my team's workflow and architecture. Right now we have a LAMP dev server on which every member of the team has a subdirectory. We work directly in this directory via LAN. There is also a "release" directory for when we're ready to upload via FTP to the production server. We use a github private repo that serves as a centralized repo. Example of a programmer's current daily workflow : Choose a user story to work on after a quick daily meeting Open a git branch named after the user story Work, commit some changes Push to github When I decide to deploy, I pull the changes, perform a code review, change the needed variables for production and upload via FTP. If changes were made to the dev database I replicate them on the production server's database as well. Any ideas where I should begin to improve this situation ? Current issues :   * Members of the team can't easily work from home since they'd have to edit on the dev server directly (lag issues)   * Deployment process is awful (changing variables manually and FTPing to production) EDIT : I'll try to add better questions.   * Setting up subdirectories for each developer on a common dev server : good idea or not ? Possible alternative : each developer setups his own dev environment (using WAMP or similar) and pushes to test server.   * For the deployment aspect I feel manually changing config variables and FTPing to production is a bad idea. Possible alternative : setting up git on production server, set config files in .gitignore (maintain them manually directly on production server) and git pushing the changes.   * For remote developers, should they replicate the dev environment (again, WAMP or similar) but work on the dev server's database ? I think it's better than copying the database on local machines.


title: Deny use of my library to compete a certain company

text: I'm developing a library for reading/writing a file format of a program created by a certain company. The guys from that company were so kind that they provided me with a documentation for their format, which I'm really grateful for. I'm intending to release the library as open-source under a license "derived" from MIT, the difference being that the library must not be used to create a program that would compete with the original program, as an expression of my gratefulness to the company. What I'm asking: is adding this rule to the license legally possible?


title: Good way to learn how to solve questions on InterviewStreet

text: > **Possible Duplicate:**   >  How do I adapt to pre-interview challenge questions? InterviewStreet is a new company that essentially acts as a filter for companies to find programmers that can code. My problem is my math is fairly weak and I'd like to study it, even if it's from the ground up, to be able to solve questions such as this one, that is found on their site: `Find the no of positive integral solutions for the equations (1/x) + (1/y) = 1/N! (read 1 by n factorial) Print a single integer which is the no of positive integral solutions modulo 1000007` Now, please do NOT post the answer to that question, it is taken directly from InterviewStreet and should not be posted here. It is not the answer I'm seeking for in this thread. What I'm asking is a more fundamental question which probably can be answered by some of the hackers in the SO community. How does one prepare for such a question? What resources are available for me to study/learn how to solve this type of problem? Is this covered on MIT open courseware? Khan Academy? Any particular books? I'm not even sure where to begin to start solving the problem above and I'd like to learn what steps I can take to do so.


title: Does Text Editor Sign The Files?

text: As images have EXIF data which provide info about where and how they are created, do any Text Editors append such kind of descriptive details to code files? For example I use Coda for my programming works. Does Coda sign any files created by itself? Is it possible to find out the author of two different projects by just looking at the inners of the files?


title: How hard is Python to learn?

text: I'm on the list of the tutors in my university _(for PHP, MySql, CSS, etc)_ but someone contacted me asking me to teach them entry level Python. Would I be able to be up quickly enough and be able **to teach it to someone else?** (I've coded in PHP, Java, C#, Javascript, jQuery, tiny bit of C++ and ASP.NET. I'm a Computer Science student. Just finished my third year.)


title: How can a child state machine relinquish control back to the parent state machine?

text: My top level state machine has some states and edges. I will call this the parent state machine.               A ----> B ----> C      Any state within the parent state machine can be a state machine too. I will call these children state machines.                          ___________              /            \     A ----> |  B0->B1->B2  | ----> C              \____________/      If the parent state machine transitions from A to B, B's state machine takes over. Once B is done running, how should it relinquish control to the parent state machine and transition to state C? Which design pattern do you use? If you're wondering, I have children state machines within parent state machines because my exact project is quite complex and it is natural to encapsulate the internal workings of a child state.


title: choosing a functional language platform for a new project

text: I have been writing code for a few years now and I don't believe I can claim to have a complete knowledge in this job yet. My experience primarily rolls around C# related areas with a decent knowledge on Silverlight and Asp .Net MVC as well. I tend to use Sql server and Postgres for normal RDBMS related tasks with Mybatis or LinqtoSql as ORM (and Cassandra as well for NoSql). Given that background, I am looking to building a new project which is a normal application using database and user interface screens. It is considerably a big project which we plan to be rolled out as a product. In recent times, I see a lot of noises being made about functional programming like Haskell and F#. I am wondering \- if it is worth to build the new system using Haskell \- or just stick to a regular application building model using Silverlight/Prism with a layering similar to onion architecture I understand the benefit of staying with the same technology background as it is always good to work on a familiar technology. I also heard that by moving towards a functional language like Haskell we get cleaner code, improved testability etc., Is it really worth considering a move to build new systems in Hasekll? Or it is yet to be proven in production environments? Simply put would I be safe if I build the new project using Haskell and my preferred database or it is too risky at this point in time to choose Haskell. Any help appreciated. Edit: I have already viewed a few other threads like the following and a few more as well, but did not get a definitive answer. Choosing a functional programming language


title: How does a one-person ISV handle software patent research? What due-dilligence is required?

text: I'd like to sell software, but I'm worried about infringing on software patents. What should I do/research prior to writing code?


title: Introducing Fowler's Table Data Gateway to refactor poorly designed systems

text: I am developing an application, which currently has about 150,000 lines of code. The previous developer didn't really use any discipline when writing code. Application is in production but is continually developed. I have read Martin Fowler's book (Patterns of Enterprise Application Architecture) and it talks about 'Transaction Scipt' and 'Data Access Objects'. These are the patterns used i.e. there is a class called Person, which contains everything Person related and a class called Order with everything Order related. The functions are not reusable because they contain everything i.e. data access logic, business logic etc. For example, Person.GetPerson will connect to the database find the person, check the age of the person, get all the orders linked to the person etc. I am thinking about introducing what Martin Fowler terms a Table Data Gateway. I am seeing this as a longer term refactor project. The problem is that this will mean inconsistency to begin with i.e. data access logic will be contained in the new Gateway, but also in the Transaction Script classes (where the other developer put it)? Is it a bad idea to go against the original developers style of coding?


title: Is there a comparative study of the memory consumption of programming languages runtimes, correlated with expressiveness and production bug ratios?

text: There are many comparative studies and available online when it comes to the runtime performance of applications built using one language or another. Some driven by corporations, some academic, some just personal experiment reports. We also get a decent share of comparative studies on side-effects of a programming language and its tooling, like:   * build times,   * likelihood of post-production bug detection,   * expressive power,   * etc... However, I've recently been more and more bummed out by the memory consumption of my programs more than anything else. This might come from the fact that while Moore's Law is on our side for raw performance, we have come to realize that other bottlenecks matter more. That, and I don't tend to update my hardware every so often, and I have some "old" (read 2005-2006 3.6GHz Pentium 4 with 4GB of RAM) that nowadays are hard-pressed to be useable for large applications without requiring me to go through great trouble to squeeze every bit of juice out of them (choice of OS, UI, tweaking of services and daemons, choice of applications to use for a task or another...). Quite honestly, sometimes I fire up `top` or `procexp` and weep at the sight of the memory used by the most innocent programs. I can address this by keeping to push in the direction listed above, and essentially trying to limit myself and the programs I use (I have a dear love for cli programs for that reason, I guess), but I also cannot help but to think that maybe we're doing it wrong. ### Modern Tools for Modern Needs Of course, higher-level languages are arguably better and justify their worth of dead weight. Some design choices were made for good (or supposedly well- intended) reasons at the time, in many toolchains. Shared libraries, memory models, pre-processors, type-systems, etc... But some might be more viable than others with our modern hardware, and I'd be curious to read a few serious studies on the matter. So, my question is, is there a pendant to the Benchmarks Game and others that focus on a comparison of the languages' base runtime memory consumption? And even further, are there some studies that cross-reference this with other parameters (similar to what this article did, for instance, for other criteria, also based on the Benchmarks Game)?


title: How should one implement the dependency-injection for a geocoding client that aggregates different coordinate provider implementations?

text: I am new to DI and I would like to know how DI might be used to help resolve this problem. If I have an `ILatLongLocation` which implements a `Latitude` and `Longitude`, then given two of these I can produce a `Distance` using a variety of algorithms, but I can also reasonably pick one of these as the "best" algorithm at design-time without losing any sleep. However, since users will rarely input physical coordinates, I may need to instead compare by zip codes or something similar. Now, in order to resolve zip codes to coordinates, I could apply a naive algorithm that uses string concatenation, etc to do a rough guess as to the physical coordinates, I could pick a random set of coordinates, etc. But in all likelihood, I will need to resolve the zip codes by using some sort of database mapping zip codes to coordinates. So being new to DI, I would like to know if the following is a reasonable application of DI and/or if I am overthinking it. `ILocatable` has `ILatLongLocation` `ILocatableProvider<T> : ILocatable` has a `T RawLocatable` and can return an `ILatLongLocation`. `IZipCodeLocatableProvider : ILocatableProvider<string>` has a `string RawLocatable` and returns an `ILatLongLocation`. `NaiveZipCodeLocatableProvider` is an implementation that just uses patterns in zip codes that are well-known to provide a best-effort guess as to the coordinates. `DbZipCodeLocatableProvider` is an implementation that uses a database (maybe through a `DbContext` or somehow else) to return the coordinates. Now `DbZipCodeLocatableProvider` itself must depend on some sort of repository or context or connection or something to access a database (unless it is literally hard-coded)... so then this means I need to have a `DbContext` or something similar... here is where I get lost. Am I thinking about this the right way? Is this a legitimate scenario for dependency injection? And how do I discriminate between, say different connection strings vs different strategies altogether for resolving zip codes to coordinates? Edit: ...and don't forget about `WebServiceZipCodeLocatableProvider` ... there's another (realistic) option.


title: Is it safe to rely on static analysis to "reproduce" concurrency bugs reliably?

text: I've inherited some Java code which I suspect harbours some concurrency bugs when synchronizing between a thread that queries data and an IO event that updates the same data. I'm trialling a static analysis tool called ThreadSafe which indeed detects various concurrency issues (i.e. field accessed from asynchronously invoked method without synchronization and Inconsistent synchronization of accesses to a collection). After discovering how difficult it is to reproduce data races reliably by writing unit tests, I wondered if it's advisable to depend on ThreadSafe to "reproduce" the bugs reliably? What I'm asking is, is it safe to depend on the static analysis tool to tell me when I've fixed the bugs? (Of course, to fix the bugs I will need to understand each one in context).


title: Maze generation given intersection tree

text: **Background Information:** I'm building a 2D maze generator. I have tried Prim's algorithm, Wilson's algorithm, and a recursive backtracker algorithm for generating my maze, however was not satisfied with the difficulty of any. I have decided to create my own. I decided that two things make a maze hard. First, mazes can have lots of intersections and choices to make. Second, they can be disorienting and cause you to lose your way. I decided to create a tree to represent the intersections and dead ends in a maze and connect each node in the tree with a randomly generated path to disorient users. **The problem:** If I begin to generate the cells in the maze for the tree, I may find that a node doesn't have the room it needs to connect to or create its children. How do I fix or avoid this problem? **My Thoughts:** There seems like there might be a way to do this by dividing the maze into sections and subdividing them, but that still doesn't guarantee enough room at the end of the division. I could also try to start small and work my way up, sectioning off smaller areas and then creating connections between them, but that could still run into pathing issues with not having enough room to connect the sections together or even creating really long paths between sections. I am using a hexagonal grid, but any solution you guys come up for rectangular grids should be easy to transfer to a hexagonal one. I wasn't sure if this should be posted in the theoretical computer science section or here, and opted for the more general one.


title: Is there any way to test how will the site perform under load

text: I have made an Asp.net MVC website and hosted it on a shared hosting provider. Since my website surrounds a very generic idea, it might have number of concurrent users sometime in future. So, I was thinking of a way to test my website for on-load performance. Like how will the site perform when 100 or 1000 users are online at the same time and surfing the website. This will also make me understand whether my LINQ queries are well written or not.


title: Should the deploy script be an artifact of the build?

text: This is a web project written in Java. So, I'm writing the build and the deploy scripts. To create the build, I used ant. The continuous build is done with Jenkins. The build generates 3 different artifacts:   1. The war file   2. A zip with layouts   3. A zip with images So far, so good, but now I need to write the deploy script, which should:   * Deploy the war (artifact 1) to the tomcat running at _server 1_   * Place the artifact **2** at _server 1_ in a specific directory   * Place the artifact **3** at _server 2_ in a specific directory So I was talking with my colleague and he said that we should also generate an artifact (maybe _deploy.xml_ ) that deploys these artifacts when placed at the correct server. So there would be another script, that would:   * Download the jenkins artifacts   * scp to each server and place the deploy.xml there   * remotely invoke the deploy.xml What makes me a little uncomfortable is the act of having the deploy.xml as a build artifact. The motivation behind this would be to be able to make a deploy without needing to have access to the VCS repositories, so a build would be self-contained, ie, any build could go into production only with what was generated by Jenkins. Where should the deploy scripts be placed? Should they be **only** at the VCS or should they be build artifacts too?


title: Right Tools For The Job? One Location vs Multiple?

text: I'm currently using Codebase for all my project management (where I'm learning Agile). I use it for tracking bugs, user stories (via tickets), wikis, files and git hosting. However, I'm looking to improve on this and find some tools better suited to things like bug tracking, managing stories, git hosting, collaboration, client feedback etc. I'm part of a small team of 3 or 4 developers. Does anyone have any recommendations? My initial thoughts based on research was:   * Project Management: JIRA   * Bug Tracking: JIRA   * User Stories and Agile: Pivotal Tracker   * Git hosting: JIRA   * Storage: Dropbox However it seems this is quite disjointed in that it could prove more work than its worth. Appreciate any advice on the above or tools which you've used and found work great for small-medium teams and suit Agile. My SPECIFIC requirements are: Bug tracking, managing stories, git hosting, remote team collaboration, client feedback, time tracking, storage, build management, project lifecycle progression data... I also found Assembla which seems excellent. One of my team members believes in "the right tool for the job" and that there is no single tool to manage all of this. I was hoping for a central location.


title: Move from Curl to Aria2?

text: We have a crawling engine that uses curl and caters to about 400,000 ppl / month. Although curl supports concurrent downloads, it does not support bandwidth limiting ( only in php 5.4.0 ) which is why my boss wants me to move to aria2. He also says Aria2 is faster ( which seems to be true to me as well ) Aria2 would require a large amounts of changes to the system. Right now we have crawling system which does not crawl in a conconrrent manner. Would moving to aria2 be a good decision?


title: Why do popular websites store very complicated session-related data in cookies -- and what does it all mean?

text: As web developers, we all learn that sessions help overcome the problems related to the stateless nature of HTTP. We create a unique session id, and send it to the browser -- and when the browser sends the same id back to us, we identify the user easily. All this sounds pretty straightforward, and NOT so complicated to implement in any language. ## NOW Look at the following screenshots I took. These show the kinds of cookies popular websites store. It looks like they are storing multiple session IDs, or they are trying the hide the actual id by setting so many cookies, or, it is something very specialized security measures they're taking to prevent session hijacking and other related problems. Or, whatever. ## Gmail (before login) ![enter image description here](http://i.stack.imgur.com/RKLmL.jpg) ## Gmail (after login) ![enter image description here](http://i.stack.imgur.com/9pWMf.jpg) ## Facebook ![enter image description here](http://i.stack.imgur.com/f760r.jpg) ## StackExchange ![enter image description here](http://i.stack.imgur.com/CIXd4.jpg) (Don't worry, you can't steal my session -- it's stale and incomplete :)) So, my question is -- what purpose does this complicatedness serve? Please explain what these different cookies mean (in general), and for what purposes these are set. Lastly, hint on how I can do it (and whether I should) in my own apps. One more question: In a lot of instances, the values in the cookies look like they are URL-encoded -- why so?


title: Call stack starts at bottom or top?

text: A stack is something that piles bottom-up. Hence a call stack adds new items on the stack when functions are called with items being removed from the stack as each function ends until the stack is empty and then the program ends. If the above is correct, why do people refer to control moving "up" the call stack? Surely control moves _down_ the call stack until it reaches the bottom.


title: Selling LINQ To Management

text: I recently started working at a new company that currently doesn't use linq, but does use C# and the .net framework. I'm coming from a LINQ background, so I'm biased, but I still think there are a lot of advantages to using linq. That being said, it's still going to be hard to influence change as I'm still very new. What suggestions do you have to sell this to management? The database systems are still relatively new, so I think now, as things are still developing, would be the best time to try convincing people to use this. This is both a technical and political question. Any help would be appreciated.


title: Isolated environment for software stacks

text: I was sure that I would find this question, but I couldn't. How to create an isolated development environment? It other words, a sandbox, where I can install different combinations of web servers, databases, other software packages and play with them, without cluttering my system packages and without manually downloading packages from official websites. Something for software stacks as virtualenv + pip is for Python. Before that I tried to install OSes inside QEMU/KVM, but that is an overkill and a bit complicated (couldn't set up bridging, for example). Is it possible to create isolated virtual environments without running virtual machines with full-blown operating systems? I use Debian GNU/Linux. **Edit (01.08.12):** A similar question on Unix.SE with more elaborated answers - http://unix.stackexchange.com/q/31136/11397


title: Inspirational software for end-users written in Haskell?

text: I think great technology is invisible. Besides the usual suspects (GHC, Xmonad, proprietary trading software) what great examples are there of end-user software written in Haskell? I think good examples are FreeArc, Hledger and "Nikki And The Robots". Do you have more examples (full blown GUI apps, small CLI tools, etc)? **Edit:** For example, I am fascinated by Wings3D, because, while it's written in Erlang, users cannot tell that. It just works. Among Haskell's weak spots are cross-platform GUIs. There are not many GUI apps written in Haskell in general and most of them are not easy to use, install or even compile. What are good examples to learn from how to make hard things look easy?


title: How to interpret programmer salary survey data, especially concerning different job titles?

text: I've been trying to understand how my compensation stacks up against the competition. I understand that this can be a bit of a localized question, so I'll do my best to avoid local issues. There are a number of web sites that provide salary survey data about different jobs. I've been looking at the data on careerbuilder.com in particular. I would like to use this data to understand how much salary I would be wise to ask for in negotiation, but it seems impossible to interpret. Let me start with job titles. I have a background in mathematics and computer programming. I am currently doing database-driven web development using mostly SQL, .net, and Javascript. I do much more programming than I do web design. In my current position, I was told that I would be a "Web Developer". I was told that I would be junior to the "Application Developers", but senior to "Junior Developers". That was fine with me. After several months lapsed, I received (with no prior notice) a new nameplate for my cube that bore the title "Application Developer". The developers who had been previously called "Application Developers" are now called "Sr. Systems Analysts". As far as I know, these new nameplates did not accompany any actual organizational change or pay differences. However, when I go to the salary surveys on careerbuilder.com and enter in "computer programmer", "application developer", "web developer" and other seemingly similar titles, I get wildly divergent results. Even more divergent are the results on Glassdoor.com, which reports survey results from individual companies. Consider this example: ( http://www.glassdoor.com/Salaries/net-salary-SRCH_KO0,3.htm ) that has differences of over 100% salary between different companies for the same title!


title: Regarding interfaces of classes in OOP

text: When one says "a class' interface": Does he/she refer to all of the get and set methods - or do they refer only to the methods' signatures and return types, without the inner implementation of these methods? (Aka, the implementation of a 'get' method isn't considered part of the interface, but rather part of the inner implementation of the class. The interface is the return type for that method and the signature of that method).


title: Guide developers to not forget their obligations

text: > **Possible Duplicates:**   >  What is the Best Way to Incentivize a Team of Developers?   >  How do you motivate peers to become better developers? Aside developer's tasks, there are minor stuff that each developer should do. In our company, the project leader spends some time with each developer to guide them on how to do several stuff, especially on inexperienced ones. Of course each developer has their tasks, but also they have notes that either they or the project leader noted. Those tasks can be like:   1. You should change the flow of this method,    2. I don't like the way you solve this issue,   3. Consider a faster solution   4. etc. Those notes of course can be noted! But laziness is an issue, even if the developer has the abilities required. My question is: How do we 'force' them to become more hypochondriacal than lazy?


title: Is using MultiMaps code smell? If so what alternative data structures fit my needs?

text: I'm trying to model nWoD characters for a roleplaying game in a character builder program. The crux is I want to support saving too and loading from yaml documents. One aspect of the character's is their set of skills. Skills are split between exactly three 'types': Mental, Physical, and Social. Each type has a list of skills under if. My Yaml looks like this:               PHYSICAL:         Athletics: 0         Brawl: 3     MENTAL:         Academics: 2         Computers      My initial thought was to use a Multimap of some sort, and have the skill type as an Enum, and key to my map. Each Skill is an element in the collection that backs the multimap. However, I've been struggling to get the yaml to work. On explaining this to a colleague outside of work they said this was probably a sign of code smell, and he's never seen it used 'well'. Are multiMaps really code smell? If so what alternate data structures would suit my goals?


title: Finding the time to program in your spare time?

text: I've got about a dozen programming projects bouncing about my head, and I'd love to contribute to some open source projects, the problem I have is that having spent the entire day staring at Visual Studio and or Eclipse (Sometimes both at the same time...) the last thing I feel like doing when I go home is program. How do you build up the motivation/time to work on your own projects after work? I'm not saying that I don't enjoy programming, it's just that I enjoy other things too and it can be hard to even do something you enjoy if you've spent all day already doing it. I think that if I worked at a chocolate factory the last thing I'd want to see when I got home was a Wonka bar.


title: Why profile applications using AOP?

text: When tuning performance in a web application, I am looking for good and light- weight performance profiling tools to measure the execution time for each method. I know that the easiest profiling method is to log the start time and end time for each method, but I see more and more people using AOP to profile (add @profiled before each method). What's the benefit of AOP profiling compared to the common "log" way? Thanks in advance Vance


title: When calling a method should we use base.methodname and this.methodname?

text: In C#, with an inherited class set -- when calling a method should we use keywords 'base.methodname and this.methodname'... irrespective of whether it is a overridden method or not? The code is likely to undergo changes in terms of logic and maybe some IF-ELSE like conditions may come in at a later date. So at that time, the developer has to be compelled to revisit each line of code and ensure that he/she makes the right choice of which method is being called --- base.methodname() or this.methodname() ELSE the .NET framework will call the DEFAULT (I think its base.methodname()) and the entire logic can go for a toss.


title: Should I buy Clean Code after reading The Clean Coder?

text: I"m currently reading _The Clean Coder_ by Robert C. Martin. It's a great book and I'm learning a lot from it. My objective is to become a "professional" programmer so I'm trying to learn the most I can when I'm not at my office. I was wondering if I should buy _Clean Code_ from the same author. Is it the natural "sequel" to _The Clean Coder_? Does it cover much the same ground to make its purchase not worthwhile?


title: Technology Selection for a dynamic product

text: We are building a product for Procurement Domain in JAVA. Following are the main technical requirements.   1. Platform Independent   2. Database Independent   3. Browser Independent In functional requirements the product is very dynamic in nature. The main reason being the procurement process around the world is different from client to client. Briefly we need to have a dynamic workflow engine and a dynamic template engine. The workflow engine by which we can define any kind of workflows and the template engine allows us to define any kind of data structures and based on definition it can get the user input through workflow. We have been developing this product for almost 2 years. It has been a long time till we can get down with the dynamics of requirements. Till now we have developed a basic workflow and template engine and which is in use at one of the client. We have been using following technologies.   1. GWT-Ext (Front End Framework)   2. Hibernate (Database Layer) In between we have faced some issues with GWT-Ext (mainly browser compatibility) and database optimization due to sub classing in hibernate. For resolving GWT-Ext issue, which a dying community so we decided to move to SmartGWT. In SmartGWT we faced issues related to loading and now we are able to finalize that GWT 2.3 will be the way to go as the library is rich and performance is upto the mark. We are able to almost finalize GWT-Spring based front and middle layer. In hibernate, we found main issues with sub-classing due to that it was throwing astronomical queries and sometimes it would stop firing any queries for 5-10 seconds or may be around 30 seconds and then resume again. Few days back I came to one article related to ORM. I am a traditional .Net SQL developer and I have always worked with relational database. Reading through this article, I also found it relating to the issues I face. I am still not completely convinced of using hibernate and this article just supported my opinion. Following are the questions for which I am looking for an answer.   1. Should we be going with Hibernate in case of dynamic database requirements and the load of the data will be heavy in future? How can we partition the data, how we can efficiently join the data, how we can optimize the queries? If the answer is no then how do we achieve database independence?   2. Is our choice related to GWT and Spring proper or do we need to change that too?   3. Should we use any other key value pair database if the data is dynamic in nature and it is very difficult to make it relational?


title: Documenting mathematical logic in code

text: Sometimes, although not often, I have to include math logic in my code. The concepts used are mostly very simple, but the resulting code is not - a lot of variables with unclear purpose, and some operations with not so obvious intent. I don't mean that the code is unreadable or unmaintainable, just that it's _waaaay_ harder to understand than the actual math problem. I try to comment the parts which are hardest to understand, but there is the same problem as in just coding them - _text does not have the expressive power of math_. I am looking for a more efficient and easy to understand way of explaining the logic behind some of the complex code, preferably in the code itself. I have considered TeX - writing the documentation and generating it separately from the code. But then I'd have to learn TeX, and the documentation will not be in the code itself. Another thing I thought of is taking a picture of the mathematical notations, equations and diagrams written on paper/whiteboard, and including it in javadoc. Is there a simpler and clearer way?    * * * P.S. Giving descriptive names(`timeOfFirstEvent` instead of `t1`) to the variables actually makes the code more verbose and even harder too read.


title: Inspiring Computer Science College Student Stories?

text: After watching "The Social Network", a movie about Mark Zuckerberg and Facebook, I had a productivity spike as it inspired me to learn many different languages and software. That spike has been deteriorating somewhat and I don't feel like watching the movie all over again so I was wondering if anybody had any other similar success stories/links/articles/whatever. Mainly about successes that started for people in college.


title: Vernon's book Implementing DDD and modeling of underlying concepts

text: Following questions all refer to examples presented in Implementing DDD In article we can see from Figure 6 that both **BankingAccount** and **PayeeAccount** represent the same _underlying concept_ of _Banking Account_ **BA** **1.** On _page 64_ author gives an example of a _publishing organization_ , where the life-cycle of a book goes through several stages ( _proposing a book_ , _editorial process_ , _translation of the book_ ... ) and at each of those stages this book has a different definition. Each _stage of the book_ is defined in a different _Bounded Context_ , but do all these different definitions still represent the same _underlying concept_ of a **Book** , just like both **BankingAccount** and **PayeeAccount** represent the same _underlying concept_ of a **BA**? **2.** a) I understand why `User` shouldn't exist in **Collaboration Context** ( CC ), but instead should be defined within **Identity and Access Context** IAC ( _page 65_ ). But still, do `User` ( IAC ), `Moderator` ( CC ), `Author` ( CC ),`Owner` ( CC ) and `Participant` ( CC ) all represent _different aspects_ of the same _underlying concept_? b) If yes, then this means that CC contains several _model elements_ ( `Moderator`, `Author`, `Owner` and `Participant` ), each representing _different aspect_ of the same _underlying concept_ ( just like both **BankingAccount** and **PayeeAccount** represent the same _underlying concept_ of a **BA** ). But isn't this considered **a duplication of concepts** ( Evan's book, page 339 ), since several _model elements_ in CC represent the same _underlying concept_? c) If `Moderator`, `Author` ... don't represent the same _underlying concept_ , then what _underlying concept_ does each represent? **3.** In an **e-commerce system** , the term **Customer** has multiple meanings ( page 49 ): When user is browsing the **Catalog** , **Customer** has different meaning than when user is placing an **Order**. But do these two different definitions of a **Customer** represent the same _underlying concept_ , just like both **BankingAccount** and **PayeeAccount** represent the same _underlying concept_ of a **BA**? **UPDATE:** 2. > 2a) As with the book, they refer to the same identity but express different > aspects of that identity in a specific context. Sort of like a single object > implementing multiple interfaces which embody the roles that object plays. a) Does having two _model elements_ ( both within same **BC** ) , each representing _different aspect of the same underlying concept_ , result in what _Evans_ calls **duplicate concepts**? b) I thought terms " _representing different aspects of an identity within particular BC_ " and " _representing different aspects of the same underlying concept within particular BC_ " are interchangeable ( ie they mean the same thing )? If not, how do they differ? c) > Sort of like a single object implementing multiple interfaces which embody > the roles that object plays. I assumed each _role_ represents a _particular aspect of the underlying concept_ , but you're saying it doesn't? What then does _role_ model and how is the thing that role models conceptually different from _an aspect of the underlying concept_? **2\. UPDATE:** **2.** a) > > Does having two model elements ( both within same BC ) , each representing > different aspect of the same underlying concept, result in what Evans calls > duplicate concepts? > > I don't recall what Evans called duplicate concepts so not sure. On page 339 Evans describes **Duplicate concepts** as being one of the two conceptual splinters that cause the unification of a model to break down. Here's the quote: > Combining elements of distinct models causes two categories of problems: > duplicate concepts and false cognates. Duplication of concepts means that > there are two model elements ( and attendant implementations ) that actually > represent the same concept. Evry time this information changes, it has to be > updated in two places with conversions. Every time new knowledge leads to a > change in one of the objects, other has to be reanalyzed and changed too. > Except the reanalysis doesn't happen in reality, so the result is two > versions of the same concept that follow different rules and even have > different data. b) and c) > This may be a linguistic issue. The way I see it, an identity can have > different concepts associated with it depending on the context. > > Again this seems to be a linguistic issue. You use "underlying concept" to > refer to identity which I think isn't clear enough to distinguish from > simply "concept" which by itself isn't sufficient. Perhaps the following will make my questions clearer: By _underlying concept_ I'm referring to _an aspect of reality_ ( ie the thing ) which we try to model. thanks


title: Internationalization messages based in views or in model entities

text: I have a small webapp in java and I am adding the internationalization support, replacing texts with labels that are defined in dictionary files. While some texts are obviously unique to each view (v.g. the html title), other refer to concepts from the model (v.g. a ticket, the location or status of such ticket, etc.) As usual, some terms will appear many times in different locations (vg, in both the edition page and in the search page and in the listings I have a "ticketLocation" label). My question is: can I organize the labels around the model concepts (so I have a `ticket.location` label and I use it everywhere such field is labeled) or should I make a different label for each (so `form.ticketLocation` and `filter.ticketLocation` and `list.ticketLocation`). I would go for the first option; I have searched for tips and the only thing that I see that could hinder me is due to the length of the string disrupting the design, and even for that I would prefer having to add a `ticket.locationShort` for places where there is not much space. What is your opinion/tips/experience?


title: how to find out if spelling mistakes in source code are a serious issue or not?

text: I find very troubling amount of spelling mistakes I see everyday in our codebase, from which I will reproduce a very short but representative example:               ArgumnetCount     Timeount     Gor message from queue       Unfortunately this is in no way limited to one person. There is a lot of non- native English speakers in our team who contribute to that, however I can also pinpoint some of the worst spelling mistakes to our Software Architect who is American, born and raised. These are also to be found even in emails, presentations, documents, whatever piece of written information we have in a software development company. I'd like to know how to find out if it is a serious issue or not? I've always met these spelling mistakes with concern, but my own, personal, **official** policy is that we are not paid to spell things right, we are paid to get things done, so inside the company I never really criticized anyone about it. But I have raised this issue with some of my close friends, and never settled it for good.


title: Design pattern for logging changes in parent/child objects saved to database

text: I’ve got a 2 database tables in parent/child relationship as one-many. I’ve got three classes representing the data in these two tables:               Parent Class     {         Public int ID {get; set;}         .. other properties     }          Child Class     {         Public int ID {get;set;}         Public int ParentID {get; set;}         .. other properties     }          TogetherClass     {         Public Parent Parent;         Public List<Child> ChildList;     }      Lastly I’ve got a client and server application – I’m in control of both ends so can make changes to both programs as I need to. Client makes a request for ParentID and receives a Together Class for the matching parent, and all of the child records. The client app may make changes to the children – add new children, remove or modify existing ones. Client app then sends the Together Class back to the server app. Server app needs to update the parent and child records in the database. In addition I would like to be able to log the changes – I’m doing this by having 2 separate tables one for Parent, one for child; each containing the same columns as the original plus date time modified, by whom and a list of the changes. I’m unsure as to the best approach to detect the changes in records – new records, records to be deleted, records with no fields changed, records with some fields changed. I figure I need to read the parent & children records and compare those to the ones in the Together Class. Strategy A: If Together class’s child record has an ID of say 0, that indicates a new record; insert. Any deleted child records are no longer in the Together Class; see if any of the comparison child records are not found in the Together class and delete if not found (Compare using ID). Check each child record for changes and if changed log. Strategy B: Make a new Updated TogetherClass               UpdatedClass     {         Public Parent Parent {get; set}         Public List<Child> ListNewChild {get;set;}         Public List<Child> DeletedChild {get;set;}         Public List<Child> ExistingChild {get;set;} // used for no changes and modified rows     }      And then process as per the list. The reason why I’m asking for ideas is that both of these solutions don’t seem optimal to me and I suspect this problem has been solved already – some kind of design pattern ? I am aware of one potential problem in this general approach – that where Client App A requests a record; App B requests same record; A then saves changes; B then saves changes which may overwrite changes A made. This is a separate locking issue which I’ll raise a separate question for if I’ve got trouble implementing. The actual implementation is c#, SQL Server and WCF between client and server - sharing a library containing the class implementations. Apologies if this is a duplicate post – I tried searching various terms without finding a match though. * * * Update based on comments from svick and TimG: To track change would the base class be something like:               public class ChangedRowBase         {             public enum StatusState             {             New, Unchanged, Updated, Deleted         };              protected StatusState _Status;              public StatusState Status         {             get             {                 return _Status;             }         }              public void SetUnchanged()         {             _Status = StatusState.Unchanged;         }              public void SetDeleted()         {             _Status = StatusState.Deleted;         }          }      Then my Child class would have something like:                   public int SomeDumbProperty         {             get;             set             {                 base.Status = StatusState.Updated;                 // Missing line here to set the property itself             }         }              private int _SomeIntelligentProperty;              public int SomeIntelligentProperty         {             get { return _SomeIntelligentProperty; }                  set             {                 if (value != _SomeIntelligentProperty)                 {                     _SomeIntelligentProperty = value;                     base.Status = StatusState.Updated;                 }             }         }      The idea being that the intelligent one detects if there has indeed been a change; otherwise using the dumb one the client app would need to either detect change and only update if there has been a change, or use the setter anyway flagging a change which actually didn't occur. I also know that my dumbproperty doesn't work (or compile) right now. If I want code in the getter or setter, does this mean I need to define a separate private variable myself ? I know the short hand {get; set;} does this behind the scenes.


title: How to learn the basics

text: I have been programming for 2 years in python, Java and C#. I have developed two programs that is being used by a IT-company I worked for and use programming/a programmers mind to solve almost every problem I counter. But still I feel I am missing something in my curriculum (selftaught mostly). When programming I usally do the most often mistake of never changing my solutions to problems in my code. Because I dont know the lowest principals in programming. I often give up on new projects I start because of this. I see codes from others and I shiver when I think back to my code afterwards. What are the basics in programming? How can I learn this? And which principals in programming is the building blocks to actually become a better programmer?


title: What file extension do you use for your template/view files in PHP?

text: I'm building a Model-View-Controller framework, and it has come time to decide how I will be creating and using view templates and layouts. Some frameworks use special extensions for these files. CakePHP uses `.ctp`. I have heard-of/seen `.tpl` files, though I've never used them myself. There is the `.inc` extension, which doesn't feel right, and of course, I could stick with plaon ol' `.php`. For that matter why not `.awesome`? What do you use for your template files? Is there any benefit to using a special file extension for these files? Are you partial to a certain extension for nostalgia or convention alone? They're typically (and will be in my project) already in their own directory, so I assume there must be _some_ reason they are differentiated by their extension in projects like CakePHP.


title: Is there a canonical resource on bouncycastle?

text: It doesn't matter if it is Java or .NET. Is there a resource out there that's the de-facto standard for describing best practices and other helpful information on bouncycastle? What about that resource makes it special?


title: Where does one draw the line between inspiration and plagiarism?

text: Suppose one would like to use in an iOS app only one function from a GPLv3 library that contains a large number of them. One cannot simply link the whole library beacuse otherwise the resulting software, having to be GPLv3, would be incompatible with the App Store. Can one "take inspiration" from the source code of the library to write a function that would perform the same task? I understand that this is a fine line, but I wonder if there is a rule of thumb.


title: Figuring out the Call chain

text: Let's say I have an `assemblyA` that has a method which creates an instance of `assemblyB` and calls its `MethodFoo()`. Now `assemblyB` also creates an instance of `assemblyC` and calls `MethodFoo()`. So no matter if I start with `assemblyB` in the code flow or with `assemlyA`, at the end we are calling that `MethodFoo` of `AssemblyC()`. My question is when I am in the `MethodFoo()` how can I know who has called me? Has it been a call originally from `assemblyA` or was it from `assemlyB`? Is there any design pattern or a good OO way of solving this?


title: What technologies or techniques senior developers of today should *unlearn*

text: Many questions here about learning new things. But what about `unlearning`? When we used to develop software 10 or 20 years ago very differently, we counted RAM in bytes, libraries were very rare, IDE was an unknown word and Merise was king. **What should we unlearn today? What bad habits we should get rid of?** EDIT: **unlearn** doesn't mean **forget**. Rather to use old techniques that was useful in the past, use the new technologies (such as GC for memory management). But your past knowledge will always be useful today.


title: Starting a User Group C#/.net

text: Inspired by this question, I have looked into user groups within my area in England, and there does not seem to be one at all for a few hundred miles. I would like to look into the possibility of setting one up in a local city, but I have no idea what the format should be. My questions are: What is the purpose of a user group? Is it to simply network or are there expectations for presentations, informal learning, etc? How and where does one promote a user group? Is it run as a free enterprise or is there usually a charge to allow for investment back into the meetings? Thanks.


title: Is it necessary to make a portfolio website for web developer

text: I have worked on around 15-20 sites . I have used different skills / languages on there. So i am confused how should write those in my resume . Or should i create a portfolio website where i have screen shots of those sites where i have wroked. Then do i need to mention about sites or just give the link in my resume


title: Is there an open source license that prohibits public hosting, so I can avoid competition?

text: I am thinking about open sourcing my project, but I want to prohibit public hosting, so noone will put up an alternative website with my code on it, and compete with my site. Internal networks, like libraries etc. would be welcome to use it. Are you aware of such a license? I guess this would be even more restrictive than AGPL.


title: What are the Vital Things noticed in an Experienced Programmer Resume by a firm?

text: Hai Friends, Tell me or share with me , i am developer with one year experience, now i want to modify my old fresher resume to an experience resume, so i want to know what are the primary things must be in an experienced resume which is attracted by the firm.


title: Manage the persistence of entities on iOS in several places: CoreData on the device, iCloud and on a REST API

text: For the needs of a project, I would persist the datas contained in Core Data in several places depending on the state of the user.   * If the user is logged to my API -> Persist the datas on my API.    * If the is logged on iCloud -> Persist the datas on iCloud    * In all case -> Persist the datas on the device. Indeed, with this schema, the datas could be saved on the device, on iCloud and on my API. We need to duplicate datas to be able to keep the last datas avalaible even if the user is not logged on iCloud or the API. * * * Here is an implementation of how I think this feature will be implemented. To uniformise the process of executing CRUD requests I think to create a `PersistenceManager` which permits to execute CRUD requests for entities depending the sate of the user. (If he's logged on the API or on iCloud or nowhere). Here there are some methods that the `PersistenceManager` will implement: **Save request** This method will save an entity depending on the state of the user. If the user is logged to the API: persist on the API If the user is logged to iCloud: save on iCloud In all case -> Save on the device with Core Data. Each datas stored will have a timestamp to be sure to get the last version of the data. **Read request** This method will retrieve entities only from de device in asynchronous mode. For each Save, Update or Delete request executed, if the user is logged to the API or with iCloud, one or both will send a notification to clients application where the user is logged to retrieve datas from API or iCloud and store them into Core Data. Then the data that the user want to read is returned by Core Data. To retrieve notification from the API, I think use socket through my API and my iOS app to communicate. But I don't know how can I do the same mechanism for iCloud. Any suggestion ? **Update request** Same mechanical than for the save request but for update datas. **Delete request** Same mechanical than for the save request but for delete datas. * * * I'm not familiar with these problematics, and I would like have your advices on it. Thanks a lot !


title: Decoupling Threads

text: It's not uncommon to hear of decoupling the UI from program logic, or database design/access from program logic...or even program logic from itself. However, I've never heard of an approach to generalizing or abstracting away the details of threading tasks to the logic (aside from Tymeac, an Android- specific package). Honestly, with all of the details going into managing threads, I don't expect many solutions to work well anytime soon, so... My question is, how do you write threads that aren't joined at the hip to the processes that use those threads? What do you normally do when requirements change in an already complicated multi-threaded application? Is there a design approach to this that I should read? I ask this because we are the dawn of the "bagillion"-core era in computing. Eventually, a good methodology will have to exist to manage 1k+ cores and even more threads here in the next couple of decades.


title: Interface hierarchy design for separate domains

text: There are businesses and people. People could be liked and businesses could be commented on:               class Like     class Comment          class Person implements iLikeTarget     class Business implements iCommentTarget      Likes and comments are performed by a user(person) so they are authored:               class Like implements iAuthored     class Comment implements iAuthored      People's like could also be used in their history:               class history     class Like implements iAuthored, iHistoryTarget      Now, a smart developer comes and says each history is attached to a user so history should be authored:               interface iHistoryTarget extends iAuthored      so it could be removed from `class Like`:               class Person implements iLikeTarget     class Business implements iCommentTarget          class Like implements iHistoryTarget     class Comment implements iAuthored          class history          interface iHistoryTarget extends iAuthored      Here, another smart guy comes with a question: How could I capture the `Authored` fact in `Like` and `Comment` classes? He may knows nothing about `history` concept in the project. By scalling these kind of functionallities, interfaces may goes to their encapsulated types which cause more type strength, on the other hand explicitness suffered and also code end users will face much pain to process. So here is the question: Should I encapsulate those dependant types to their parent types (interface hierarchies) or not or explicitly repeat each type for every single level of my type system or ...?


title: F# performance vs Erlang performance, is there proof the Erlang's VM is faster?

text: I've been putting time into learning functional programming and I've come to the part where I want to start writing a project instead of just dabbling in tutorials/examples. While doing my research, I've found that Erlang seems to be a pretty powerful when it comes to writing concurrent software (which is my goal), but resources and tools for development aren't as mature as Microsoft development products. F# can run on linux (Mono) so that requirement is met, but while looking around on the internet I cannot find any comparisons of F# vs Erlang. Right now, I am leaning towards Erlang just because it seems to have the most press, but I am curious if there is really any performance difference between the two languages. Since I am use to developing in .NET, I can probably get up to speed with F# a lot faster than Erlang, but I cannot find any resource to convince me that F# is just as scalable as Erlang. I am most interested in simulation, which is going to be firing a lot of quickly processed messages to persistant nodes. If I have not done a good job with what I am trying to ask, please ask for more verification.


title: Why did the Sun engineers decided to make Java only call by value?

text: Is there any specific reason they decided to go with Call by value? Is it for simplicity?


title: Server side C# MVC with AngularJS

text: I like using .NET MVC and have used it quite a bit in the past. I have also built SPA's using AngularJS with no page loads other than the initial one. I think I want to use a blend of the two in many cases. Set up the application initially using .NET MVC and set up routing server side. Then set up each page as a mini-SPA. These pages can be quite complex with a lot of client side functionality. My confusion comes in how to handle the model-view binding using both .NET MVC and the AngularJS scope. Do I avoid the use of razor Html helpers? The Html helpers create the markup behind the scene so it could get messy trying to add angularjs tags using the helpers. So how to add ng-model for example to @Html.TextBoxFor(x => x.Name). Also ng-repeat wouldn't work because I'm not loading my model into the scope, right? I'd still want to use a c# foreach loop? Where do I draw the lines of separation? Has anyone gotten .NET MVC and AngularJS to play nicely together and what are your architectural suggestions to do so?


title: Database-stored configuration management

text: Developing database-backed software, often one finds it convenient to store stuff in the database which one might traditionally express in code, but which is useful to store in the database (so that it can be changed without requiring a reload of the application). For instance, one might have processes which send automated email using a template; it makes sense to store this template in the database, so that the text can be tweaked by the users without having to change the code/redeploy/etc. However, these templates are "important"- they are required for the correct operation of the system, and for instance, if they become malformed or missing, the underlying functionality would probably stop working. As they live now in the database, they don't outside version control- you might add audit tables to have change history about this information, but revisions/etc. are separate and independent from your main code's revisions. How do you handle this kind of stuff? Not putting this kind of stuff in the database and make changes go through development/change control/deployment cycles? Or something else? Cheers, Álex


title: What is the Mars Curiosity Rover's software built in?

text: The Mars Curiosity rover has landed successfully, and one of the promo videos "7 minutes of terror" brags about there being 500,000 lines of code. It's a complicated problem, no doubt. But that is a lot of code, surely there was a pretty big programming effort behind it. Does anyone know anything about this project? I can only imagine it's some kind of embedded C.


title: What language do companies like NASA use to create their applications?

text: So obviously NASA need programmers to develop applications for them, be it VOIP applications, applications for control of machines and AI, etc. But in what language do they actually use for this? I'm 15 and plan on studying Software Engineering in University and my dream job is to program for NASA, astronomy is a huge hobby of mine. I have a need to learn things before I am of the "recommended" age, for example I have been studying post-grad Astrophysics in my free time. As a result of this I would like to know what programming language NASA use so I can begin to learn the basics and see if it is something I may enjoy. Please do not say `Live you life as a kid` as I have seen people say such things before, this is how I enjoy to live my life and absolutely love programming. I just feel that, like in many things, if I learn it at a younger age I will have greater experience when I am older - yes I have aspirations like you wouldn't believe (Haha). I am thinking of learning how to program an Arduino, or Engduino as we may be witnessing in my Computer Science classes, but is this at all related to the type of programming NASA do. I understand that NASA will be programming MUCH, MUCH, MUCH more advanced programs than I, but to just get the sense of bringing a inanimate object to life would be an achievement to me. So yeah, what programming language do they use, what would you recommend I study in University to follow up such a dream?


title: Serpent Algorithm thats implement Cipher

text: How must i change the Standard Implemplementation of the Serpent Algorithm that i can use it with the javax.crypto.CipherInputStream or javax.crypto.CipherOutputStream? I must implement/extends the Cipher class and when i do it, what must i change? The Original Implementation of the Serpent Algorithm is here http://www.cl.cam.ac.uk/~rja14/serpent.html Exist a Implementation of the Serpent Algorithm that's implement Cipher? I found the Java implementation of the Algorithm on the Page of its Creator. The Problem in this is: i can't use it with javax.crypto.CipherInputStream or javax.crypto.CipherOutputStream. I try to use the ObjectOutputStream to write a Configuration File, but i would like to encrypt it with the Serpent Algorithm. The same is with the reading of this Configuration file. I don't want to use API's like the BouncyCastle and flexiprovider because they create a to heavy boilerplate which i don't need. What is the best practice to use a finished (final and tested) Algorithm that dont extends/implements Cipher and it should be used in javax.crypto.CipherXxxStream?


title: Are you able to close your eyes and focus/think just on your code?

text: I have some colleagues at work, they arrive at the morning, switch off email, phone, close the door, etc. Then they close their eyes and during 30 minutes try to focus on their programming (C++, C, etc) and remember what they did yesterday. Then and somehow the process or imagine the code on they mind, with closed eyes. And some time later they just grab pencil and dump code on a sheet of paper or on their IDE (Kdevelop, Visual Studio, Eclipse, etc). Some of these guys are really effective and develop very complicated code. Me, I can not do this and I wonder if some of you can do something similar, and in case, if you could give some advice on how to be able to focus so deep in a codde or problem. Thanks


title: What should be used to diagram an application's internal architecture?

text: I have an application that has several dependencies, including a Matlab library and a Microsoft Windows Media Player ActiveX control. How would I graphically depict the internal architecture of this application for documentation purposes? Would a UML structure diagram be appropriate? If so, would it be as simple as the following: ![enter image description here](http://i.stack.imgur.com/77xN8.png)


title: Help with MVC design pattern?

text: I am trying to build a java program for user login but I am not sure if my MVC design is accurate. I have the following classes:   * LoginControl - servlet   * LoginBean - data holder java class with private variables getters and setters   * LoginDAO - concrete java class where I am running my SQL queries and doing rest of the logical work.   * Connection class - java class just to connect to the database   * view - jsp to display the results   * html - used for form Is this how you design a java program based on MVC design pattern? Please provide some suggestions?


title: Is masking really necessary when sending from Websocket client

text: The current Websocket RFC requires that websocket clients mask all data within frames when sending (but server is not required to). The reason the protocol was designed this way is to prevent frame data from being altered by malicious services between the client and server (proxies, etc). However, the masking key is still known to such services (it is sent on a per frame basis at the beginning of each frame) Am I wrong to assume that such services can still use the key to unmask, alter, and than re-mask the contents before passing the frame to the next point? If I'm not wrong, how does this fix the supposed vulnerability?


title: Email Content creation | Proper design

text: Working on an E commerce application where we need to send so many email to customer like   * Registration email   * Forget Password   * Order placed There are many other emails that can be sent, I already have `emailService` in place which is responsible for sending email and It needs an Email object, Everything is working find, but I am struck at one point and not sure how best this can be done. We need to create content so as it can be passed to `emailService` and not sure how to design this. For example, in Customer registration, I have a `customerFacade` which is working between `Controller` and `ServiceLayer`, I just want to delegate this Email Content creation work away from Facade layer and to make it more flexible. Currently I am creating Registration email content inside `customerFacade` and some how I am not liking this way, since that means for each email, I need to create content in respective Facade. What is best way to go or current approach is fine enough?


title: Standards for how developers work on their own workstations

text: We've just come across one of those situations which occasionally comes up when a developer goes off sick for a few days mid-project. There were a few questions about whether he'd committed the latest version of his code or whether there was something more recent on his local machine we should be looking at, and we had a delivery to a customer pending so we couldn't wait for him to return. One of the other developers logged on as him to see and found a mess of workspaces, many seemingly of the same projects, with timestamps that made it unclear which one was "current" (he was prototyping some bits on versions of the project other than his "core" one). Obviously this is a pain in the neck, however the alternative (which would seem to be strict standards for how each developer works _on their own machine_ to ensure that any other developer can pick things up with a minimum of effort) is likely to break many developers personal work flows and lead to inefficiency on an individual level. I'm not talking about standards for checked-in code, or even general development standards, I'm talking about how a developer works locally, a domain generally considered (in my experience) to be almost entirely under the developers own control. So how do you handle situations like this? Are the one of those things that just happens and you have to deal with, the price you pay for developers being allowed to work in the way that best suits them? Or do you ask developers to adhere to standards in this area - use of specific directories, naming standards, notes on a wiki or whatever? And if so what do your standards cover, how strict are they, how do you police them and so on? Or is there another solution I'm missing? [Assume for the sake of argument that the developer can not be contacted to talk through what he was doing here - even if he could knowing and describing which workspace is which from memory isn't going to be simple and flawless and sometimes people genuinely can't be contacted and I'd like a solution which covers all eventualities.] **Edit:** I get that going through someone's workstation is bad form (though it's an interesting - _and likely off-topic_ \- question as to precisely why that is) and I'm certainly not looking at unlimited access. Think more along the lines of a standard where their code directories are set up with a read- only share - nothing can be changed, nothing else can be seen and so on.


title: Do validate non-input data from a client?

text: One of our developers has an opinion that all client data should be validated before using it. Even non-input data. Say, our web service has an internal protection against database injections. Examples: machine generated codes, various integers, indexes, calculated values. We use ORM (Django). As I know there is a next approach in Django: validate only values entered as primary strings (usually via web forms). For example: is there any reason to create validation rules to validate numbers if we know that there is 500th error (if the data are wrong) in the beginning of handling request? I think no. But probably I'm wrong. Do my position requires to be changed?


title: What is the name of this design pattern?

text: I have been using this "design pattern" (may or may not be an "official" design pattern) for a while and I wanted to know if it had a name (so that I could name my classes after it). Example in PHP code (though applies to any language) (the example is stupid please don't mind):               interface Formatter {         public function format($variable);     }          class IntFormatter implements Formatter {         public function format($variable) {             echo (string) $variable;         }     }          class StringFormatter implements Formatter {         public function format($variable) {             echo '"' . $variable . '"';         }     }      Now the pattern I want to know if for this class:               class FormatterDispatcher implements Formatter {         private $formatters = [];              public function setFormatter($type, Formatter $formatter) {             $this->formatters[$type] = $formatter;         }              public function format($variable) {             $type = gettype($variable);                  return $this->formatters[$type]->format($variable);         }     }          // Now in the code:     $formatter = new FormatterDispatcher();     $formatter->setFormatter('int', new IntFormatter());     $formatter->setFormatter('string', new StringFormatter());          $formatter->format($variable);      As you can see, it's just a proxy to other implementations of the interface. It will select the implementation to use based on the class of the parameter (here I used primitive types for simplicity's sake). So what is the name of this pattern? PS: in a language that supports Generics, the code would definitely look better, but I guess the spirit would be the same.


title: Laravel 4: Binding/linking two users together

text: I'm building a unittest system. At some point I want to bind two users together in order to make an assignment for those two. So when the admin chooses to link two students together the system should figure out how to, maybe using the ID numbers of the both users. I have an idea on how implement this, but not very clear.


title: How do I get a job as a game developer?

text: I'm an entry-level programmer just out of college. As I've found out, I don't really enjoy working on "boring" applications like networking, firewalls, and such. My dream job would be something like a game developer. What should I be focusing on to move into games development? Are there specific technologies or languages that I should know?


title: calculate complexity of LinkedHashSet

text: I have an `ArrayList<LinkedHashSet<String>> setOfStrings` for example this arraylist internally is composed like:               positionX[hello,car,three,hotel,beach]     positionY[.....]     ...      I want to find car inside this data-structure, so I did it               for (Iterator<LinkedHashSet<String>> iterator = setOfStrings.iterator(); iterator.hasNext();) {          LinkedHashSet<String> subSet = iterator.next();         if (subSet.contains("hotel"))             System.out.println("found");     }      The for iterate over the entire `arrayList` and the complexity in the worst- case is O(n), but I'm confused on the complexity of the method `contains()` of set. In according of `javadocs` this method is executed in **constant time** , but I've heard that in certain cases the complexity might become `O(n)`. Saying that, I'm not sure about the complexity of this snippet algorithm. Can someone provide me an explanation of that?


title: Rectangle class java.lang.Object

text: Can someone please explain to me the difference or benefits rather to using the rectangle class               ex. Rectangle r1 = new Rectangle(x,y,w,h);       versus the graphics class drawRec method?               g.drawRec(x,y,w,h);      I'm thinking that you can create a new object outside of paint() or paintcomponent() which gives creating an object more options and maybe the associated methods is a bonus? I'm just speculating though because the tutorial I was going through switched from using one to the other without explaining why. I believe I understand how to use them just not when it's better to use which. Please try to keep your responses at the beginner level seeing as how I'm just starting out but of course any assistance is GREATLY appreciated. Thanks!! Here is a code segment of what I'm working with:               public void paintComponent(Graphics g){          g.drawImage(yellowBall, xCoor, yCoor, this);         Rectangle r1 = new Rectangle((boardXSize/2), (boardYSize/2),50, 50);         g.setColor(Color.red);         g.fillRect(r1.x, r1.y,r1.width, r1.height);              repaint();          }


title: finding high end software contracting jobs

text: I've been contracting for about 3 years now. I am currently a contractor for a web firm. This is a hourly position. I want to find larger projects. I had read that some people are able to only do one or two jobs a year and be set on that. I want those types of jobs, and I want to hire people to take on these jobs as well, but I have no idea where to start. I highly doubt places like odesk post these types of contracts. Where can I find them? How can I make good money and live comfortably while working for myself?


title: What would the ultimate developer training class look like?

text: I think today's typical/traditional 3-5 days developer training classes aren't so great, as you tend to forget half of it shortly after. It's too much one way communication and not enough interaction. Also brain research has shown that this kind of setup is usually not optimal for efficient learning. For clarification, I am referring to professional, commercial, paid classes. However this could also be applied for any kind of studies. How could the ultimate developer training package be setup to really make sure you learn what you are supposed to learn? Would that be more:   * Multimedia?   * Exercises?   * Homeworks?   * Spread out over time instead of 3-5 compact days?   * Group projects?


title: Can a Guy with Embedded System Background go into Game Development

text: Well, I finished my Masters in Embedded Systems, and I am working in GUI development, and working with graphic tools and images and GUI's keep me glued to my seat more than working on code for MUP/MUC . And I want to give game development a Fair chance, try out developing a game from scratch using basic libraries then tryout the same in a free/open source game engine and there is a good chance I may fall in love with it, but it is poissible for a person with an Electrical and Electronics Bachelors and Embedded Systems Masters ( just a years experience in the field) go into game development and be successful in the profession. And I asked the same question @ stackoverflow.com (wrong place to ask ) http://stackoverflow.com/questions/13794822/can-a-guy-with-embedded-system- background-go-into-game-development/13794943#13794943 And I received good but a very generic answer. I would be happy to know the actual pro's and con's of a master's in embedded systems migrating to Game Dev


title: Difference between Atomic Operation and Thread Safety?

text: From the discussion I've seen it seems that _atomic operation_ and _thread safety_ are the same thing, but a lot of people say that they're different. Can anyone tell me the difference if there is one?


title: What exactly do I need to do if I use a LGPL licenced library?

text: I have read this questions and answers, but I still don't understand what exactly do I need to do if I dynamically link with a library that uses a LGLP licence (the SDL library in my case). If I understand LGLP text correctly, I need to somehow provide the source for the library. Is this enough? If not, what else needs to be done?


title: How do you make a manager understand Agile?

text: I have a problem with a senior director who doesn't understand iterative development (much less Agile). He is insistent that our software design specification (SDS) be complete before any line of code is written. Complete, to him, means all functional detail is there. Also, being a former Cobol programmer, he wants to see "modules" and flowcharts. This is a Java web app for crying out loud! Anyway, I'm trying to find a simple place to gently point him to show that the SDS need not be 100% complete before we begin coding (nor can it be complete). Any suggestions? Thanks!