IntelliJ Idea - am I doing it wrong? (former Eclipse user)

I have been an Eclipse user as long as I can remember, and have always been happy with what it has offered. As you know, Idea is now free, and one of my main excuses for not using Idea has been "I'm sure it's very very good, but Eclipse is free and it's easily good enough for what I need". So, now that Idea is free, in order to try it out I decided to start a new Play Framework project, and instead of typing `play eclipsify` I typed `play idealize`, and followed the steps to import the project into Idea. This worked fine, and at some point along the way I was given the opportunity to choose my key layout mappings, so I chose Eclipse. I have made lots of progress, and am really impressed with Idea's superior refactoring and variable name suggestion. However, at the same time, I am missing some key features of Eclipse that I would be astonished not to find in Idea:   * In Eclipse, I can type `CTRL`+`Shift`+`O` to organise imports. All the imports are sorted out for me, and for anything ambiguous it asks. In Idea I seem to need to move to any ambiguous ones with the cursor and hit `Alt`+`Enter` for each one so that I can choose which import to do.   * On methods with misspelled names, incorrect signatures, etc, in Eclipse I can hit `CTRL`+`1` and a dropdown gives me suggestions. I don't seem to be able to do this in Idea.   * `CTRL`+`O` gives me the quick outline, which is a nice popup showing the current class's high-level outline. I don't seem to be able to do this in Idea.   * `CTRL`+`Shift`+`T` in Eclipse brings up a dialog to type the name of a class to open. More often than not, Idea seems to stop responding at this point, and I have to, at the very least, move focus away and back again in order to get it to start responding again.   * how on earth do I expand a collapsed import statement without resorting to the mouse? In Eclipse I would just move the cursor to it and hit enter. In Idea the best I can do is a `CTRL`+`D` and then `CTRL`+`Shift`+`O` :) I'm guessing that these are features that I've just not found beceause Idea's keyboard mapping is not a 1:1 match with Eclipse's, or that the functionality can't be perfectly matched to a specific hotkey combination because Idea goes further in what it offers. The problem where Idea stops responding seems more like a bug to me. I really really want my 'relationship' with Idea to work out, I can 'feel' it is a very very good IDE, but these little niggles are getting in my way. Is the latest free release buggy, or have I just not given myself enough time to change my habits and expectations compared with Eclipse (I've only been using it for a week or so)?


What is a good algorithm for tracing around the edge of a 2D polyline

