title: Software Engineer VS "Harder" Jobs

text: _This should probably be in a Dear Abby column, nevertheless..._ I am the only engineer in my entire family (including extended family). Occasionally I hear family members say that being a Software Engineer is not as hard as say a UPS Driver. While both may work the same hours, intrinsically the SW Engineer job is rated as less difficult than the other. The general consensus is that we just sit in front of computers all day with some occasional meetings. I feel that being a Software Engineer is not physically demanding but mentally draining. For those that have encountered this line of thinking before, what is the best way to convince your friends and family otherwise? Edit: My Wife told her Mother... I am tired after work and don't want to be running errands... her Mother said that I am in an office all day on a computer, how can I be tired. Side note: I am also an Army Reserve Officer, member of my city's planning commission, and a freelance blogger for my local newspaper. Plate is pretty full aside from being a SW Engineer - BUT, the notion still remains with the family that being a SW Engineer is nowhere as difficult as being an UPS Driver, which my brother-in-law is currently employed as.


title: Isn't the Spiral Model/Agile Development essentially just a more rapid and compressed Waterfall Model?

text: Since I learned about the Spiral Model of software development, I've tried to apply it to the different projects I've been involved in. However, I'm starting to feel like it's really just compressing and iterating more rapidly through a traditional Waterfall Model. Even in each Spiral or Agile cycle, there are still step-by-step tasks/objectives that need to be finished in order to complete the spiral, and that step-by-step process seems really similar (although shorter total cycle and perhaps less steps) to the Waterfall Model. Is the main difference the introduction of a feedback loop into the process of development earlier on and throughout the process, or is there a fundamental difference in the actual step-by-step completion of a task?


title: How do you deal with stealing?

text: I have been recently hacking on a project I started a couple of months ago. It was a simple idea. Allowing people to collect achievements for code they shared on Github. So I started this noble endeavor, trying to rake in my friends to get coding and helping. I spent all my free time working getting this up and running and building it. _Enter musical time lapse_ My friends pitched in when they could. As you can imagine, I became very attached to its success. Then just as I was gearing up for release, a company releases a very similar product. I was very disheartened when I came to hear my little project was release by someone else, but it wasn't like I had rights to the idea. I swallowed my pride and shot them an email saying something along the lines of > Hey, I have been working on something similar. We should talk! It's super > cool stuff. We talk, I get the feeling that he really doesn't want to collaborate, although cordial we allow each other access to one another site. Couple of days pass, and **I see that some of the descriptions for my achievement are appearing on their achievement site.** After speaking to him originally, I **_was_** going to send them a nicely worded email outlining my plan for my achievement system and call it quits. **Once I saw the descriptions of my achievements appearing on their site, I couldn't just let it go.** I decided to fight back. I have open-sourced the project, just leveling the playing field and it frees me up from having to deal with the competition, since I am was only working on it part-time. This isn't the action I can take every time, I am wondering what options do I have if I find myself in this position in the future? lawsuit? stern email? Just as a heads up, I am looking for advice on how to deal with this without lawyers; or is this the way things play out in the real world?


title: Is Cleanroom still used on software projects?

text: Cleanroom is a software engineering process that's often mentioned in textbooks. There was some documented use of the process in the 90s (I believe it was used at the NASA Software Engineering Lab), but I haven't heard anything about it years. Does anyone have any direct experience using it on a software project?


title: Question about SDLC. How to answer this?

text: I have seen this asked many times in job interviews but I am still not sure how to answer this. I am a web developer for quite some time but I still have problem with explaining OOP and SDLC (Familiar with system development life cycle) . How to prepare for above 2 topics for an interview point of view. Still I use both all the time during development. I am not clear on OOP SDLC Is there any simplest answer to both of these?


title: How do you decide how much your software will cost?

text: If you are a solo developer, or have a leading role in a software company, you might have to decide how much your software will cost one or another day... What is your experience with calculating how much your software costs for your customer? Why does this method it work for you?


title: Is there a defined way to create a commit history for Git

text: I have been working (alone) on an open-source project without using any sort of formal version control. I recently started using Git and GitHub for this project and am wondering if it is possible for me to build a code/commit history based off of the archived, older versions of the code that I have. Development thus far has been solely linear. It's progressed from version 0.1 through 0.9.6.3 without any branches. I've looked through the Git User Manual and the closest thing I can think of would involve making labeled or named commits for each previous version. What is the best way to handle this? Do I need to create a new repository and start pushing labeled commits into it, ending with the current version? Is it possible to change the dates of existing commits? Is there a more straightforward way? I'm using Git on Windows XP (native, not Cygwin), but if it would be easier I can set it up on my Ubuntu box.


title: Do code style guides increase productivity?

text: Our team of 12 is currently considering implementing a style guide. The question came up if long term productivity benefits outweigh the short term productivity loss as everyone adapts. What has been your experience with style guides? I should also note our code base is rather large and we'll probably have to run our code through uncrustify or something similar to bring the entire code base into conformance with the guide.


title: Learning programming from a book which uses C++98

text: I am learning programming from a book called "Programming Principles and Practice" by Bjarne Stroustrup. It has been highly recommended over here and elsewhere. My only issue is that it uses C++98 and as I understand there have been two other standards c++2003 and c++2011. Going through this book will be a significant investment of time and effort for me (210 hours recommended) and I would not want to commit to if my skills or knowledge gained may be outdated or not as useful etc. On the other hand this book is written by an expert and is widely recognized as one of the best for entry level programming (assuming no prior knowledge). Despite a lot of research I have struggled to find another book which is written by such a leading authority and provides good and accurate introduction for the beginner. Could someone share some insight as to what and how much I would be losing out on if I use this book and learn C++98. And whether going through it would be a good choice for a person in my situation and worth the investment of time and effort. If you own this book or are experienced user of C++, your insight will be appreciated even more. Thanks.


title: Preferred lambda syntax?

text: I'm playing around a bit with my own C like DSL grammar and would like some oppinions. I've reserved the use of "(...)" for invocations. eg:               foo(1,2);      My grammar supports "trailing closures" , pretty much like Ruby's blocks that can be passed as the last argument of an invocation. Currently my grammar support trailing closures like this:               foo(1,2)     {        //parameterless closure passed as the last argument to foo     }      or               foo(1,2) [x]     {         //closure with one argument (x) passed as the last argument to foo         print (x);     }      The reason why I use [args] instead of (args) is that (args) is ambigious:               foo(1,2) (x)     {     }      There is no way in this case to tell if foo expects 3 arguments (int,int,closure(x)) or if foo expects 2 arguments and returns a closure with one argument(int,int) -> closure(x) So thats pretty much the reason why I use [] as for now. I could change this to something like:               foo(1,2) : (x)     {     }      or               foo(1,2) (x) ->     {     }      So the actual question is, what do you think looks best? [...] is somewhat wrist unfriendly.               let x = [a,b]      {     }      Ideas?


title: What Is The Best Technique For Managing Bugs and New Features With Version Control in CVS/SVN for a Team of 6 to 9 People?

text: In a company working on a long term software project, there are 6 to 9 developers working in the same office. The development team uses JIRA for bug tracking and CVS (and some SVN) for version control of different Java Web Apps related to the software application. The team uses REST to communicate between the Web Apps on different servers. The environment consists of Amazon EC2 and Google App Engine Apps, all written in Java, HTML, CSS, and JavaScript. The development team commits the code every day. Using this strategy, deployments happen every 20-25 days, but they would like to target once per week or once every 2 weeks instead. When the code goes through testing, the testers find and report bugs, but when the development team fix the bugs and deploy the software, the software sometimes then has more bugs in it because developers working on new features are still committing code to the repository. Sometimes the sales team or customers find bugs as well on production systems. Our thought is that we could check out a copy of the code that is stable and make changes there. I suspect this is a problem with how the version control is used, but it could be something else in the process. How should this agile development team of 6-9 people make sure that the releases are both frequent, once per week or once every 2 weeks, and that the deployments are high quality with no regression bugs?


title: Software Development vs. Information Technology

text: What are the major differences between Software Development and Information Technology. If you have majored in IT is it a fine major but as different as Software Development and Computer Science as stated in Joel's blog?


title: How to make a legacy system time-zone sensitive?

text: I need to implement time zones in a very large and old Delphi system, where there's a central SQL Server database and possibly hundreds of client installations around the world in different time zones. The application already interacts with the database by only using the date/time of the database server. So, all the time stamps saved in both the database and on the client machines are the date/time of the database server when it happened, never the time of the client machine. So, when a client is about to display the date/time of something (such as a transaction) which is coming from this database, it needs to show the date/time converted to the local time zone. This is where I get lost. I would naturally assume there should be something in SQL to recognize the time zone and convert a DateTime field dynamically. I'm not sure if such a thing exists though. If so, that would be perfect, but if not, I need to figure out another way. This Delphi system (multiple projects) utilizes the SQL Server database using ADO components, VCL data-aware controls, and QuickReports (using data sources). So, there's many places where the data goes directly from the database query to rendering on the screen, without any code to actually put this data on the screen. In the end, I need to know when and how should I get the properly converted time? What is the proper way to ensure that I handle Dates and Times correctly in a legacy application?


title: Using grammars to extract bibliographic citations

