title: FXML Boiler Plate Code

text: Is there a way to address a typical boiler plate code to instantiate and load FXML? A typical version:               public void start(Stage primaryStage)      {            URL fxmlUrl = this.getClass().getResource( /* your string path*/ );              FXMLLoader loader = new FXMLLoader(fxmlUrl);              try          {                primaryStage = loader.load();             this.controller = loader.getController();         }          catch(IOException ioe)         {             ioe.printStackTrace();         }              primaryStage.show();     }      Note for the code above, the backing FXML file has `<Stage></Stage>` as root. This is just my preference. The loading and matching up to the FXML root can adjust accordingly. In any case, the loading of the FXML file and obtaining reference to a controller is the crucial part (for most of the time). I've attempted to create a utility method such the one below to help prevent this boiler plate code:               <R, C> void loadFXML(R root, C controller, String path)     {         URL fxmlUrl = this.getClass().getResource( path );              FXMLLoader loader = new FXMLLoader(fxmlUrl);              try          {                root = loader.load();             controller = loader.getController();         }          catch(IOException ioe)         {             ioe.printStackTrace();         }     }      However, at some stage there was null pointer errors, or the loading was incorrect. I believe it has something to do with the Generics and/or casting. How can the this code be imporoved? Or perhap can another type code be suggested to solve this problem?


title: Is there a process-oriented IDE?

text: My problem is simple : when I'm programming in an OO paradigm, I'm often having part of a main business process divided in many classes. Which means, if I want to examine the whole functional chain that leads to the output, for debugging or for optimization research, it can be a bit painful. So I was wondering : is there an IDE that let you put a "process tag" on functions coming from different objects, and give you a view of all those functions having the same tag ? **edit** : To give an example (that I'm making up completely, sorry if it doesn't sound very realistic). Let's say we have the following business process for a HR application : receive a holiday-request by an employee, check the validity of the request, then give an alert to his boss ("one of those lazy programmer wants another day off"); at the same time, let's say the boss will want to have a table of all employee's timetable during the time the employee wants his vacations; then handle the answer of the boss, send a nice little mail to the employee ("No way, lazy bones"). Even if we get rid of everything not purely business-related (mail sending process, db handling to get the useful info, GUI functionalities, and so on), we still have something that doesn't really fit in "one class". I'd like to have an IDE that would give me the opportunity to embrace quickly, at the very least :   * The function handling the validation of the request by the employee;   * The function preparing the "timetable" for the boss;   * The function handling the validation of the request by the boss; I wouldn't put all those functions in the same class (but perhaps that's my mistake ?). This is where my dreamed IDE could be helpful.


title: Mono is frequently used to say "Yes, .NET is cross-platform". How valid is that claim?

text: In What would you choose for your project between .NET and Java at this point in time? I say that I would consider the "Will you always deploy to Windows?" the single most important (EDIT: technical) decision to make up front in a new web project, and if the answer is "no", I would recommend Java instead of .NET. A very common counter-argument is that "If we ever want to run on Linux/OS X/Whatever, we'll just run Mono", which is a very compelling argument on the surface, but I don't agree for several reasons.   * OpenJDK and all the vendor supplied JVM's have passed the official Sun TCK ensuring things work correctly. I am not aware of Mono passing a Microsoft TCK.   * Mono trails the .NET releases. What .NET-level is currently fully supported?   * Does all GUI elements (WinForms?) work correctly in Mono?   * Businesses may not want to depend on Open Source frameworks as the official plan B. I am aware that with the new governance of Java by Oracle, the future is unsafe, but e.g. IBM provides JDK's for many platforms, including Linux. They are just not open sourced. So, under which circumstances is Mono a valid business strategy for .NET- applications? * * * Edit: Mark H summarized it as: "If the claim is that _"I have a windows application written in .NET, it should run on mono"_ , then not, it's not a valid claim - but Mono has made efforts to make porting such applications simpler.".


title: What is idiomatic?

text: I understand an "idiom" to be a common operation or pattern that in a particular language is not simplified by core language syntax, such as integer increment:               i = i + 1;      In C++, this idiom is simplified by an operator:               ++i;      However, when someone uses the term "idiomatic", I am not sure how to understand it. What makes a piece of code "idiomatic"?


title: SQL injection attacks, how do I test and secure coldfusion queiries?

text: I'm running Coldfusion 8 and SQL server 2008. I've been building serveral forms that insert data into the database from external users, we have a custom built security module built by the guy who I've taken his job. 1) How can we test our HTML forms to ensure that we're protected from SQL injection attacks? 2) How do I secure CFqueries in CFC's? 3) What are some best practices in terms of SQL & Coldfusion for security? \-- A lot I know!


title: Efficient algorithm to sort html list of players

text:
We have list of players, which is represented in form like this:

Player1

1

Player2

2

Player3

3

Player4

4

       Something happens, and Player 4 recieves 600 points. So it goes on 1st place. With him - player3 recieves 300 points and goes on 2nd place. It happens after same event - let's assume, that they get these points from server, but that's all load that is allowed on server and server does not calculate positions. What is most efficent way to get view like this:

Player4

1

Player3

2

Player1

3

Player2

4

       It's not question about code, it's question about:   * What kind of task it is? Just sort?    * Is it ok to use JavaScript to solve this task if lists are less than 500 rows?    * Is it ok to re-render whole players list, or there are some ways to just change div element position(index in DOM or something like this)?    * Are there any tools and libraries around, that can help solve this task efficiently?  P.S.: If we want to animate all this story - we should create a queue of animation tasks each time scores for all players recalculates? **Update:** I have followed @Jalayn's answer, and stuck on following problem: Let's assume that list `[1,2,3,4]` transforms to `[2,3,4,1]`. If we map it, we will get following position diffs `[+1, +1, +1, -3]`.. Now, if we move one by one elements to it's position change, all will be ok, till we get to negotiate position diff - 1st position diff can't move down any more.. So, my update to question - how we can animate rows more than twice? **And final problem, on which I am stucked:** Not sure, if it most be solved in this question. BTW, if 2 players have same points - animation plan brakes and element_ids duplicates. My question now is how to make following transformation of structures list: `[(#id1, 1, 100),(#id2, 2, 50), (#id3, 2, 50), (#id4, 4, 25)] => [(#id3, 1, 150), (#id1, 2, 100), (#id4, 3, 75), (#id2, 4, 50)]` For now my solution is to refresh whole list, but not completly regenerate it - just move all elements to the first position in order they sorted in backed JSON. Animation is too complex to be done cause of final problem.


title: Delphi vs C# for GUI programming

text: I'm coming from PHP and Python background with little knowledge of C, I have done many web based application now I'm thinking of Desktop application for windows platform. A friend told me to go for Delphi and others are saying C# is the best, well, what I'm looking for is   1. Simplicity   2. Productivity   3. Good API documentation   4. Speed   5. Drag and Drop   6. Multi threading & Good Network API Thanks


title: What kind of positions could a beginning developer expect to qualify for in five years?

text: I am a Junior developer, just landing in a job after completing my Masters. I'm not clear on what positions or roles I could possibly be in after five years? So My Question is, What kind of positions can an Entry level programmer like me seek in 5 years?


title: java application architecture

text: We have to write an administration panel for many customers. But we want to have just one administration panel, and use it in various projects. This admin panel will have basic components such as access control logic, maker-checker system in changes, user logging and etc. It will also have reporting for the customer, logs of transaction of the customer (which can vary according to the industry such as mobile banking, banking, ticket sales). These components may have to be modified according to the business. So we are thinking about the architecture here, Is it OK to use jars of every basic components, and bring them together on a glue application? Or should we build each component as WARs and make interfaces between them? If there are any more ideas, it will be appreciated.


Where does the word "Programming" come from? I'm referring to the word "program" as referring to "to instruct a computer". Programming, programmer etc...


title: What is a zombie process or thread?

text: What is a zombie process or thread, and what creates them? Do I just kill them, or can I do something to get diagnostics about how they died?


title: My company won't let me listen to music anymore

text: I began programming at the age of 14 and over a decade has gone by, during this time, a day hasn't gone by when I don't listen to music, radio or podcasts. When I'm programming at home or in work, I always like to listen to music, sometimes the same album or playlist throughout the week, as it becomes a constant, and I almost don't notice its there. 1 headphone in usually means, talk to me, both headphones is known to the girlfriend and friends as "code mode". They know better than to get more than a few words out of me. I'm sure you guys understand! So, I use to work for a big ATM company dealing with banks on a daily basis, I was more of a number than a person, and when I worked I could listen to music all day and night. If anyone had any issues, they would ping me on MSN or give me a tap. I was fine with that, and so was everyone else (as they all did the same). Now I've moved on (had to relocate) I have a new job in a much smaller company. The company is NOT software orientated at all, I am the only on site programmer, all previous work was outsourced. We have around 30 people in the office (mixture of admin, accounts but mainly noisy sales teams), I probably talk to 2 of them. They're not a social bunch, I'm fine with that, as I know what they do has no impact on what I do and vice versa, so I sit quietly, put my headphones on and code. I know (they kind of know) that I'll be leaving this time next year, as they're a small company we established in the interview that after 2 years I might struggle to find projects. So... back to my problem (I promise that was all relevant) in my first week I set up my coding environment, and began working. The IT manager pulled me aside and said "we have a slight issue, you can't wear your headphones" when I asked why they responded "the boss will go mad". So after a few months of no headphones, or sneakily wearing them when it got really loud. I became confident to wear them, as the boss himself acknowledged I wore them. I told him "it helps me concentrate, and gets me in the zone". He didn't say anything at this point (and never has). I had no issues for around 4-5months. Then last month I was called into a meeting with one of the MDs, he told me I can no longer wear headphones. Again I asked why, this time they said "the sales team are wearing them". They don't, I know they don't because I sit next to them all. I tried to argue my point, I received the 'I know I feel for you' speech, and that was that. No more music. I returned to the office and had a few pairs of eyes on me, looking pretty happy with themselves. One even turned to the receptionist behind me and said "have you noticed", the receptionist responded... "what?" then got up looked over the divide straight at me. Subtle huh. I like to call this "Small Company Fever"... they don't like change when trying to 'save the world' everyday. So now after a month, I find I can't concentrate fully, my mind wanders. To make it worse... they've moved my desk from the middle of the office, to the main door, which happens to be next to the toilets, the huge photocopier/printer and the kitchen. Its loud, really loud. Its actually starting to stress me out, and make me want to look for a new job. So heres is my dilemma. Am I just being a big girls blouse, should I just shut up and just get on with it as its only for another year and a bit... or do you think I have a genuine problem, and if so... how would you deal with it? Sorry for War & Peace II. All the best! Rocky