If I have a polyline made up of any number of vertexes, what is an efficient algorithm for tracing around the boundary of this polyline? There are 4 situations to consider:   1. The polyline does not intersect itself and has no colinear edges.   2. The polyline does not intersect itself but has an interior or exterior loop.   3. The polyline has self intersections in a bowtie shape.   4. The polyline has self intersections which form interior loops. An example of each (all are closed):   1. Vertex List = (5,3) (10,3) (10,7) (5,7)   2. Vertex list = (0,0) (3,0) (3,3) (1,3) (1,2) (2,2) (2,3) (0,3)   3. Vertex list = (5,3) (10,7) (10,3) (5,7)   4. Vertex list = (0,0) (3,0) (3,4) (1,4) (1,2) (2,2) (2,3) (0,3) Visually: ![The shapes to trace the outline of.](http://i.stack.imgur.com/NYUSy.png) In this case a convex hulling algorithm really is not appropriate, because I wish to preserve any concavities in the shape. Results: To clarify, the bow tie shape should not be crossed over, and a simple area calculation should yield an area for this shape (i.e. the two triangles end up logically wound in the same direction). ![This is what the resultant shapes should look like](http://i.stack.imgur.com/KUJv7.png) Not only does this algorithm have to work (which is the first priority) it should be fast enough to run on hundreds of thousands of polylines in a few seconds. In addition, the algorithm has to be able to handle any combination of the four cases.


Design patterns: moving object references around an application

I'm new to Programmers and I am looking to increase my knowledge of programming. Recently, a user on Stack Overflow told me using singletons is a bad idea, that they encourage tight coupling and that they make testing harder. What prompted this discussion was that every class I've ever written accessed any kind of data through a singleton. For example, a class that handles state data for a game. If any other class wanted to access this data, all they would have to do is get the singletons instance and there it would be. Specifically, instantiating a class on the AppDelegate, then accessing it via: [[[[UIApplication sharedApplication] delegate] gameObject] getScore]. The SO user told me that I should instantiate the 'gameObject' wherever I first need it, then pass that object to every other class that needs it via either a method as an argument, or via a property. I was discussing these points when someone else pointed out that this information is completely wrong, that singletons are unrelated to coupling and that they do not affect testing at all. I'm now completely confused as to which person is correct. Could someone please clarify which technique is best for an object to persist for the lifetime of the app, and be accessible to other classes, and also maintain loose coupling. To me, the object passing by method or property to each class seems the most logical, but I do not know! Thanks in advance for any help!


How do I unit test multi-threaded code?

Are there ways to unit test your multi-threaded code for race conditions and deadlocks? To see if they are performing the way they should be...


Logic required to solve a problem relating to location of objects

I have raised a question on dba.stackexchange.com but as the heart of my question is in fact to do with logic I have raised a more general representation of my issue here. I think it is the right place, apologies if not. I have a number of objects that are read and written to in a set sequence. I also have four locations in which I can store these objects. These objects vary in size but for the purposes of simplicity I have rated them 1 to 3 with 3 being the largest. Location of objects is fixed e.g. objects can not be moved in between sequence steps I have a table which details the sequence of the process. It has three columns: Sequence, Source, Destination. Processes can and do run in parallel and therefore sequence is not a unique identifier however should one be required it can be considered to be in place. In an ideal world no object should be located in a way that would result in no object required for a sequence step being co-located with another. Of course this is highly unlikely and instead I am looking for a best solution as opposed to a perfect one. I have therefore considered that the potential locations may be best ranked as followed.   1. All objects for a sequence located separately.   2. Source and destination objects for sequence located separately.   3. Objects located anywhere Given that each object has a size I also considered perhaps multiplying the location rank by the size and therefore giving the locations a score. Then based on this I could find the best solution by looking at it's total score. Does anyone have any suggestions or perhaps addressed a similar problem in the past? Any help input is greatly appreciated.


How can you explain "beautiful code" to a non-programmer?

When speaking with a non-programmer friend, I happened to mention the concept of "beautiful code" and she wanted to understand what that meant, but I was at a bit of a loss as to how to explain it to someone who would have no context whatsoever. When all code looks like gibberish to someone anyways, how can you explain what makes one piece of code prettier than another? Analogies could be useful too.


A question about static types

How would you statically type the following JavaScript program               function c(str) {       c = eval(str);       return c(str);     }      I'm not trying to start a flame war but I'm genuinely curious. I've always assumed that dynamic languages allow more programs to be written because of examples like the above. But if a statically typed language is Turing complete then it should be able to express the equivalent of the above program. So where exactly does my reasoning break down because this seems paradoxical to me? My reasoning is that this is obviously a function that can not be typed in a statically typed language and still allow the generality that the above code allows for.


I am building an application that will be modular, in a way that it will be a set of separate systems communicating with each other. It uses Hadoop on all systems, and HBase on 3 of the 4. Scaling will only be an issue on the non Hbase system, it uses it's own NoSQL like system. It will be a client facing system, and is very memory intensive, so each server can handle a limited number of users, before drastically dropping performance. All 4 systems have Zookeeper procedures & options built in. Is it smart to design a command and control server, that will monitor system resources and spin up/spin down servers at times of peak? Would that set me up for failure, since if it faults the whole system can fail? How hard would it be to automate a task like that for Hadoop?


I want to sell an app but also share the source code

I'm sorry if the title isn't clear, I have no idea about licences... The thing is that I have created a little app for android targeted at developers. I want to get paid for the app, but I also want to share the code so others can modify it to improve it or to suit their needs. I think this is somewhat close to minecraft way (sell and expect that everybody pays, but have no problem with people modifing the source, build mods, etc) and is pretty close to http://livereload.com/ way of distributing and licensing. Maybe I should sell the app and give access to a private repo from the app itself (so, once you bought it, you get access to the source). Am I right? is this my best option?


I-Framing Third Party Pages In Chrome Extensions

I wrote a (super) simple Chrome Extension for the Telerik Code Converter that just iframes their page in a browser action pop-up. It's been really helpful as I use this tool all the time when I have to port some of my more complex C# code to VB. I was wondering if it would be **ethical** for me to upload this Extension to Chrome Web Store for other developers to use? Of course I wouldn't ever be charging or profiting from it in any way.


Is an Inner Function Justified in this Situation

I'm new to the functional programming concepts in C#, but I have some experience with higher order functions via Haskell, Scala, Python and Ruby. I'm currently going through an old .NET 2.0 codebase with a LOT of duplication in it. Most of it is simple "copy/paste" with a few variables changed. I'm trying to condense as much of this as possible. **A chunk of code within a routine I'm working on now goes a bit like this, for example:**               if (PostProcess.UsesFirstPass)     {         w.WriteLine(V1 + " = 0" + " !! SET FOO");         w.WriteLine(V2 + " = 0" + " !! SET BAR");         w.WriteLine(V3 + " = 0" + " !! SET BAZ");         if (PostProcess.IsSpecial){             w.WriteLine(V3 + " = 20" + " !! INCREASE BAZ");         }         w.WriteLine(V4 + " = 0" + " !! SET QUUX");     }     if (PostProcess.UsesSecondPass)     {         w.WriteLine(V5 + " = 0" + " !! SET FOO");         w.WriteLine(V6 + " = 0" + " !! SET BAR");         w.WriteLine(V7 + " = 0" + " !! SET BAZ");         if (PostProcess.IsSpecial){             w.WriteLine(V7 + " = 20" + " !! INCREASE BAZ");         }         w.WriteLine(V8 + " = 0" + " !! SET QUUX");     }     if (PostProcess.UsesFinalPass)     {         w.WriteLine(V9 + " = 0" + " !! SET FOO");         w.WriteLine(V10 + " = 0" + " !! SET BAR");         w.WriteLine(V11 + " = 0" + " !! SET BAZ");         if (PostProcess.IsSpecial){             w.WriteLine(V11 + " = 20" + " !! INCREASE BAZ");         }         w.WriteLine(V12 + " = 0" + " !! SET QUUX");     }      Where any of the "V"s you see in there is a string variable defined earlier. It's part of a fairly large method. I could write another method called, say, `WriteVariables()` and pass in the required info and call it three times, but it only ever applies to this section of method. I think this would be a place where writing an anonymous inner function would make sense. I did it to test it out, and it seems to work fine. **Now I have a single delegate that looks something like:**               private delegate void WriteCutVars(string V1,          string V2, string V3, string V4, CuttingParameters cutParam);          // snip //          WriteCutVars WriteVars = (Va, Vb, Vc, Vd) => {         w.WriteLine(Va + " = 0" + " !! SET FOO");         w.WriteLine(Vb + " = 0" + " !! SET BAR");         w.WriteLine(Vc + " = 0" + " !! SET BAZ");         if (PostProcess.IsSpecial){             w.WriteLine(Vc + " = 20" + " !! INCREASE BAZ");         }         w.WriteLine(Vd + " = 0" + " !! SET QUUX");     }     if (Process.UsesFirstPass) WriteVars(V1, V2, V3, V4);     if (Process.UsesSecondPass) WriteVars(V5, V6, V7, V8);     if (Process.UsesFinalPass) WriteVars(V9, V10, V11, V12);      **My main questions:**   * Is this a proper use of inner functions?    * Is this acceptable when I'm the only CS graduate on a team of mostly mechanical engineers?


Can a domain specific language be used to representing the Open SRD

I am in the early stages of creating an open source C# library that would allow developers to drop in the open SRD (http://www.d20srd.org/) into an existing project. Abstracted it is a complex set of tightly coupled business rules. Having previously worked on an adaptive object model project for health care risk management I began with that pattern in mind. Due to the high coupling of rules it is becoming apparent that the project may require some kind of scripting. Have started researching DSL implementation I am now considering scrapping the adaptive object model for a domain specific language. I have not work with domain specific languages so my question is it reasonable to assume a domain specific language can be used to representing the open SRD?


WPF Development in businesses

Apologies if this is too broad a question(or wrong SE to ask on), but something I've been wondering for a while. I enjoy WPF a lot, and think I'm fairly competent at work with it, and developing for it, and considering trying to advance my career further in that direction (currently on web, would like to move more towards a desktop/wpf focus). But I've never seen a WPF front-end designer position job advert, (or a FED designer position with WPF facets), is this down to in the industry that WPF devs are expected to handle both design & implementation of the UI, alongside the behind-code. Only asking this, as I'm terrible at design and if it's a crucial part of being a WPF developer, then it's going to be a fairly large hurdle to overcome. That's not to say I can't work with a given design. I know it could be a company dependant thing, some requiring WPF devs to have both sides, some companies just requiring them to have the behind C#/VB skills, but would like to hear from current developers in the industry, what their experience is. Thanks


User management data - the need for a username and password

I would have this asked on StackOverflow if it had code, but it's more on the idea/concept so I asked here. I am working on the UI of our inventory system when I found out that when registering a user in the system, the username and password of the user _is optional_. I asked our supervisor why is this so. He said that in the system, there are "bins of assets" (think of boxes with toys) where we assign through the system employees to handle these bins. Employees must be registered in the system but some of them are not given access to the system, therefore _there is no use giving them usernames and passwords_. But I think his argument is wrong, really wrong because every time I hear "no username no password" makes me cringe as it is most synonymous to a no- password, free-to-access account. And so I ask:   * **What would be the correct database design to separate this system-user employee and non-system-user employee that does not use this no username, no password scheme?** Currently, as the description implies, we have a single table with uid, username, hashed password and other fields with additional user data.   * To prove to him a point, I would like to know **why storing a blank username and password for an account is totally wrong for non-system-user registered employee**.   * **What are alternatives to having this system?** I know it's best to keep in one table the registered users but I have never seen this situation where there are registered users that don't have access to a system. It's like you are given a Facebook account, profiles and all but don't have a username and password for it (or in this case, blank)


If python compiles to assembly and an OS is written in it, will it compete favorably with C in benchmarks?

Ok, I have used the word _python_ in the question, but it well could be language agnostic in that: If a language X has a well optimised compiler targeting assembly and an OS is written in that language, then will it compete favorably with C in benchmarks? This comes from two conceptions I have (could be wrong):   * Languages are defined by grammar rules (syntax-semantics); they themselves are independent of performance. Performance is a function of implementation.   * C is often efficient because the most popular OS(es) are written in it - so limited wrapping and unwrapping - and it compiles to (these days) well optimized assembly code. And, yes, before some of us pull out guns, I understand and appreciate that in certain situations some languages may outperform C, but by and large C does better than most languages in most situations.


Website compatibility with old operating systems

I'm a web developer. I most often come across this critical situation when the website layout fits with the design when run on Windows 7 or 8 and Mobile Operating Systems (Android, iOs, Windows 8). But when the website is visited by old operating systems like Windows XP and Windows 1998 the whole layout collapses very badly. And specially when visited on old operating systems with Internet Explorer. If we take into account the old operating systems (and/or IE on them) it creates havoc for us. Sometimes, even the well supported front-end frameworks like Twitter Bootstrap give up there and won't support the older browsers. When clients or management request to make the website compatible with all the OS out there including Win XP, how to address this?


Are mutliple database calls really significant with a network call for a web API?

At one of my employers, we worked on a REST (but it also applies to SOAP) API. The client, which is the application UI, would make calls over the web (LAN in typical production deployments) to the API. The API would make calls to the database. One theme that recurs in our discussions is performance: some people on the team believe that you should not have multiple database calls (usually reads) from a single API call because of performance; you should optimize them so that each API call has only (exactly) one database call. But is that really important? Consider that the UI has to make a network call to the API; that's pretty big (order of magnitude of milliseconds). Databases are optimized to keep things in memory and execute reads very, very quickly (eg. SQL Server loads and keeps everything in RAM and consumes almost all your free RAM if it can). **TLDR: Is it really significant to worry about multiple database calls when we are already making a network call over the LAN?** If so, why? To be clear, I'm talking about order of magnitude -- I know that it depends on specifics (machine hardware, choice of API and DB, etc.) If I have a call that takes O(milliseconds), does optimizing for DB calls that take an order of magnitude less, actually matter? Or is there more to the problem than this? **Edit:** for posterity, I think it's quite ridiculous to make claims that we need to improve performance by combining database calls under these circumstances -- especially with a lack of profiling. However, it's not my decision whether we do this or not; I want to know what the rationale is behind thinking this is a correct way of optimizing web API calls.


Validation and Error Generation when using the Data Mapper Pattern

I am working on saving state of an object to a database using the data mapper pattern, but I am looking for suggestions/guidance on the validation and error message generation step (step 4 below). Here are the general steps as I see them for doing this: (1) The data mapper is used to get current info (assoc array) about the object in db:               +=====================================================+       |  person_id  |   name   |   favorite_color   |  age  |       +=====================================================+       |   1         |   Andy   |   Green            |  24   |        +-----------------------------------------------------+      mapper returns associative array, eg. Person_Mapper::getPersonById($id) :               $person_row = array(         'person_id' => 1,         'name' => 'Andy',         'favorite_color' => 'Green',         'age' => '24',     );          (2) the Person object constructor takes this array as an argument, populating its fields.               class Person {              protected $person_id;         protected $name;         protected $favorite_color;         protected $age;              function __construct(array $person_row)         {             $this->person_id = $person_row['person_id'];             $this->name = $person_row['name'];             $this->favorite_color = $person_row['favorite_color'];             $this->age = $person_row['age'];         }              // getters and setters...              public function toArray()         {             return array(                 'person_id' => $this->person_id,                 'name' => $this->name,                 'favorite_color' => $this->favorite_color,                 'age' => $this->age,             );         }     }      (3a) (GET request) Inputs of an HTML form that is used to change info about the person is populated using Person::getters               <form>         <input type="text" name="name" value="<?=$person->getName()?>" />         <input type="text" name="favorite_color" value="<?=$person->getFavColor()?>" />         <input type="text" name="age" value="<?=$person->getAge()?>" />     </form>      (3b) (POST request) Person object is altered with the POST data using Person::setters               $person->setName($_POST['name']);     $person->setFavColor($_POST['favorite_color']);     $person->setAge($_POST['age']);      *(4) Validation and error message generation on a per-field basis   - Should this take place in the person object or the person mapper object?   - Should data be validated BEFORE being placed into fields of the person object?  (5) Data mapper saves the person object (updates row in the database):               $person_mapper->savePerson($person);     // the savePerson method uses $person->toArray()      // to get data in a more digestible format for the      // db gateway used by person_mapper      Any guidance, suggestions, criticism, or name-calling would be greatly appreciated.


How restrictive are the GPL's linking restrictions really?

To my basic understanding, software licenses only apply when redistributing software. Even if I am wrong about this in general, the GPL states that you need not agree to the GPL in order to receive or run a GPL-covered program. Say there is Program X. Program X requires Library L to run. Program X is covered by a GPL-incompatible license (e.g. the Eclipse Public License, or a proprietary license). Library L is covered by the GPLv3. Program X cannot be distributed alongside Library L - the combination would need to be covered by the GPL, which would violate the EPL.   1. What prevents users from separately installing Program X and Library L, and then using Program X?   2. Perhaps more relevantly in the modern world of auto-updaters, what prevents Program X from including a wrapper which downloads Library L from the Internet (say, from Library L's official website) and then executing Program X? In both of these cases, nothing from Library L is distributed by the authors of Program X, so Library L's license should not apply.   3. What, if anything, changes if Program X instead requires Library L', a fork of Library L by the authors of Program X, which is only available from the same website as Program X and is only usable with Program X, but is never distributed in the same package as Program X?   4. What if this is all in a dynamic language, and no part of Library L is required to compile Program X?   5. What if Program X is distributed in source code form, so that the distribution was not compiled from Library L's headers?


Blurring the lines between async and regular functions in C# 5.0

Lately I can't seem to get enough of the amazing async-await pattern of C# 5.0. Where have you been all my life? I'm absolutely thrilled with the simple syntax, but I'm having one small difficulty. My problem is that async functions have a totally different declaration from regular functions. Since only async functions can await on other async functions, when I'm trying to port some old blocking code to async, I'm having a domino effect of functions I have to convert. People have been referring to this as a _zombie infestation_. When async gets a bite in your code, it will keep getting bigger and bigger. The porting process is not difficult, it's just throwing `async` in the declaration and wrapping the return value with `Task<>`. But it is annoying to do this over and over again when porting old synchronous code. It seems to me it will be much more natural if both function types (async and plain old sync) had the exact same syntax. If this were the case, porting will take zero effort and I could switch painlessly between the two forms. I think this could work if we follow these rules:   1. Async functions won't require the `async` declaration anymore. Their return types wouldn't have to be wrapped in `Task<>`. The compiler will identify an async function during compilation by itself and do the Task<> wrapping automatically as needed.   2. No more fire-and-forget calls to async functions. If you want to call an async function, you will need to await on it. I hardly use fire-and-forget anyways, and all the examples of crazy race conditions or deadlocks always seem to be based on them. I think they are too confusing and "out of touch" with the synchronous mindset we try to leverage.   3. If you really can't live without fire-and-forget, there will be special syntax for it. In any case, it won't be part of the simple unified syntax I'm talking about.   4. The only keyword you need to denote an asynchronous call is `await`. If you have await, the call is asynchronous. If you don't, the call is plain old synchronous (remember, we don't have fire-and-forget anymore).   5. The compiler will identify async functions automatically (since they don't have a special declaration anymore). Rule 4 makes this very simple to do - if a function has an `await` call inside, it is async. Could this work? or am I missing something? This unified syntax is much more fluid and could solve the zombie infestation altogether. **Some Examples:**               // assume this is an async function (has await calls inside)     int CalcRemoteBalanceAsync() { ... }          // assume this is a regular sync function (has no await calls inside)     int CalcRemoteBalance() { ... }          // now let's try all combinations and see what they do:          // this is the common synchronous case - it will block     int b1 = CalcRemoteBalance();          // this is the common asynchronous case - it will not block     int b2 = await CalcRemoteBalanceAsync();          // choosing to call an asynchronous function in a synchronous manner - it will block     // this syntax was used previously for async fire-and-forget, but now it's just synchronous     int b3 = CalcRemoteBalanceAsync();          // strange combination - it will block since it's calling a synchronous function     // it should probably show a compilation warning though     int b4 = await CalcRemoteBalance();      Note: this is a continuation of an interesting related discussion in SO


Java Program That Notifies When Camera is Being Accessed

I'm trying to find a developer to write me a pretty basic program. I am also a developer, but don't have enough time to write it myself. This program has a pretty basic function. It will notify users, via some dialog (or alert) that some program is about to access the _built in desktop / laptop_ camera. It could be skype or facetime, or whatever it is, the program should be aware of when the OS's camera is going to be accessed and notify the user. Yes, even if the user is initiating the camera themselves via Skype, the notification would still appear. My question is this. If I need this program written in Java, is it possible? Obviously I am trying to get it done in Java so it would run on Windows _and_ Mac. If it is not possible, then it seems as though I'd have to write 2 separate programs on Windows and Mac. I've come here to get suggestions so that I can connect with the right developers. If you have any suggestions, I'd be happy to hear them. Thanks!


What I need to do to learn Quality Assurance?

I am a Biology student, who has changed my career to IT and have been working in the software field for the past 4 fours under the **QA (auditing processes for ISO9001 purposes)**. Now I'm a Software QA Execute and have decided to increase my knowledge on QA. What are the next steps I can look for? Are there any **certifications** that I can do under QA, which will be very useful? (I have already done certification on IQA). I have heard about **CSQA** certifications for QA, are there any other certifications apart from these? Or as always, are there any books for upgrading my knowledge on QA?


Open Source PHP Encoder

Are there some recomendations on Open Source or Free **PHP Encoder** systems? Is something available?


How should I unit-test a class that relies on having realistic data?

I have a class that encapsulates the results of a scientific measurement. I’m building in unit tests from the beginning, but I don’t have a lot of experience with unit testing and I’m not sure which behaviors I should be testing and how. My class does three kinds of things:   1. Reads measurement data from a file (or a string) into its instance variables   2. Writes its measurement data out to a file or a string   3. Performs calculations on its data (e.g. getting the average of a set of numbers) My approach right now is to include a known-good example data file in my `test` directory. One test reads the data in from the file, passes it to my class, and makes sure that it meets some basic sanity checks. Another test passes the file’s _filename_ to my class, lets the class read it, and runs the same tests. The remainder of the tests read the data in from the file, pass it to my class, and check that the results of the data-processing methods are correct, given what I know about that data set. This seems pretty tangled, though. The tests that check (3) implicitly assume that the behaviors of (1) are correct, since it’s the functions in (1) that are being used to populate the class in the first place. And the tests of (1) could benefit from the extensive checks done by the tests for (3). Am I structuring my unit tests poorly, or is this just a natural result of the fact that I need to use a specific dataset in my tests?


Is there a tool that visually represents all the potential paths to a particular piece of code?

As an example of what I need and why I want it, I am trying to determine how a certain value (CurTotal) is getting set (wrongly). I've come up with these notes to myself to try to understand just what is happening: **CurTotal is declared in frmEntry.SetTotalControlsProperties(). CurTotal gets its value within that method from wrkFile.getAmount(), and txtCurTot is eventually assigned that value. SetTotalControlsProperties() is called:**               0) From the main (frmCentral) form's openfrmUPC() method     1) From frmEntry's overloaded constructor: public frmEntry(string DSDtablename, string recType, int QOne, int sDesc, int sList)     2) Conditionally from within DoSave(), which is called from btnSave_Click() and PrepareForPrinting()     3) From frmEntry's saveDSD(), which is called from DoSave(), which is called by btnSave_Click and PrepareForPrinting()     4) From frmEntry's saveINV(), which is called from DoSave(), which is called by btnSave_Click and PrepareForPrinting()     5) From frmEntry's btnClear_Click()      **So the most "interesting" ones are 0, 2, and 3 (I don't think the observed bogus activity takes place in saveINV(), I'm almost positive it's not in the constructor, and I know it's not in btnclearclick()).** So my head is swimming better than Mark Spitz (or, for you young whippersnappers out there, Michael Phelps) ever dreamed of slicing pell-mell through the chlorinated aqua. Making matters more malevolent for me, I can't step through this code (Windows CE, running in Windows XP mode, no emulator), except in my waterlogged brain*. So I ask: Is there a tool that visually represents all the potential routes from which SetTotalControlsProperties() is called/CurTotal is set? Best of all would be a tool that provided a listing of just what route the code took to get to a designated spot. Side question: Why is there no "spaghetti" tag? People got arrested for less than this in communist Russia.   * Cue (or is it "queue"?) TYA's "Over the Hill" here. ## UPDATE Fresh evidence that there truly is a need for such a tool: The method that sets the CurTot amount, namely _wrkFile.getAmount()_ , does this:               public double getAmount()     {         if (tAmount < 0)         {             SetTotalItemsAndTotalAmt();         }         return tAmount;     }      SetTotalItemsAndTotalAmt() assigns vals based on this query:               string dynSQL = "SELECT * FROM workTables WHERE name = '" + name + "'";      ..and "name" here is not passed in to SetTotalItemsAndTotalAmt, nor is it a local var. Arggghhhhhhhhh!!!


Why does the tool offer to change the code - just because it can?

Resharper (or is it Visual Studio - it's a yellow light bulb with a tiny red filament in it) offers to "invert if" on this code:               if (tItems >= 0)     {         return tItems;     }     SetTotalItemsAndTotalAmt();      ...and if I allow it to, it becomes this:               if (tItems < 0)     {         SetTotalItemsAndTotalAmt();     }     return tItems;      ...but then it offers to "invert if" again, and if I gullibly take the bait, it sets it back to its former glory. If one way is considered better (more grokkable, I guess) than the other, why would it also allow a reverse inversion? And if it's a case of "six of one and half a dozen of the other," why does it even bother to offer a change? ## UPDATE Actually, come to think of it, one of those ways is not even valid, for it says, " _WorkFiles.getAmount()': not all code paths return a value_ " unless it has the return statement outside the if condition. My guess is this is _not_ Resharper doing this; those Urquell-powered cats wouldn't do such a thing, methinks.


Prefered way to declare events

I am fairly happy with my understanding of the .NET event model. I think I might be misunderstanding a small nuance of the system. When I started out putting events into my classes I would use the standard way like so:               public event EventHandler<MyEventArgs> MyEvent;      This meant that anything subscribing to the event would need a method like:               void HandleThatEvent(object sender, MyEventArgs args){...}      Which is nice, but I found that I would rarely care about the sender, so it made a lot of method signatures bloated. So I switched to declaring my own delegate types               public delegate void MyEventHandler(SomeClass argument);      Which cut down on clutter, but left me with a small problem when it came to writing handlers:               eventImplmentor.MyEvent += HandleThatEvent;     .     .     .     void HandleThatEvent(/*oh, um, what arguments does it take? Intellisense isn't telling me*/)      So I would have to go back to the declaration of the delegate and look and then go back and write them in, or compile it and wait to be told. So now instead, I'm just using `Action`, `Action<T>` or whatever template fits.               public event Action<SomeClass> MyEvent;      So that I can hover over the event and be told what parameters it expects. My question, after all that: Is there a best practice for declaring events in C#? Should I go back to the `EventHandler<T>` way, or is `Action<T>` acceptable?


Has working on open source projects helped your productivity in your day job?

If yes, can you provide an example? Is it due to learning new tricks that you wouldn't learn otherwise by reading other's code? Or any other reasons as well?


what exactly is system programming?

I have never understood what system programming meant. The usual definition given is "...doing something close to the Os or extending Os features...". Does using Windows API directly rather than some libraries to say do file i/o make it system programming? Was writing Android OS system programming? If I write something that would expose linux kernel through a console like app on Android am I doing system programming? If I am writing software to control a washing machine am I writing system programming? I am a beginner in programming and this is confusing me to no end. Please explain contrasting it with "application programming".


ASP.NET without viewstate input, How comes?

I got surprised when I visited some sites with an 'aspx' extension at the end of their URLs and when I looked at their html source I didn't see any view state like the follwing:               <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="SNIKalxBOk0/lp+SgXklgi/0/IUoRXTjEjp6NrL2ColFXGht1bTDit5V+wHdkcuM3YVmVNKG1jpM6zAg+MQCnvPDvlEvK8RNwHblq8NN1Ys=" />      How did they prevent this to happen? even if you turn the view state off you'll get at least of of the above input in your HTML output. Here is one of the examples that I looked at: http://www.ada.org/index.aspx


About Intellectual-Property agreement with employer

In IP agreement IP is define as below > Intellectual Property (whether or not patentable and whether or not made > during working hours) is defined as but not limited to: all product > specifications, developments, inventions, works of authorship, derivative > works, technologies, programs, systems, software, mobile applications and > other mobile programming interfaces, designs, methodologies, encryptions, > ideas, techniques, patents, formulas, processes, concepts, know-how and date > made or conceived or reduced to practice or developed during employment > period ,remain the property of XXXXXXX[COMPANY_NAME]XXXX or its affiliates. This is the first time I have seen any IP agreement. Isn't it too stringent? or its standard practice across industry?


Java default Integer value is int

My code looks like this               import java.util.Scanner;               public class StudentGrades {          public static void main(String[] argv)     {         Scanner keyboard = new Scanner(System.in);         byte q1 = keyboard.nextByte() * 10;     }     }      It gives me an error `Type mismatch: cannot convert from int to byte.` Why would Java store a literal operand that is small enough to fit in a byte, into an int type? Do literals get stored in variables/registers before the ALU performs arithmetic operations?


Convert plain text to a pdf template

I have some articles (more than 200 pages) in plain text. It needs to be converted to an given PDF markup. I got some Photoshop files for the headers for every page and a list of requirements for the different elements. Which program would you use? And what would be your workflow?


Why are there so many string classes in the face of std::string?

It seems to me that many bigger C++ libraries end up creating their own string type. In the client code you either have to use the one from the library (`QString`, `CString`, `fbstring` etc., I'm sure anyone can name a few) or keep converting between the standard type and the one the library uses (which most of the time involves at least one copy). So, is there a particular misfeature or something wrong about `std::string` (just like `auto_ptr` semantics were bad)? Has it changed in C++11?


Is MVC just the SEO of PHP programming?

There's around a zillion "PHP frameworks". And most of them bill themselves as _following_ the MVC pattern. While it's welcome to overcome osCommerce coding style (processing logic heavily intermixed with SQL and HTML), there are certainly simpler and easier to follow approaches to get a maintainable application design. The original MVC concept was targetted at GUI applications. And for Gtk/Python it seems feasible to follow it accordingly. But PHP web apps don't operate on live Views (GUI elements) and a persistent Controller runtime. It's quite certainly a misnomer if it just describes the used code + directory grouping or class naming. "MVC" seems to be used like a buzzword for PHP frameworks. And I've actually seen one or two mature PHP frameworks admit it, but redefining the phrase anyway to match interna.   So is it generally snake oil? Why isn't better terminology used, and a more sensible concept for maintainable PHP propagated? **Some elaborative reasoning** Why I suspect that PHP implementations don't follow the real MVC pattern: **Models** : in theory, Models should be fat and contain business logic, and controllers should be thin handlers (input->output). In reality the PHP frameworks advocate **shallow** Models. CI and Symfony for example equate Model == ORM. Even HTTP input is handled by the controller, isn't treated as model. **Views** : workarounds with AJAX discounted, there can't be Views on web pages. PHP frameworks still pump out pages. The interface still effectively follows the ordinary HTTP model, there's no advantage over non-MVC applications. (And lastly, none of the widespread php frameworks can factually output to GUI Views instead of HTML. I've seen a PHP library that can operate Gtk/Console/Web, but the frameworks don't.) **Controller** : I'm unsure. Controllers probably don't need to be long- running and persistently active in the MVC model. In PHP framework context, they're however mostly request handlers. Not really something to get argumentative about, but it just feels slightly buzzwordish. **Would there be better descriptors?** I've seen acronyms like PMVC or HMVC thrown around. Though descriptions get more ambigous there, maybe these would describe the current web frameworks less hokey?


WAN Connectivity between multiple MS ACCESS DB

I have a client that asked me to develop his Windows Application and use MS Access instead of SQL database. I did and now he asked me that he deployed the Application through several of his offices. Now he wished to have a "main Server" with all information from the "client applications" for Reporting purposes and also to update information per "client application". I proposed the idea of "EDI" through FTP, also converting the current app to connect thru SQL via WAN, but somehow he said that FTP is not an option and also WAN connection is impossible since the internet on their country is so slow that an mp3 must be downloaded for 20 minutes or so he says. Is there any other way to communicate with the other DB(MS Access) and capture data or update data as necessary without using FTP EDI exchange?


What are the common techniques to handle user-generated HTML modified differently by different browsers?

I am developing a website updater. The front end uses HTML, CSS and JavaScript, and the backend uses Python. The way it works is that `<p/>`, `<b/>` and some other HTML elements can be updated by the user. To enable this, I load the webpage and, with JQuery, convert all those elements to `<textarea/>` elements. Once they the content of the text area is changed, I apply the change to the original elements and send it to a Python script to store the new content. The problem is that I'm finding that different browsers change the original HTML.   * How do you get around this issue?   * What Python libraries do you use?   * What techniques or application designs do you use to avoid or overcome this issue? The problems I found are:   * IE removes the quotes around `class` and `id` attributes. For example, `<img class='abc'/>` becomes `<img class=abc/>`.   * Firefox removes the backslash from the line breaks: `<br \>` becomes `<br>`.   * Some websites have very specific display technicalities, so an insertion of a simple "\n"(which IE does) can affect the display of a website. Example: changing `<img class='headingpic' /><div id="maincontent">` to `<img class='headingpic'/>\n <div id="maincontent">` inserts a vertical gap in IE. The things I have unsuccessfully tried to overcome these issues:   * Using either JQuery or Python to remove all `>\n<` occurences, `<br>` etc. But this fails because I get different patterns in IE, sometimes a `∙\n`, sometimes a `\n∙∙∙`.   * In a Python, parse the new HTML, extract the new text/content, insert it into the old HTML so the elements and format never change, just the content. This is very difficult and seems to be overkill.


How many applications should you provide to cover all sort of mobile phones

At the moment we have:   * Iphone   * Android   * J2me touch   * J2me non-touch   * J2me touch for Blackberry   * J2me non-touch for Blackberry We were thinking of making another   * J2me non-touch for crappy devices (because the regular non-touch is just to heavy) The question is, can you think of any other versions of our application that we should provide to target 'ALL' mobile phones


If attribution is done via a pseudonym, who owns the rights to the code?

I'm aware of a few cases where coders used a pseudonym for attribution instead of their real names. **Examples include:**   * Satoshi Nakamoto (Bitcoin)   * Why (Ruby) One thing I've wondered is if attribution is done via a pseudonym, who owns the rights to the code?


How to split large, tightly coupled classes?

I have some huge classes of more than 2k lines of code (and growing) that I would like to refactor if possible, to have some more light and clean design. The reason it is so big is mainly because these classes handle a set of maps that most methods need to access, and methods are very connected to each other. I will give a very concrete example: I have a class called _Server_ that handle incoming messages. It has methods like _joinChatroom_ , _searchUsers_ , _sendPrivateMessage_ , etc. All of these methods manipulate the maps such as _users_ , _chatrooms_ , _servers_ , ... Maybe it would be nice if I could have a class handling messages concerning Chatrooms, another handling all about Users, etc. but the main problem here is that I need to use all of the maps in most of the methods. That's why for now they are all sticked in the _Server_ class as they all rely on these common maps and the methods are very connected to each other. I would need to create a class Chatrooms, but with a reference to each of the other objects. A class users again with a reference to all the other objects, etc. I feel like I would be doing something wrong. Thank you for advice!


Why are assumptions important when defining a puzzle?

in this question OP has presented a site where some puzzle are available. He described the problem about solving them. I was curious is that really so problematic. The first one was really easy, so I tried next one this time from the end that should be the hardest one (puzzle). And here I have some problem with understating it or probably I am messing something. Let focus on the example: Data:               M1      C1      C2      277317     M2      C2      C1      26247     M3      C1      C3      478726     M4      C3      C1      930382     M5      C2      C3      370287     M6      C3      C2      112344      Result:               617317     2 3 6      My problem is that relying on the assumption that > any one compound can be used in a chemical reaction to create any other > compound The solution could be               508878     2 6 5      Why ? In the content of the task, we do not have sad anything about that we have to start with compound one then from this get two then from two, three etc. So the result should be to have all cheapest compounds, basing on the assumption we dont need to care how it was created. So this reduce our problem to structure like this.               M1      C2      277317     M2      C1      26247     M3      C3      478726     M4      C1      930382     M5      C3      370287     M6      C2      112344      And from this list we should pick the lowest cost for each compound. * * * So how did the achieve that solution, `2 3 6` ? By me they have used to complex logic for that, their basic assumption was that C1 -> C2 is the same as C2 -> C1 so they have used a rank (hash code)               17 * 37 * 1 * 2 == 17 * 37 * 2 * 1      (for this post i have used easier representation using the bit shift and bit- wise or that is more less the same)               M1    001 | 010 = 011  277317     M2    010 | 001 = 011  26247     M3    001 | 100 = 101  478726     M4    100 | 001 = 101  930382     M5    010 | 100 = 110  370287     M6    100 | 010 = 110  112344      After such operation the set of solution is reduced to this form               M1    3  277317     M2    3  26247     M3    5  478726     M4    5  930382     M5    6  370287     M6    6  112344      So now I don't have the information about compounds, but only a rank that provide the solution. We had three compounds on start we have three ranks so is seams to be correct, and the result is the same that in the example (cost 508878 machines 2 6 5). * * * My observation is that the content of the puzzle is very funny but have a lot of holes in the limitation about the method that should be applied to achieve the result. So concluding, what i am messing ?


How do you work with Asynchronous functions, recursively?

I am currently working on FLEX and have to call a web services. once I have the result, I have to call the web service again, with the previous result as the input. A compounding problem, is that the service might return multiple results, and I have to call the service again with each of the results as the input. Lastly, i need the results to be in a hierarchical array collection, with each result as the child of the input to the web service. If it were a synchronous function, it would have been very easy, but I have spent half a day trying to come up with something elegant for the web service. I ended up with having two arrays, one for the input, and one for the results. Every time I had one or more result, I would put it in the Input array and the results. I would then remove the first item from the input array and call the web service with it, and so on, till I finished all the inputs. Once I had all the results, I made a recursive function that would create the hierarchical tree, that I needed. This seems like a very hacky, WTF Solution. Is there any elegant and better solution? I am all ears.


As a solo programmer, of what use can Gerrit be?

**Disclaimer:** I'm aware of the questions How do I review my own code? and What advantages do continuous integration tools offer on a solo project?. I do feel that this question aims at a different set of answers though, as it is about a specific software, and not about general musings about the use of this or that practice or tech stack. I'm a solo programmer for an Eclipse RCP-based project. To be able to control myself and the quality of my software, I'm in the process of setting up a CSI stack. In this, I follow the Eclipse Common Build Infrastructure guidelines, with the exception that I will use Jenkins rather than Hudson. Sticking to these guidelines will hopefully help me in getting used to the Eclipse way of doing things, and I hope to be able to contribute some code to Eclipse in the future. However, CBI includes Gerrit, a code review software. While I think it's really helpful for teams, and I will employ it as soon as the team grows to at least two developers, I'm wondering how I could use it while I'm still solo. _Question:_ Is there a use case for Gerrit that takes into account solo developers? Notes: I can imagine reviewing code myself after a certain amount of time to gain a little distance to it. This does complicate the workflow though, as code will only be built once it's been passed through code review. This might prove to be a "trap" as I might be tempted to quickly push bad code through Gerrit just to get it built. I'm very interested in hearing how other solo devs have made use of Gerrit.


Motivation for a development team?

In two and half months I have successfully brought a team from the brink of doom to being a successful development team. The project is a using new .net technologies (MVC, EF), has new tools, and the team members have a large say in how a feature will be created, designed and implemented. What I want to do for the team is to keep this momentum going. I think the motivation is good and the project is interesting enough that it won't bore someone just yet, but I know that as time goes on, doing the same thing over and over lowers the interest level. What as a team lead can I do to make sure that we keep up this high level of motivation we have right now?


What are the design decisions involved in choosing how to expose a Java web application?

There are many ways to expose a Java web application to the consumer: application container (JBoss etc), servlet container (Tomcat etc), OSGi (Knopflerfish etc), self-executable WAR (Winstone etc) and so on. Are there any clear considerations where one approach should be favoured over another? As an example, could a collection of self-executable WARs running as raw Unix processes outperform the same applications deployed within Tomcat taking into account administration and scalability concerns?


Submitting Java Code with Junit unit test

I have mostly worked on simple java programs and compiled and run them with Eclipse on Windows. So, I have no experience of using command prompt for compiling Java projects and do not have much info about what actually happens beneath the play button in Eclipse. Now I have to submit a Java application which will have basic operation on XML. My project also will have (JUnit) Unit Test. My question is related to submission of this Project.   1. Which files would be necessary to submit the code. So, it executes properly?   2. Does choosing Eclipse as an IDE or junit as a unit testing framweork produces any dependenices i.e the executor of the program should have eclipse/libraries to execute the program on his machine?


Override methods should call base method?

I'm just running NDepend against some code that I have written and one of the warnings is `Overrides of Method() should call base.Method()`. The places this occurs are where I have a base class which has virtual properties and methods with _default_ behaviour but which can be overridden by a class which inherits from the base class and doesn't call the overridden method. For example, in the base class I have a property defined like this:               protected virtual char CloseQuote     {         get         {             return '"';         }     }      And then in an inheriting class which uses a different close quote:               protected override char CloseQuote     {         get         {             return ']';         }     }      Not all classes which inherit from the base class use different quote characters hence my initial design. The alternatives I thought of were have get/set properties in the base class with the defaults set in the constructor:               protected BaseClass()     {         this.CloseQuote = '"';     }          protected char CloseQuote { get; set; }          public InheritingClass()     {         this.CloseQuote = ']';     }      Or make the base class require the values as constructor args:               protected BaseClass(char closeQuote, ...)     {         this.CloseQuote = '"';     }          protected char CloseQuote { get; private set; }          public InheritingClass()         base (closeQuote: ']', ...)     {     }      Should I use `virtual` in a scenario where the base implementation may be replaced instead of extended or should I opt for one of the alternatives I thought of? If so, which would be preferable and why?


Why softwares used in factories are so poorly designed?

Why apps like Trumph's suite are so poorly designed and (without seeing the actual source, I can only guess) badly written? This question came this afternoon after a crash while doing a simulation in Trumph's Punch software, my boss told me "they're the leader in this sort of technology, so if something goes wrong it's likely on purpose"... I tried to explain, as a dev, the fact that even leading companies can release ugly software (in terms of efficiency and design) with, as an example, the fact that even big companies like twitter/facebook/google/microsoft/sony... are often in trouble with security holes, couldn't make him understand this. **TL;DR: why such high-cost software aren't well designed and are not as efficient as they could be?**


Is Notepad++ used in professional software development?

iam a newbie in programming , focusing on web development with PHP. I have tried several IDEs Nusphere,PHP storm, all IDEs i tried doesnt load fast (ofcourse because of all extra features) i always liked Notepad++ as its fast even though it doesnt have features. Does notepad++ meets all requirments for professional PHP development? Should i invest time on learning IDEs? Should i learn any PHP IDEs to be a professional PHP Developer?


Using <= for every dependency in case of following semantic versioning idea

As Semantic Versioning (and common sense) declares - the major version is incremented in case if non backward compatible change is introduced. Now let's assume we have a project called `Project` that has a current version `1.0.42` and a library `Lib` it depends on that is of a `2.1.3` version at the moment. Does that mean that following semver ideology we should constraint the dependency of the `Project` to be `Depends: Lib (< 3)`? From my experience - no one does that, but I find it semantically correct and very self-descriptive. What do you think of this?


Source Code Only Allowed With One Open Source Project

I have an open source project that is licensed under the GNU General Public License v3 and it's done in Windows Presentation Foundation. I came across someone that sells themes/skins for WPF projects and he is willing to donate one of the skins for use with open source project. However, he only wants the skin to be allowed to be used with my project. I was wondering what the best way would be to prevent other people from stealing the skin and using it with their projects? Is there a license that would fit this requirement? Or is there a better way to accomplish this?


Threads or ThreadPool? Fixed or Dynamic ThreadPool?

I have a java program which listens on a port for input. Based on Input, it calls a webservice and then returns a success/failure back to the client program. I fork a thread for each client connection. The response back to the client which connects to the program has to be quick. These are the choices I am considering   1. use regular threads   2. use `ExecutorService` with `newFixedThreadPool`   3. use `ExecutorService` with `newCachedThreadPool` The reason I am considering Pools is because my threads are shortlived - they just call a webservice, return result to the client and close the connection. I don't think `newFixedThreadPool` would be the right thing because then connections would be waiting in queues to get a thread. `newCachedThreadPool` would have been perfect except for one thing - threads die after a minute. In my case, I get bursts of connections - i.e. multiple connections and then there may be a lull for a few minutes and then again bursts. I think the threads in the CachedThreadPool would die and and would again have to be recreated - so in this case, it may work like #1 sometimes. Ideally I would have loved to have `newCachedThreadPool` with a minimum - i.e. a setting which says number of threads would never go below say 20. So idle threads are killed but never allow to go below a minimum threshold. Is there anything like this available? Or are there any better alternatives?


When and for what purposes should the const keyword be used in C for variables?

While getting my code reviewed here the issue of using the `const` keyword came up. I understand that it is used for implementing read-only behaviour on variables. I am confused about what are the various situations when it can be useful.   * Should it be used for the sake of clarity in function prototypes?   * Should it be used as a security measure during code development?   * Should it be used in the scope of various functions for declaring run-time constants?   * Should it be used at all? These question are just examples of the confusion that I am facing. The general confusion is   * When should be the `const` keyword used in C programming?    * What are the various types of benefits that can be gained by using this keyword in C?   * Are there any cons of using `const` keyword? * * * It has been pointed that this question may be too broad due to all these questions in the detail of my question. I just wanted to clarify that these questions are just to clarify the confusion regarding the main question. > When and for what purposes should the const keyword be used in C for > variables? It can also be rephrased as > The proper use of `const` keyword in C` with the pros and cons of the same.


Project implementation details in node.js

I am working as a software engineer turned team leader in a large software company. One of my areas of strength is node.js, and we are in the process of moving a lot of our services to separate node.js services, which is proving to be very successful so far. However, I am supposed to stop day to day development of small node.js services, and simply lay down a proper specification, so that one of my team members can work on the actual code. I am aware of tools like UML, but I don't think they apply to a system with apis built with node.js/express. I have made a few flowcharts, but my seniors want me to be very complete with the spec, down to each implementation detail. How I can achieve this? Should I design objects in UML and make my developers make javascript objects which can be used in express routes?


Don't like my current job, want to leave, how to explain this in a job interview?

A few years ago I immigrated to another country and early last year I managed to get my master's degree. Back then I was desperately looking for a job and I was fortunate to get offered a job in a small software development company. For the record, back in my home company, I was a well-known developer with a very good track record and I used to work as a senior developer and team leader for a software development company. Now after more than 1 year, for both technical and non-technical reasons I want to leave my current job. I can tolerate some of the technical problems we have but our manager and team leader are constantly disrespecting me and communicate with me in an offensive and belittling manner and for times and times this has made me feel depressed, anxious, stressed, and what not. Now my question is, how should a person in my situation, respond to "why are you leaving your current job?". Obviously I cannot say "because my manager is a psycho who is disrespecting me and offending me all the time and I have had enough". How do you think I should respond to questions like this?


What is ideal range (Min and Max date) for Calendar backup?

I need to take backup of calendar on my phone. We have requirement that we need to take backup of entire calendar data. Now, phone always supports recurring events. So, event may exist from 01-01-1601 to 31-12-3000. Logically, there is no point of taking backup from 01-01-1601 to 31-12-3000. I just want to know your views on the ideal range for the same.


JEE frameworks, a road map to learn? and should I learn them?

**Background Information** I have been into programming since past 1 years professionally, my day to day work includes writing BIRT reports, designing and validating forms using JEE (struts/spring, hibernate). I don't have a comp Sci 4 year degree (Electronics), so I have very Limited experience in comp Sci. **Question** JEE frameworks (struts1/2, spring, hibernate etc) are hot nowadays, however java world have a tendency of building A4j, B4J... mayway4J kind of stuff (and I am tired of it). AFAIK, frameworks are nothing but bunch of XML config files and hundreds of classes built to cram (by developer). And sooner then later a new framework come into picture that says **I am the best among all**. So My Question is - 1.What will you do to learn a framework (many frameworks) considering that it can be obsolete till you'll be master in it (Learning frameworks can take significant amount of time)? 2.Considering early into your career, will you give a damn that how well someone knows framework (knowing frame work is important but still..) and why/how should I learn a framework knowing I have to (un)learn it in order to learn other one (plenty of of 4Js....)? I am just trying to get a big picture, that, if you're in place of me, what would be your learning/cramming strategy (Road map)? I am not intended to start a holy war between A versus B, (frameworks are more or less essential).


Learn C++ before/at the same time as C#?

I'm currently learning C#, but wondering whether it is beneficial to learn some C++ before/at the same time as in order to understand the concepts a little better? I've got a C++ book and it does seem rather useful, especially explaining pointers and references.


Solutions for software using many calls to a server

I am developing software that uses many calls to a server. On a client side it's a Silverlight application. Almost every time a user clicks on a button in it, it sends 1-5 WCF calls to a server. There can be up to dozen or so users at a time. The server is a database server that serves data to a client. I am an intermediate level developer and am thinking about caching some data and syncing my changes from time to time. Are there any official solutions or technologies for it, like, patterns and such?


Game server code design

I'm designing a multiplayer game server where the players are in rooms. Right now I have classes to take care of the client, networking, etc. I'm struggling however to find a design for this Room class. For example, when I want to change a client's room, should I call `client.changeRoom(newRoom)` or `newRoom.addClient(client)`? What about when leaving a room, should a client detach itself from the room or the room detach the client? I'm very confuse here, I just don't want to end up with a design I will regret in the future.


Are there any opensource APIs that help analyze code?

As an example, let's say that I need to check for a certain usage of C# code and warn the user that that is a bad pratice. There are multiple usages that I want to detect, such as:   * Resource not being released by developer (in a heavy COM environment)   * Instance should be created using Activator instead of new (I don't have control of the API I'm analyzing)   * Others The implementation of the API can be in any language, but I'll be mostly analyzing c# and vb.net. Suitable languages:   * C#   * Python   * Other


Always return single objects in an array for REST API JSON payloads?

For a REST API that I am working on, I want to return JSON in a consistent layout:               {       "Data" : {          "Id" : 123,          "Email" : "charlie@somewhere.com"          "Firstname" : "Charlie",          "Surname" : "Brown",      },      "Error" : null     }      The payload will always contain "Data" and "Error", where one or the other can be null. My question relates to "Data" and endpoints which only ever really return one object. For example, let's say I have an API `users/current`, which returns the currently authenticatedd user. I would have returned that user as shown above; a single JSON object named "Data". For endpoints that could return zero, one or more objects, then I would (of course) make "Data" be an array:               {       "Data" : [         {           (first object)         },         {           (second object)         }       ],       "Error" : null     }      I've heard a point of view that, for consistency, "Data" should _always_ be an array. Even when an endpoint would logically only ever return a single object (or null). What do others think? I think that there's no need to make "Data" and array if there'll never be more than one object returned.


reading and understanding c code

I want to understand the linux kernel code, and I have been going through it but I am not able to get the full feel of what is happening(I am concentrating on network part of the linux kernel), so can anyone of you suggest good practices of reading C (or any other lang) code in general and specific to network part of the linux kernel. Thanks in advance


How do I organize a GUI application for passing around events and for setting up reads from a shared resource

My tools involved here are GTK and Haskell. My questions are probably pretty trivial for anyone who has done significant GUI work, but I've been off in the equivalent of CGI applications for my whole career. I'm building an application that displays tabular data, displays the same data in a graph form, and has an edit field for both entering new data and for editing existing data. After asking about sharing resources, I decided that all of the data involved will be stored in an MVar so that every component can just read the current state from the MVar. All of that works, but now it is time for me to rearrange the application so that it can be interactive. With that in mind, I have three widgets: a TextView (for editing), a TreeView (for displaying the data), and a DrawingArea (for displaying the data as a graph). I _THINK_ I need to do two things, and the core of my question is, are these the right things, or is there a better way. Thing the first: All event handlers, those functions that will be called any time a redisplay is needed, need to be written at a high level and then passed into the function that actually constructs the widget to begin with. For instance:               drawStatData :: DrawingArea -> MVar Core.ST -> (Core.ST -> SetRepWorkout.WorkoutStore) -> IO ()     createStatView :: (DrawingArea -> IO ()) -> IO VBox          createUI :: MVar Core.ST -> (Core.ST -> SetRepWorkout.WorkoutStore) -> IO HBox     createUI storeMVar field = do         graphs <- createStatView (\area -> drawStatData area storeMVar field)              hbox <- hBoxNew False 10         boxPackStart hbox graphs PackNatural 0              return hbox      In this case, createStatView builds up a VBox that contains a DrawingArea to graph the data and potentially other widgets. It attaches drawStatData to the realize and exposeEvent events for the DrawingArea. I would do something similar for the TreeView, but I am not completely sure what since I have not yet done it and what I am thinking of would involve replacing the TreeModel every time the TreeView needs to be updated. My alternative to the above would be...               drawStatData :: DrawingArea -> MVar Core.ST -> (Core.ST -> SetRepWorkout.WorkoutStore) -> IO ()     createStatView :: IO (VBox, DrawingArea)      ... but in this case, I would arrange createUI like so:               createUI :: MVar Core.ST -> (Core.ST -> SetRepWorkout.WorkoutStore) -> IO HBox     createUI storeMVar field = do         (graphbox, graph) <- createStatView (\area -> drawStatData area storeMVar field)              hbox <- hBoxNew False 10         boxPackStart hbox graphs PackNatural 0              on graph realize (drawStatData graph storeMVar field)         on graph exposeEvent (do liftIO $ drawStatData graph storeMVar field                                  return ())              return hbox      I'm not sure which is better, but that does lead me to... Thing the second: it will be necessary for me to rig up an event system so that various events can send signals all the way to my widgets. I'm going to need a mediator of some kind to pass events around and to translate application-semantic events to the actual events that my widgets respond to. Is it better for me to pass my addressable widgets up the call stack to the level where the mediator lives, or to pass the mediator down the call stack and have the widgets register directly with it? So, in summary, my two questions: 1) pass widgets up the call stack to a global mediator, or pass the global mediator down and have the widgets register themselves to it? 2) pass my redraw functions to the builders and have the builders attach the redraw functions to the constructed widgets, or pass the constructed widgets back and have a higher level attach the redraw functions (and potentially link some widgets together)? Okay, and... 3) Books or wikis about GUI application architecture, preferably coherent architectures where people aren't arguing about minute details? * * * The application in its current form (displays data but does not write data or allow for much interaction) is available at https://bitbucket.org/savannidgerinel/fitness . You can run the application by going to the root directory and typing               runhaskell -isrc src/Main.hs data/      or...               cabal build     dist/build/fitness/fitness data/      You may need to install libraries, but cabal should tell you which ones.


Deciding factors in pair programming

Are there specific things that you look out for before getting the team into pair programming? Obviously pairing someone who's great with C++ with another who knows ASP.NET best won't get me far, but how about someone who's great with C++ with another who knows Java best but can pick up C++ quick enough? What else? Experience levels? Character traits?


Moving your career to another programming language

I'll cut to the chase. I'm looking for advice on how an experienced developer would convince a prospective employer that they should be considered for a position that uses another language. This is with other non-language specific requirements being met (knowing version control, OO, degree, etc...). For example an experience PHP developer looking to move to a Perl position. Is it even possible? How diffiult would it be? Is it language dependant? EDIT: The answers that I got are proof that this communitys future is bright indeed, but sadly it only allows me to select one answer. Thank you to all that replied.


Data Serialization to process business logic

Going by the general principle of data abstraction, I normally abstract data in a serialized format(JSON) and pass it as a parameter to the Business Logic(BL) modules such that the BL module always see a consistent format of the data irrespective of the underlying data storage layer. Even if I use a ORM, I use the serialized format of that ORM. I feel I have the following advantages.   * By serializing data, there would be better control over data and parameters   * Any developer can write BL without thinking too much about the underlying data storage   * Wrappers can be written for new databases (There are a lot of ready-made wrappers to convert data into JSON)   * Testing could be done ruthlessly and without a database (since the data format is serialized)   * Functionally easier to understand and better OLAP, OLTP integration I also notice the following drawbacks   * A new layer to be added between the database and the BL module (most ORM's nowadays come with a predetermined JSON format)   * Extra function calls slow down the application (but I think this trade-off is OK when compared to better testing and easy maintenance)   * Increased level of abstractions may confuse the developer I make the above observations mostly in the context of business applications To follow this discussion, lets have an example so that things could be discussed in its context. Assume a product database having the columns: Product,Rate,Taxes and we need to create a invoice **Code without database abstraction**               GET rate,taxes for product X from database     multiply qty with rate and add taxes     display invoice      **Code with database abstraction**                 GET rate,taxes for product X from database       Convert it into JSON       call create_invoice function //This does all the calculations       display invoice      In the second example, I would pass arguments in the form (Product=X, Qty=5, Rate=5, Taxes=0.05). If taxes are to be split into more that one category (State Tax=0.03, Central Tax=0.02) or a discount factor to be added I would just increase the number of parameters in the BL functions such that the database fields, the JSON keys and the function parameters match (this is done automatically during serialization and most ORM's do it). This makes it easy, in my approach, to extend functions and also make modules independent of data since the modules always know the data they can receive and even if they receive a new parameter, they can adapt it provide the underlying code is intelligent. My general questions are   1. Is this a good pattern and what's it called (Data abstraction comes to my mind)?   2. Pros/Cons of this pattern(apart from those mentioned above) in the context of business application, apps for embedded devices, big data   3. Is there a difference between this pattern and ORM (I believe so since ORM is mostly a class wrapper to get data from a database while this pattern is more oriented towards data structure)   4. If this is good, can this be easily understood by a new developer?


Which statement performs best?

I was faced with this question by my team leader. Statement 1 (written by me):               lnkbtn1.visible = lnkbtn2.visible = lnkbtn.visible = false;       Statement 2 (written by my team leader):               lnkbtn1.visible = false;     lnkbtn2.visible = false;     lnkbtn3.visible = false;      Which statement is better and why?


What lessons did you learn from a project which nearly/actually failed due to bad multithreading? Sometimes, the framework imposes a certain threading model that makes things an order of magnitude more difficult to get right. As for me, I have yet to recover from the last failure and I feel that it is better for me not to work on anything that has to do with multithreading in that framework. I found that I was good at multithreading problems which have simple fork/join, and where data only travels in one direction (while signals can travel in a circular direction). I am unable to handle GUI in which some work can only be done on a strictly- serialized thread (the "main thread") and other work can only be done on any thread but the main thread (the "worker threads"), and where data and messages have to travel in all directions between N components (a fully connected graph). At the time when I left that project for another one, there were deadlock issues everywhere. I heard that 2-3 months later, several other developers managed to fix all of the deadlock issues, to the point that it can be shipped to customers. I never managed to find out that missing piece of knowledge I'm lacking. Something about the project: the number of message IDs (integer values which describe the meaning of a event which can be sent into the message queue of another object, regardless of threading) runs into several thousands. Unique strings (user messages) also run into about a thousand. **Added** The best analogy I got from another team (unrelated to my past or present projects) was to "put the data in a database". ("Database" referring to centralization and atomic updates.) In a GUI that is fragmented into multiple views all running on the same "main thread" and all the non-GUI heavy-lifting is done in individual worker threads, the application's data should be stored in a single plase which acts like a Database, and let the "Database" handle all the "atomic updates" involving non-trivial data dependencies. All other parts of GUI just handle screen drawing and nothing else. The UI parts could cache stuff and the user won't notice if it's stale by a fraction of a second, if it's designed properly. This "database" is also known as "the document" in Document-View architecture. Unfortunately - no, my app actually stores all data in the Views. I don't know why it was like that. **Fellow contributors:** (contributors don't need to use real/personal examples. Lessons from anecdotal examples, if it is judged by yourself to be credible, are also welcome.)


How to include programming-related hobbies on a resume?

I'm sure a lot of software developers have pet projects and hobbies that they do outside professional tasks. I have my own, and I'm struggling with how to include them on a resume. These are not necessarily hot open source projects that everyone's life depends on, just some tinkering with fun languages like Haskell or Lisp that I do to learn new concepts. Maybe some experimenting with a web framework that I was curious about. I have a couple reasons for wanting to include these on a resume:   * I have a handful of languages and technologies listed where I would consider myself "experienced." I would have no trouble being grilled on these at an interview. But if I put Haskell on that line of technologies, I would fold if asked an advanced question about it.   * When I help interview job candidates (I'm not a hiring manager, but we have engineers participate in the technical side of interviews), I always ask them about their programming hobbies, if any. It opens them up about stuff not on their resume, maybe leads to something interesting that I wouldn't have learned just from asking about past jobs.   * I really am passionate and curious about software, and I want to show potential employers that I am expanding my knowledge outside job duties. But I want to be honest about not being an expert when I'm not an expert. What's a good threshold for including a programming hobby on a programming resume - read a book or two, wrote working programs, used it to solve a problem of X magnitude, etc.? How segregated should it be from professional experience - included with other skills (but with some sort of "just a hobby" qualifier, in its own section of "personal interests", or pushed off to the second page everyone throws away? Or, leave it off entirely and let the interviewer ask, if they care?


Dealing with co-workers in a stressful work environment

Our department has been hit by some layoffs over the past year and we're running a skeleton crew. They got rid of most of our support staff. The remaining team members would rather worry about what others are doing rather than work as a team and figure out how to improve their own situations. The one co-worker (who does network administration) spends long hours in the office. Part of it is due to the workload but another part of it is due to bad time management (his own fault and management). He'll walk past my desk and make snide remarks like "working hard?" and "do something". If I offer to help, he acts like he doesn't need it. He's kind of the insecure type and likes to do everything himself and then hold it over everyone else. I'm afraid he might end up burning out. Another guy has been bitching about his workload. He spends as much time worrying about what others are doing than getting stuff done himself. He thinks he's too good for "grunt work" and wants to be a manager. When his plate is full, he makes sure everyone else knows it when he has to do get stuff done. They're not bad guys but the stress seems to be getting to everyone. I'm the only one left who knows how to code so a lot of time is spent on programming projects but also have support duties. I can't get a whole lot done due to the interruptions. The guys in the office don't consider what I'm doing to be "work"....and seem to think that I should be helping them with support and not programming. So basically they think I'm supposed to work on IT support and then go back to the office to work on programming projects while they surf the internet. I don't whine and moan and complain like everyone else does so they assume that I don't have enough to do. So now I get to listen to snide remarks about my workload. Management likes my projects because they save the company money. What is the best way to deal with this situation?


What license/EULA do I need for free to use software?

I am not sure what exactly I am looking for here, but here are the facts: I will be offering a free to use software, free as in $0 cost only(not OSS). I need a piece of text included in the installer with agree/disagree, that would protect my rights. Specifically that I don't guarantee anything and shouldn't be held liable for their losses that the software might cause. I want to allow them to use the software for anything they like, but not allow to redistribute, sell, or reverse engineer it. I am not even sure whether this text is technically a license, disclaimer, or end user license agreement. I doubt there is a ready to go template for what I am looking for, but any pointers would be greatly appreciated.


Why not use a RTOS with microkernel architecture for highly concurrent web servers?

Why not use a RTOS with microkernel architecture for web servers? The scheduler is deterministic and all requests will be handled quickly leading to faster response time? It's easy to extend an OS based on microkernel architecture, since everything is like a client-server communication via message passing. Also, the server will be very light weight and requires less resources. Say that you are developing the web service using C++. I am thinking about QNX for the OS. Is it a bad idea, or it does not matter?


Database strategy for connected but disparate applications

I'm working on a series of inter-related but separate web applications, all situated on the same host:               Super Admin     |     ---Site Network Admin     |   |     |   ---Site     |   |     |   ---Site     |   |     |   ---Site     |     ---Site Network Admin         |         ---Site         |         ---Site         |         ---Site      All three will have access to the same core library (Zend Framework), and separate application libraries for each tier in the network - thus 3 applications and one library - but different configurations to support unique instances. I'm interested to hear people's opinion on the best database strategy to support these applications. On the one hand, I could deploy one database, or perhaps one for each application level (i.e. 3). This has the advantage of being easy to roll out changes, but the disadvantage that users share the access burden - i.e. if one user is really hammering the database, the performance of other applications sharing the database will suffer. Another disadvantage is that any data corruption could potentially affect all end users. On the other, I could utilise a series of databases - one for the first two tiers to share administrative data - but separate instances for each site deployed on the network. This has the advantage that end users are isolated and thus data corruption is more easy to contain. The disadvantage is obviously the converse of the previous example - in that changes are then harder to roll out across the network. My thinking is that it's dictated by usage vs user population. If you have low quantities of users, but they interact with the database a lot - then plan B is best. If it's the former, that you have high yields of users with low interaction rates - then plan A is best. I'm interested to hear other people's thoughts as to the best approach for dealing with this situation.


Which CS courses are a "must" for a web developer

My goal is to learn how to program a website with Python/Django in the next year. From what I've understood, I also have to learn HTML, CSS, JavaScript. I understand in order to build a website, I will need to find a co-founder whose skills far exceed mine. But still, the situation will be way different if I'm a person who's closer to his/her level and has dedicated a lot of time teaching himself than every other "I have an idea, just need a tech co- founder" type of guy. I do plan to pursue a degree in computer science, but after finishing high school last May decided to take an year off, so I am free to learn programming in the next 10 months. For now, I have the chance to attend some college courses in a top institution. Which ones are a must for a web developer so that I don't have any gaps in my understanding of programming and write "sophisticated code"? EDIT:Thank you all for the help!From the courses suggested I may be able to attend some/none/all of OOP(with Java),Networks and Graphics,SE- Algorithms,Discrete Math for Comp.Scientists,Databases,Information Retrieval and Data Mining.Which of those are more important for Web development with Django? I've read a lot of times people saying that self-taught programmers had gaps in their knowledge, didn't write clear code.This is why I'm asking which CS courses can fill those gaps? Not only in practical skills,but in mindset,way of thinking.


Perfomance of 8 bit operations on 64 bit architechture

I am usually a Python / Database programmer, and I am considering using C for a problem. I have a set of sequences, 8 characters long with 4 possible characters. My problem involves combining sets of these sequences and filtering which sets match a criteria. The combinations of 5 run into billions of rows and takes around an hour to run. So I can represent each sequence as 2 bytes. If I am working on a 64 bit architechture will I gain any advantage by keeping these data structures as 2 bytes when I generate the combinations, or will I be as well storing them as 8 bytes / double ? (64 bit = 8 x 8) If I am on a 64 bit architecture, all registers will be 64 bit, so in terms of operations that shouldn´t be any faster (please correct me if I am wrong). Will I gain anything from the smaller storage requirements - can I fit more combinations in memory, or will they all take up 64 bits anyway? And finally, am I likley to gain anything coding in C. I have a first version, which stores the sequence as a small int in a MySQL database. It then self joins the tabe to itself a number of times in order to generate all the possible combinations. The performance is acceptable, depending on how many combinations are generated. I assume the database must involve some overhead.


Is it acceptable to upload offensive content to GitHub?

I developed an offensive content checker for my website and want to publish it on GitHub. However, the source code contains many offensive, racist and otherwise nasty content. The source is fully documented, but I wanted your opinion on whether it's acceptable to publish such work on GitHub or whether to leave the array of strings up to the imagination of the reader?!


I've been told HTML is a markup language, C++ is a programming language, what could make that difference?

My programming friends are always telling me that HTML is a markup language and C++ is a programming language. When I ask them what's the difference, they never give me a reasonable answer. What could make one call C++ a programming language, and HTML not?


What should I include in my class documentation header

I'm looking for informative class documentation format for my Entity, Business Logic and Data Access classes. I found following two formats from here **Format 1**               ///-----------------------------------------------------------------     ///   Namespace:      <Class Namespace>     ///   Class:          <Class Name>     ///   Description:    <Description>     ///   Author:         <Author>                    Date: <DateTime>     ///   Notes:          <Notes>     ///   Revision History:     ///   Name:           Date:        Description:     ///-----------------------------------------------------------------      **Format 2**               // ===============================     // AUTHOR     :     // CREATE DATE     :     // PURPOSE     :     // SPECIAL NOTES:     // ===============================     // Change History:     //     //==================================      I feel following are the basic elements   * Author    * Created Date   * Description   * Revision History as Namespace and Class name will be there in anyway. Please let me know your thoughts, which format is recommended and whether there is a standard way of writing revision history?


What does the "d" mean after linux packages?

I've noticed that a lot of the packages I've been installing on my Ubuntu machine has this "d" at the end. Googling it doesn't give me any answers that I can find. For example: FTP server - Package called: pure-ftpd TFTP server - Package called: atftpd SSH server - Package called: sshd What's up with this "d"?


How to ditch the cubicle?

I would really like to get out of the 9-5 "cubicle" existence and do something where I can work from home, take off when I like, etc. Don't get me wrong... I don't mind working hard, but I just am not enjoying the whole corporate thing where my hours, vacation days, dress code, place of work, etc. are set. I really think this is possible because other developers are somehow pulling this off. But so far it is just in the "dream" stage and I have no idea how to move it forward. I don't know if I want to be freelancer, start my own company or what. In case it matters, I have been working in .Net / MVC for the past few years (both desktop and web) but have experience with other languages as well (Java, C++, Perl, etc.). I don't have much experience with "web design" side of things since in all my jobs other people have handled that while I have worked on the "programming" work. Just to make it more concrete what I want... I wake up on a random Tuesday in June and it's a gorgeous day. I am ahead of schedule on my projects and I don't feel like working ... I want to go hiking. I want the freedom to do that without dealing with some PHB. Another scenario... I do feel like working but I want to go visit an old friend or relative for a week in Bismarck / Budapest / Boston. Said friend has reliable Internet. Why can't I do that? I'm not talking about being irresponsible just a bit more free.


Reassigning Ownership Automatically

Are there any software licenses that automate the reassignment of ownership? For instance, in a usual circumstance, you have a license, and then you make all contributors sign off that by contributing they reassign ownership to the project owner. In the sort of license I'm looking for, by just _editing **and** redistributing_ the result (whether in source or binary form), the person who had made changes would not only have to redistribute the code but would also have automatically reassigned their ownership to me. Alternatively, if that's not possible, can I add a binding clause to an existing license that makes it so?


Why are <section>, <header> and <footer> tags not used much when I see sites that are in HTML 5?

I've noticed that even when a websites front end is coded in HTML 5 as evidenced by the `<!DOCTYPE html>`, people rarely seem to use the new HTML 5 `<section>`, `<header>` and `<footer>` tags. Is it because people don't understand that you're supposed to use reusable classes for styling things within a `<section>` instead of the full path of tag selectors to the element?


Would I be able to use code hosting services to host malware code?

Let me start by saying that I am a computer security researcher. Part of my job is to create malware to deploy on a controlled environment in order to study or evaluate several aspects of computer security. Now, I am starting to think that using an online code hosting service (such as BitBucket, Github, etc...) to have all my code in 1 place, would allow me to work on my projects more efficiently. My question is: **Are there any issues with this?** I have studied those companies' privacy policies, and they state that they allow usage of their services for lawful usage. Since I am not distributing malware, but I am only using it on my machines and machines that I am authorized to use, aren't I allowed to use the service? For the usage that I am doing, malware is the same as any other software. **I recognise that I should be extremely careful with code hosting** , as any mistake from my part could hold me liable for damages and leave me open against legal action. As such I am recognizing that I should use private repositories, so the code is not available to the public. **But how private is a private repository?** How can I trust that companies like them will not leak or sell a potential (electronic) viral weaponry that I may have created in the future?


How to copyright and license individual code files

I have a habit of writing small, reusable components in my spare time. I reuse these components with my clients' code bases. It occurs to me there's a potential issue that using identical code for multiple clients may bite me back in the future. I don't care who uses the code. I just don't want a situation where one company tries to sue another for copyright infringement due to my actions. I'm not familiar with common licensing schemes. What do I need to specify in my code files to indicate that these protions are copyrighted to myself and usable by anyone, while differentiating them from the code specificly written for the client? Where can I find more information on this scenario?