text: My task lays in the area of text mining / labelling, more particular extraction of bibliographic citations (references) from the plain text, as shown here: ![enter image description here](http://i.stack.imgur.com/CjLn6.png) Basically, for the input text the algorithm should recognize:   * The beginning and end of citation   * Journal name, title, author, issue, volume, pages This task was already approached in e.g. Citation Parsing Using Maximum Entropy and Repairs (Ng Yong Kiat, 2005), which demonstrated that CRF models deal better then MEMM or pattern-based approaches. Currently there are two projects, that do the job:   * ParsCit, a Perl program build on the top of CRF++ project   * Grobid – Java module, also based on CRF++ While the results of mentioned approaches are already known (and are very good), I was given a task to do the same but using the context-free grammars. Indeed, the information looks to be very structured but I am not sure if this approach can outperform CRF on sensitivity, at least I hope it can beat it on accuracy. My idea is the following:   * Define the fixed grammar rules for already known types:   `YEAR → (19|20)\d\d | \d\d\d\d`   `PAGE → \d{1,3}\-\d{1,3} | e\d{1,3}`   `ISSUE → \d{1,3}`   * It is possible to infer from training set the probabilities of rule alternatives e.g.:   `PAGE → \d{1,3}\-\d{1,3} with P=0.8 | e\d{1,3} with P=0.2`   * From the pre-annotated training set generate the high-level rules (all chars between non-terminals are terminals):   `CITATION → AUTHORS, JOURNALTITLE, ISSUE, PAGES, YEAR | AUTHORS, BOOKTITLE, VOLUME, CHAPTER, CHAPTERTITLE, EDITORS, PUBLISHER, PUBPLACE | ...`   `CITATIONS → CITATION | CITATIONS; CITATION | CITATIONS; and CITATION` The problematic places are:   * `AUTHORS`: There is no fixed rule for them, but one can write a function, that can score that the given text looks like an author. Also the list of possible (English) surnames is not so huge, but if I create the thousands of rules it will slow down the grammar parser. Let's say for authors we have some scoring function, that for given input returns a number [0 .. 1] reflecting how the input really looks like an author. The grammar parser should feed all possible variants for `AUTHORS` and stop on one with a best score.   * `JOURNALTITLE`: The same story. There is obviously no general rule to define it. There is a list of all journals, but then comes also the subproblem of abbreviation: _Ann. NY Acad. Sci. = Ann N.Y. Academy Sci = Annals of the New York Academy of Science_. Again, we can define a scoring function for that; in worst case the function can measure the distance between input sting and all known journal titles using Damerau–Levenshtein algorithm.   * The text like "Vol", "Chapter", "edited by" can be very useful as terminators prefixing the corresponding values (and thus reducing the ambiguity of the grammar), but can they be identified and learned automatically?   * The same for terminators before and after citation, which can be very useful (perhaps will speedup the parsing):   `SUPERCITATION → ( CITATIONS ) | ( see, e.g., CITATION ) | see, for example, CITATION | described in, e.g., CITATION | is disclosed by CITATION`   Does it make sense to "hardcode" them or try to learn them?   * The "noise" text between citations: how to deal with it? The goal of the lexical analysis is perhaps not to find the most probable parse tree, but also to maximise AUTHORS and JOURNALTITLE functions. Can somebody advise me:   * If SCFG is the right way to approach the problem? If yes, how is it possible to adapt this approach to create a parse tree based on probabilities and also on scoring functions?   * Are there any other relative works / articles?   * Are there any libraries that can help in chunking the text (written in a way that can be applied also for e.g. Chinese text)? I have found some monsters like UIMA, Mallet, MinorThird... I wonder about your personal experience when using them for the task like above. Thank in advance for any reply.


title: What non-technical skills do I need?

text: Apart from:   1. being strong technically   2. being able to communicate effectively What are the most important formal / informal skills required to really shine as a developer? (Naturally, I struggle with the first two, but even so...).


title: Push response to the user for which the request is created in Asp.Net (Chat Server)

text: I am working on a Chat Server Application in Asp.Net with C#. Suppose there are 5 users online say User A,B,C,D,E. Suppose A sends a message in chatbox to user B, so how the chatbox (Textbox/Textarea of chat) of User B will load the new content? One Option is to refresh the chatbox every 10Seconds or 15 seconds but it's pretty unuseful way because as if there is no new message for the user the chatbox will still be refreshed. * * * I have an aspx page say client.aspx with client.aspx.cs as code behind file and server file say server.cs. There is a send button on aspx page on click event of this button i called a method of my server file say UpdateChatbox(from,to,content) now the from is User A, to is User B and content is my msg in chatbox, Now the question is : How Server.cs file update the ChatBox on client.aspx page of User B?


title: Should I lock a list of objects while a socket is receiving messages?

text: I have a scenario where I will be receiving messages through a socket connection. I also need to keep a list of 100 messages (such as List) and periodically toss out old messages from the list when a condition is met.               List<Message> MessageList = new List<Message>();     Message CurrentMessage = new Message();          public void ReceiveSocketMessage (SocketMessage Message) {              if (Message.Type == duplicate) {             CurrentMessage = MessageList.FirstOrDefault(x=> x.MessageText == Message.Text);             CurrentMessage.Time = DateTime.Now;         } else {             MessageList.Add(Message);         }     }      Since the socket sends messages very quickly, it seems like any other method that attempts to access MessageList will cause a problem. Other methods will need to access the list at many random points in time. I just can't get my head wrapped around working on the list of objects without causing trouble. What is the traditional method of handling this? UPDATE: Would it be simpler just to maintain a list of items in a database table instead of a list of c# objects? A database would surely have all the major locking problems ironed out to a point where I shouldn't need to worry about it.


title: What is the best solution for printing a document from Azure with limited user interaction?

text: I currently have a web app hosted in Azure, with a few worker background jobs. My goal is for a user to click print on a page, and to them the printer will magically start printing a document(for security purposes). The setup will look something like this:                    Azure           |     _____________     |     |     |     B1    B2    B3      Where each 'B' is a building. When a user from B2 clicks on a web app to print a document, the document will start printing in the designated printer in B2. Each building is on its own network when it comes to workstations and computers. I'm not 100% sure how to approach this. One option is to have a Windows task running on each workstation that will continuously ping blob storage for new documents. If one shows up if will start printing. This is probably the easiest route but seems like it would be maintenance hell for 100+ buildings. It also seems like a waste when there may only be one document a day. Are there any other options for printing a document in such a fashion?


title: SQL Server CE 4, graphical tools for designing tables, etc.?

text: I thought that Visual Studio 2010 SP1 would include support for using SQL Server Compact Edition 4 inside the designer, but it seems not. Was I wrong, or has I managed to botch up my installation somehow? I installed SQL Server CE 4 from the download page, not through the web installer. If Visual Studio 2010 SP1 does not, and should not, include such support, what are my choices, if any?


title: Applying Denotational Semantics to design of Programs

text: I've read a bit on denotational semantics (DS) and I'm very intrigued about the process of designing computer programs where types and functions have strong and clear mappings to mathematics. Are there any resources that discuss designing programs based on DS in detail? I've seen a few superficial treatments of the subject. I'm conversant in Haskell, Scala, Common Lisp, and a bit of Scheme so any resources that use those languages would be greatly appreciated.


title: Difference between the two enums

text: I came across an enum definition :-               typedef enum NSInteger {         kBorderTypeNone   = 0,         kBorderTypeLeft   = 1 << 0,         kBorderTypeRight  = 1 << 1,         kBorderTypeTop    = 1 << 2,         kBorderTypeBottom = 1 << 3     } BorderType;      and also (possibly) it can be equivalent to               typedef enum NSInteger {         kBorderTypeNone   = 0,         kBorderTypeLeft   = 1 ,         kBorderTypeRight  = 2,         kBorderTypeTop    = 4,         kBorderTypeBottom = 8     } BorderType;      What are the internal differences(if any)? Is there any advantage of one over the other? Which one is recommended? If both are same then how compiler handles it? In which phase of compiler is it reduced to same set of instructions?


title: Is is common to use the command pattern for property get/sets?

text: Suppose I have a controller class with a bunch of properties. Each time a property is changed, I would like to update the model. Now also suppose that I use the command pattern to perform model updates. Is it common to use command classes within property get and sets of the controller class or is there a better way? Here is an example of what I am currently using:               class MyController {       private int _myInt;       public int MyInt {         get { return _myInt; }         set {           MyCommand cmd = new MyCommand();           cmd.Argument = _myInt;           cmd.Execute();  // Command object updates the model         }       }      }


title: Resources for using TFS for Agile Project Development?

text: Our company just installed TFS for us to start using for project development processes and source control. They want us to start using it to manage our projects as well. We have a small team, no current bug or task tracking software, and 2 developers of the 3 have experience with any actual methodologies. What books, websites, and/or other information can you recommend for us to use to get started?


title: Any language where every class instance is a class too?

text: Taking inspiration from Javascript prototypes, I had the idea of a language where every instance can be used as a class. Before I potentially reinvent the wheel, I would like to ask if there is a language already using this concept:               //To declare a Class, extend the base class (in this case, Type)     Type(Weapon,{price:0});          //Same syntax to inherit; simply extend the parent:     Weapon(Sword,{price:3});     Weapon(Axe,{price:4});          Sword(Katana,{price:7});     Sword(Dagger,{price:3});          //And the same to create an instance:     Katana(myKatana,{nickname:"Leon"});     myKatana.price; // 7     myKatana.nickname; // Leon          // An operator to return children of a class;     Sword_; // [Katana, Dagger]          // An operator to return array of descendants;     Sword__; // [Katana, Dagger, myKatana]          // An operator to return array of parents;     Sword^; // Weapon          // Arrays can be used as elements     Sword__.price += 1; //increases price of Sword's descendants by 1     mySword.price; //8          // And to access specific element (using its name instead of index)     var name = "mySword"     Katana_[name]; // [mySword]     Katana_[name].nickname; // Leon      Has this kind of approach been already studied/implemented?


title: Google-Gson Converting JSon to CSV

text: What is the easiest way to convert a Json data to a String at CSV format ? I haven't read all the api yet but it seems that subclassing the default JSonWriter allows to remove unnecessary character in order to be closer to CSV format. Does a simpler solution exist ?


title: Building a Graph Editor - How to create a data driven graph

text: I am developing a graph-editor that uses drag and drop to build hierarchical graphs (containing nodes and links). Each node in the graph should be linked to a table in our database (SQL Server). I did a lot of research about libraries based on javascript or/and JSON specifications to draw nodes and links. There are a lot of great examples to follow, but I have no idea about the way I can link a graph to a database (SQL Server, Oracle, MySQL...). I thought about this architecture (Question posted on stackexchange.com) I have looked at the D3 library. It creates data-driven charts, but I think it only uses flat files, and not relational databases. First can you please tell me if my architecture is well thought out? And second can you give me some ideas about the way I can link my graphs to the DBMS? Thanks a lot.


title: Where should you store variables for a search program in java?

text: **I'm wondering which is a more effective storage method in java.** Would be better to save constants in a class or a resource? The constants will be searched later by my Search program which will go through the list of constants so as to recognize possible options. Also if there is a more efficient method of storing them please say so or if i doesn't matter where i store them. **1). A java class called Search is going to be inputted with two or more constants they will then either access a java class that will redirect them as needed.** **2). Search will receive the same information but will look to a external resource to see what possible files match it then corresponding what info was give will open a pathway to the java class it correlated.** Which version should be better or will it not matter? the values the constants contain are going to be ints but each int will have their own unique meaning. To clarify why i need these arrays each number is going to have a meaning and the arraylists will hold the numbers like 1 may mean work 2 may mean private and so a private work document would have name PDocument has [1,2] so on and so on hope that clarifies So which option is more effecient #1 or #2


title: How can I configure my programming environment to enable rapid switching between projects?

text: It often happens that I develop multiple different projects at once, so I need a solution to switch from one environment to another. I have created batch files to do the job but as this thing grows, I'll soon need something better. Some things I do are:   * Map drives   * Launch applications   * Load test databases   * Set environment variables   * etc. Any suggestions on that? **Edited:** I want to unify the development process in some way. We use VS, Eclipse, Notepad++ or what ever the developer needs. The goal is to be able to load a project in any windows machine without having compiling or other issues. Example:   * The solution might need to reference files, sdk folders, test data paths or other stuff. To solve this: I have mapped the code to a drive. The project doesn't need to know whether the dev is using c:\dev or c:\programming folders (user choice). They only need to map their coding folder to a drive (lets say W:) every file of the solution is under W:   * Another problem is the SDKs. An sdk can be in c:\programfiles\Microsoft sdks\etc.. or in c:\programfiles **x86** \Microsoft sdks\etc.. Those Sdks should also need mapping to a standard folder that the solution knows. Another thing is that we want services running (apache lets say) if we develop a website. We don't want this to run all the time. The solution so far is to distribute batch files that the developer edits once in order to match their paths to the solutions and they run the batch before they start their new task. I am thinking on developing a app that will set the environment as desired. Preconfigured sets that are distributed. The developer executes them in order to set the enviromnent as desired. I hope to be clear now on the problem. Any suggestions on doing that in a better way?


title: Differences between different creative coding libraries

text: I've worked with Cinder previously under Windows, but have recently switched to Ubuntu. Since Cinder doesn't work on Linux (::sadface::) I've began looking for alternatives. With that in mind, could you please tell me what the differences between Processing, openFrameworks and Polycode are, and compare them to Cinder? Specifically, I would like to know   * If there are differences in the _functionality of the packages_ compared to Cinder (ie. one does something that Cinder doesn't and vice versa).    * I would also like to know how different the _syntax of the package_ is from Cinder's. I have already seen the following articles : here and here and have also visited the corresponding website for each of the libraries but could not find a clear and concise answer to my question.


title: JavaScript Frameworks for traditionally structured web applications

text: I am looking for a way to control large amounts of JavaScript code in a ASP.Net MVC web application. I have been looking at Ember.js and whilst it's pretty compelling it takes control of the routing and as such treats the server as little more than a place from which to receive API calls. This isn't really useful for what I need. I wondered if there recommendations for similar projects out there that allow faster, more structured, JavaScript but in traditional server-based web applications?


title: Data transfer between "main" site and secured virtual subsite

text: I am currently working on a C# ASP.Net 3.5 website I wrote some years ago which consists of a "main" public site, and a sub-site which is our customer management application, using forms-based authentication. The sub-site is set up as a virtual folder in IIS and though it's a subfolder of "main", it functions as a separate web app which handles CRUD access to our customer database and is only accessible by our staff. The main site currently includes a form for new leads to fill in, which generates an email to our sales staff so they can contact them and convince them to become customers. If that process is successful, the staff manually enter the information from the email into the database. Not surprisingly, I now have a new requirement to feed the data from the new lead form directly into the database so staff can just check a box for instance to turn the lead into a customer. My question therefore is how to go about doing this? Possible options I've thought of:   1. Move the new lead form into the customer database subsite (with authentication turned off).   2. Add database handling code to the main site. (No, not seriously considering this duplication of effort! :)   3. Design some mechanism (via REST?) so a webpage outside the customer database subsite can feed data into the customer database How to organise the code for this situation, preferably with extensibility in mind, and particularly are there any options I haven't thought of?


title: Rest API Architecture from Rest in Practice book

text: We maintain an API that as part of its purpose makes a call to an external API. This external API takes a few seconds to fulfil the request we make to it. With our current architecture the request is made synchronously, meaning that the http response we return to the user request is blocked until our service get the response from the external API. I am considering changing our architecture to be able to deal with the request asynchronously... By this I mean accept the user request into our API and put a message on a queue so that we return an http response a lot quicker. The response would contain the address of where the full/complete result can be found. A background task would then pick messages up from the queue and make the call to the external API, then store the result at the address provided in our response. The address could then be polled by the user/client until the desired state of the respource is reached (i.e. when the background task has finished calling the external api and has stored the result). This architecture I have mainly lifted from the REST in Practice book. The crux however is that our external API only takes 2-3 seconds to return the response. The example in the book describes an ordering process that might take minutes or hours. Is this suggested solution worth the increase in complexity for such a short response time from our external dependency? i.e. will the application still scale with the existing synchronous architecture?


title: Factory-Class versus Static Class

text: I've got a little problem in choosing the best design. I have some (5 at the moment) image processing operations in my coe (Java). Every processing step independent from the other ones and consoists of a small amount of code, 5-15 lines in general. These are mostly wrappers to JAI, AWT and so on. My current design is an abstract class:               public abstract class AbstractPreProcessingStep {         protected Logger logger = Logger.getLogger(this.getClass().getName());              protected AbstractPreProcessingStep() {         };              public abstract BufferedImage startProcessing(BufferedImage input);          }      Every processing step implements this class and can be called uniform. (like the Strategy-Pattern). Since every processing step may have a different set of parameters, I created a factory class, like this:               public class PreProcessingFactory {                   public static AbstractPreProcessingStep createColorInverter() {             return new ColorInverter();         }                   public static AbstractPreProcessingStep createRescaler(float rescaleFactor) {             return new Rescaler(rescaleFactor);         }                   public static AbstractPreProcessingStep createEdgeDetector() {             return new EdgeDetector();         }              public static AbstractPreProcessingStep createBlackAndWhite() {             return new BlackAndWhite();         }     ...      So, if you want to create a black and white image with inverted colors, you need to do this (pseude code)               bw = PreProcessingFactory.createBlackAndWhite();     inv = PreProcessingFactory.createInverter();     result = bw.startProcessing(result);     result = inv.startProcessing(result);      In my mind, this is a good design since the implementation details are hidden and new processing steps can easily be add by adding a new class. The other approach which was in my mind was to create a single class with every step as a static method - however, I've got dislike of 'static' Do you have any suggestions to improve the code?


title: Operator distributivity in expressions - syntactic sugar

text: When writing boolean expressions out, you often have to use something of the type:               A == any of B1, ..., Bn     C < all of D1, ..., Dm      But in code you have to use expanded forms:               A == B1 or ... or A == Bn     C < D1 and ... and C < Dm      That looks, to me, like _any of_ and _all of_ are simply the distributed form of _or_ and _and_. That made me wonder if you can apply distributivity to operators in some way that compilers/interpretors can understand. For the above example, say, something like this:               A == B1 +_or ... +_or Bn     C < D1 +_and ... +_and Dm      Essentially, taking operators as relations, it should work something like this:               R1(A, distributive_R2(B1, ... , Bn)) becomes     R2(R1(A, B1), ... , R1(A, Bn))      This could apply to more than just booleans:               X / Y1 +_+ ... +_+ Yn becomes     X/Y1 + ... + X/Yn      Of course, my `+_` prefix may not be the ideal syntax; I'm sure there's better ones out there. Nevertheless, this strikes me as being possibly quite useful and understandable. Any thoughts?


title: Should CountDownLatch be used for waiting for an event?

text: I have a situation here, where I have a loop that loops x amount of times. The value x is determined by the user. Everytime it loops, I want it to wait for a button click before continuing the loop. ie. something like this (pseudocode):               loop(x times){     Button b;       wait until a click       when clicked{         b.onclicklistener{           setText(x);         }       }     }      I am using this for an android app, so with Thread.wait()/Thread.notify() what I learned was that it interrupts the main UIthread, so I cannot use that. So what I believe the only two options that I can use to kind of "pause" the loop is CountDownLatch.await() or AsyncTask (I don't know what that does, have not researched about it) Would CountDownLatch.await()/CountDownLatch.countDown() be the best methods and class to use in this example, or should I look into AsyncTask?


title: Does using Creative Commons No-Derivatives license conflict with GitHub terms?

text: When a software project wants to use Creative Commons Attribution- NonCommercial-NoDerivs 3.0 Unported License that denies making derivatives, does it conflict GitHub terms of service clause F.1 that says: > By setting your repositories to be viewed publicly, you agree to allow > others to view and fork your repositories. Eg. is forking (allowed by GitHub) the same as making derivatives (denied by CC). A fork has an owner, has its own download links, has separate history from the original repo etc. and any other feature you might expect from a "derivative". I know that using CC for a software project is not the brightest idea but some are still doing this and I wonder if it is even allowed by the GitHub terms. IANAL is OK, I just want to see some opinions about it


title: Why is cleverness considered harmful in programming by some people?

text: I've noticed a lot of questions lately relating to different abstraction techniques, and answers saying basically that the techniques in question are "too clever." I would think that part of our jobs as programmers is to determine the best solutions to the problems we are given to solve, and cleverness is helpful in doing that. So my question is: are the people who think certain abstraction techniques are too clever opposed to cleverness _per se_ , or is there some other reason for the objection? EDIT: This parser combinator is an example of what I would consider to be clever code. I downloaded this and looked it over for about half an hour. Then I stepped through the macro expansion on paper and saw the light. Now that I understand it, it seems much more elegant than the Haskell parser combinator.


title: Should I pass array or pointer?

text: I am writing a C++ library (but prefer C style interface functions) and one of the function returns array of floats. I am not sure if I should pass pointer or fixed array to get this data?               // in the library header file     #define MAX_ITEMS_SIZE   1000          int getData(float * data, int &size );      or               int getData(float (&data)[MAX_ITEMS_SIZE], int & size )      If I am passing the pointer, the client should allocate MAX_ITEMS_SIZE for it. Is that a reasonable and fair expectations? Passing it as array forces the client to pass the max memory required. Which one is better? Some more background, the MAX_ITEMS_SIZE is the maximum number of floats that can be returned. In reality the array will contain less items which is filled in the size parameter. The function returns int which is error code where zero means no error. My overall goal is how to return the data which is array of floats in easy to understand and reliable way. Even though I am using C++, I would like to stick with C interface functions so the library can be used more widely.


title: How to provide a ubiquitous object without including it in every parameter list

text: I'm writing a small C++ class, **Block** , to transform serialized data into a memory structure, and supply the structured data to callers through several accessor methods. I've tried to keep its scope specific and limited. The users of the class are very low-level - they, too, are very narrow in their focus and have as few external dependencies as possible. This is how I've been taught to engineer things if at all possible. By minimizing dependencies and creeping featurism, it's easier to unit test, and easier to reuse. The problem is that my class depends upon someone else's class, **Metadata**. It, too, does one very specific thing: it reads data that defines the characteristics of the data stream I'll be transforming from a database table and passes it to me. His class checks for mySQL errors, which should be rare, and logs any errors to a **Log** object. This **Log** object appears in all of our company's applications. Instantiating it is a big deal - it wants Job numbers, it wants a lot of configuration information from the database that's normally put there in production by account managers using a GUI. You have to do a lot of work before your program can instantiate the Log. Yet this tiny, low-level class ( **Metadata** ) with one tiny task wants it to be passed in, by me. My object certainly has no business instantiating the **Log** , so I have to take it as a parameter from whoever calls me. And so forth, up the calling hierarchy. I can understand why management wants a class to encapsulate and standardize message logging. But the need for it to be passed to, and through, just about every method is extremely ugly, and makes testing and reuse much more difficult. This kind of problem must be fairly common. How can this be done without cluttering up the signature of every method you write? Is this a legitimate case for Globals? Is there some kind of Object Oriented approach? And, is this a God object?


title: CSS Classes for semantics vs. styles in general cases

text: The W3C spec on the `class` attribute says > There are no additional restrictions on the tokens authors can use in the > class attribute, but authors are encouraged to use values that describe the > nature of the content, rather than values that describe the desired > presentation of the content. Reference I work on a massive website that has many disparate pages. We have a default stylesheet that is shared across practically all pages. I find it useful to have CSS rulesets such as these:               .center { text-align: center; }     .red { color: red; }      However, these classes do not semantically describe content. I'm sure you can understand that there are an enumerable number of cases where I need to center text or color it red, and each of these specific instances may have nothing to do with one another. For example, the class `warning` may be useful in one spot, but in another it may just be `aside`. I wouldn't necessarily want _all_ warnings to be red either. I realize that this is a hyper-technical question, but I do want the hyper- technical answer. Is there any correct way to reconcile having general style rules that express no semantics with the HTML spec? Is this a case for _shudder_ inline styles?


title: Should I continue using procedural php code or move to a framework

text: I haven't done any serious web development stuff since last year because of family/time issues. I need to get back into it because it's my career choice and I'll be finished with my associates degree soon. I decided to revamp a previous website I helped the owner build. After deciding what to change, I couldn't make up my mind if I should continue with writing procedural code or move to a framework. I know without a doubt I can do it with procedural code but I'm undecided between it. I guess I'm looking for a second opinion, what would you do if you were in a similar situation?


title: How to publish paid Android apps if you're not from US/UK

text: I was pretty excited while creating one of my apps but as it turns out you can't actually sign up for Google Checkout if you don't live either in the USA or in the UK. And since Google Checkout is the only way Android Market will pay you, all my efforts seem to be going in vain. So because I live in India, I can't sell my apps. I tried contacting Google by various means on this, but haven't got any response so far. I tried searching the web as well just to find out that one can't be paid via any other way. I am pretty sure that many people here might have gone through the same problem. How did you solve it? I have a PayPal account and an AdSense account as well. Can they help in any way? And if nothing works out, how am I supposed to be selling my app?


title: Abstracting out a module or using the Module Singleton directly?

text: I am working on a module which is dependent on other module for some functionality. Now the dependent module provides a lot of functionality and I need only few of them, hence got the idea to create an abstraction of the same in my module which is again be a singleton only. My question is when to abstract out and when to use the modules singleton class directly? Is there any guidelines for the same? Or its depend upon project to project?


title: Renaming long named method in C#

text: I'm working on a project where exist one method with title               string ValidateNewPasswordExpireCurrentPasswordAndCreateNewPassword(...)      I'm sure the method name must be changed. But can't found good and descriptive alternative. Also I can't separate method in multiple methods, like ValidateNewPassword(), ExpireCurrentPassword() and CreateNewPassword(). How can I rename the method and the same time to not lose self describing ability ?


title: Deploying v Releasing

text: So there's this desktop application. And I am wanting to inform it's users that a new version has been released. Is it more correct to say that a new version of a desktop application has been 'released' or 'deployed' (as with a web app)?


title: Release as open source after granting usage rights?

text: I have written software and have granted usage rights to different companies per contract. Is it possible to change the software licence to an open source licence afterwards? At what circumstances is this impossible and how will this affect the current contracts? Like one of the companies is allowed to modify and resale the software. If I change to GPL are they forced to change to GPL, too?


title: Does this justify goto statements?

text: I came across this question a second ago, and I'm pulling some of the material off of there: Is there a name for the 'break n' construct? This appears to be a needlessly complex way for people to have to instruct the program to break out of a double-nested for loop:               for (i = 0; i < 10; i++) {         bool broken = false;         for (j = 10; j > 0; j--) {             if (j == i) {                 broken = true;                 break;             }         }         if (broken)             break;     }      I know textbooks like to say goto statements are the devil, and I'm not fond of them at all myself, but does this justify an exception to the rule? I'm looking for answers that deal with n-nested for loops. **NOTE:** Whether you answer yes, no, or somewhere in between, completely close-minded answers are **not** welcome. Especially if the answer is no, then provide a good, legitimate reason why (which is not too far from Stack Exchange regulations anyway).


title: Transparently adding a database interface layer

text: I am currently looking for ways to optimize an application that is consuming unacceptable amounts of memory. The process basically takes input and parses it into a tree. The tree is currently stored in memory. For an average input, it may consume 100 MB to 2 GB of memory. For larger inputs, it may consume up to 6 GB, which is more than what most of our machines can handle if we wanted to test it locally. We are afraid there will be even larger inputs in the future, and so it's time to find a more scalable solution. Rather than storing everything in memory, I would like to move the tree, or parts of the tree, into external storage. Benchmarking the effects of not storing certain parts of the tree in memory has resulted in a 90% reduction in memory consumption. We have a framework (well, just our own library) that allows us to work with the tree using a set of standard getter and accessor methods. We use standardized methods for creating, reading, updating, and deleting nodes. Our parsers typically interact directly with nodes. For example, a sample method might say               // Takes some data and updates the tree with new data     private void managePerson(String id) {            // this returns a node with the given ID, or creates one if it doesn't exist yet       // and returns a reference to it       NodePerson node = getPerson(id)             // add or update some attributes       node.age.set(25)       node.name.set("John")            // add some points to the existing value       int points = node.points.get()       node.points.set(points + 5)     }      Given this information, I am thinking of using a database. However, I would also like to be able to implement the changes transparently so as not to affect a decade's worth of code that relies on the tree. What can I use that will allow me to get data out into a database while allowing developers to get a reference to an object (eg: a person node) and treat it like any other object without any knowledge of where and how the tree is stored internally? It would also be nice if the solution tried to optimize the amount of queries that are made. For example, instead of inserting 10000 person nodes one at a time, it would somehow figure out a way to batch insert it. This is meant to be temporary storage: once the parsing is complete, all of the data can be discarded as we are serializing the data in a file (again, based on practices that have been implemented years ago. This can be changed, but we don't have plans for that yet)


title: Recommended .NET / C# coding standards?

text: What coding standards do you think are important for .NET / C# projects? This could be anything from dealing with curly braces and spacing and pedantry like that. Or it could be more fundamental questions such as what namespaces in the .NET Framework to avoid, best practices with config files, etc. Try to avoid creating a post that is simply the corollary to another. For example, it would be fine to have one post focusing on curly braces. We don't need two to support one style vs. the other. The idea is not to vote for your pet standard, but rather to flesh out what should be thought about when creating standards.


title: Naming Convention for Private / Public Fields

text: I read the following on the MSDN: > Use Pascal casing for all public member, type, and namespace names > consisting of multiple words. > > Note that this rule does not apply to instance fields. For reasons that are > detailed in the Member Design Guidelines, you should not use public instance > fields. > > Use camel casing for parameter names. * * * Well it says it does not apply to instance fields so what applies to instance fields? I know I should not use them, but if I do, what is the correct convention? I guess it would be Pascal, but I'm not sure about it...


title: Developing a search algorithm

text: I want to create a basic search engine, and I want you to give me some ideas how to filter out the best results for my visitors. I have three fields regarding a product the user can search in:   1. Title   2. Category   3. Description I came up with these ideas and I ask you to either competently criticize them or add to them.   1. If the search term occurs in all three fields it should be among the first results.   2. If it is in two of the fields it is below the results of 1.   3. Combine the amount of occurences and output a value in per cent. For instance if in all fields together the term clock appeared 50 times and in all fields together there are 200 words, then the per cent value is 50/200*100 = 25%. Another product entry amounts to say 20% so product one having 25% is listed before product two having 20%.


title: Function calls to calls in windows api

text: I am a beginner programmer who is learning C. I find it hard to grasp the whole programming concept, thus I have questions. When programming in Windows, how does Windows communicate with the programs that run on it? A question I have been pondering about is how when you incorporate a function call which is in another memory location on the disk or memory (not a function you yourself wrote and is included in the compilation), especially the Windows API, does the compiler know where the function location is so when the program is run it can call that function? For example, a very simple program that displays a window which reads hello world. You would have to call Windows API functions to achieve such features as creating the window, its size, colors and so on... So basically what I am struggling to grasp is how the programs I write communicate with the platform, framework they are run on(generally windows for Windows API). Apart from clarification on this one above, I would love a resource that explains this concept further.


title: Moving from Winforms to WPF

text: I am a long time experienced **Windows Forms** developer, but now it's time to **move to WPF** because a new WPF project is comming soon to me and I have only a short lead time to prepare myself to learn WPF. What is the best way for a experienced Winforms devleoper? Can you give me some hints and recommendations to learn WPF in a very short time! Are there simple sample WPF solutions and short (video) **tutorials**? Which **books** do you recommend? Is www.windowsclient.net a good starting point? Are there alternatives to the official Microsoft site?


title: Learning graphical design as a developer

text: I'm mostly a developer and have been offered a job as webmaster. It's likely that I'll be asked to make some cosmetic changes to a website every now and then. Has anyone made this transition? If so, how did things go? Also, are there any good online sources to get up to speed on how things are done today?


title: Catching typos or other errors in web-based scripting languages

text: My background is mainly strongly typed languages (java, c++, c#). Having recently gotten back to a bit of javascript, I found it a bit annoying that if I misspell something by accident (for example I'll type 'myvar' instead of 'myVar') my entire script crashes. The browser itself most of the time doesn't even tell me I have an error, my program will just be blank, etc. Then I have to hunt down my code line by line and find the error which is very time consuming. In the languages I am used to the compiler lets me know if I made a typo. My question to you is, how do you overcome this issue in scripting (javascript)? Can you give me some tips? (this question is mainly aimed at people that have also come from a strongly typed language). Note: I mainly use the terminal/VIM ... this is mainly b/c I like terminal and I SSH alot too


title: How do I set up my "personal" library?

text: Through SO/P.SE browsing, I've been picking up useful pieces of Python code (e.g. a Mutable memoizer, an efficient prime generator) that I'd like to stick into one spot to have available should I need it in future projects. What are some best practices for how a "personal" code library of reusable classes/functions/modules should be set up? For example, do I just drop it all into one module? Or should I model it after the standard library, even though some modules may have 1 class/function in them?


title: Advantages of a left to right language syntax

text: I've been watching an interview with Herb Sutter on Channel9 and he mentioned at the end of the video that left to right language syntax would be on the top on his whishlist for a future C++ standard(although he acknowledges that modifying C++ in that way would pretty much make for a completely different beast). Apart from:   * more understandable by humans, clearer to the naked eye;e.g.              //C syntax          /*pointer to function taking a pointer to function(which takes 2 integers as           arguments and returns an int), and an int as arguments and returning an int*/          int (*fp)(int (*ff)(int x, int y), int b)          //Go analogous syntax which is left to write          f func(func(int,int) int, int) int        * easier to parse(leads to better tool support as mentioned in the video - e.g. code refactoring)  what other advantages are there with a "left to right" syntax in a programming language. I know only of Pascal and Go employing that kind of syntax(and Go does not even go the full way as I understand from this blog post from which I took also the examples) Would it be feasible to have a systems programming language with that kind of syntax?


title: Equidistant polygons

text: Consider these polygons: ![Consider these polygons](http://i.stack.imgur.com/jSeLV.png) For reasons of simplicity I only consider triangles or polygons with 4 vertices. These shapes are specified by the vertices, the output of the program should be modified vertices. I am trying to find an algorithm to create a space between the polygons, the colored area depicts the space: ![polygons with space](http://i.stack.imgur.com/yQD6h.png) I have tried these things:   * scaling each polygon around it's center of gravity    * scaling the bounding box of each polygon None of those worked. I am thinking of an algorithm to modify the corner points of each polygon to create the equidistant space. What would be a feasible algorithm for this problem?


title: Business Logic vs Presentation/View Logic

text: I often question myself of where to put the logic that organize the data to a view that is not necessarily a business logic in a 3-layered architecture (DAO, Business, View). I'll put an example to be clearer: I have a UI in my aplication that shows pending tickets and answered tickets in two different tabs. To get the data from the database, I make a single query. Since there is no business logic, I'm returning the whole list to the Controller (View) and separating it in two lists to pass to the view template. Should I be separating this in the business layer? Or is it correct to separate in the controller, since the logic is attached to that single UI?


title: Pros/Cons for a Data Structure covering multiple databases?

text: I'm about to extend a system containing two separate systems. Or domains, if we see the system as a domain level. **Today** One domain is used internally. The other is public, which means it is more exposed to whatever can happen "out there". Services of some kind (few options apply) perform operations between the two separate systems. The public and internal system have separated database storages, and are not related to each other. Let's call the domains client and store. **Tomorrow** I'm into a new application that will have lots of more user-specific information at the client domain. The design may be comparable to a 'private database' that has a facebook-account-link as a key. This compares to a database that held user actions, but had no user specific data (such as address, date of birth, email and so on), just a key to the Facebook-server. On the other side, the STORE database (compared to Facebook-server in this case) doesn't know anything about the user actions. **Goal** Approximately 85-90% of the queries will be within their own domain (client if client, store if store). Though, there are some situations where the client need to get data from the STORE database and the STORE needs to create/handle users in the CLIENT database. **Questions out from my head**   * Is this a good way to go?   * Pros/cons? Orphans? Database Performance? Problematic .NET coding?   * Principles of the choice for the boundaries of data? .. and other things you may know or think of   **An example of structure** ..dbStore.Users   * userid (PK)   * name   * dateOfBirth   * emailAddress -> Wallet (another table) ..dbStore.Wallet   * walletid (PK)   * userid   * createddate -> BankAccount (another table, not typed) ..dbClient.users   * storeUserId (unique, non-inc) <\-- corresponds to dbStore.User, no restraint   * accessLevel   * lastLoggedIn   * serviceXxEnabled   * udpAccessKey ..dbClient.action   * actionid (PK)   * isSomething   * someDate   * anythingElse ..dbClient.installation   * installationid (PK)   * userid We won't collect bank-account information, it just to give a picture of the data structure and its importance in keeping it in separate systems. I hope this Q is comprehensible enough.


title: Why should I care about micro performance and efficency?

text: Many questions and answers on the C/C++ pages, specifically or indirectly discuss micro performance issues (such is the overhead of an indirect vs direct vs inline function), or using an O(N2) vs O(N _log_ N) algorithm on a 100 item list. I always code with no concern about micro performance, and little concern about macro performance, focusing on easy to maintain, reliable code, unless or until I know I have a problem. My question is why is it that a large number of programmers care so much? Is it really an issue for most developers, have I just been lucky enough to not to have to worry too much about it, or am I a bad programmer?


title: Aren't there compilers better at telling the programmer what's wrong in a code?

text: I have worked a little while with the Microsoft compiler from Visual C++ but I worked a long time with G++, and I remember often having bad times understanding what was wrong in my code with the former. Beside binary code generation and optimisation, I think this is a very important feature of a C++ compiler: giving the programmer a clue that makes him understand as fast as possible what is wrong with his/her code. I can understand some programmers understand programming as some sort of "competition" to make less errors, but to me that's a counter productive opinion. I once tried Clang compiler for C from the LLVM thingie, I didn't use it for a long time, but I was impressed on how explicit and easy to understand the error messages were. What are your experiences, and how do you think this matters ? Some WIP of C++ Clang: http://clang.llvm.org/cxx_status.html


title: Creating a Performance Model for a Legacy product

text: I've been given the task for creating a performance model for a legacy product. The product is about 10 years old and has never had any performance requirements or performance models before. Generally whats happened in the past is a customer will complain that a particular feature is slow or they are not getting the throughput that they want/need and the developers will investigate and see if any more performance can be squeezed out the code for the feature. Since the product doesn't have any hard measurements and metrics for past versions I fell all I can do is create baselines for the current version and go from there. Other developers sometimes _notice_ that memory usage is really high and ask why. Also, I am new to the product so I don't know all the feature points (which there are hundreds to thousands) and the performance cost of running each. The program is an ASP.NET/.NET 2.0 webapp on IIS 6. I've started looking into performance counters and the CLR Profiler to start getting measurements. I've also read the following docs: Measuring ASP.NET Performance Improving ASP.NET Performance So my question is: **How can I create a performance model for a legacy product that I am new too and hasn't had a performance model/requirement in the past?**


title: What is the ideal learning path to building Android apps with Scala, without prior Java experience

text: Unfortunately, there are not currently any books on the subject of 'Learn Android Development with Scala', which would be the ideal solution. I'm guessing that I'll need to pick up at least 3 books here, one for each topic. However, I have no idea what order to read them in, whether to read them simultaneously, what parts of the Java book I can safely skip, etc. What is the best path for me to get started building Android apps using Scala?


title: Should user input of a contact form be validated?

text: On software company websites I visit the first time, I often open the "Contact us" page and try to submit the contact form with all fields empty. I am just curios if they validate the user input. If it is just submitted or only validated poorly (e.g. only Javascript validation), I often hear myself thinking > Oh, look how sloppy they are! Can't even validate user input. That calls > itself a software company? No, I don't think I want to buy any software > services of them. A friend of mine has such a "sloppy" contact form. You can submit a completely empty form. I asked him why he does not validate user input, and he said: > Look, I want that customers can contact me. They should enter any > information they want. If they only want to enter a message and leave the > other fields empty, why should I care? They enter the relevant information > anyway. I do not want to add any barriers when contacting me. I did not ask him how many empty messages he gets, though. However, what is the better option now? Both arguments (check how company handles user input vs. not adding any barriers in contacting) seem to make sense for me. I want that the user can easily contact me, but still has the impression that I am precise when programming webpages.


title: Building a sequential list in languages with cons/linked lists

text: In languages where cons lists are a major datatype, it is very easy to create a list from last to first by prepending items. When doing processing from some input file, however, one is most likely to encounter items in first to last order. Do languages like these typically recurse?               (define (parse file)       ...       (cons datum (parse file)))      Use append operations at each step? Build the list in reverse order and then reverse it? Is there some canonical design pattern that can solve the problem that input is typically going to be in the reverse order of the way the list is constructed?


title: Globally important concepts to understand?

text: I have a history of web development using LAMP + html/css (though I admit the LAMP aspect isn't in great depth) and would like to follow the career path of software developer, so I'm currently learning C, after which I'll look at C++. **I was wondering if anybody could give me a list of subject area's within computer programming as a whole that are important to fully understand, right through to a 'senior' level of career progression?** Obviously I know it's the mindset and knowing when to use various techniques that makes a good programmer, but you have to start somewhere! By topic areas I mean for examples:   * Data types   * Variables   * Functions   * OO   * etc. Many thanks.


title: How does a web browser save passwords?

text: How do current web browsers (or mobile mail clients and any software in general) save user passwords? All answers about storing passwords say we should store only hashes, not the password themselves. But I'm having a hard time searching the web trying to find the best techniques to store passwords when we know we will need them in plain text later on — without storing them in plain text, without using a weak encryption (known key) and without asking the user for a master password. Any ideas?


title: Improving performance for web scraping code

text: I have a website in which the code scrapes other websites for getting the accurate data. While the code works good but there a decent lag in performance because the code firsts downloads the html stream from various sites(some times 9 websites), extracts the relative part and then renders the html page. What should I do to get an optimal performance. Should I change from shared hosting (godaddy) to my own server or it has nothing to do with my hosting and I need to make changes to my code?


title: What are the pressures of being a software engineer?

text: I am thinking about a career in software engineering, but before I look for work I wanted to get an idea of what to expect particularly with pressure. This will be my first programming job (so I am looking for entry level), so I am not yet mature as a programmer yet. My question is what is the pressure like in these jobs? How high can the pressure get? If your boss gives you an assignment and it's due in two weeks but it takes you 3 will you get fired, because your unable to perform? Are you given time to learn more about the technology, develop your coding skills and grow, or are you expected to know it already and blaze through the project? If you have trouble with code are you expected to handle it yourself and work independently, or are you able to ask others for help if you are stuck? Are you expected to put in a lot of late nights to meet the deadlines? I know that this can depend on the company as well, but I just wanted some professional insight to the possible pressures of being a software developer/programmer etc. I also know that other jobs have pressure too! I just would like to know the pressure unique to software engineering. The reason I ask this question is because I had a bad experience programming once and I wanted to know if most of these jobs are the same. If software engineering/developing/programming is tough pressure that I don't want to handle are there other types of development like web development, system admin, etc that are less pressure that I can get into and still code? Thanks for reading and I look forward to hearing everyone's thoughts.


title: How can I prevent users from merging origin/X into Y in git?

text: Is it possible to force git to only merge remote tracking branches into the corresponding local branch? E.g. assume origin/X tracks X on origin and corresponds to local X and the same for origin/Y and Y. I want to prevent users to do `git checkout Y; git merge origin/X`. Is it possible? How? **Edit:** To make it clear: The workflow is not the problem. People try to merge the wrong branches because they forgot to checkout the correct branch before merging. It is not about "offenders" or pushing to the central repo. It's just people forgetting at which branch they are. The last "incident" was literally: > "I should commit and push real quick before I leave. > > git add .   >  git commit -am 'Feature Y'   >  git push origin > > Whoops, whats that. It tells me to merge branch origin/X first. OK whatevs. > > git merge origin/X > > Whoops, whats that now. Lots of merge conflicts. What have I done. I better > call somebody..." The user was working in branch Y and did not understand what the `git push origin` was saying. It told it that origin/X needed merging and that's what he did, because he wanted to "push real quick". In the case above branch X was one commit ahead of the local X, so pushing all branches yielded the "needs merging" error. I adjusted the "workflow" now to always push a branch explicitly, e.g. `git push origin Y` instead of just `git push origin`, but that's not curing the problem. It should (usually) not be allowed without a warning to merge origin/X with Y. For merging feature branches X and Y can be merged.


title: How should I choose the right documentation for my team?

text: I've asked this question a few days ago about how much documentation should be made and now I realize I may have been asking only half of the question. My goal is to promote some sort of documentation in order to increase continuous knowledge inside the team. My team is working mainly on server-side services which extends proprietary devices which are distributed locally (national not global) In addition we supply APIs and administration web apps to those services. **What would be the best types of documentation for my team?** **Should we focus on DFDs, sequence diagrams, class diagrams, just plain text... ?** **Are some documentation methodologies better for specific industries or are there some which are just a waste of time?** _I fear this last question would be put down as too subjective, but I do hope there are some standard answers for this question, similarly to when someone asks about good OOP techniques and gets directed to design patterns and SOLID principles._


title: Ubiquitous Language and Custom types

text: Note that my question is referring to those attributes that even on their own already represent a _concept_ ( ie on their own provide a _cohesive meaning_ ). Thus such attribute needs no additional functional support and as such is _self-contained_. I'm also well-aware that even with _self-contained_ attributes the _custom types_ may prove beneficial ( for example, they give the ability to add new behavior later, when business requirements change ). Thus, my question focuses only on whether _custom types_ for _self-contained_ attributes really enrich Ubiquitous Language **UL** a) I've read that in most cases, even simple, _self-contained_ attributes should have custom, more descriptive types rather than _basic value types_ ( _double, string_ ... ), because among other things, _descriptive types_ add to the **UL** , while the use of _basic types_ instead weakens the language. I understand the importance of **UL** , but how does having a _basic type_ for a _self-contained_ attribute weaken the language, since with _self-contained_ attributes the name of the attribute already adequately describes the _concept_ and thus contributes to the **UL** vocabulary? For example, the term `person_age` already adequately explains the concept of _quantifying the number of years a person has_ :               class Person     {            string person_age;     }      so what could we possibly gain by also introducing the term `ThingAge` to the **UL** :               class person     {           ThingAge person_age;      }      thanks


title: Entity Framework Joining Tables With Ranged Foreign Key Relationships

text: I'm not sure if "Ranged Foreign Key Relationship" is an actual term or if I just made it up, but this is what I am talking about: AgeGroup Table               int MinAge { get; set; }     int MaxAge { get; set; }     string Description { get; set; }      Customer Table               public int CustomerID { get; set; }     public string Name { get; set; }`     public int Age { get; set; }     public virtual AgeGroup AgeGroup { get; set; }      Given the above two tables, how can I join them using the (EntityFramework, DataAnnontations, DbContext) and be able to access `Customer.AgeGroup.Description`? Consider the following example data: AgeGroup               MinAge MaxAge Description     0      12     Youngin     13     19     Teenager     20     29     Twenties     30     39     Thirties     40     9999   Old      Customer               CustomerID Name        Age     345        Joe Smith   17     493        Cobaltikus  31     631        Jane Doe    29      How can I relate these? Cobaltikus has an Age of 31. There is no corresponding AgeGroup record with 31. The corresponding AgeGroup record is the one with MinAge = 30 and MaxAge = 39. I can do this easily in SQL, but how do you do it with EntityFramework?               SELECT       AgeGroup.Description          FROM       Customer,       AgeGroup          WHERE       Customer.CustomerID = 493       AND AgeGroup.MinAge <= Customer.Age       AND AgeGroup.MaxAge >= Customer.Age


title: Using XML field Vs. creating a table for unstable organization

text: I am in the middle of design an application to issue and store invoices for an organization. The problem is the organization is not stable at all. There are many types of invoices and they may increase and change. First, I tried to use tables in my DAL, one table to store invoices, one for invoice fields, and one for invoice field values. The problem was, this way needs Reflection to detect fields later, and this may slow the application when invoice contains plenty items. Second, I tried to keep core of invoice data as two tables: invoices and invoice items. Other fields are fully catchable from other tables. I mean, Business Layer should provide different results per invoice type. It should choose the right queries, and process the results according to the type of invoice. Two problems with this solution are:   1. I still have lots of join between other tables when I want to show an invoice, for per invoice item. I should recalculate everything every time for every invoice item.   2. What if the invoice items table doesn’t support a new type of invoice? Then I probably should add a new table to store that kind of invoices items.   3. My client asked me to keep all data related to an invoice, they do not want me to recalculate it every time. They want something like a snapshot of related data at the time invoice is creating. Now, what I’m think can I use the benefit of XML in table? I can save the invoice, with whatever fields as xml.   * I can save the different version of their invoices.   * On changes, I only update my Business.dll and no DAL change required.   * Linq to XML is not slow. What do you suggest?


title: How does the new google maps make buildings and cityscapes 3D?

text: Anyone who's seen the new Google maps has no doubt taken note of the incredible amount of three-dimensional detail in select American cities such as Boston, New York, Chicago, and San Francisco. They've even modeled the trees, bridges and some of the boats in the harbor! Minor architectural details are present. It's crazy. Looking at it up close, I've found there's a rectangular area around each of those cities, and anything within them is 3Dified, but it cuts off hard and fast at the edge, even if it's in the middle of a building. The edge of the rectangle is where the 3D stops. This leads me to think it's being done algorithmically (which would make sense, given the scale of the project, how many trees and buildings and details there are), and yet I can't imagine how that's possible. How could an algorithm model all these things without extensive data on their shapes and contours? How could it model the individual wires of a bridge, or the statues in a park? It _must_ be done by hand, and yet how could it be for so much detail! Does anyone have any insight on this?


title: Can I use MongoDB for a commercial web based service?

text: Can I use MongoDB as the database for providing a paid service? MongoDB is licensed under the AGPL, but the drivers I'm using are MIT licensed. Do I have to buy a commercial license for MongoDB or can I use it as a backend for my app?


I, perhaps, made a _wrong_ choice of going with a `Component-based Framework` like JSF for an internet facing, high traffic web application. Development with JSF has although been easier but what I fear now is whether JSF would allow me that scalability & performance with all it fundamental problems & issues. State saving in a high traffic web app, does that make sense at all!? How do I tune up my JSF app now to make it perform better under heavy load? I am already trying to reduce the state / component tree by reducing the no of components on page. What are other things I can tune up to make JSF app perform better ?


title: Are COM objects a form of IPC?

text: In Pro C# 2008 it is stated > Using constructs such as AppIDs, stubs, proxies, and the COM runtime > environment, programmers can avoid the need to work with raw sockets, RPC > calls, and other low-level details. It then demonstrates a VB6 call where a COM object is instantiated by passing in the AppId. Then, a method call is performed on said object. Does this mean COM allows IPC directly with objects? Is this secure? Why does .NET disallow this behavior?


title: Why is Twitto not secure?

text: I've come across Twitto, which basically is a web framework that fits in a tweet. It is so short that I can post the code here :               require __DIR__.'/c.php';     if (!is_callable($c = @$_GET['c'] ?: function() { echo 'Woah!'; }))       throw new Exception('Error');     $c();      It basically searches for a file named c.php and calls whatever function in that files that is the same name as `$_GET['c']`. On the project's website, there is a big red banner at the bottom of the page that reads : > » TWITTO IS NOT SECURE, DON'T USE IT FOR YOUR NEXT WEBSITE « I am no PHP guru, but to me it looks like if you take all the precautions you normally take with a standard PHP site (sanitizing user input, etc), it should be secure enough ? What is wrong with this tiny framework ? EDIT : I understand why this framework is not secure AS-IS, but with the proper bootstrapping and validation checks and everything inside the function you call, it should be just as secure as any other framework ?


title: Developing only for 64 bit servers a bad idea?

text: In an attempt to solve one problem I encountered another. I would like to have an easy and memorable way of creating unique error numbers, across projects and across developers. The scheme I came up with was to use the initials of the developer, find their position in the alphabet, and append the date and time. Example: lets say the developer Mark Elliot Zuckerberg (initials MEZ) writes code that throws an exception on Feb 8th 2014 at 12:54AM. The error code would be: 8526020820140054 This works brilliantly on 64 bit machines, but the resulting integer is too large for 32 bit computers. Does that make this a bad idea? How common are 32 bit servers, and do we expect them to slowly disappear completely?


title: Open Source Cloud Computing

text: Recently I realized that the most popular social platforms on the net are in the hand of just a few companies, Google, Twitter, Facebook, to name just a few. Taking into account the world changing power of these frameworks I am looking for a non-profit, democratic alternatives to these sites. (Mozilla is a non-profit project, however it could not thrive without the backing of Google.) In my imagination, the ideal approach (see explanation below) would be a distributed approach as used in file sharing programs or tools like seti@home. Every user willing to take part in the project would have to install software on his or her computer to act as a node in the network that would make up a social space similar to Google+, Facebook or Twitter but with a non-commercial approach. This approach could also be used for a "democratic" cloud to store data. Is anyone aware of projects that go in this direction? * * * I call it "ideal approach" for a couple of reasons. No need for big server farms or hardware maintaining costs. Invulnerability against most hack attack because it's distributed and there is no central node. Just some I could think of right now.


title: introducing pointers to a large software project

text: I have a fairly large software project written in `c++`. In there, there is a `class foo` which represents a structure (by which i don't mean the programmers struct) in which `foo`-objects can be part of a `foo`-object. Here's `class foo` in simplest form:               class Foo     {         private:             std::vector<unsigned int> indices;         public:             void addFooIndex(unsigned int);             unsigned int getFooIndex(unsigned int);     };      Every `foo`-object is currently stored in an object of `class bar`.               class Bar     {         private:             std::vector<Foo> foos;         public:             void addFoo(Foo);             std::vector<Foo> getFoos();     }      So if a `foo`-object should represent a structure with a "inner" foo-object, I currently do               Foo foo;     Foo innerFoo;     foo.addFooIndex(bar.getFoos().size() - 1);     bar.addFoo(innerFoo);      And to get it, I obviously use:               Foo foo;     for ( unsigned int i = 0; i < foo.getFooIndices().size(); ++i )     {         Foo inner_foo;         assert( foo.getFooIndices().at(i) < bar.getFoos().size() );         inner_foo = bar.getFoos().at(foo.getFooIndices().at(i));     }      So this is not a problem. It just works. But it's not the most elegant solution. I now want to make the inner `foo`s to be "more connected" with the `foo`-object. It would be obviously to change `class foo` to:               class Foo     {         private:             std::vector<Foo*> foo_pointers;         public:             void addFooPointer(Foo*);             std::vector<Foo*> getFooPointers();     };      So now, for my question: How to gently change this basic class without messing up the whole code? Is there a "clean way"?


title: How to structure unit testing of huge libraries?

text: I am writing unit tests for a library written in Qt/C++. The library is rather big, with lots of functionalities. I have a separate `unitTest` folder which I have my `UnitTest.cpp` in there. Having all test case / unit tests in the same file, makes it one very big `.cpp` file. I was wondering what is the best approach to unit test huge libraries. Should I have different `UnitTest.cpp` files in different folder? Like one for every class? or every name space?


title: Difference between daemon and child thread?

text: As per my knowledge daemon thread is a thread that runs in background(low priority thread) and also a child thread runs in the background when the parent thread runs foreground so where does the difference lie between a child and a daemon thread? It's in case of java and can you explain referring to other languages too.


title: Is abusing Application.UnhandledException for login redirection okay?

text: I'm programming a windows phone 7 app which needs authentication for news-like read access. I use Application.UnhandledException to handle (my) `AuthFailedException`, which can be thrown from any page, and navigate to a login page. To mimic a modal dialog, I do the following:   1. I attach a `BackKeyPress` event handler to clear the back stack, effectively causing the app to exit.    2. On login, I invoke the actual go-back behavior to get back to the previous page, which threw the `AuthFailedException` (all in the view model via proper dependency injection). This feels dirty, but at least a little better than what hacks might be neccessary otherwise... Any advice on how to improve the situation?


title: Choosing the language to build an app in based on hiring market vs performance and maintainability

text: I'm facing a choice of whether to start building Haskell components for a certain production app that is all done in Ruby. I'm leaning toward Haskell for several reasons, primarily speed (compiled Haskell is like 4-8x faster), greater transparency (via Haskell type system), and safer refactorability (type system). I've written a few open source and production programs in Haskell already and enjoy writing it very much. Feasibility is not an issue. I've played around with the Haskell Snap web framework and database libraries like PostgreSQL.Simple and am satisfied that rewriting a Rails app and various backend programs with Haskell is feasible. The real issue is hiring programmers when we need to scale the dev team, or eventually handing off the programming responsibilities altogether. It's a lot easier to find programmers in Ruby than in Haskell. On the other hand, the Haskell community seems to be growing, and it's not too hard to train programmers to modify parts of a Haskell program if you approach it as a DSL (much like Ruby on Rails). The Haskell type system also seems to promise much safer collaboration than dynamic Ruby does. In his essay "Beating the Averages" (http://www.paulgraham.com/avg.html), Paul Graham argues that using a superior language can be a decisive advantage. But when does it make sense to forgo using a superior language in order to make it easier to add programmers to your team?


title: Building a tool to fix compiler errors automagically

text: When a program doesn't compile, error messages are sometimes esoteric. Often a simple Google search leading to a site like stack exchange solves the problem. Now why can't we automate this? How about a Siri for coding? By Siri, I mean an intelligent personal assistant. Not talking about speech recognition here. I wonder if there is anybody out there (startups/ research labs) building a cool product like this. It will cut down debugging time drastically.


title: Do these specific tables need surrogate keys?

text: ## Background I have this tables               +-------------------------+  +------------------------+     |Airport                  |  |Country                 |     |-------------------------|  |------------------------|     |airport_code string (PK) |  |country_code string (PK)|     |address string           |  |name string             |     |name  string             |  +------------------------+     +-------------------------+          +-------------------------+     |Currency                 |     |-------------------------|     |currency_code string (PK)|     |name string              |     +-------------------------+      **airport_code** is the IATA (International Air Transport Association ) airport code, you can see them in your luggage tags when you travel by plane. ![enter image description here](http://i.stack.imgur.com/rPnue.png) **country_code** is the ISO 3166-1 A3 standard country code, you can see them in the olympics. ![enter image description here](http://i.stack.imgur.com/EpjiB.png) **currency_code** is the IS0 417 standard 3-chars currency code, you can see them in international currency exchange display boards. ![enter image description here](http://i.stack.imgur.com/YD3GW.png) ## Questions **Are these natural PKs good enough ?** **Is using world respected standards, which are accepted by whole industries good enough for PKs ?** **Do this tables need surrogates no matter what ?**


title: Is it possible to release something with proprietary dependencies under Apache2 licence?

text: If I write code with proprietary dependencies, can I release my own code under the Apache licence? An example of this would be a plugin for a proprietary framework.


title: Surviving MATLAB and R as a Hardcore Programmer

text: I love programming in languages that seem geared towards hardcore programmers. (My favorites are Python and D.) MATLAB is geared towards engineers and R is geared towards statisticians, and it seems like these languages were designed for people who aren't hardcore programmers and don't think like hardcore programmers. I always find them somewhat awkward to use, and to some extent I can't put my finger on why. Here are some issues I have managed to identify:   * (Both): The extreme emphasis on vectors and matrices to the extent that there are no true primitives.   * (Both): The difficulty of basic string manipulation.   * (Both): Lack of or awkwardness in support for basic data structures like hash tables and "real", i.e. type-parametric and nestable, arrays.   * (Both): They're really, really slow even by interpreted language standards, unless you bend over backwards to vectorize your code.   * (Both): They seem to not be designed to interact with the outside world. For example, both are fairly bulky programs that take a while to launch and seem to not be designed to make simple text filter programs easy to write. Furthermore, the lack of good string processing makes file I/O in anything but very standard forms near impossible.   * (Both): Object orientation seems to have a very bolted-on feel. Yes, you can do it, but it doesn't feel much more idiomatic than OO in C.   * (Both): No obvious, simple way to get a reference type. No pointers or class references. For example, I have no idea how you roll your own linked list in either of these languages.   * (MATLAB): You can't put multiple top level functions in a single file, encouraging very long functions and cut-and-paste coding.   * (MATLAB): Integers apparently don't exist as a first class type.   * (R): The basic builtin data structures seem way too high level and poorly documented, and never seem to do quite what I expect given my experience with similar but lower level data structures.   * (R): The documentation is spread all over the place and virtually impossible to browse or search. Even D, which is often knocked for bad documentation and is still fairly alpha-ish, is substantially better as far as I can tell.   * (R): At least as far as I'm aware, there's no good IDE for it. Again, even D, a fairly alpha-ish language with a small community, does better. In general, I also feel like MATLAB and R could be easily replaced by plain old libraries in more general-purpose languages, if sufficiently comprehensive libraries existed. This is especially true in newer general purpose languages that include lots of features for library writers. Why do R and MATLAB seem so weird to me? Are there any other major issues that you've noticed that may make these languages come off as strange to hardcore programmers? When their use is necessary, what are some good survival tips? Edit: I'm seeing one issue from some of the answers I've gotten. I have a strong personal preference, when I analyze data, to have **one** script that incorporates the whole pipeline. This implies that a general purpose language needs to be used. I hate having to write a script to "clean up" the data and spit it out, then another to read it back in a completely different environment, etc. I find the friction of using MATLAB/R for some of my work and a completely different language with a completely different address space and way of thinking for the rest to be a huge source of friction. Furthermore, I know there are glue layers that exist, but they always seem to be horribly complicated and a source of friction.


title: Can we technically un-blur images?

text: Since there is an algorithm to blur images, so that part of it cannot be recognised, can we reverse the algorithm and unblur part of than image? Is there a program that already does that, is that even possible, even in a near future?


title: Can I use the test suite from an open source project to verify that my own 'compatible library' is compatible?

text: The question Is it illegal to rewrite every line of an open source project in a slightly different way, and use it in a closed source project? makes me wonder what would be considered a _clean-room implementation_ in the era of open source projects. Hypothetically, if I were to develop a library which duplicates the _publicly documented_ interface of an open-source library, without ever looking at the source code for that library, could that code ever be considered a derivative work? Obviously it would need the same _class hierarchy_ and _method signatures_ , so that it could be a drop-in replacement - could that in itself, be enough to provoke a copyright claim? What about if I used the test suite of the open source project to verify whether my _clean_ implementation behaved in the same way as the original library? Would using the test suite be enough to _dirty_ my _clean_ code? As should be expected from a question like this, I am not looking for specific legal advice, but looking to document experiences people may have had with this sort of issue.


title: How do I comply to GPL in case of Appliance?

text: We are developing an enterprise network appliance which has got some GPL softwares like linux and apache and some others with APL license. But the core of the service is proprietary software and access is provided only via a web interface. My query is what all I need to do in order to comply with GPL license in this scenario. Would providing a list of Third party softwares used in the appliance in the web interface be sufficient?


I'm 10 months out of school and I lost my first programming job last week. I personally know a lot about different stuff - just look at my StackOverflow account, but I don't feel I have the professional experience necessary to ask more in salary. For example, I was told they were looking for a mid-level person at $75k/year. I told him I wasn't sure where I fell. He asked me where I could fall, so I said I was worth only $50k/year - which was close to my last salary. The guy told me I wasn't what they were looking for. How do I not undersell myself when looking for a job, while remaining honest?


title: Help/suggestions for Parallel assembly line scheduling (Dynamic programming)

text: I am working on a problem similar to the assembly line scheduling by dynamic programming.The issue is that unlike the classic problem where we have predefined stations now I only have information which task should run before which other(could be more than one) tasks. I have to find out which tasks to put on which line to minimize the total time taken by the production.So obviously if the tasks are on a single line then they are executing in serial fashion and hence are slower. So I have following issues   1. How do I create time based levels/lines as I don't have a sequence of all tasks? I only know which task comes before which(one or many) tasks. Time based levels are necessary as I have to minimize the time (which would happen when the tasks are executed in parallel).   2. How do I determine the optimal order of tasks to minimize time? As several tasks would be waiting for a single task, I have to minimize this time as well.   3. Like the original problem, communication between different lines would also have a cost. I have to determine whether this communication cost is worth moving the task to a separate line(from its communicating task) **tl;dr** : A parallel version of the assembly line scheduling (Dynamic programming) where all lines could be busy at the same time and I don't have any station numbering/ordering. I just know which tasks should be executed before which. I have to decide which tasks to put on the same line and which tasks to put on the different lines (given the communication time when tasks are on different lines) to minimize the production time.