title: To map - word usage in software context

text: I always get confused about how to use the verb "to map" in the context of associating objects with each other, particularly if the mapping is directional. Is there a distinction between > mapping users to IDs and > mapping IDs to users In the given example, which would be the better way to put it?


title: Analogy for Android fragments

text: I'm trying to understand the flow of Android apps. I come from a RoR background, so I try and use that background to understand new concepts in Android. Here's my question: How can I think about fragments? Are they like partials in Rails? If so, how? If not, why?


title: What does it mean to write "good code"?

text: In this question I asked whether being a bad writer hinders you from writing good code. Many of the answers started of with "it depends on what you mean by good code". It appears that the term "good code" and "bad code" are very subjective. Since I have one view, it may be very different from others' view of them. So what does it mean to write "good code"? What is "good code"?


title: LGPL, .lib, .dll, and linking

text: I am trying to build a project which uses an unmodified copy of libconfig (http://www.hyperrealm.com/libconfig/). libconfig is LGPL, but I don't want to open source any of my code. By my understanding, LGPL means I need to provide the source for the library (easy), and _a means for them to use their own modified version of the library_. It's the latter component that confuses me a bit (apologies for some c naivete). Currently, my VS2010 solution has my project, and the libconfig project. The libconfig project builds a dll, but I also need to link my project against the .lib of libconfig to get the dll's definitions (Can someone explain why this is necessary, when I'm already including the header file?). Despite the linking, the .dll file needs to be present at runtime for the binary to be able to run Do I need to provide all of the .obj and .lib files I produce to satisfy the LGPL? Is there a way to avoid the linking of the .lib file? I've looked into LoadLibary and GetProcAddress but it looks way more complicated than I'd like. Or am I simply overestimating the requirements of the LGPL here? If there's another, more permissive config library for c++, that would also solve my dilemma. But I haven't been able to find something (and I'd like to avoid boost).


title: How should I deal with Time Zones in a .NET WCF application?

text: Our company runs a SaaS application where users log in from across the world (although mostly in the US). We store all our time relevant information as UTC, but we need to display times using local time. The application is web based, and we would like to "auto-detect" the user's Time Zone by using javascript to determine their UTC offsets during various times of the year. The user's offset info would be passed to our server in their first request and the server will look up all the Time Zones that it knows about and see which valid time zones match. I'd like to use the built in TimeZoneInfo object, but I understand that               TimeZoneInfo.GetSystemTimeZones();      relies on the server's registry settings. We currently have 18 load balanced web servers that host our WCF service layer, and I _believe_ our TechOps team is vigilant in making sure that all servers are patched with the same service pack at all times. I also need to pay special attention to the various US Time Zones, specifically Pacific, Mountain, Central and Eastern. Can I assume that the string based Id field will _not_ change anytime soon? For example, if I call               TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time")      I want the appropriate TimeZoneInfo object to be returned. So a few questions:   * What is the best way to deal with time zones, especially when it comes to the changing rules (US time zone rules changed in 2006) and determining offsets. Should I be trying something else? Keep in mind that the product team doesn't want the user to have to select their time zone and they are fine with time zones being inaccurately reported under certain conditions (e.g. if the user is in Mexico, it is ok to be reported as "Pacific Standard Time" instead of the more accurate "Pacific Standard Time (Mexico)".   * If I assume that all of our load balanced web servers are always running the same OS version and patch level, can I assume that I will get consistent results?   * Are there any other things I need to consider?


title: raw aql query in framework with Active Record pattern based ORM

text: I use yii framework that implements Active Record pattern as ORM base. It has CActiveRecord class that is a table wrapper class with attributes reflecting table columns. So each object of this class represents a database row. Wiki says about Active Record pattern: > Active record is an approach to accessing data in a database and > A database table or view is wrapped into a class. Thus, an object instance > is tied to a single row in the table. So far so good. But where should I put complex raw sql query that retrieves statistics data for example? And, more generally, where should I put methods that retrieve some data that can not be an active record object (like data retrieved with aggregation queries) or if I knowing do not want to retrieve an object but an array instead for example?


title: Filtering lists in an Android App offline or online?

text: I have an android app that fetches a list of about 100 Items.   Trying to get the server load down, I've built a filtering feature that   does everything offline, so basically instead of calling the server (and thus a MySQL query every call)   It filters on its own.   However I've noticed the app tends to lag (while the only change is the offline filtering).   Is the processing of relatively big object-lists something that should be done offline or should I live the load on the server ?


title: Benefits of combining programming languages

text: I know there are different ways to combine programming languages (Haskell's FFI, Boost with C++ and Python, etc...). I have an odd interest in combining programming languages; however, I have only found it "necessary" once (I didn't want to rewrite some older code). Also, I notice that this interest is shared (there are an abundance of questions about integrating languages on SO). My question is, simply, are there any other benefits in combining programming languages? Is there value in mixing different programming paradigms (e.g. functional+OO, procedural+aspect-oriented)? Any from-the-field examples would be much appreciated. **UPDATE** When I say "combine two languages" I am talking about using them in conjunction, in ways not necessarily originally intended. For example, suppose I use Boost to incorporate Python code in C++.


title: How do you schedule software updates, major releases, milestones (what is this?)

text: What are the common terminology used to schedule software update and support. For example, I really have no clue how releases and updates differ, how often are updates released (not everyday I hope)? Most importantly communicating stuff like milestone (what is this mean?), roadmaps, basically I want to know how I can offer support to end users by using industry terminology.


title: Hating your own code - for good or bad, how do you deal with it?

text: Have you ever had this feeling that your code is bad, the whole project is a mess, and you just want to step off? On your daily job you can explain this feeling away with your coworkers, asshole boss, or something like this. But with side/pet projects there is really no excuse. For example I'm currently maintaining my Firefox extension - fixing bugs and adding new features. Quite frequently when I go back to the code written months ago the feelings that arise inside me are quite controversial - "Did I write that? Really??" Knowing that proper implementation of new feature "the right way" requires throwing away whole module and still putting together a quick hack - sometimes I don't even hesitate. As the project grows, features are added there remains less and less room for refactoring... Do you have any recipes for dealing with this kind of emotional state? Do you just pull yourself together and give the whole project another thought, rewrite version 2? Or maybe just ignore all this - "working code is better than perfect code"?


title: Drawbacks to redefining method in precompiled header

text: I have a lot of calls to `NSLog(...)`. I need to change all of these calls to `CLSNSLog(...)`. So I added this to my precompiled header (.pch):               #import <CrashlyticsFramework/Crashlytics.h>     #define NSLog(...) CLSNSLog(__VA_ARGS__);      Everything works. I don't see any drawbacks to this -- the team can continue to use NSLog(...) and I can revert pretty easily. But am I missing anything, or are there any design issues this will create later on?


title: Identify this programming style

text: Some of the legacy code I've inherited uses the fact that C# supports multiple assignment to write code like:               void DisableControls()     {         ddlStore.Enabled                =         ddlProgram.Enabled              =         ddlCat.Enabled                  =         btnSaveProxy.Enabled            =         btnCancelProxy.Enabled          =         btnViewMassManagerProxy.Enabled =         grdPromo.Enabled                = false;     }      It's a very _pretty_ style, with all the `=` lined up neatly, and the value being assigned down at the bottom, but it's also a rather annoying one to work with. (And yes, those are tabs lining things up, not spaces). I would like to know what, if anything, this style implies about the original coder, since I've only seen it on a few occasions before. Does it indicate a C++ background? .NET 1.1? Just someone's personal preference? ~~Is there any reason that the chained assignment like this would be more efficient than individually setting each control's`.Enabled`? Less so?~~ (This part was answered by @gnat's comment: `This way makes it easy to insert btnWhatever.Enabled = as new buttons are added and delete as some buttons are deleted`) * * * Edit: Other elements of this person's style, assuming the whole file was written by one person (likely but not certain), include putting function arguments on the next line, and putting commas at the beginning of a line instead of the end of the previous line. Example:               PromoUpdate[] GetPromoUpdates(                                 StateField field)     {         List<PromoUpdate> updates   = new List<PromoUpdate>();         foreach (PromoOptInState p in field.States.Where(                                                         x => x.IsDirty))         {             updates.Add(new PromoUpdate() {                 promoCode   = p.Code                  , optIn     = p.IsOptedIn             });         }         return updates.ToArray();     }      It's very weird.


title: Does using Xapian in Django-Haystack enforces GPL?

text: Consider the following situation:   * She uses Django (BSD) for a website.   * She uses Haystack (BSD) for textual search in the website.   * She uses the backend of haystack, xapian-haystack (GPL), to use Xapian (GPL) as the search engine of Haystack. Question: must she distribute the source code of her website under GPL (or equivalent)? My question is specific on whether the source code is considered to be a derivative GPL code. Pragmatically, I would say the code is written entirely in Python+Django+Haystack, and Xapian could be substituted by other search engine. Indeed, the difference in the code is as simple as               HAYSTACK_CONNECTIONS = {         'default': {             'ENGINE': 'haystack.backends.xapian_backend.XapianEngine',             'PATH': os.path.join('tmp', 'test_xapian_query'),             'INCLUDE_SPELLING': True,         }     }      or               HAYSTACK_CONNECTIONS = {         'default': {             'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',             'URL': 'http://127.0.0.1:9200/',             'INDEX_NAME': 'test_default',             'INCLUDE_SPELLING': True,         },     }      But I would like very much to have a second opinion on this.


title: Why does Java support brackets behind variables and even behind method signatures?

text: Java allows this:               class X{         int i,j[]; // j is an array, i is not     }      and even worse, it allows this:               class X{         int foo(String bar)[][][] // foo actually returns int[][][]         { return null; }      }      Okay, the reason for this might be that it was lent from C/C++. However, Java meant to be easier than C/C++. Why did the Java inventors decide to allow this hard-to-read construct. The convoluted types of C where the variable name is in the middle of the type are just hard to read and provoke programming errors. Especially the brackets behind the method signature. I have never seen these in use and that is for a good reason. No one looks behind the signature when checking the return type of a method. While the first example may save some keystrokes (because `int` does not have to be written twice), the brackets behind the signature do not even save any, so I see absolutely no gain here. So is there a good reason for this (especially the second one) that I am missing?


title: Using Windows tools to edit Linux project files

text: In the spirit of getting new people on the project up to speed and leveraging their familiarity with existing Windows tools, what are possible options for cross-platform editing/development? Of course, the Windows people could learn vi/Emacs, X, Eclipse/NetBeans, etc, but this would involve a period of learning, per-person. Is there any combination of technologies/tools that would let developers that are most familiar with a Windows tool-chain help out on a Linux-based project? E.g. One developer would like to use UltraEdit. For reference, the Linux project(s) are all daemon processes written in C++ and the development server has:   * Version Control systems include RCS, CVS and SVN.    * Compile tools are GCC and a Make-like build system.   * X Windows   * Telnet/RSH/SSH Suggestions don't have to be free/open-source, but an indication of licensing terms would be greatly appreciated (Updated to add language)


title: What problem does automated user interface testing solve?

text: We are currently investigating automated user interface testing (we currently do automated unit and integration testing). We've looked at Selenium and Telerik and have settled on the latter as the tool of choice due to its much more flexible recorder - and we don't really want testers writing too much code. However, I am trying to understand the overall benefit. What are peoples' views and what sort of things work well and what doesn't? Our system is under constant development and we regularly release new versions of our (web based) platform. So far the main benefit we can see is for regression testing, especially across multiple client deployments of our platform. Really looking for other people's views. We "think" it is the right thing to do but in an already busy schedule are looking for some additional insight.


title: Is there any research about daily differences in productivity by the same programmer?

text: There has been a flurry of activity on the internet discussing a huge difference between the productivity of the best programmers versus the productivity of the worst. Here's a typical Google result when researching this topic: http://www.devtopics.com/programmer-productivity-the-tenfinity- factor/ I've been wondering if there has been any research or serious discussion about differences in day-to-day productivity by the same programmer. I think that personally, there is a huge variance in how much I can get done on a day by day basis, so I was wondering if anyone else feels the same way or has done any research.


title: What do you feel is the best way to increase colleagues knowledge?

text: Our team recently joined up with a few smaller teams, and as we had some direction and standards to our development it was decided that it would be best to train those up in our chosen languages and methodologies. Some members take years to achieve an acceptable level of competence, and I've noticed that there seems to be this assumption that a developer with less knowledge requires almost 50% of a more knowledgable persons time. When I started devloping several years ago I had no mentor, I had a project in front of me, a good book, and later on I had the internet, and that's pretty much paved my learning approach over the years, as a result of that I can taken on a language or methodology and learn very quickly, the only time I need to seek advice from colleagues is for design work, code reviews and standards discussions. The staff who have this allocated time to mentors appear to be constrained, and I strongly feel that when it comes to technology, you shouldn't need much human interaction, if you rely on someone to **_walk you through_** technologies I fear that they will only remember that and therefore be constrained in the learning. So my question is, how do you deal with training up staff? My way has always been to **not find out the solution** but to **find out how to achieve the solution**. I don't quite understand the whole **_spending time shadowing another developer_** , maybe that's just me, but there must be a standard approach to this. Would like to some input please.


title: Munging intro level knowledge of set theory with intro level knowledge of electronics to parse and evaluate the content of HL7 messages

text: This question is being asked for the purposes of evaluating whether or not attempting to use things I picked up in college was a good idea, or even remotely defensible. Last year I wrote a 'formula creator' for figuring out what to do with fields or how to populate fields of HL7 data. The fact that it's HL7 data is almost unimportant, except for the fact that it's not always known whether or not an HL7 field is going to exist or if it's going to repeat. Therefore, I thought, if I need to get a list of these fields I can return myself a set of them. If I don't find them at all, I can add an undefined, fuzzy value, to the set. Then I can evaluate certain things on the set, (i.e. do all of them exists, do more than 6 match some regular expression, do the ascend from greatest to least). Everything works OK, except what to do with 'All Of' and empty set. For the interest of making a program easy to use, should 'all of []' return true or false? I tried to make a case that "In set theory, the existential operator yadda yadda deaf ears". I'd like an answer to the first question, because it may require going back to the drawing board, but I'll fast forward a to a few months ago we got around that problem by never having an empty set. If we encountered 0 fields in the HL7 message, we'll just ploink undefined in the set. The way I wanted to use undefined was as some sort of catalyst for, "I have no idea". So True or Undefined = Undefined, False and Undefined = Undefined and Not Undefined = Undefined. I made it a point to be very consistent in my programming with this, but everything that ailed the program could have been alleviated by making "Not Undefined" = True. I told the two guys who actually use my program to 'always make his formulas to expect the true case', cuz that's how Don Knuth does it. In summary, my program works. The problem is that it is encumbered by my adherence to principles, clearly outside the domain of the problem, that if I slackened would make the program flow better and function without requiring me to consult the source code. My question is, should abstractions match the domain? Can I legitimately argue to a nurses, bosses and (more military minded) programmers that "all of an empty sack is true" or "the opposite of unknown is still unknown"?


title: Burnout... Project Issues... Now They're Witholding My Salary... What Should I Do Next?

text: I've been working at a startup for 9 months. Except for the first 3 months, I've been miserable. It started when I joined the organization. I didn't join as a fresher. My first task was to create a replica of the mobile application that was being developed by a senior developer. Mobile development was new to me, but I managed things gracefully and the application got client acceptance. During this time, that senior developer got fired, and I was the only developer left on the team. Soon, I was told to move over to the new mobile development platform to help the team there, who was having trouble with the initial release of the application. I helped them, and they were able to ship the initial release gracefully. With my efforts, I got management's attention, and as the fog of worry (temporarily) faded, they told me to do some research about a core piece of that app. The research took me two months, and meanwhile the team messed up the application. I was told to take charge of the main development and abandon research until further instructions. Those "further instructions" never came. When I took charge, we were a team of two. We were both new to technology and we were struggling. Within a month my teammate left the company, and I was alone. While my learning process continued, the client reported some serious design issues. During the development phase, it took me 10 days to troubleshoot these issues and another month to solve them. During this time, I was doing 4 tasks (i.e. development, design, research, and QA) all alone. `I was weak in design and QA`, and for that I was criticized a lot by both the client and management. It took me one week to cope with the burnout; and it took me three months to stablize the project. I wasn't granted any leave during those 3 months, was called every weekend for 5 weeks, and forced to work for at least 12 hours each day. I once tried to oppose this and my salary was on hold for 10 days without any explanation. Today, the status is this:   * Among three versions of that application (including mine) every team has at least one feature that is not acceptable.   * The whole project is 3 months behind schedule.   * Two weeks ago, our project leader, for the first time, acknowledged that his initial work estimates were wrong.      * So he wanted us to estimate the remaining time.     * He told us that he would convince the client to accept these new dates.     * In three days, our estimations were rejected thrice by the project leader himself and weren't discussed with the client.     * We were three days behind our schedule for the release (and a week behind the schedule reported to the client).     * Still, the project estimates were not accepted by the client and there are 5 minor bugs open in that application.  After this, they moved me from that application to a different application which was abandoned by a developer some 7 months ago. The client wanted its beta delivered quickly with all of its issues resolved. There were 12 issues and, among them, 10 issues were resolved. I sent a "test beta" to the client and he mostly accepted it. But there were some problems and the client forced me to solve the remaining two issues at any cost in the given timeline. As the sole developer, the project leader requested my opinion about those two bugs. Both tasks were impossible. One was unsupported by the api and the other couldn't be completed in the given timeline even if somebody worked 24 hours/day. But he wasn't convinced and he asked me to complete these two bugs in the given timeline, thus forcing me to work the weekend. He even froze my salary again, and this time I am in a financial crunch. > **What should I do in this situation?** I am inclined to leave, but the question is - Should I leave **immediately**? If I do, that will put them in jeopardy and will make them realize that something was wrong on their side. I am not worried about relations with them, but I am worried about the next developer who will take my place (if they can find one). The only problem is that I have to suffer economically somewhat for a month. OR Should I wait for my salary? I do not believe that my salary will be credited tomorrow, and I don't have enough mental strength to face them and still be calm and able to work. But if I pursue this tact, it's at least somewhat _more likely_ that I will have _some_ money and that I can support myself and my family. Or do you have some other option in mind? Thanks for patiently reading my question.


title: Designing A 2-Way SSL RESTful API

text: I am starting to develop a WCF API, which should serve some specific clients. We don't know which devices will be using the API so I thought that using a RESTful API will be the most flexible choice. All devices using the API would be authenticated using an SSL certificate (client side certificate), and our API will have a certificate as well ( so its a 2 Way SSL) I was reading this question over SO, and I saw the answers about authentication using Basic-HTTP or OAuth, but I was thinking that in my case these are not needed, I can already trust the client because it possesses the client-side certificate. Is this design ok? Am I missing anything? Maybe there's a better way of doing this?


title: How to deal with IDE Addon creep?

text: I'm sure I am not alone in this issue so I wanted to see what others do to handle this problem. Whenever I have to reinstall my IDE, one of the first things I do is go out and look for addons. It starts out just grabbing whatever I plan on primarily doing but ends up with getting anything that looks interesting or may find useful in the future. "But it's addtional functionality _for free!_ " In the end I just end up with a dev environment with a lot of bloat. Also happens over time so you reinstall only to start the cycle over again... Is there a good way of handling this?


title: Should a web developer understand TCP/IP and how routers manage requests?

text: I had a job interview today for a Job position as developer on an important site. They asked tonnes of programming language related questions, which I managed to answer without problems, but then they started asking question about how TCP/IP requests were made once I made a request on my PC to a web server. I did received those contents as a student, but I dont remember them well, because I'm working mostly in web development, my question is: As a software developer, mainly working on web applications, do I need to have **extensive** knowledge of TCP/IP and how routers manage requests or it's just black box knowledge to me?


title: How to unit test with lots of IO

text: I write Linux embedded software which closely integrates with hardware. My modules are such as : -CMOS video input with kernel driver (v4l2)   -Hardware h264/mpeg4 encoders (texas instuments)   -Audio Capture/Playback (alsa)   -Network IO I'd like to have automated testing for those functionalities, such as integration testing. I am not sure how I can automate this process since most of the top level functionalities I face are IO bound. Sure, it is easy to test functions individually, but whole process checking means depending on tons of external dependencies only available at runtime.


title: problem on calculating Big O complexity

text: i have this function on which i have to calculate the time complexity with the **Big O notation** :               public void print(ArrayList<String> operations, ArrayList<LinkedHashSet<String>> setOfStrings) {         int numberOfStrings = 0;         int numberOfLetters = 0;         String toPrint = operations.get(1);         for (Iterator<LinkedHashSet<String>> iteratorSets = setOfStrings.iterator(); iteratorSets.hasNext();) {             LinkedHashSet<String> subSet = iteratorSets.next();             if (subSet.contains(toPrint)) {             for (Iterator<String> iterator = subSet.iterator(); iterator.hasNext();) {                 numberOfLetters = numberOfLetters + iterator.next().length();             }             numberOfStrings = subSet.size();             break;             }         }     }      the method does this operation: For example, if have as operation `print foo`, I have to do these steps,first of all, I have to find where `foo` is:   * Inside `setOfStrings`, I can have this situation:                       position 1 : [car, tree, hotel]             ...             position n : [lemon, coffee, tea, potato, foo]        * When I find the string `foo`, I have to save the number of strings inside that position and the number of letters of each string, so in this case, I will save:                 5(number of strings) 23(sum of number of letters)      some considerations:   1. For the `arrayList` of `operations`, I get always a specific position, so I don't iterate. It is always `O(1)`.   2. For the `ArrayList<LinkedHashSet<String>>` , I have to iterate, so the complexity in the worst case is O(n)   3. the operation `if (subSet.contains(toPrint))`, it will be O(1),because hashSet has mapped all objects inside it.   4. the iteration inside the hashset made with `for (Iterator<LinkedHashSet<String>> iteratorSets = setOfStrings.iterator(); iteratorSets.hasNext();)` , it will be O(m),because i have to iterate inside the entire hashset to sum the letters of each words **_so in conclusion i think the time complexity of this algorithm is`(O(n)*O(m))`_** are these considerations all corrects? thanks.


title: Smart Pointers inside class vs Normal Pointers with Destructor

text: Regarding pointers which are members of classes. Should they be of a smart pointer type or is it enough to simply deal with them in the destructor of the class they are contained in?


title: Version Control & Deployment on Large Ecommerce Site

text: I am currently Front End Dev for a large ecommerce store and I'm wanting to switch the entire site to a Version Control System (Git) and Deployment service (Beanstalk). I'm having trouble understanding a couple of things though. Firstly, my only experiance with version control has been my personal Wordpress Site, where things were simple. I would have a local copy of the site on ampps, and there was the live site. I would make changes locally, then when happy push to bitbucket which in turn deployed to the live site via FTPloy. Simple. Now we have two servers, dev and live. At the moment we simply edit the files on the dev via FTP and when signed off, upload those to the live server. If I was to implement version control, how do I develop on the dev server efficiently? Without being able to have a local version of the site, each minor change (a simple css property for eg) would have to be pushed to the dev server to see the results, no? Surely this isn't how it's done, it would be way too much hassle, especially if working on it for hours... I can't seem to find any examples on the web of how this is handled when you don't have a local environment set up. Which isn't possible in this case. I think I'm missing something fundamental to be honest, not being entirely clued up on how it works. If you need more details just let me know. Cheers.


title: Simple issue tracker for 1-2 developers

text: I'm currently working mostly alone on a project (in Java). I'm mostly alone as I have an advisor that gives me high level instructions on what to do, and will seldom make any code contribution. She will code in a couple of acceptance tests from time to time, though. I've never used an issue tracker before, and was thinking about starting to use one now, as I'd like to have a place where I can log possible bugs I find and keep track of them in a centralized manner. Would it be possible to integrate the issue tracker with Eclipse, better yet. So here are the constraints:   1. It's NOT a open-source project. Our code is not to be shared with anyone!   2. we are and will be using Subversion;   3. we have our own Subversion server and we will keep using this same Subversion server;   4. it must be free;   5. it must allow at least 2 users. What is your advice on what to pick? I'm looking for the simplest solution available.


title: How to synchronize configuration for Findbugs between build server/Maven and several programmers

text: Here's a common scenario for developers who want to integrate static analysis in their workflow. Any suggestions on how to get this working with a minimum of pain? The situation is similar to the one discussed here: http://enterprise-it- solutions.blogspot.dk/2011/02/maven-configure-checkstyle-pmd-eclipse.html The dev system uses a centralized build server based on Maven and Hudson. The developers use Eclipse and Java, and use a standard tool (git, svn or baazar) for source control The developers need a local version of the static analysis tool to avoid having to deal with a dozen quality issues at once when they want to check in a change. The build server (Maven + Hudson) has a Findbugs configuration that defines "Current standard for quality". For each programmer, there should also be a standard configuration for Findbugs that is at least as restrictive as the server-side configuration, and perhaps even identical to it. The programmer should be able to change his local configuration, because - let's face it - he's gonna do that anyway at least once, yet it should be relatively easy to reset to standard. Changes should only flow from the server to the developers, not the other direction.


title: Can I use this GPL'd PGP library internally in my company?

text: This PGP library was bought up by Network Associates and then eventually Symantec Corporation. The source code is available and is licensed under the GPL (it was linked to from here). They have a source code license here: > http://www.pgp.com/developers/sourcecode/sourcecode_license.html Even though this code is licensed under the GPL, are they restricting me from using it for business purposes. i.e. I am not making any modifications to the code, I am not linking the code into any other commercial or otherwise business application. I just want to run the command line and desktop applications as part of the normal day-today goings on of my business (signing and encrypting emails). Is this permissable? **Update:** After having carefully re-read this page: > http://www.pgp.com/developers/sourcecode/index.html I have just noticed that the library itself _is not_ licensed under the GPL: > **Modifications to GPL Code**   >  Although PGP® software itself is not subject to the GNU General Public > License (GPL), PGP Corporation utilizes certain code subject to the GPL However, the question and answers, had the library been fully GPL'd did help.


title: How to create animated Gifs of programming examples?

text: I've seen this a few times on GitHub. You visit a repo and there are animated Gifs showing how to use the open source project via a console or IDE. These Gifs show text as a person is typing. It's clearly a screen capture taking place, but I was wondering how these are created? Here is an example repo: https://github.com/YuriyZanichkovskyy/ReReflection Here is an example GIF: ![enter image description here](http://i.stack.imgur.com/Ck4GP.gif) > If this is the wrong place for this question. Please point me in the right > direction.


title: How to include license for MIT-licensed CSS?

text: I have a project licensed under the GPL. However, it includes a bit of code from animate.css, which uses the MIT license. How would I include the appropriate licensing information for that CSS? I've included that bit of css (maybe 25 or so lines) in my main stylesheet, so I'd rather not have a huge stamp like what's on this page, if I can avoid it.


title: Is there any way to use Python to replace Flash for in browser animation, gaming, whatever?

text: Is there any way to use Python to replace Flash for in browser animation, gaming, webapps, whatever? Pretty straight-forward IMHO. Does anyone know how to do this?


title: Naming conventions for language file keys

text: What is your strategy for naming conventions for the keys in language files used for localization? We have a team that is going to conversion of a project to multiple languages and would like to have some guidelines to follow. As an example, usually the files end up being a series of key/value pairs, with the key being the placeholder in the template for the language specific value.               'Username': 'Username',     'Enter Username': 'Enter your username here'


title: "Comments are a code smell"

text: A coworker of mine believes that _any_ use of in-code comments (ie, not javadoc style method or class comments) is a code smell. What do you think?


title: Forcing people to read and understand code instead of using comments, function summaries and debuggers?

text: I am a young programmer (finished computer science university but still under a year of working in the industry) and I recently got a job working on some C code for a decent size web service. Looking at the code the only places I saw comments were when people were stashing their old code. Function and variable names are similarly informative most of the time - `futex_up(&ws->g->conv_lock[conv->id%SPIN]);`. Confronting a senior programmer about the situation and explaining that adding comments and meaningful names would make the code more maintainable and readable in the future, I got this reply: > In general, I hate comments. Most of them time, like the case you mention > with the return value, people use comments to get around reading the code. > The comments don't say anything other than what the guy thought the code > does at the time he put in the comment (which is often prior to his last > edit). If you put in comments, people won't read the code as much. Then bugs > don't get caught, and people don't understand the quirks, bottlenecks, etc. > of the system. That's provided the comments are actually updated with code > changes, which is of course totally unguaranteed. > > I want to force people to read the code. I hate debuggers for a similar > reason. They are too convenient and allow you to step through dirty code > with watches and breakpoints and find the so-called problem, when the real > problem was that there are bugs in the code because the code has not been > simplified enough. If we didn't have the debugger, we would refuse to read > ugly code and say, I have to clean this up just so I can see what it is > doing. By the time you are done cleaning up, half the time the bug just goes > away. While what he wrote goes against a lot I have been taught in the university, it does make some sense. However, since experience in the studies sometimes doesn't work in real life, I would like to get an opinion of people more vetted in code. Is the approach of avoiding commenting code to make people actually read the code and understand what is going on make sense in a medium-sized coding environment (one that can be reasonably read in whole by every person working on it within a month or two), or is it a recipe for a long-term disaster? What are the advantages and disadvantages of the approach?


title: Beginner's guide to writing comments?

text: Is there a definitive guide to writing code comments, aimed at budding developers? Ideally, it would cover when comments should (and should not) be used, and what comments should contain. This answer: > Do not comment WHAT you are doing, but WHY you are doing it. > > The WHAT is taken care of by clean, readable and simple code with proper > choice of variable names to support it. Comments show a higher level > structure to the code that can't be (or is hard to) show by the code itself. comes close, but it's a little concise for inexperienced programmers (an expansion on that with several examples and corner cases would be excellent, I think). **Update** : In addition to the answers here, I think this answer to another question is highly relevant.


title: Why should you document code?

text: > **Possible Duplicate:**   >  "Comments are a code smell" I am a graduate software developer for an insurance company that uses an old COBOL-like language/flat-file record storage system. The code is completely undocumented, both code comments and overall system design and there is no help on the web (unused outside the industry). The current developers have been working on the system for between 10 and 30 years and are adamant that documentation is unnecessary as you can just read the code to work out what's going on and that you can't trust comments. Why should such a system be documented?


title: Should comments say WHY the program is doing what it is doing? (opinion on a dictum by the inventor of Forth)

text: The often provocative Chuck Moore (inventor of the Forth language) gave the following advice[1]: > Use comments sparingly! (I bet that's welcome.) Remember that program you > looked through - the one with all the comments? How helpful were all those > comments? How soon did you quit reading them? Programs are self-documenting, > even assembler programs, with a modicum of help from mnemonics. It does no > good to say: > > `LA B . Load A with B` > > In fact it does positive bad: if I see comments like that I'll quit reading > them - and miss the helpful ones. What comments should say is what the > program is doing. I have to figure out how it's doing it from the > instructions anyway. A comment like this is welcome: > > `COMMENT SEARCH FOR DAMAGED SHIPMENTS` Should comments say _why_ the program is doing what it is doing? * * * In addition to the answers below, these two _Programmers_ posts provide additional insight:   1. _Beginner's guide to writing comments?_   2. An answer to _Why would a company develop an atmosphere which discourage code comments?_ ### References 1\. _Programming a problem-oriented-language_, end of section 2.4. Charles H. Moore. Written ~June 1970.


title: Is there really anything to gain with complex design?

text: I've been working for a consulting firm for some time, with clients of various sizes, and I've seen web applications ranging in complexity from really simple:   * MVC   * Service Layer   * EF   * DB To really complex:   * MVC   * UoW   * DI / IoC   * Repository   * Service   * UI Tests   * Unit Tests   * Integration Tests But on both ends of the spectrum, the quality requirements are about the same. In simple projects, new devs / consultants can hop on, make changes, and contribute immediately, without having to wade through 6 layers of abstraction to understand what's going on, or risking misunderstanding some complex abstraction and costing down the line. In all cases, there was never a need to actually make code swappable or reusable - and the tests were never actually maintained past the first iteration because requirements changed, it was too time-consuming, deadlines, business pressure, etc etc. So if - in the end -   * testing and interfaces aren't used   * rapid development (read: cost-savings) is a priority   * the project's requirements will be changing a lot while in development ...would it be wrong to recommend a super-simple architecture, even to solve a complex problem, for an enterprise client? Is it complexity that defines enterprise solutions, or is it the reliability, # concurrent users, ease-of- maintenance, or all of the above? I know this is a very vague question, and any answer wouldn't apply to all cases, but I'm interested in hearing from devs / consultants that have been in the business for a while and that have worked with these varying degrees of complexity, to hear if the cool-but-expensive abstractions are worth the overall cost, at least while the project is in development.


title: Sticking to a Task vs Varying It

text: When you have several programming tasks to do at once, do you prefer to go through them one at a time, or to vary them, perhaps based on subtasks or on time? Why? For myself, I find that: Pros for sticking:   * If I lose my concentration or train of thought, it takes a while to get back into it. If I chug through one task, I'll probably get more done.   * Getting to cross things off a todo list feels good and looks good to my employer. Pros for varying:   * Sometimes my most productive work is in the first hour or so that I'm working on a task. If I vary, I get several first hours in a day.   * Getting stuck on a task when you're not making any progress is not much fun. Giving it some time often allows you to come up with solutions in a more relaxed manner. What do you do? Is there a particular time frame between varying tasks that works best?


title: Better programming by programming better?

text: I am not convinced by the idea that developers are either born with it or they are not. Where’s the empirical evidence to support these types of claims? Can a programmer move from say the 50th to 90th percentile? However, most developers are not in the 99th or even 90th percentile (by definition), and thus still have room for improvement in programming ability, along with the important skills. The belief in innate talent is “lacking in hard evidence to substantiate it” as well. So how do I reconcile these seemingly contradictory statements? I think the lesson for software developers who wish to keep on top of their game and become experts is to keep exercising the mind via effortful studying. I read a lot of technical books, but many of them aren’t making me better as a developer.


title: Have you ever organised a "Code War"?

text: The IT management classic PeopleWare suggests organised "Code Wars" as a way to boost morale. Has anyone ever put this into practice? How did you do it?


title: Managing p/t consultants like Open Source contributors?

text: I just assumed tech lead for a project which has had a problem with its very part-time (maybe 2-5 hours / week) contractors:   * submitting code that brings down the production app,    * pull requests that cannot be auto-merged,    * writing misnamed tests that don't actually test what they claim, and    * not writing tests for the new submitted features. A big problem is that these remote, part time contractors aren't in the office to respond immediately if there's a problem with their code. Also, I'm the only full time developer on the app, and we can't afford to have my time spent checking and debugging others' code. My idea is to adopt an open-source working style with them. I.e., would a big, important project (like Linux, Ruby, Rails, etc.) accept the proposed changes? We find out the criteria they have and then enforce that. We let go any contractor who doesn't play by the rules. Is this the way to handle the relationships? EDITED: To highlight the very part-time nature of the contractors. Less than 10 hours per week, usually 2-5.


title: Are we queueing and serializing properly?

text: We process messages through a variety of services (one message will touch probably 9 services before it's done, each doing a specific IO-related function). Right now we have a combination of the worst-case (XML data contract serialization) and best-case (in-memory MSMQ) for performance. The nature of the message means that our serialized data ends up about 12-15 kilobytes, and we process about 4 million messages per week. Persistent messages in MSMQ were too slow for us, and as the data grows we are feeling the pressure from MSMQ's memory-mapped files. _The server is at 16GB of memory usage and growing, just for queueing._ Performance also suffers when the memory usage is high, as the machine starts swapping. We're already doing the MSMQ self-cleanup behavior. I feel like there's a part we're doing wrong here. I tried using RavenDB to persist the messages and just queueing an identifier, but the performance there was very slow (1000 messages per minute, at best). I'm not sure if that's a result of using the development version or what, but we definitely need a higher throughput[1]. The concept worked very well in theory but performance was not up to the task. The usage pattern has one service acting as a router, which does all reads. The other services will attach information based on their 3rd party hook, and forward back to the router. Most objects are touched 9-12 times, although about 10% are forced to loop around in this system for awhile until the 3rd parties respond appropriately. The services right now account for this and have appropriate sleeping behaviors, as we utilize the priority field of the message for this reason. **So, my question, is what is an ideal stack for message passing between discrete-but-LAN'ed machines in a C#/Windows environment?** I would normally start with BinaryFormatter instead of XML serialization, but that's a rabbit hole if a better way is to offload serialization to a document store. Hence, my question. [1]: The nature of our business means the sooner we process messages, the more money we make. We've empirically proven that processing a message later in the week means we are less likely to make that money. While performance of "1000 per minute" sounds plenty fast, we really need that number upwards of 10k/minute. Just because I'm giving numbers in messages per week doesn't mean we have a whole week to process those messages. =============== edit: ## Additional information Based on the comments, I'll add some clarification:   * I'm not sure serialization is our bottleneck. I've benchmarked the application, and while serialization does show up in the heat graph, it's only responsible for maybe 2.5-3% of the service's CPU utilization.   * I'm mostly concerned about the permanence of our messages and potential misuse of MSMQ. We are using non-transactional, non-persistent messages so we can keep queueing performance up, and I would really like to have at least persistent messages so they survive a reboot.   * Adding more RAM is a stopgap measure. The machine has already gone from 4GB -> 16GB of RAM and it's getting harder and harder to take it down to continue adding more.   * Because of the star routing pattern of the application, half the time an object is popped then pushed to a queue it doesn't change at all. This lends itself again (IMO) to storing it in some kind of key-value store elsewhere and simply passing message identifiers.   * The star routing pattern is integral to the application and will not change. We can't application-centipede it because every piece along the way operates asynchronously (in a polling fashion) and we want to centralize the retry behavior in one place.   * The application logic is written in C#, the objects are immutable POCOs, the target deployment environment is Windows Server 2012, and we are allowed to stand up additional machines if a particular piece of software is only supported in Linux.   * My goals are to maintain current throughput while reducing memory footprint and increasing fault tolerance with a minimum outlay of capital.


title: Defining classes in JavaScript that exist in your back-end

text: Doesn't it seem relatively duplicative to define your Models in your backend code AND on your front end for a rich internet application? I'm porting a GUI application I had written to have a web interface, which is all grand and nice any all, but things like Spine, SproutCore, JavascriptMVC would have you define your models and views and implement specific controllers. Being that I've got a well defined MVC pattern on my backend code (which is making this super easy to port; the views in my app took python dicts and returned python dicts to the controllers which could easy interface with the models; I can just convert these to JSON back and forth to speak to the web front end), why would I want to recreate the entire pattern again on the front end? What are good ways to work around this? Should I just say "screw this" and use something like http://pyjs.org? Should I write a bunch of code to export my models into JSON and then write some JavaScript code to build the Models on the front-end automatically so I'm still only defining them once? What would be the best approach to this?


title: An extensible logging architecture for Android?

text: The end goal is to have a variety of data sets that can all be graphically plotted against eachother. All data should correspond to a date, so that when plotted against each other, they show the correct relationship through time. The key feature though, is to be able to add a new parameter to log at any time which will then be logged simultaneously and will then be able to be plotted against other data sets (from the time the later began onwards). As a sub point, it also needs to be able to deal with sparse information which is sometimes available and sometimes not. An example of the data can be seen below. C is sparse data and D is a data field added half way down the table. ![Example of data](http://i.stack.imgur.com/1Q30u.jpg) I have considered SQLite but the thought of all the column changes due to columns added by myself and users didn't appeal. Currently, I am thinking of creating an object which keeps track of time and contains a data field list of different data lists such as A, B, C and D as in the image. The thinking being that to add a new data field, I could just add a new parameter (e.g D) list to the data field list which already contains A, B, C. Then I could just serialize this into JSON to keep it persistent and when I want to graph anything with sparse data, I could interpolate it. That is my current solution but I would very much appreciate any opinions on better practices or flaws in my current solution.


title: Is this a good code documentation practice?

text: I'm working on 2 projects `projA` and `projB`, and both projects are maintenance projects. For `projA` there are 3 programmers and for `projB` there are 2 programmers. In each case all are working on separate points. As code documentation is very important, can you tell me which one is the better practice? Examples:                 {Author : lee    -verion 1.7    -date 30 dec  -asked by someGuy  -decription: to antialiase a line}          procedure antiAlias(thisline);       begin          //do the anti aliasing...        end;      or                  {*123}       unit testone;     ..     ..     ..              procedure antiAlias(thisline);       begin          //do the anti aliasing...        end;     ..     ..           end. //end of the unit..          {*123}       {Author : lee    -verion 1.7    -date 30 dec  -asked by someGuy  -decription: to antialiase a line}      the `{*123}` represent the point I have done for the particular unit. So the next point `{*124}` will be at the end of the unit. This is done (very rarely though) as the code looks clean without the commented part and lots of decription at the end.


title: Best practice to store DateTime based on TimeZone

text: Developing a web application which should allow User to schedule appointment based on their TimeZone. And I am storing the User scheduled datetime as server datetime into database field. While showing schedule information retrieved the value from Database and converted into user timzone. processing in Code base I am converting the DateTime based on the user timezone. Please suggest is this best practice or any easy way is exist?


title: Best Practice - XML To Excel

text: I've to read a big XML file with a lot of information. Afterwards I extract the needed information (~20 Points(columns) / ~80 relevant Data (rows, some of them with subdatasets) and write them out in a Excel File. My Question is how to handle the extraction (of unused Data) part,   * should I copy the whole file and delete the unused parts, and then write it to excel   * or is it a good approach to create Objects for each column?   * should I write the whole xml to excel and start to delete rows in excel? What would be performant and a acceptable solution?


title: Releasing Mobile Application under multiple platforms, same time or?

text: I've always had this idea circling around until I am facing this issue. We made an android app, it is ready, but we are planning to release the same app on iOS and possibly Windows Phone; Now, should we just release the Android app and promise the clients that the iOS version is coming soon (create anticipation before release)   or delay the release until the iOS version is ready? Same applies if we have a premium and free version, should we release the free version and promise that the better premium is coming soon, or release them both the same time? EDIT: as requested, the APP is a social APP, it depends on people's activity to succeed, and the manpower is the same, we made the iOS version, but to compile it we are waiting for the company to get us better Mac Machines (will be in a week for most)


title: Are there restrictions on table and column names in DB2?

text: I'm working with a DB2 database and I can't help but notice - these table and column names are really confusing! I realize that good names are important in every facet of software development, and it's quite possible that the non-intuitive names are unique to my experience, but someone told me that DB2 places severe restrictions on table and column names. **Is this true?** Or could it be that DB2 admins have traditionally followed a certain naming convention that seems foreign to SQL Server veterans like myself?


title: Patient Record Tracking System

text: ## Background At a medical facility, staff can remove patient records (file folders) from a room. The room is locked using a standard tumbler lock (i.e., no swipe cards). The medical facility does not have much funding available. All staff members have a computer in their office (some computers are several years old). All staff members, who have permission to fetch file folders, have a computer and a known location. ## Problem A significant amount of time is spent physically "tracking down" the location of patient records. This is inefficient for the person trying to find the files and disrupts other staff who are queried during the search. Eventually (possibly years hence) the records will be digitized. This is a classic library book check-out problem. ## Solution Architecture This is what I am thinking:   1. Web service that tracks file folders by ID.   2. Print QR Code (or bar code) label stickers with ID.   3. Label all the physical patient record file folders.   4. Equip all computers with inexpensive scanner (e.g., web cams).   5. Install QR Code (or bar code) reader software on each computer.   6. Write software that passes scanned document to code reader software (e.g., press CTRL-F12).   7. Write a web service that updates a file folder's location given an IP address. The part that remains is another web service that allows a person to search for an ID. The search result indicates the last known office where the folder was scanned. The tracking process becomes:   1. Staff takes file folder and returns to office as usual.   2. Staff holds folder to scanner, presses hot-key.   3. System audibly (and/or visually) acknowledges new location. ## Question What inexpensive solution would you put in place to substantially reduce the time taken to track down patient records (and curtail disrupting other staff)? Ideas for hardware components (e.g., inexpensive bar code readers) are appreciated. Inexpensive bar code readers requiring resident driver software that takes several megabytes of RAM, however, would not be feasible (due to older hardware and budget constraints). The system likely does not need to be perfect, but it should offer a dramatic reduction on the amount of time it takes to locate a physical file folder, with minimal overhead. Thank you!


title: What to do after accidentally erasing many database entries?

text: Today at work I did an update to production. The update involved replacing old items from two tables with new data. I of course did a back up of the tables before that. Well, now 6 hours after getting home I realized at shower that there was a foreign key reference on cascade delete for many tables and when I replaced the older data it also removed lots of other data -- I'm not even sure I know all of the data that got removed... The thing is, there are about 270 tables and I've been to the company for 3 months. I was supposed to do this update today and the CTO was away doing remote work. I tried to contact via Skype and email, but he's away. I figured not to call him at this time of day (late evening here). What should I be doing here? It's the beginning of weekend and I feel bad leaving the system in such a condition for two days... and especially because I screwed up things. The client is doing billion dollar business and its the biggest client the company has so this was a major drawback. If the hosting provider does not have nightly backups I will probably get fired. Damn I hate automatic magic like FKs. :( What would you do in my position?


title: How do you address the gap on your resume after a self-funded sabbatical?

text: There are a ton of questions on Programmers.SE about whether or not taking extended time off is a good idea and what to do during that time off to maintain your skill level: Will taking two years off for school in a related field destroy a mid level development career? Can I take a year off without hurting my career? If you take a year or two out from being a developer, is it really that hard to get back into it? Is taking a break in career to learn stuff "a bad idea" They've been really helpful, but I still have a question about the logistical details of take a self-funded sabbatical. I'm coming to the end of a year off from working as a software developer (after 7 years in the field.) I've taken this year to let myself explore interests that I'd never had enough time for: baking, sewing, photography, and making new and interesting friends. During this time, I've also been working on pet development projects in technologies and disciplines that I would never have had the chance to explore otherwise. in addition, I've read all of those software development books I'd never had time to read and kept up with programming news and blogs. The development projects have all had an eye towards being part of a Micro ISV, but only one of the projects has made it to any sort of production stage. That project is impressive, but not very successful (yet!) I've got a reasonably active programming blog that I believe reflects a high dedication to software development and demonstrates that I haven't just put my programming skills on a shelf for a year. My question is: **What is the best way to transmit this information to a potential employer at the resume/cover letter level?** I'm reasonably confident that I can explain this sabbatical in an interview setting. I know that at the resume level though, hiring managers will use any excuse they can to throw my resume out (I've done hiring and I would probably have thrown out my own resume if it didn't handle this time off really well, maybe it's karma.) So I feel like the resume/cover letter is the really tricky part in getting a kick-ass new job. I have a few ideas about what to do, but I'm not sure what the larger community sees as acceptable. Here are the approaches I'm considering:   1. Put a special section on my resume for the sabbatical time in which I outline the personal projects. If I do this, what's a good way to label it?   2. Create a personal company name and put these projects in the work experience section of my resume under that company. This seems like the most go-getter way to do it, but I'm worried it could be perceived as trickery when I get to the interview stage. Also if I do this, what do I put as my title?   3. Leave my resume as-is and explain everything in my cover letter, with a link to my active blog.   4. There's probably something I'm not thinking of, I'm open to any other ideas. I know I've included a bunch of special-snowflake information about my personal situation, but I would prefer answers for the more general case. The personal details are here more as an example than as a request for answers designed specifically for me.


title: How does one get a group of programmers together for a project?

text: I recently pitched a project I've been working on to a small company that I know, coincidentally, has a need for something similar. They seemed excited by what I have, and what I said I could do, but worried that, as a lone (actually, they said 'rogue') programmer I could up and leave them with a non- functional program. They suggested that I get a few people together, write up a solid proposal, and meet with them again. They've promised office space and a good budget because this is an application that would greatly increase productivity for them. The problem is I'm still quite new to the field, I have no professional experience, and while I know I could complete this project, I don't know how to find other people to bring in on it. Does anyone have any experience in situations like this? Any ideas on where I could look? Also, the company and I are both located in Manhattan, if that helps determine where to look for people.


title: Internal-use websites: Is there a compelling case against SQLite?

text: Many web frameworks, such as Flask or Django use SQLite as their default database. SQLite is compelling because it's included in python, and administrative overhead is pretty low. However, most high traffic public production sites wind up using a heavier database: mySQL, Oracle, or postgresql. _The questions_ : Assume:   * Site traffic is moderate, and concurrent read/write access to the database will happen   * We will use SQLAlchemy with SQLite write locks (although this comment makes me a little nervous)   * The database will contain perhaps 60,000 records   * Data structures do not require advanced features found in heavier databases Is there ever a compelling case against SQLite concurrency for websites that serve as moderate-traffic internal corporate tools? If so, what conditions will cause SQLite to have concurrency problems? I'm looking for known specific root causes, instead of general fear / unsubstantiated finger pointing.


title: Logging: Why and What?

text: I've never written programs which make significant use of logging. The most I've done is to capture stack traces when exceptions happen. I was wondering, how much do other people log? Does it depend what kind of application you are writing? Do you find the logs actually helpful?


title: Idea for a physics–computer science joint curriculum and textbook

text: I want to write (and have starting outlining) a physics textbook which assumes its reader is a competent computer programmer. Normal physics textbooks teach physical formulas and give problems that are solved with pen, paper and calculator. I want to provide a book that emphasizes computational physics, how computers can model physical systems and gives problems of the kind: write a program that can solve a _set_ of physics problems. Third party open source libraries would be used to handle most of the computation and I want to use a high-level language like Java or C#. Besides the fact I'd enjoy working on this, I think a physics-computer science joint curriculum _should_ be offered in schools and this is part of a larger agenda to make this happen. I think physics students (like myself) should be learning how to use and leverage computers to solve abstract problems and sets of problems. I think programming languages should be thought of as a useful medium for engaging in many areas of inquiry. Is this an idea worth pursuing? Is the merger of these two subjects in the form of an undergraduate college curriculum feasible? Are there any specific tools I should be leveraging or pitfalls I should be aware of? Has anyone heard of college courses or otherwise that assume this methodology? Are there any books/textbooks out there like the one I'm describing (for physics or any other subject)?


title: Handling "backup" files with Git

text: I have a project folder that has multiple duplicate files that are named slightly differently to create "backups". So I have "file1.txt" and "file1 backup.txt". Is there a preferred method to capture the old history when I make the folder into a git repository?


title: Should all, none, or some overridden methods call Super?

text: When designing a class, how do you decide when _all_ overridden methods should call `super` or when _none_ of the overridden methods should call `super`? Also, is it considered bad practice if your code logic requires a mixture of supered and non-supered methods like the Javascript example below?               ChildClass = new Class.create(ParentClass,     {        /**         * @Override         */        initialize: function($super) {           $super();           this.foo = 99;        },             /**         * @Override         */        methodOne: function($super) {           $super();           this.foo++;          },                  /**         * @Override         */        methodTwo: function($super) {           this.foo--;          }     });      After delving into the iPhone and Android SDKs, I noticed that `super` must be called on _every_ overridden method, or else the program will crash because something wouldn't get initialized. When deriving from a template/delegate, _none_ of the methods are supered (obviously). So what exactly are these "je ne sais quoi" qualities that determine whether a _all_ , _none_ , or _some_ overriden methods should call super?


title: Assert equality in mstest when types may differ

text: I've been working on some MSTest automated test infrastructure, that is testing a tool that merges data sets into SQL Server database tables. The basic structure of the test is to:   1. Define the incoming dataset using anonymous types   2. Apply the data using the reconcile tool   3. Read records from the output tables   4. Compare result rows to input data, column by column Example input data:               public class InputData : List<dynamic> {} // Inspired by Massive etc          InputData input = new InputData()     {         new { ExternalID = 1, PropertyName = "hello", Agent = "test" },         new { ExternalID = (Int64)2, PropertyName = "fred", Agent = "test" } // Fixes the problem with a cast     };      The issue I'm dealing with, is that the type inferred on my anonymous objects will be an Int32, but the corresponding column in my target table is a bigint, and hence the record will have an Int64 value. As a result, when I use Assert.AreEqual across each column, it fails on any int fields:               Assert.AreEqual failed. Expected:<1 (System.Int32)>. Actual:<1 (System.Int64)>      You can see I have cast the int on my second anonymous object, this can be used to fix the issue. The primary aim of these tests is to make the sample data as slim and easy to read/write as possible, and I'd prefer to avoid the visual noise of all those casts. I'm thinking about the best way to deal with the assertions. It seems like I should use dedicated assertions based on type. I guess the real question is, how aggressive should I be in converting between types automatically?


title: How is software for machines such as ATMs or TVs built?

text: As a beginner programmer I've only worked with programming computer based applications, but a question has been coming to my head very often since I started programming and I can't get it answered properly. Machines don't act on their own, that's the programmer's job, he tells it what to do and when to do it, but my curiosity lies beneath computers. I'll take the examples of an ATM software on this post but keep in mind there are many others such as a washing machine display, or a TV, mobile phone, you name it. How exactly is the software for these kind of machines built? I imagine it can't be identical to computer-based programming. What language do they use to make such things work and how does one get the job done? Are there programmers specialized on this kind of programming? What is the process of making these machines come to life?


title: Rewarding programmers based on application importance

text: Is it correct for management to give more importance or reward programmers who have worked on strategic and important application versus someone who has worked on a general application?   Both may have put the same efforts.


title: how can you avoid version nightmare?

text: I am in charge of the deployment or implementation work.Due to my company's immaturity product,there is a version upgrade serveral days. Each time there is a upgrade version,I had to notify the customer they had to replace their old version product.What I do is reconfigure all the configuration files for different customers who has its specific needs. Finally email them the new version of products and tell them ... Doing all this work is boring. Is there anyone have similar experiences? Any advice is welcomed. More context: I get a updated version from svn respository,it's configuration files is default.And each customer needs serveral configuration files different from each other,but their own configuration files is normally stay unchanged.My work is to export serveral products from the svn folder for each customer and copy their own configuration files in.


title: What to do about "next piece syndrome"?

text: Inspired by this question: What to do about "stopping point syndrome"? I often find myself a half hour away from knocking-off time having just wrapped up a component of my work, and facing a "next piece" that is going to take more than half an hour. (That's happening right now, as a matter of fact. Hence my surfing stackexchange during business hours!) What do you do? Launch into the new piece knowing you'll have to stop in the middle? Set it aside and twiddle your thumbs until the clock runs out?


title: Do App Stores Have Exclusivity on Your Apps?

text: Let's say I write a mobile app and I want to sell it on all three:   1. Apple Market Place   2. Android Market Place   3. Windows Market Place Will any of these market places tell me that it's not possible, that in order to sell it I must only go through them and not through the other ones? p.s I know Angry Birds sells on all three. But how is that? I mean, don't books, for example, have exclusivity deals with their distributors?


title: When is the time right to bring a project to the alpha/beta/public phase?

text: When should a project be released to alpha, beta and to the public? Is it a good idea to extend the alpha and beta phases when it is needed? When in a later phase (eg. beta), is it wise to go back to an early phase (eg. alpha) if it didn't work out?


title: Pair Programming/Collaboration in a small company

text: I work at a small development company as the lead developer. We have two other developers, as well as my boss who is a developer, but doesn't really do much of the actual coding anymore. The problem I am trying to overcome is multifaceted. We have a tendency all to work on our own projects without much collaboration between us. As a matter of fact, I (as the most advanced developer) ask for the others' opinion/help more than they do mine, because I value the input of an outside eye. I want to increase our collaboration, and have expressed that to them. In large part because I'd like to show them some things about how to become better developers and follow better practices. But given our other developers' personality types, I think they are more comfortable working alone. I've been reading about pair programming, and I have read (in some forums) that it doesn't work well when you have one developer being more advanced than the others (which I am). And yet, I feel it is imperative that we start to collaborate so that our work is not so disparate. My question is whether anyone has ever been in a similar situation, and what worked for them? I realize this is not a one-size-fits-all situation, but I'm willing to give multiple approaches a shot. We all work in a common area, developers don't have have individual offices / cubicles.


title: Efficiently "moving" data upward through a communication stack

text: I have implemented an application protocol stack that moves an incoming stream of data upward through several layers, as follows:   1. **copies** a TCP segment from an OS buffer to `my_buffer`.   2. after identifying a record boundary, splits the record in `my_buffer` into tab-separated strings which are **copied** into `deque<string> my_deque` (rather than into a vector because I then have to immediately pop a couple of fields from the front)   3. **copies** `my_deque` to `vector<string> my_records[n]` where it is presented without further copying to the application. I'm wondering whether it's best to stick to a clean architecture (layering) and pay the price (whatever that is) of copying payload from layer to layer, or if there are some simple optimizations that people use. Is it customary to use separate buffers for separate layers, or is this something which can easily be optimized away without dangerously compromising the independence of the layers?


title: Breaking the "ubiquitous language" by having an IoC Container in Domain Model?

text: I am a bit new to DDD and bear with me if my understanding seems way off. My question is about Udi's solution to domain events, particularly the class `DomainEvents` (see code below) An excerpt from Udi's code. It lives domain model as a static class.               public static class DomainEvents     {         [ThreadStatic] //so that each thread has its own callbacks        private static List<Delegate> actions;             public static IContainer Container { get; set; } //as before             //Registers a callback for the given domain event        public static void Register<T>(Action<T> callback) where T : IDomainEvent        {           if (actions == null)              actions = new List<Delegate>();                actions.Add(callback);       }            //Clears callbacks passed to Register on the current thread       public static void ClearCallbacks ()       {            actions = null;       }            //Raises the given domain event       public static void Raise<T>(T args) where T : IDomainEvent       {          if (Container != null)             foreach(var handler in Container.ResolveAll<Handles<T>>())                handler.Handle(args);               if (actions != null)              foreach (var action in actions)                  if (action is Action<T>)                      ((Action<T>)action)(args);       }     }       Based on the code above, in order for the `DomainEvents` to be used by the domain model, both must first be in the same assembly. Which makes the `DomainEvents` part of the domain model right? (I may be wrong here) So my question is: **Does`DomainEvents` itself breaks the rule _"ubiquitous language of DDD"_**? Because it's implementation does not pertain to any domain. My other concern is that the static member `IContainer` creates an ioc- container-dependency in the domain model. Though I am not really sure if Udi's `IContainer` is an interface or an actual IoC container. My 2nd question is: **What is this`IContainer` in the `DomainEvents` class?** If it is truly an IoC container then doesn't it break the rule of _"DDD should not have an infrastructure in the domain"_? Is my understanding correct that an IoC-Container is considered an infrastructure? (Please correct me if I'm wrong) If you may find any of this confusing, please say so. **EDIT:** I have built my projects where the domain model is separated on its own assembly (I call this business layer) with absolutely no references to any infrastructure components. See onion architecture. ![enter image description here](http://i.stack.imgur.com/xN3GJ.png) Now I want to incorporate the domain events pattern. But doing so forces me to add infrastructure components to my business layer. Components being the `DomainEvents` and an IoC framework just to satisfy the `IContainer`, both having no relation to the domain whatsoever. **Isn't one of the idea of DDD is about separating the infrastructure from the domain?** Now I will play the pragmatic programmer, I just wanted to know that is it generally ok to do so? are there alternatives? What are you thoughts on this approach? Am I missing something basic here?


title: Critique the Structure of my Horse Racing Betting Platform

text: I am creating a program (mostly just for fun) that displays live prices for horse racing markets and the prices that several models predict they should be. I am very interested in the optimal way to structure this kind of data. I need a `Dictionary<int, (something)>` to store `<raceId, data>` where the key (raceId) is a number I generate (to get rid of old races from the dictionary when the race is over). The vales (data) consists of the actual prices for each selection in the race and the prices of 3 separate models that correspond to each selection. The dictionary will contain 20-60 races depending on the time. Here is an example of the data for each race:               ActualPrice    ModelAPrice    ModelBPrice    ModelCPrice     3.25           3.26           3.29           3.20     5.60           5.63           5.55           5.57     etc.      The number of rows is usually around 40. Some of the models don't offer prices for some of the rows, but for each actual price there is at least 1 model price. Additionally, for each race data I store strings for the RaceCourse, StartTime, Location, etc. I also store marketIds in the form of ints, these correspond to several rows at a time (these are used to place the actual bets), there are about 6 marketIds per race. I was using a class to store all the data in called RaceData that is made up of fields for strings (i.e. RaceCourse, Location), ints (i.e. WinMarketId, PlaceMarketId) and doubles (i.e. HorseA_ActualPrice, HorseA_ModelAPrice, etc). So my dictionary is made up of `<RaceId, RaceData>`. But I was wondering if instead it would be better to store the data over 3 Dictionaries.               Dictionary<int, Dictionary<string, string>>      <RaceId, <StringName, StringValue>>      Example of usage: Use RaceId=102313 and StringName="RaceCourse" to get Value="Flemington"          Dictionary<int, Dictionary<string, int>>     <RaceId, <MarketName, MarketId>>     Example of usage: Use RaceId=131231 and MarketName="WinMarket" to get MarketId=1321313          Dictionary<int, Dictionary<string, double>[]>     An array of dictionaries (one for each column of the data).     <RaceId, <RowName, Price>>     Example of usage: Use RaceId=12313 and RowName="HorseAWinPrice" to get Price=3.25      I'm not really sure if an array of dictionaries is needed for the last one, as I could just change the keys to have the column at the front, i.e. "ModelA_HorseBWinPrice" or "Actual_HorseBWinPrice". Which one is better? Speed is a major concern when I have ~60 races and ~200 primatives for each. I have to perform several basic calculations using the values in each row for all of the races. I also need to display the racename/time in a listbox, and for the selected item in the listbox, display all of the prices on the form (in several list boxes). It is worth noting that each listbox corresponds to a marketId. Which is a better solution or can you suggest a better one that I have not put forward?


title: What could be a reason for cross-platform server applications developer to make his app work in multiple processes?

text: We consider a server app development - heavily loaded with messing with big data streams. An app will be running on one powerful server. A server app will be developed in form of crossplatform application - working on Windows, Mac OS X and Linux. So same code, many platforms for stand alone server architecture. We wonder what are the benefits of distributing applications not only over threads but over processes as well, for programmers and server end users? Some people said to me that even having 48 cores, 4 process threads would be shared via OS through all cores, is that true?


title: Can I scrape a website for font stylings?

text: I am trying to scrape websites for valuable text for example the title of an article, the author's name, and other distinguished text. I cannot always guarantee that this sort of text will have informative tags, and but this needs to be done as quickly as possible. As a possible short cut I think that I could just try to pull the text with unique styling. The title is normally bigger than the body text, and the by-line is normally smaller. Is there a way to quickly pull all of the font stylings of a page and then rank them by size and how often it is used?