title: What's a good length for Javadoc for a class that is say 800 lines long?

text: I'm doing a code-review on someone's code for class. The class is about 800 lines long, contains a good dozen of functions but the description is like 1 line long. I'm wondering, generally speaking, how long should the description of a class be? (in Java)?


title: Can MS Visio Class Diagrams be used to generate classes?

text: I'm fairly new to Visio, and was wondering if there's a way I could auto- generate the code from Visio diagrams. I was looking to generate either C# classes, SQL statements for building the database layer, or EntityFramework objects. I am using MS Visio Professional 2010


title: What is the most appropriate testing method in this scenario?

text: I'm writing some Objective-C apps (for OS X/iOS) and I'm currently implementing a service to be shared across them. The service is intended to be fairly self-contained. For the current functionality I'm envisioning there will be only one method that clients will call to do a fairly complicated series of steps both using private methods on the class, and passing data through a bunch of "data mangling classes" to arrive at an end result. The gist of the code is to fetch a log of changes, stored in a service- internal data store, that has occurred since a particular time, simplify the log to only include the last applicable change for each object, attach the serialized values for the affected objects and return this all to the client. My question then is, how do I unit-test this entry point method? Obviously, each class would have thorough unit tests to ensure that their functionality works as expected, but the entry point seems harder to "disconnect" from the rest of the world. I would rather not send in each of these internal classes IoC-style, because they're small and are only made classes to satisfy the single-responsibility principle. I see a couple possibilities:   1. Create a "private" interface header for the tests with methods that call the internal classes and test each of these methods separately. Then, to test the entry point, make a partial mock of the service class with these private methods mocked out and just test that the methods are called with the right arguments.   2. Write a series of fatter tests for the entry point without mocking out anything, testing the entire functionality in one go. This looks, to me, more like "integration testing" and seems brittle, but it does satisfy the "only test via the public interface" principle.   3. Write a factory that returns these internal services and take that in the initializer, then write a factory that returns mocked versions of them to use in tests. This has the downside of making the construction of the service annoying, and leaks internal details to the client.   4. Write a "private" initializer that take these services as extra parameters, use that to provide mocked services, and have the public initializer back-end to this one. This would ensure that the client code still sees the easy/pretty initializer and no internals are leaked. I'm sure there's more ways to solve this problem that I haven't thought of yet, but my question is: what's the _most appropriate_ approach according to unit testing best practices? Especially considering I would prefer to write this test-first, meaning I should preferably only create these services as the code indicates a need for them.


title: Using factory pattern when classes have little in common

text: I have used Factory pattern where I have multiple classes which does similar sort of work, but I don't want client to worry about class instantiating and return types. So Instantiate the necessary class dynamically depending on input and pass the values. These classes have similar methods but does slightly different work and these classes inherit the same common interface. Is this the correct way or can I improve it further?


title: In the Aggregate: How Will We Maintain Legacy Systems?

text: > NEW YORK - With a blast that made skyscrapers tremble, an 83-year-old steam > pipe sent a powerful message that the miles of tubes, wires and iron beneath > New York and other U.S. cities are getting older and could become > dangerously unstable. July 2007 Story About a Burst Steam Pipe in Manhattan * * * We've heard about software rot and technical debt. And we've heard from the likes of:   * "Uncle Bob" Martin - Who warned us about "the consequences of making a mess".   * Michael C. Feathers - Who gave us guidance for 'Working Effectively With Legacy Code'. So certainly the software engineering community is aware of these issues. * * * But I feel like our aggregate society does not appreciate how these issues can plague working systems and applications. As Steve McConnell notes: > ...Unlike financial debt, technical debt is much less visible, and so people > have an easier time ignoring it. If this is true, and I believe that it is, then I fear that governments and businesses may defer regular maintenance and fortification against hackers until it is too late. [Much like NYC and the steam pipes.] * * * My Question:   * Is there a way that we can avoid the software equivalent of NYC and the steam pipes?


title: Why do expressions print variable value using System.out.print?

text: Why does java print the value of the variable that is assigned it in the code below? I want understand what is happening here. My thought is that the expression inside println() method is evaluated first. For the first example, 5 is assigned to int x. At that point, does x become available for the println() method to print its value? This code confuses me. I wouldn't have thought expression like x=5 could return a value. Thank you. Examples:               int x;     System.out.println(x=5); //prints 5          boolean isValid;     System.out.println(isValid = true); //prints true          String fruit;     System.out.println(fruit="Orange"); //prints orange


title: Is it good design to require class users to use Rvalue reference

text: I have the following situation where I have a base class and multiple polymorphics derived classes:               #include <iostream>          class Base {         public:             virtual void foo() = 0;     };          class Derived1 : public Base {         public:             virtual void foo() { std::cout << "Derived1::foo()\n"; };     };          class Derived2 : public Base {         public:             virtual void foo() { std::cout << "Derived2::foo()\n"; };     };      I want to make sure that my class users will _always_ use the base class to use object of this hierachy. I got the idea to provide a factory methods returning the good object. From now, the methods look like this:               Base&& make_base(int i) {         if(i == 1)             return Derived1();         else             return Derived2();     }      The client can then use it that way:               int main() {         Base&& b = make_base(1);         b.foo();     }      Assuming C++03 compatibility is **not** needed, is this considered a good practice? PS: Sorry for my writing, I am not an english native person. # Edit AS _DeadMG_ point out, my initial make_base have undefined behaviour. If I can't require clients to only use Base class, I which I could recommand it. Is this kind of factory a better idea?               #include <type_traits>     #include <string>          template <class Derived>     Derived make_base() {         static_assert(             std::is_base_of<Base, Derived>::value,             "'Derived' must derived from 'Base'.");              // Default behaviour         return Derived();     }          template <>     Derived2 make_base<Derived2>() {         // Specialise behaviour         // Do something         return Derived2();     }          int main() {         auto b = make_base<std::string>(); // Error, 'Derived' must derived from 'Base'.         Base&& b1 = make_base<Derived1>(); // call make_base()         Base&& b2 = make_base<Derived2>(); // call make_base<Derived2>()         b1.foo();         b2.foo();     }


title: Is it necessary to read every single byte to check if a copied file is identical to the original?

text: I recently learned of a program called Total Commander. It's a Windows Explorer replacement and has its own stuff to copy files. To check whether the files are identical, instead of calculation a CRC, it literally checks every single byte, one at a time, on both the original and the copy. My question is: Is this necessary? Can CRC or any other such technique go wrong? Should you, as a programmer, try and implement this perfect but slow system, or is it too extreme?


title: How to decrease errors before testing?

text: During last year, several of the projects of the company where I work failed. We develop web software, that are not especially complicated (the most are CRUDS and search form about this data). One of the problems that management has identified is the test phase. Putting simple, our protocol is:   1. Analysis of the requeriments    2. Development   3. When construction is over, upload the executable to a server    4. Execute test plan    5. Repair the errors    6. Execute the test plan, to check if errors persist.    7. If all is ok -> Send to the client. The problem is that when we finish phase 3 and start phase 4, the number of errors is to damn high, that the execution plan takes to much time, and we get an interminable list of things that we have to repair. Until arrive to the test plan we are on time, but after this we spend more hours that were planned and then "fail" the project. We deliver with enought quality for the client but spend more hours repairing bugs. The management is looking for a solution, and is planned a meeting to ask us for ideas to improve the quality before the first test plan. Any idea?


title: Information protection when registering on web sites

text: Up until now it seems that when you register on a random web site you do so with blind trust. You assume that the site isn't harvesting information and passwords. You assume the site is reasonably secure. And you also assume that the information you've submitted isn't used in an undesireable way. More recently, it's become possible to connect up to a site with a Google+ or Facebook account. But that brings along another problem. Anyone that has access to the social account can access anything that's linked to it. So, has any thought gone into making something that's truly independant ? Something like an information locker a person could set up themselves. Do any relevant projects exist ?


title: gtkmm manage/add vs smart pointers:

text: gtkmm provides lifetime management of widgets using               Gtk::Widget* aWidget = Gtk::manage(new Widget());           Gtk::Widget.add(*aWidget);      This delegates lifetime management of aWidget to its container widget. We also have several types of smart pointers, particular the C++ 11 smart pointers templates, which I use everywhere. I find the manage/add syntax easier and cleaner to use, but it's not part of the C++ Standard, it's a gtkmm specific feature, which makes me think I should stick to std::shared_ptr, etc. So I'm wondering what are the advantages/disadvantages of smart pointers vs the gtkmm manage/add model (aside from cases where you need the reference after the owner container has been deleted, or when you have a top level widget that has no containing widget).


title: Should a newcomer to Perl learn both Perl 5 and 6?

text: I have started playing around with Perl 5 lately, and it seems very interesting. I would like to spend some time learning it more in depth when I can. My question, since Perl 6 is slowly taking place (I believe...) and is said to break backward compatibility, is this: am I better learning Perl 5 and then Perl 6, or is learning Perl 6 directly a better time investment according to you? If the changes from Perl 5 to 6 are making it hard to understand Perl 5, I should certainly start with Perl 5 to be able to read "old" scripts, then check Perl 6. There is also the "Perl 6 is not yet completely released" problem. I know there's an early adopter implementation for Perl 6, but if Perl 6 isn't officially released before some more years, I'll stick to 5 for now. I would certainly like some insight on this. Feel free to discuss related stuff. My interest in scripting languages is fairly new. Thanks!


title: What qualifies "too many database requests" in code?

text: This is a discussion myself and some of my colleagues are having and thought I'd come out here and see what if there's a general consensus on it. It basically comes down to the following 2 opinions on database calls: 1\. Make one large call to get everything that may be needed to reduce database the number of DB calls 2\. Make smaller separate calls based on what is requested to reduce the size of DB calls Where this is especially coming into play is in common code. We'll use the example of an Employee class as that's fairly straight forward. Let's say that your Employee class has 10 value attributes (first name, last name, hiredate, etc.) and then 2 class attributes ... 1 pointing to a Department class and then 1 supervisor that points back to another Employee object. In mindset #1, you'd make one call that returns the Employee data as well as the fields needed to populate the Department and Supervisor attributes ... or at least the fields that most often used from those sub objects. In mindset #2, you'd only populate the Employee object at first and then only populate the Department and Supervisor objects if and when they are actually requested. 2's stance is pretty straight-forward ... minimize the size of the requests and how many database objects need to be hit each time one of those requests is made. #1's stance is that even if it could be implemented properly, the sheer fact that the code would have to make multiple connections is going to cause more strain on the connection between the webserver and the database as opposed to reducing it. The driving force behind researching this is that the amount of traffic between our webserver and database server is getting out of control.


title: What are the Pros and Cons of the GPL?

text: I'm looking at licensing some open source software and am looking at the GPL. What are the pros and cons of using this license?


title: Unique ID algorithm

text: I've got a route that contains objects. Each one has value 0 or 1. I need unique route ID which will identify any objects order. Currently I'm doing it using binary number that is converted to decimal (see picture). ![Objects](http://i.stack.imgur.com/Rvbom.png) The problem is, that amount of objects in route is up to 15. So, decimal number will be very big (up to 32767) with many values, that will never be used.   How to convert that number, to another unique value, but much smaller (<255)? I need to do that, only by using simple arithmetical operators (+,-,*,div).


title: The dreaded C# programming interview test - any advice?

text: I have a possible C# dev job lined up but before I can interview, I need to pass a test with the employment agency. Now even though I am a senior developer with over 10 years of programming experience and more than 3 of these years with c#, I am really not looking forward to this test and I think there is a good chance I will fail it. In my experience these tests are unpredictable asking you stuff you seldom use in everyday work situations. I need your best advice on what I should be revising on - a good book or website for example. I have less than 1 week to prepare and it is essential I pass this. Thanks in advance. EDIT: To further justify my concerns of writing such tests - Consider the following question: 12) An Event is :                  a) The result of a users action - correct answer        b) The esult of a party        c) code to force users action      The correct answer according to the test is A, but since I've been doing SOA development (often when events can be based on system events (not user actions) I'm 100% sure an event doesn't have to be driven by a user action. This was also a C# question (not an ASP.net question). Based on my understanding, I couldn't really spot a correct answer but B seems the best of the lot (if the definition of party is : any entity that can trigger an event. These kind of questions scare me.


title: Research on common problems that people have when learning programming?

text: Is there any research into the most common mistakes or conceptual errors that people with no previous exposure to computer programming make when attempting to learn or being taught programming? This question may be a dup, but in order to help reduce that possibility:   * This question is not about people who can't learn to program or find it too difficult, but about problems or mistakes that even the ones who do learn, and perhaps even find easy, are more likely to have or make at first.   * This question is not about errors that programmers who already know how to program make, only about clean slate beginners.   * It is not about teaching or how to teach, it is about what, even after "proper teaching", some percentage of a introductory class's students might, at first, still think or do in (perhaps even surprising to the teacher) contravention to the teaching material. This question is also not about programming style or patterns, but about the type of mental errors in beginners that prevent any code solution, even if not using the current thought in best practices.


title: Efficiently storing and parsing client's browser details

text: Do there exist browser fingerprinting API's that instead of running browser information (e.g. the user agent, installed plugins, screen resolution, system fonts etc.) through a hash function, instead encode the information with a lossless data compression algorithm to produce a string that can later be decompressed to receive the original information? I've been looking for an efficient way to compress all the system fonts, plugins, etc. from a given browser into a small string so that it's easier for me to store them and then read back particular strings when I need to in there original format, but I haven't been able to find anything that even partially does this.


title: What's the difference between the insert methods and why one is faster

text: I have insert 14.485 lines on MySQL like this:               INSERT INTO `bairros` (`id`,`cidade_id`,`descricao`) VALUES (1,8891,'VILA PELICIARI');     INSERT INTO `bairros` (`id`,`cidade_id`,`descricao`) VALUES (2,8891,'VILA MARIANA');     ...      It took around 5 minutes. I had to insert in another table 16.021 lines, same database, so for test I did this:               INSERT INTO `bairros` (`id`,`cidade_id`,`descricao`) VALUES (1,8891,'VILA PELICIARI'),(2,8891,'VILA MARIANA');     ...      It took just a few seconds. What is the difference, for the database, between the scripts? And why one is faster than the other?


title: How does production server and staging Server actually work in production

text: I have one Linux VPS server for my company and we develop PHP sites. What i normally do is just make the subdomain of main site like test1.mainsite.com and work on that till it finishes. and then chnage the domain name. I have heard that big companies have the staging server and production server. I just want to know how that system works and when site is complete how do they transfer the site via FTP , SSH , RSYNC , what they do with old staging server. I jsut want to implement the enterprise strategies in my company and want to know how to proceed Thanks


title: How would one handle external dependencies in an open-source project?

text: When one writes an open-source project and uses Google Code or GitHub, and wants to use a library like Lua, how should one do this?   * Should the dependency be included in the repository?   * Should the dependency be built from within the same build script as the rest of the project, or from a separate build script? Given that the library doesn't need installation before compilation.


title: Should an integration test be used in place of a unit test involving personal data?

text: I am trying to develop a series of unit tests for a production system that are dependent on a person's social security number. While I am more than comfortable hard coding a clearly bad social security number to test for failure, I'm uneasy about including one that is good for proper (and passing) results. The following is a simplified test that I'm using:               [TestMethod]         public void API_Hours_Get()         {             var controller = new HoursController();             var employee = new EmployeeController();             var badResult = controller.Get(123124569);             var goodResult = controller.Get(employee.GetEmployeeByUserId("Username").First().SSNumber);             Assert.IsFalse(badResult.Any());             Assert.IsTrue(goodResult.Any());         }      This test passes just fine and gives me the results I want. But, from my understanding, it is an integration test. From a best practices perspective, is this substitute okay for my test suite and just ignore the fact that I don't have a 'pure' unit test for the SSN-dependent modules or is there a better approach for situations like this?


title: Naming of related classes and interfaces

text: I have created an `ObjectParser` class which parses data into strongly typed objects using an `IObjectParserDataSource` as the data source (the data could be an Excel file, text file, array, query string, etc). Examples of my implementations of `IObjectParserDataSource` are:   * `TextFileObjectParserDataSource`   * `ExcelFileObjectParserDataSource` These class names feel really long and convoluted to me. I could name them:   * `TextFileDataSource`   * `ExcelFileDataSource` But this introduces a level of ambiguity and they don't became as clearly related to `IObjectParserDataSource` at first glance. This becomes important because defining these data sources will happen in client code and I wish to minimize potential confusion and uncertainty. **How would you name these classes in such a scenario?**


title: Notepad++ For Normal Text and Syntax Highlight?

text: I want to use Notepadd++ for taking notes on python programming language. I want to write some normal sentences and also write codes on same page simultaneously. I don't want to show line numbers for the normal texts but I want to show line numbers for programming codes. Is this possible? I mean normal lines should be without syntax highlighting and line numbers which usually show on left hand side of each line. And syntax highlighting for the codes written in the same file? For example... To print strings in Python we should use single or double quotations after print keyword. For example... 1 print "Hello World!" (this line should be with line number and syntax highlighting)


title: Should I refactor single letter variables for constructs like pointer/structure names?

text: And No, i am not referring to single variables in loops or exceptions. Lets say pointer/struct names in large c ,c++ programs . Are there any languages where this type of naming is acceptable or is the norm. Or any constructs in c/c++ ( not iterators,loops) where it is implicit. what is the general practice in handling such naming conventions ? would you change it? if so how would you change it? If you are a team-project lead and some one raises an issue with regards to the naming convention how would you view it?


title: Compiling OpenGL Assembly Language (ARB) assembly code

text: I have two questions to ask.   1. If I want to code in ARB, what are the prerequisites I need to write the code?   2. I have been using OpenGL and DirectX lately. I want to compile and run the ARB code. What compiler should I use to compile and run the code?


title: How to create a use case diagram for board game played on PC

text: I'm struggling with a task as I was given to practice UML and use cases. The problem is that I should model computer version of a board game so I am unsure about a few things. obviously it does not matter if you play against the PC or another player, the actions are the same. The game is simply like tic tac toe. E.g. > Actor Player ---(Place a diamond)-----include---->(Check for a > row)---include-->(Swap players) But the game is played on the PC, so is Check for row really a use case? And the same with Swap players? Because the system would do that. On the other hand, if it was not, how could I continue?


title: Is it good practice to put bug analysis and fix code in bug report?

text: When I fix a bug I mention briefly what was the issue and in which revision its fixed. But this way nobody would know how much tricky the issue was and how much effort went in analysis and findings. What is the best practice for a developer to show such things to higher management to get noticed?


title: What are hooks?

text: I keep coming across this term hooks in various programming articles. However I don't understand what they are, and how can they be used. So I just wanted to know what is the concept of hooks; if someone could link me to some examples, particularly in the context of web development, it would be great.


title: What would you do to improve the working of a small Development team?

text: My company is having a reshuffle and I'm applying for my boss' job as he's moved up the ladder. The new role would give me a chance to move our development team into the 21st century and I'd like to make sure that:   1. I can provide sensible suggestions in the interview to get the job so I can fix the team   2. If I get the job I can actually enact some changes to actually improve the lives of the developers and their output. I want to know what I can suggest to improve the way we work, because I think it's a mess but every time I've suggested a change it's been shot down because any time spend implementing the change would be time that isn't spent developing software. Here is the state of play at the moment:   * My team consists of 3-4 developers (Mainly Java but I do some .Net work)   * Each member of the team is usually works on 2-3 projects at a time   * We are each responsible for the entire life cycle of the project from design to testing.   * Usually only one person works on a project (Although we have the odd project that will have more than one person working on it.)   * Projects tend to be bespoke to single customer, or are really heavilly reliant on a particular customer environment.   * We have 2-3 "Products" which we evolve to meet customer requirements.   * We use SVN for source control   * We don't do continuous integration (I'd like to start)   * We use a really basic bug tracker for internal issue tracking (I'd like to move to an issue/task management system) Any changes that bring a sudden dip in revenue generation will probably be rejected, the company isn't structured for development most of the rest of the technical team's jobs can be broken down to install this piece of hardware, configure that piece of hardware and once a job is done it's done and you never have to look at it again. This mentality has crept into development team because it's part of the company culture.


title: Private Wiki vs Google Doc to share specifications for a team?

text: My team is debating whether to put the specifications on a private wiki or in a google document. Can someone provide me with a summarized list of pros/cons for using a private wiki vs google docs for team specifications? My gut feeling is the google-docs is heavier and slower to use, but easier, while private wikis, like mediawiki, seem to be harder to set-up and run.


title: Is TOS Necessary?

text: Let us say that someone is hosting a web application where others can come and register and use for free(like stackoverflow or stackexchange). Is a terms of service agreement necessary? Like this TOS for stackexchange ? If there is no TOS agreement, are there any implied(default) legal conditions?


title: How do I convert a list of Requirements into Constraints?

text: I am trying to prepare my first software design document. I am self-taught and have no formal training in CS. Having done a wee bit of reading up on it beforehand, I have created a list of Requirements, Qualities and Non-Qualities for the system, which provide an overview from a managerial viewpoint on what the project is tasked with providing. The intent was for these to be convertible into design Constraints, which in turn would guide justifiable design decisions. So far they do not get into many specifics of what resources are to be provided, but are general in that they should apply to all resources present in the system. I am having difficulty, however, in proceeding to the next step. What exactly is a Design Constraint supposed to look like? How specific or general should it be? How do I convert domain Requirements into Constraints? Have I already gone nuts and over-specified things? :-) **Background**   I am the only programmer at a small service company. We have a current HTML with PHP PIs application which grew organically and has no test infrastructure. Editing one bit has repercussions and unintended consequences in far flung parts of the app. I want to replace it with a more professionally designed (in fact, any kind of designed) one, object-based with a test suite. Management doesn't know about programming and I need to know which of the current features are cruft, which workflows are bogged down, etc. This is intended to be my guidance both during a perpetually postponed design meeting and during implementation. * * * So far, I have the following: **Terminology**   * "Owner" refers to a company or division running their own deployment of the Software, with data independent of any other deployments.   * "Developer" means an individual who is either a programmer with write access to the source code, or a database admin working for an Owner.   * "User" means an individual who has authenticated access to a deployment.   * "Staff" means a User who works for an Owner.   * "Client" refers to a User who is a customer of an Owner. **REQUIREMENTS**   What features _must_ the service exhibit?   * **Platforms** : Access to the service must be available via a variety of recent-to-modern, general business computing devices. (i.e. desktop, laptop, tablet and smartphones as of 2013).   * **Mobility** : Reasonable efforts at providing access to the service for all Users must be made, regardless of their physical location.   * **Secure** : All data must require authentication and authorization to access, and non-safe requests must come with sufficient confirmation that they were initiated by user intent.   * **Access Controls** : Resources and sets of resources must have variable authorization permissions.   * **Admin Powers** : Read and write authorization to individual resources and sets of resources must be seperate.   * **Unbreakable** : The system must not be able to be put into a "broken" state by Users.   * **No Clobber** : A User should not be allowed to overwrite another user's changes unknowingly.   * **Off-line** : A User's scheduled events for the current day must be readable off-line.   * **Rapid Bootstrap** : New Staff must be able to get up to speed on the internal side of the system quickly.   * **Owner Agnostic** : Nothing specific to one Owner should be present in a new, clean deployment for another Owner.   * **Brandable** : An Owner must be able to configure the system to exhibit their branding and corporate specifics.   * **Safe Data** : A frequent and reliable back-up of all data must be easily scheduled. **QUALITIES**   What other features would we _like_ the end product to exhibit?   * Fast developer turn-around for bug fixes.   * Fast prototyping for new features.   * Error-free implementation of new features.   * Regression-free changes.   * Attractive Client UI.   * Efficient Staff UI.   * Widest device and OS support reasonably achievable.   * All accountability/blame data (who did what, when?) should be involatile.   * All other data should be editable by a user with sufficient authorization, without needing a Developer.   * Data back-ups should be creatable on demand by a sufficiently authorized user.   * Data back-ups should be restorable on demand by a sufficiently authorized user. **NON-QUALITIES**   What features are _not important_ and will allow flexibility of design?   * Programming language choice   * UI monolingualism   * We do not need a generic resource import or export system.   * [this list is incomplete]


title: How can I salvage my internship?

text: I'm currently working as an intern at a very large, non-software development company. The position I applied for wasn't specifically a development position, but the team that hired me wanted a CS major to help try to develop some internal projects for them. I've been here for four weeks and the initial bewilderment is starting to wear off. However, I'm the only CS major in the entire office -- no one on my team, in the building, or even in the neighboring locations has any background in software development. The best I've got is a database manager, and their department is too busy to support me with my projects. My teammates are helping me learn how they do their jobs (which is important for me to do my job), but there's no one to help my do _my_ job i.e. development. The projects they've given me are larger in scope than anything I've done in school. That, combined with the fact that I'm working alone, trying to develop applications from scratch with no form of guidance or even clearly defined goals, has me very worried about my ability to be successful. I barely know where I should be begin, and now I have probably less than two months remaining. I feel like I should be learning the software development process, but right now it's like I'm feeling my way through the dark. This is especially troubling for me since I'm not very confident with my development skills in the first place. I've been researching and teaching myself, but I'm only getting bits and pieces. They have high expectations from me, but I'm unsure of my ability to deliver. Obviously, I need to sit down and talk with my managers about the position I'm in and I intend to do that as soon as possible (they're often travelling and out of the office). How should I deal with this? This internship will be over before I know it, and I don't want to leave with nothing to show for my time here. They don't want that either, and they're always available to help me but without knowledge of programming there's only so much they can do. I'm afraid to tell them that I'm incapable of producing what they want. How should I relate this to them? I see the engineering interns getting help from other engineers, learning how to do their jobs, and I feel like I'm just sitting here biding my time. Any advice on how to rectify my situation would be greatly appreciated. **Update** I appreciate all the helpful feedback from everyone, it's helped put my mind at ease. The first thing I did was meet with my managers and supervisors. We discussed what was expected from my time here. They understand that I don't have that much time as an intern, and this helped put a scope on the type of framework we want to accomplish, which will allow future interns or employees to hopefully build off of what I leave. I also addressed my concerns regarding my capabilities with the allotted time, which they understood and expected. I received a call from the database administrator at another location - my manager talked with his supervisor and they're going to support my project, which will now give me a resource to use so I'm not sitting around with no idea what I'm doing. That's only one half though. Out of all the possible projects, we narrowed it down to the two most important to work on. As for my other project, as someone mentioned I'm essentially the lead software architect which is a unique situation for an intern. If things go at least semi-successfully, I think I'll have gained a good deal of knowledge and experience that can help me with future employers. For now, I think I have some solid footing to start researching and developing my projects. Thanks again for the responses from everyone!


title: How do certain iPhone apps allow purchases without IAP?

text: According to section 11.2 of the App Store Review Guidelines,               Apps utilizing a system other than the In App Purchase API (IAP)      to purchase content, functionality, or services in an app will be rejected.      Various apps like JetSetter, Gilt, and Kayak include in-app purchasing flows that either collect credit card information directly, or use a UIWebView to direct the user to a third-party website to purchase goods and services. What provision allows apps to do this, and what are the limitations to purchasing physical goods and services in an iPhone app without using IAP?


title: How dependent on Rich Hickey is Clojure?

text: I was just asked this question by my company who is investing in a Clojure application and I did not have a good answer? Can anyone, in all seriousness tell me what would happen to Clojure if Rich left the project?


title: In need of a divide and conquer approach for re-writing small open-source utilities

text: Preamble (Skip if you don't like to read) I've been learning C/C++ in school for a year now and all the assignments in the book, after reading through the chapters, were not too difficult to implement. Some examples of programs I've written are abstract data types like binary trees, queues, stacks, lists, and other types of programs were palindrome searching, encrypting and decrypting files, and other similar first-year type programs. As stated, after reading the chapters, I was easily able to implement and understand the algorithms used to solve many of the problems. So I feel comfortable with the syntax and logic of these small manageable problems. Background (You can skip this part) In preparation for my transfer to UCSD in the fall, I installed Linux on my machine and switched to using Vi -- definitely a change from Visual Studio. To keep my mind sharp and venture into real-world programs, I decided to download the source for a famous Linux console utility called Wget (http://www.gnu.org/software/wget/), with the intentions of re-writing the program as a C++ object-oriented version. The challenge I am facing is the program, while being a simple single-purpose utility, is still quite enormous when staring at the code. ...The Question (You CAN'T skip this part) How does one begin to look at a program they didn't write and study it in order to try to re-write it, change it, etc? I guess I'm looking for advice/guidance on a divide and conquer type approach to studying a program written by other people in order to try to re-write it. I understand massive programs like OpenOffice, the Linux kernel, Gnome, etc. don't fall into this "I'm going to re-write them" sort of thinking. But small utilities I would imagine do. Thanks for reading, I hope I asked a thoughtful question and I hope it sparks some useful answers which can be found helpful to others as well.


title: An event that raises itself - is it too complicated?

text: I have a little problem. I'm writing a resource loading and caching system, in which user can request a resource, and set a callback to be called when resource is loaded (and/or wait for load to finish). This leads to code like this:               var waitobj=Loader.RequestObject("foo");     waitobj.LoadFinished+=delegate{ Bar(); };      However, since resources are cached, the call to `RequestObject` may actually complete synchronously. This means that when callback is set, request is already finished, and callback is never called. I thought up a clever trick: let's just check the state of request in the event adder itself!               public event LoadFinishedHandler LoadFinished {         add {             if(Finished)                 value();             else                 m_LoadFinished+=value;         }     }      This will call the callback function no matter what.. but my coworkers said that this method is too complicated and no one will be able to maintain this code. I like this trick anyway, but I'm obviously biased. What do you think, is this trick too clever for its own good?


title: Are proofs worth the effort?

text: I bought the de-facto book for learning about data structures and algorithms (CLRS). The book is though quite good but the singularity is in the proofs. The book is filled with Lemmas, theorems, peculiar symbols and unimaginable recurrence relations which are very hard to understand. I am able to somehow get the algorithms but the discrete mathematics just not for me. So should I leave them out and just concentrate on algorithims?


title: Is routing a site with RESTful not the best when you have very long URLs?

text: I've read a lot about RESTful, but I have always had a hard time figuring out how I'd use it with a very long query string. This is an in-house project, and it won't always have a simple /someAction or someController/12/14/my-article- I-want-indexed. I'm not worried about SEO because the application is not on the Internet. My querystrings are long sets of ?somevar=123456&x=4785&y=394958....... Most examples for REST I have seen are for SEO and simple web apps like a blog, maybe a CMS. Is REST not the best practice for a situation where having long URLs with lots of variables in the querystring is the norm? Here is an example of what looks to me like a non-RESTful way: http://www.target.com/s?searchTerm=bicycle&category=0%7CAll%7Cmatchallpartial%7Call+categories&lnk=snav_sbox_bicycle Is this link an illustration bad practice and design? It's not a super long URL, but it illustrates that not everyone uses REST, if I understand REST. I know the reasons for REST, pretty URLs, hackable URLs, etc. I'd like to design my application well but feel like it would be shoehorned into a pattern I don't need. What is the best practice here?


title: Types of ER Diagrams

text: I'm currently taking a class for database design, and we're using the ER diagram style designed by Peter Chen. I have a couple of problems with this style:   * Keys in relationships don't seem realistic. In practice, synthetic keys like "orderid" seem to be used in almost all tables, including association tables, but the Chen style diagrams heavily favor (table1key, table2key) compound keys.   * There is no notation for datatype.   * The diamond shape for associations is horrible, and produces a cluttered diagram. In general, it just seems hard to capture some relationships with the Chen system. What ERD style, if any, do you use? What has been the most popular in your workplaces? What tools have you used, or do you use, to create these diagrams?


title: Does this factory method pattern example violate open-close?

text: In Head-First Design Patterns, they use a pizza shop example to demonstrate the factory method pattern.               public abstract class PizzaStore {       public Pizza orderPizza(String type) {         Pizza pizza;              pizza = createPizza(type);              pizza.prepare();         pizza.bake();         pizza.cut();         pizza.box();              return pizza;       }            abstract Pizza createPizza(String type)     }          public class NYPizzaStore extends PizzaStore {       Pizza createPizza(String item) {         if (item.equals("cheese") {             return new NYStyleCheesePizza();         } else if (item.equals("veggie")) {             return new NYStyleVeggiePizza();         } else if (item.equals("clam")) {             return new NYStyleClamPizza();         } else if (item.equals("pepperoni")) {             return new NYStylePepperioniPizza();         } else return null;       }     }      I don't understand how this pattern is not violating open-close. What if we require a beef Pizza, then we must edit the if statement in the NYPizzaStore class.


title: c#/java or c++ (Personal question)

text: First of all this is not a comparison between the languages. So I've asked a question before telling that I am a beginner programmer (hardest thing done is a chat server/client when I was reading about threads, and I've used twitter api, which is somehow very easy.). My goal is to become a better programmer and understand more things since I'm only 14 years old. I read that learning c++ will make me understand more things in programming, and help me in future becoming a better programmer but, I think, at the moment, that I'm improving in c#, creating more programs and enjoying... do you think I should continue and become better in c# and java and forget learning c++ till I go to the university and I will be forced to learn c++? Personally I think I'm wasting time in c++ focusing more on theoretical things rather than programming itself.


title: JS Framework for server-heavy and/or client-light pages

text:
I've been reading articles such as this one that indicates web development has evolved to use JS frameworks. Where I work, we have a massive website with many existing web applications that are already established and are server side heavy. One article I read said that the DOM manipulation/jQuery method leads to unmaintanable spaghetti code, and that you should strive to use a JS MV* framework. However, sometimes I just have a fairly simple list of items generated from the server; something like:
show

one

     //js     $(".shower").on("click", function () {         $(".hider[data-id=" + $(this).data("id") + "]").show();     });      ...and that would pretty much be the extend of the JS on that page. According to the MV* framework disciples, the need to reference specific classes or attributes in the JS is a problem and models should be used instead. However, it seems like overkill to include a massive library for creating rich applications to handle some fairly trivial DOM manipulation and animations. Is there a JS framework in existence that bridges the gap between complete front-end stack frameworks and tightly coupled HTML/JS? If not, how could I write such code to avoid this coupling? Additionally is there any reason to push strongly for making the switch to such a framework for established server-heavy applications (especially in cases where we have to support JavaScript being turned off)?


title: Is a popular site like www.google.com served up by one computer?

text: In basic networking, we talk about DNS servers, that they resolve human readable addresses (www.google.com) into an actual IP address. As far as I understand, at least using the basics, an IP address refers to a single device (say a router). Surely, www.google.com cannot be served up by one computer? How is www.google.com distributed across multiple servers?


title: Is it wrong to have HTML strings within PHP objects, or is it only wrong in controllers?

text:
I've always thought that in typical MVC design it is bad practice to build & concatenate HTML strings in any PHP file or class that isn't strictly a template. I'm working on a large project with strict guidelines in place, and while it is forbidden to put any HTML code in the PHP _controller_ , it is fair game to have PHP sub-objects that might generate lots of HTML code strings which then get passed into the template. These "sub-objects" contain additional logic that could change the HTML depending on conditions. **Thus my 2 main questions are:**   1. Is this considered MVC?    2. Are these objects considered part of the View, or are they a frankenstein of the Model and the View? **Example:**               <?php     /* controller.php */     class KittenController {              protected $view = 'view.html';              public function render (Request $request) {             $data = $this->getDynamicData(); // get some data             $object = $this->getObject();  // get a PHP object             $this->setField('foo', $data['bar']);             $this->setField('baz', $object->render());         }     }                    <?php     /* object.php */          class Object {         public function render () {             $html = '';             $html .= '
';             if ($this->hasDuck()) {                 $html .= '
I have a duck...
';             }             else {                 $html .= '
No duck here...
';             }             $html .= '
';                  return $html;         }     }
         [[foo]]
              [[baz]]


title: What is the best way of storing centralised data for (and from) translation?

text: We are starting the process of internationalizing our software. To do this we will be writing a series of filters to convert all of our different resource files (resx, text, java resource, etc) into a common format. We will then be outputting xliff files for translation. After translation the process will run in reverse. We would like to keep the central store updated with any changes that developers make to the resource files ideally using ant during the build process, maintaining knowledge of which branch or version of the software is using which resources. We'd also like to keep track of which version of software the resources were taken from which are sent for translation, the dates when the files were sent and received back and also who translated them. The idea then being we apply the translations to the correct branch, we can take diffs of the central store in future to send partial resources for translations and we can report on quantity of translation at a point in time. We are considering storing all of this data within the svn repository as a tree of xliffs, perhaps branched in a mirror of the main code repository. Is this sufficient or would we be better off just using a database to maintain this information?


title: Checking at javascript level vs checking in PHP?

text: Setup: We've got a form with default text values present within the text box itself which "goes away" when I click on them and enter a value (not if I dont enter a value). Currently the 'default' value or the user inputted value gets POSTed to the PHP script. Should I have the javascript code check if the value being submitted is the default one and set it to "" (blank string) OR should I perform this check in PHP where I'll have to do a check if its "" OR if its to the default value. Which is more efficient, having javascript clean up the data before sending it to PHP, or having PHP do the check itself? One reason to keep it within PHP (though not a consideration for us at the moment) is so that we can display the default text labels in multiple languages, and check if the user has left them blank. That would be easier in PHP, I imagine?


title: How should I evaluate the Database Solution for Large Data Application

text: **_Background_**   I have been tasked to write an application that will be a combination of document and inventory management in VB.net which will be used to store document images in TIFF, PDF, XPS, TXT, DOC, PPT and so on as binary data that can be retrieved for viewing, printing, and possible OCR to be searchable as well along with meta data such as sender, recipient, type of document, date, source, etc. So the table would probably be something like: DOC_NAME, DOC_DATE, NOTES, ... DOC_BINARY (where the actual document will be put inside) **_Help Please_**   I need help with understanding how to evaluate my database options. What my concern is finding a database solution that will not become unstable due to size restrictions, records limitations and performance. Some of the options are MS_SQL, SQL Express, SQLite, mySQL, and Access. Now I can pretty much eliminate Access right off the bat as it is just too limiting and not scalable. I can further eliminate SQL Express because of the 2 GB limit and again scalability. So I believe that leaves me with MS_SQL, SQLite and mySQL (note, I am open to alternatives). And this is where I need help in understanding how to evaluate those databases. The goal is that the data is all in one place (a single file) that will make backup and portability easier. For small volume usage, pretty much any solution will hold for a while, but my goal is to think ahead and make sure its able to withstand heavy large volume usage as well. Another consideration is also the interoperability with .NET and stability of such code to avoid errors and memory leaks. How should I evaluate my database options for this scenario?


title: Subclassing to avoid line length

text: The standard line length of code is 80 characters per line. This is accepted and followed by the most of programmers. I working on a state machine of a character and is necessary for me follow this too. I have four classes who pass this limit. I can subclass each class in two more and then avoid the line length limit.               class Stand          class Walk          class Punch          class Crouch      The new classes would be _StandLeft_ , _StandRight_ and so on. _Stand_ , _Walk_ , _Punch_ and _Crouch_ would be then abstract classes. The question if there is a limit for the long of the hierarchies tree or this is depends of the case.


title: Common for programmer to be asked to maintain code in a different language?

text: I was hired ~1 year ago to write Java code (actually, to re-write a legacy codebase - I suspect the company would be happy no matter what language I was writing it in). Just yesterday I was tasked with fixing bugs in a VB6 program - I have never used Visual Basic before. My question is, is it common for a programmer to be asked to maintain/debug/fix code in a language completely unknown to him on the drop of a hat? I should clarify, I have no problem doing so, I'm simply wondering if this is a common experience for corporate programmers.


title: How bad is it to have two methods with the same name but different signatures in two classes?

text: I have a design problem related to a public interface, the names of methods, and the understanding of my API and code. I have two classes like this:               class A:         ...         function collision(self):             ....          ...          class B:         ....         function _collision(self, another_object, l, r, t, b):             ....      The first class has one public method named _collision_ , and the second has one private method called _ _collision_. The two methods differs in argument type and number. As an example let's say that _ _collision_ checks if the object is colliding with another object with certain conditions _l_ , _r_ , _t_ , _b_ (collide on the left side, right side, etc) and returns _true_ or _false_. The public _collision_ method, on the other hand, resolves all the collisions of the object with other objects. The two methods have the same name because I think it's better to avoid overloading the design with different names for methods that do almost the same thing, but in distinct contexts and classes. Is this clear enough to the reader or I should change the method's name?


title: How does a garbage collector prevent the whole memory from being scanned on every collect?

text: Some (at least Mono's and .NET's) garbage collectors have a short term memory area which they scan often, and a secondary memory area which they scan less often. Mono calls this a nursery. To find out which objects can be disposed of, they scan all objects starting from roots, the stack and the registers and dispose all objects that aren't being referenced anymore. **My question is how they prevent all in use memory from being scanned on every collect?** In principle, the only way to find out what objects aren't in use anymore is to scan all objects and all their references. However, this would prevent the OS from swapping out memory even though it isn't in use by the application and feels like a huge amount of work that needs to be done, also for "Nursery Collection". It doesn't feel like they're winning much by using a nursery. **Am I missing something or is the garbage collector actually scanning every object and every reference every time it does a collection?**


title: How might one teach OO without referencing physical real-world objects?

text: I remember reading somewhere that the original concepts behind OO were to find a better architecture for handling the messaging of data between multiple systems in a way that protected the state of that data. Now that is probably a poor paraphrase, but it made me wonder if there is a way of teaching OO without the (Bike, Car, Person, etc.) object analogies, and that instead focuses on the messaging aspects. If you have articles, links, books, etc., that would be helpful.


title: Implementing distributed Semaphore for AWS workload

text: We have a messaging gateway in AWS (Amazon Cloud) that comprises of a number of nodes (Linux servers) responsible for receiving, routing, despatching and escalating messages (emails, SMS' and voice calls). They all talk to a backend MySQL database on a dedicated machine. Every few minutes we run a maintenance script - escalating stale messages, etc. The problem is that we shouldn't run the maintenance on multiple nodes at the same time - hence I want to implement some sort of _Distributed Semaphore_ that would be raised by the first node and if any other node attempts to run the script before the first one finishes it should simply exit. At the moment we run the script only on one node and have the cron job disabled on the others, but we prefer to have all the nodes with the same configuration. On a single host I would probably use a lock file but how do I do that across multiple hosts? They don't have a shared filesystem and pretty much the only thing they share is the MySQL database. Also - if the process or node dies halfway through the processing the semaphore should eventually release or time out. I prefer to use the database as the Semaphore holder but am also quite happy to use any other AWS service. FWIW The script is written in Python. Not that I think it matters... Thanks for any ideas!


title: What non-programming books should a programmer read to help develop programming/thinking skills?

text: There are a lot of questions about what programming books should be on the programmer's bookshelf. How about non-programming related books that can help you become a better programmer or developer? It would also be interesting to know why they would help. My first choice would be Sun Tzu's "Art of War" (however cliché), because it made it obvious that the success of any project depends on the strength of its weakest link (and warfare is a big project).


title: Implementation of instance testing in Java, C++, C#

text: For curiosity purposes as well as understanding what they entail in a program, I'm curious as to how instance testing (`instanceof`/`is`/using `dynamic_cast` in c++) works. I've tried to google it (particularly for java) but the only pages that come up are tutorials on how to use the operator. How do the implementations vary across those langauges? How do they treat classes with identical signatures? Also, it's been drilled into my head that using instance testing is a mark of bad design. Why exactly is this? When is that applicable, instanceof should still be used in methods like `.equals()` and such right? I was also thinking of this in the context of exception handling, again particularly in Java. When you have mutliple `catch` statements, how does that work? Is that instance testing or is it just resolved during compilation where each thrown exception would go to?


title: What is a simple explanation for the reinterpret_cast expression?

text: I see that it is a compiler directive which instructs the compiler, but what does that mean?


title: Why do executables depend on the OS but not on the CPU?

text: If I write a C program and compile it to an `.exe` file, the `.exe` file contains raw machine instructions to the CPU. (I think). If so, how is it possible for me to run the compiled file on any computer that runs a modern version of Windows? Each family of CPUs has a different instruction set. So how come any computer that runs the appropriate OS can understand the instructions in my `.exe` file, regardless of it's physical CPU? Also, often in websites in the "download" page of some application, you have a download for Windows, for Linux, and for Mac (often two downloads for each OS, for 86 and 64 bit computers). Why aren't there many more downloads, for each family of CPUs?


title: What is the difference between channel-based I/O and stream-based I/O in java?

text: What is the difference between stream-based Input and Channel-Based Input? The java API provides both stream-based in "java.io" package and channel-based in "java.nio" package. Which one of the two is better in performance and reduced run-time errors?


title: How to hide the python code from users?

text: I am developing a paid application in python. I do not want the users to see the source code or decompile it. How can I accomplish this task to hiding the source code from the user but running the code perfectly with the same performance.


title: How to conduct a good tech workshop

text: I am currently trying to organize a small workshop for several people to generate interest in android. I intend to conduct a hands-on workshop, taking everyone through various components and features by building an app. One way I can think to do this is to write an app before hand, share it with everyone and then try to develop in group the same code again, understanding the nuances. However, I am not sure how well that'll work out. I am curious to hear other methodologies or ideas which will help me make this workshop fruitful and engaging for everyone. I am guessing some of you have experience with similar stuff, can you please suggest what would be a good way to go about it? PS - Using possibly irrelevant tags, as my reputation won't allow me to create new ones.


title: If you could pose a question to a Turing test candidate, what would it be?

text: How would you distinguish the man from the machine?


title: Optimize strategies for xml parsing?

text: I am looking for general optimization tips and guidelines for xml parsing. One of the optimization strategies is of course selecting the "right" parser. A detailed comparison between the available parsers for ios can be found here http://www.raywenderlich.com/553/how-to-chose-the-best-xml-parser-for-your- iphone-project. However, I am currently trying to investigate general guidelines and tips on how to optimize by payloads to increase the performance as possible. This question is similar to (a question I have posted in the context of ios) but I have not got a sufficient answer. So this question is not in the context of any particular programming language.


title: Changing CSS classes when different strings are displayed in a text element with jQuery

text: I'm just wondering if this method would be possible using jQuery HTML and PHP. Basically I have a filtering system were products are listed, some have different attribute values such as Hatchback for example. The text element that holds these PHP echo's also have a css class that implements an icon. I'm just wondering can I alter class's that are added to a html element just by looking at the string? So for example if the string displays "Pick-up" then jQuery alters the class and adds the one associated with the "Pick-up" string? Thanks sorry if this is a little confusing, I can explain more if needed.


title: Forking project on Github process

text: There is a project on Github that I mostly like and want to use. There are a few things I want to do differently/remove that doesn't make sense for what I want/need. Also I want to add a few things as well. As I understand it, I should fork the project and I can make whatever changes I want and push back to my fork. From there, I also want to occasionally pull into my fork the changes from the original project so I get the latest bug fixes/features. Am I off-base of how I think it should work? How would bring in the changes from the original project?


title: Delivering estimates and client expectations?

text: When a client asks for an estimate on how long it would take to develop different sections of an app, is it best to give them a total amount or what it would take for each section? Is it better/more common to give a range of hours/days or just a single number? Do you think most clients feel that if a programmer says it should take 50 hours that they should be billed for 50 hours? If I say it would take 50 and it actually takes 60, do I tell them in advance that I'm going over on my estimate or just charge what was originally quoted?


title: Architecture suggestions on a multi-project multi-database 'intranet'

text: Here is the situation I have inherited:   1. We have approximately 10 websites (Asp.net web forms) that each have their own database.   2. Each of these databases houses some site specific data, and each has some form of a user table that will map to what is called a User Service.   3. The User Service is just another website that has a database with one table (User) that have about 3 different unique identifiers for a user: a UserId guid, an internal desktop application id (third party app, needed to map back to it), and a username.   4. On all the different websites the databases have the User table, sometimes called Person, or Student, or whatever else, and they are inconsistent in which UserService.User.[IdentifyingColumn] they map to. The Problem: It is getting to a point where these application are now needing to share some data with each other, and I see that need increasing as the departments are streamlined even more. With this current set up, it is a lot of hoop jumping to get the right UserId column to match to the right UserId column in the UserService. Confused yet? Me too.. **The Question:** How to approach correcting the issue? I have a few different ideas, some I like more than others, but in order to implement them I need some solid benefits I can bring up to the head of IT, as well as justify the programming time taken for the re-write. Idea 1: Create a true intranet application. One web application with one database. This way they all live in the same project, and sharing data between the various departments is very simple and quick. Idea 2: Create a "Master Key" identifying field that will be the end all to identify a user. Make this key available on each database and so there will not be any odd mapping and the various sites can talk to each other. To me this one solves one problem, mapping each db to the next one. It is still very fragmented and there is very little code re-use. Idea 3: Work with it in the current form trying to continue the present fashion of many small databases and sites. **Which of the above options would you suggest, and why?**


title: Base64 decode and SH1 decryption of Sec-WebSocket-Accept value example from Websocket RFC

text: I am planning to implement the Websocket protocol and currently learning how handshake headers must be structured. According to this link http://datatracker.ietf.org/doc/rfc6455/?include_text=1 > To prove that the handshake was received, the server has to take two   >  pieces of information and combine them to form a response. The first piece > of information comes from the |Sec-WebSocket-Key| header field   >  in the client handshake: > > Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ== > > For this header field, the server has to take the value (as present in the > header field, e.g., the base64-encoded [RFC4648] version minus any leading > and trailing whitespace) and concatenate this with the   >  Globally Unique Identifier (GUID, [RFC4122]) "258EAFA5-E914-47DA-   >  95CA-C5AB0DC85B11" in string form, which is unlikely to be used by   >  network endpoints that do not understand the WebSocket Protocol. A   >  SHA-1 hash (160 bits) [FIPS.180-3], base64-encoded (see Section 4 of   >  [RFC4648]), of this concatenation is then returned in the server's   >  handshake. > > Concretely, if as in the example above, the |Sec-WebSocket-Key| header field > had the value "dGhlIHNhbXBsZSBub25jZQ==", the server would concatenate the > string "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" to form the string > "dGhlIHNhbXBsZSBub25jZQ==258EAFA5-E914-47DA-95CA- C5AB0DC85B11". The server > would then take the SHA-1 hash of this, giving the value 0xb3 0x7a 0x4f 0x2c > 0xc0 0x62 0x4f 0x16 0x90 0xf6 0x46 0x06 0xcf 0x38 0x59 0x45 0xb2 0xbe 0xc4 > 0xea. This value is then base64-encoded (see Section 4 of [RFC4648]), to > give the value "s3pPLMBiTxaQ9kYGzzhZRbK+xOo=". This value would then be > echoed in the |Sec-WebSocket-Accept| header field. So when I actually decode "s3pPLMBiTxaQ9kYGzzhZRbK+xOo=" in base64 decoder on decoder, it gives me @:e^qlk Which I do not think it is going to decrypted into original value using SHA-1 properly. So far, my understanding is 1) Server received Sec-WebSocket-Key value from client and combine that with GUID generated from the server So it becomes like: dGhlIHNhbXBsZSBub25jZQ==258EAFA5-E914-47DA-95CA-C5AB0DC85B11 2) then server applies SHA-1 and base64 encoding onto it and the key becomes: s3pPLMBiTxaQ9kYGzzhZRbK+xOo= to send back to the clinet. So in order to turn Websocket-accept value into the original "dGhlIHNhbXBsZSBub25jZQ==258EAFA5-E914-47DA-95CA-C5AB0DC85B11", I need to decode the above value using Base64 and decrypt it with sha-1 and I must receive the original value back. However, when I actually attempt it, it gives me the weird value I have mentioned above. Could you please correct me which part I am doing wrong? Thank you.


title: Data replication patterns / algorithms

text: I have a series of systems that need to be distributed to a variable number of nodes ( _at least two, but more likely 8 - 10_ ). For performance reasons, any one piece of state needs to be maintained in memory and replicated to at least two nodes although as demand increases this may be replicated to more nodes as dictated by the _manager_. Unfortunately, we cannot buy commercial data grids which are already very good at this. **The question** : Assuming the state is immutable, what are some patterns and/or algorithms I can use to facilitate this process? I've supplied a sample to facilitate the discussion, but I'm not tied to this. Really!... I'm wide open on picking a new direction to meet these requirements. If you could point me to pictures or code samples that would be much appreciated. As it stands, one of the nodes will self-promote and will orchestrate who should replicate and when ( _i.e. the manager_ ). **Other assumptions:**   * List item   * Systems will communicate via TCP/IP and Multicast    * No databases    * No file transfer... just byte arrays   * All components are currently C#, and I can change almost anything    * Eventual consistency will be fine _Note: I realize this sample does not handle fail cases. At this point I thought it would over-complicate things_ ![Possible sequence](http://i.stack.imgur.com/yRCLX.png)


title: Is there a good name for "classic" .NET?

text: So, as Microsoft has created many forks and branches off of .NET, there have been a few different product names come up:   * Silverlight   * .NETCore/WinRT/.Net for Windows Store Apps   * .NET for Windows Phone/CoreCLR   * .NET Micro Framework   * .NET Compact Edition However, what do you call the traditional .NET we all know and love? You can't call it Desktop .NET probably, because it also runs on servers, and that might imply you're using that client-profile thing. .NET for PC seems unusual. You can't really just say "this is a product for .NET" because then people might assume that includes support for one of the other frameworks Does Microsoft have an official "name" for the traditional .NET that runs in Windows PCs?


title: How to architect enterprise desktop applications for Windows 8

text: I think I have a grasp on the expectations of consumer application development for Windows 8. Create a new Metro-based UI on top of WinRT, deploy it to your customer via the Marketplace, and everyone wins. Seems simple enough. Unfortunately, I'm not in that business. I work on internal, line-of-business applications for a large enterprise. We currently use .NET technologies such as WPF and Silverlight in order to create rich UIs that can be easily deployed to our users via the web or ClickOnce. The applications can support WinXP and Win7 without too much headache, and our developers get to use XAML which is a very solid UI technology. It seems like WPF and Silverlight have questionable futures at this point, so it is a bit worrisome to continue investing in those. But a Metro UI doesn't seem appropriate for enterprise applications, and the WinRT API is quite limiting with regards to "typical" things that enterprise applications need to do. **How should I be architecting my XAML-based applications, currently being deployed to WinXP and Win7, so that they will be supportable and evolvable on Win8?** Assume for the purposes of this question that the features provided by HTML5 on top of ASP.NET are not adequate for the applications I'm looking to create. I understand that I can use HTML5 for some applications, but I'm trying to figure out what I should do when that isn't enough. **Edit #1:** This is in response to @Emmad Kareem's comment. I do agree that Silverlight/WPF are viable in the short term (2-5 years). However, the applications we produce have potentially very long lifetimes (10-20+ years). So survivability in the long term for a given technology is a concern for us. Also, we have some concern that it will be more and more difficult to find developers that are interested in Silverlight / WPF development if those technologies are considered "dead" by the community. I just want to understand my options and make a decision with my eyes open.


title: php templating with codeigniter

text: I am currently develop a website application in codeigniter, and I'd like to do something in PHP / CodeIgniter where I can make a common template for separate sections of the website. I was thinking that I would keep the header / footer in a separate php files & include them separately. The thing I'm not sure about is the content beneath the header and above the footer. This website application will contain a lot of different pages, so I'm having a hard time figuring how what's the best way to do this.


title: Passing an object between different handlers or a Superclass that contains most of the logic

text: I'm going to try to make this as concise and concrete as possible, but apologies since I can think of multiple ways to make it work. This question might also relate to handling production workflows or manufacturing, but I have no experience in these areas. I have a problem where I need to move an Object, O, from different states to other states (like a Nondeterministic finite automata). The problem is the Object can be in different states at the same time, and the interaction sometimes matters. For example say there are 10 states, O can be in up to 3 of those states at the same time. I'm a bit lost as to what type of code design I should use to model this. The two ideas I am thinking about are   1. Pass O from handler to handler, and manage the transitions between states, and keep some sort of info in O saying which states they are in, so that each state can figure out what to do based on what other states O is in.   2. Have a larger Superclass that handles which states O is in, and handles the interactions. I'd normally say 1. but handling all the interactions between handlers in each handler sounds messy. What would be the better option between these 2? Or is there another method that is preferred? ** Update and Clarification ** As a concrete example. The Object can be in one of many physical locations, while it can also be in one of several stages of processing (The object might move back and forth between locations, or back and forth between the stages of processing). As additional complexity each physical location might have sublocations, but I think I can ignore that for now. So if it's clearer, it can be considered to be two independent automata, but choosing the edge to move to the next state in either automata depends on it's state from both automata.


title: Can I minify Javascript that requires copyright notice?

text: I guess this is actually a legal question, but it relates to software. I'm about to include a JS plugin in a project. The comments include: >   * Redistributions of source code must retain the above copyright notice, > this list of conditions and the following disclaimer. * Redistributions in > binary form must reproduce the above copyright notice, this list of > conditions and the following disclaimer in the documentation and/or other > materials provided with the distribution. >   1. Is using this in my web site "redistribution?"   2. If I minify this to conserve bandwidth, I assume it will strip all comments. **If the answer to #1 is yes, doesn't that imply I'm legally not allowed to minify it?** (That would stink, since I was planning to auto-minify all JS as part of the deploy process.)


title: how to prove the complexity of an algorithm mathematically

text: I know the fundamental algorithms and it's complexities. for e.g if Binary Search has Complexity O(log n), then how I can mathematically prove this?


title: Which of these 3 languages is easiest to convert to Delphi?

text: I am intending to purchase some source code for my Delphi program. It is not too big an algorithm, but it is not available in Delphi and I'll have to translate it to Delphi. However, I have not worked in any of the languages it is offered in and I don't know which I should buy. I want the one that will translate to Delphi most easily and accurately. The three languages are: C++, Java, and C#. Which one would be easiest to convert?


title: In a functional requirements document, is the Assumptions section dangerous?

text: I am currently a reviewer on a Best Practices document for Developers or Business Analysts in writing a Functional Requirements document. This document is not necessarily a template for functional requirements documents, but a guide to what elements are necessary, optional, and dangerous to include a Functional Requirements document. The author of the document states that: > Functional Requirements documents should NEVER have an Assumptions secion! > Do not assume anything about what people know about this application or any > external issues surrounding it. I am not sure that I agree with this sentiment but don't really have the words to refute it either. In a perfect world the analyst will have time to properly analyze every stakeholder input and every possible external issue but inevitably due to time constraints and other issues some assumptions need to be made. Is this a bad idea because it is too easy for the intellectually lazy to declare assumptions rather than requirements? If not then why do you think Assumptions are a good idea? **EDIT:** To clarify, I am not asking about the Assumptions section of technical documentation but of an Assumptions section in a requirements document written by a non-technical business analyst.


title: How are we supposed to deal with Customers who don't give a damn?

text: I have some customers who expect everything for next to nothing. They also want things to behave a certain way, or look a certain way, but when explaining to them why it's not a good idea to implement a certain feature and offering suggestions, they don't listen. When things go wrong, they get moody, and demand I change/recode the entire feature to their liking, but when told that it's because they wanted it that way, they don't listen. I've found that after years of being around these types of people, it's had a major impact on the way I deal with people I can't stand, and I've seriously run out of ideas. How do you deal with people who never listen, never learn, and want everything for free?


title: How to depict Import a file action in the Sequence diagram

text: Everyone says sequence diagrams are so easy but I just cannot figure this out. Basically user clicks on an 'Import from temp folder' button, the program opens a window with a list populated with filenames, user clicks on a filename, clicks on OK and the document is imported. I know the order of the actions but how to depict e.g. populating a list, or selecting an item from a list? So I assume the objects would be like:               [USER]  [ImportDialogWindow]    [ListOfFiles:STRING]   [?where to go with selected file]


title: Packaging PHP/Python files inside android .apk files?

text: I am developing an android app using HTML5. I want to make it work completely offline. I know that it is possible to package the .html, .css and .js files inside the .apk file itself in the "resources" but is it possible to also package PHP or Python files inside the .apk file itself? So that no internet connection would be required to run the app?


title: unit testing on ARM

text: We are developing application level code that runs on an ARM processor. The BSP (low level code) is being delivered by a 3d party so our code sits just on top of this abstraction layer (code is written in c++). To do unit testing, I assume we will have to mock/stub out the BSP library(essentially abstracting out the HW), but what I'm not sure of is if I write/run the unit test on my pc, do I compile it with for example GCC? Normally we use Realview compiler to compile our code for the ARM. Can I assume that if I compile and run the code with x86 compiler and the unit tests pass that it will also pass when compiled with RealView compiler? I'm not sure how much difference the compiler makes and if you can trust that if the x86 compiled code pass the unit tests that you can also be confident that the Realview compiled code is ok.


title: Why are HDL IDEs so user-unfriendly when compared to generic-purpose language (like Java/C) IDEs?

text: I've been programming for a while now, and I've covered a lot of languages. And this trend that I noticed is that all HDL languages have so painful IDEs! In general, any development environment having some Hardware related development has very crappy UI. I'm talking about uVision, ModelSim, VHDL Simili, Xilinx etc, compared with Netbeans, Eclipse, Visual Studio etc. Why do hardware-guys hate their developers? NOTE: There are exceptions (LABView is awsome!). Can you think of any more?


title: Why a static main method in Java and C#, rather than a constructor?

text: I’m Looking for a definitive answer from a primary or secondary source for why (notably) Java and C# decided to have a static method as their entry point, rather than representing an application instance by an instance of an `Application` class (with the entry point being an appropriate constructor). * * * ### Background and details of my prior research This has been asked before. Unfortunately, the existing answers are merely begging the question. In particular, the following answers don’t satisfy me, as I deem them incorrect:   * _There would be ambiguity if the constructor were overloaded._ – In fact, C# (as well as C and C++) allows different signatures for `Main` so the same potential ambiguity exists, and is dealt with.   * _A`static` method means no objects can be instantiated before so order of initialisation is clear._ – This is just factually wrong, some objects _are_ instantiated before (e.g. in a static constructor).   * _So they can be invoked by the runtime without having to instantiate a parent object._ – This is no answer at all. Just to justify further why I think this is a valid and interesting question:   * Many frameworks _do_ use classes to represent applications, and constructors as entry points. For instance, the VB.NET application framework uses a dedicated main dialog (and its constructor) as the entry point1.   * Neither Java nor C# technically _need_ a main method. Well, C# needs one to compile, but Java not even that. And in neither case is it needed for execution. So this doesn’t appear to be a technical restriction. And, as I mentioned in the first paragraph, for a mere convention it seems oddly unfitting with the general design principle of Java and C#. To be clear, there isn’t a specific _disadvantage_ to having a static `main` method, it’s just distinctly _odd_ , which made me wonder if there was some technical rationale behind it. I’m interested in a definitive answer from a primary or secondary source, not mere speculations. * * * 1 Although there is a callback (`Startup`) which may intercept this.


title: Good technologies for developing a modular server component in .net?

text: I am using WPF, Prism and Unity to develop the user interface for a .net application. The UI will run from a PC, but I also need to develop a separate complex server component that will provide services to the PC component via WCF. Prism and Unity have proved to be of great value in creating a modular application, at least as far as the user interface is concerned. I would also like to make the server component modular, but I cannot find anywhere what techniques, patterns and technologies are suitable. I have considered:   * Unity or one of the other DI containers    * Selected parts of Prism, such as modules and events Are these suitable for developing a modular server component? Or are these UI technologies only and should I be looking at something completely different?


title: Do you check in bin or debug folders (and dlls) into your TFS?

text: Quick question about TFS - Do you guys check-in bin/debug folders into TFS? (if so, why?) Since the content of those folders are dynamically generated is it better to leave them out so that the programmer will not run into read-only issues?


title: When does 'optimizing code' == 'structuring data'?

text: A recent article by ycombinator lists a comment with principles of a great programmer. > `#`7\. Good programmer: I optimize code. Better programmer: I structure > data. Best programmer: What's the difference? Acknowledging subjective and contentious concepts - does anyone have a position on what this means? I do, but I'd like to edit this question later with my thoughts so-as not to predispose the answers.


title: How are software licenses applied?

text: I have created a small and helpful project that I'd like to upload to a public repository and share under the FreeBSD license. What are the common steps I should make to apply the license to my code? I mean, what are the technical actions that should be done to apply the chosen license. More specifically:   1. Should I put the licensing information in the header of every file?   2. If yes, should I put the whole license text or there is an acceptable short version?   3. Should I have a specific file (e.g. in the root directory) that deals with the licensing? Is putting the license text in it enough?   4. If a project is a cooperative effort by various people on-line, that are not part of any organization, what should be written in the copyright clause? Are there any other technical issues I should know?


title: Should I work for free while applying for a job?

text: An employer usually asks a candidate to do a small project at home ("homework") as a part of applying for a job. Last time I applied for a job (as a web developer), there were aproximately 10 applicants who were all given different tasks. Despite the fact that there was only one vacancy, the company used the work of all of the candidates in one of its projects. Actually, it is quite plausible for a company to create these "vacancies" just to make people work for free - I estimate, that aproximately 2 weeks of programmer's work was saved with all of the job applications that company had on one vacancy. Is this a common practice and how can you protect yourself from working for free in the future?   Have you seen this during your career?


title: How to create distinct set from other sets?

text: While solving the problems on Techgig.com, I got struck with one of the problems. The problem is like this: > A company organizes two trips for their employees in a year. They want to > know whether all the employees can be sent on the trip or not. The condition > is that no employee can go on both the trips. Also to determine which > employees can go together the constraint is that the employees who have > worked together in past won't be in the same group. Examples of the problem: > >   1. Suppose the work history is given as follows: {(1,2),(2,3),(3,4)}; then > it is possible to accommodate all the four employees in two trips (one trip > consisting of employees 1& 3 and the other having employees 2 & 4). Neither > of the two employees in the same trip have worked together in past. >   2. Suppose the work history is given as {(1,2),(1,3),(2,3)} then there is > no possible way to have two trips satisfying the company rule and > accommodating all the employees. > Can anyone tell me how to proceed on this problem?


title: At what point is it good to try to reinvent a standard?

text: Take a look at this picture from XKCD.com ![Hey, some mouse-hover text. Wonder if it says something about USB devices?](http://imgs.xkcd.com/comics/standards.png) Browsers are a good example of this. While I develop websites for them, I have to search through the unique 'standards' for each to make sure my sites are fully compatible. When developing a new program (to compete with existing products), I can see people thinking that their idea is worth putting there in a final product that other products will see the advantages and include it as well. Obviously this isn't always the case (browsers, are once again a good example). Some features are ignored by Webkit browsers and some by Gecko browsers and yet IE tends to just ignore everything quite frankly. In truth, these new 'ideas' or implantation tend to just cause problems for the end-user. Now, sometimes these ideas are important to include. Without ideas, there would be no change and without change, no advancement or positive improvements. At what point is an idea/feature worth implementing. What decides if a feature is worthy of becoming 'standard'?


title: Modern languages and the JVM

text: Many modern programming languages (Scala, Erlang, Clojure, etc.) are targeting the JVM. What are the main reasons behind that decision?   * JVM's maturity?   * Portability?   * Because JVM simply exists, and the language designers were not willing to write a new VM/interpreter?


title: How can I secure a short-term programming job or internship abroad?

text: I am planning to go to the UK or Ireland (but it could be any location, generally speaking) for 3-6 months in about a year or so and would like to be part of a software development team there. I am not necessarily looking for a full-time job, but given that several areas around there are known to be "programmer paradises", I'd rather benefit from it to broaden my horizons and also share what knowledge I have. What I would like to do is:   * to spectate and take part in the knowledge exchange and decision making strategies. To see how people think of different problems, how they tackle them, how they subdivide and distribute the work etc.    * to experience best practices in action, rather than trying to make them work for me as a lone developer or work for yet another company, that wants me to just get it done.   * to get in touch with technologies and languages that are new to me, although this is really optional, because it's something I can do myself (although I rarely seem to find the time).  I like to think, that I have a lot of things to bring to the table, but I would also like to learn, or better yet to experience, a lot. So what I am looking for an internship for a developer with work experience. Basically something like as a journeyman's stay: to work with somebody, who I can turn to, when in obvious need of wisdom. How can I go about doing this?


title: Commitment level to the project?

text: You've quoted your time that it will take certain time to produce a piece of software. When you have started the project, is it better to go hard at the beginning and cruise later? or to try to maintain a consistent effort throughout the project?


title: Git & project backups

text: I've been using SVN for sometime and have been making an awkward, but soon to be rewarding transition over to git. Theres quite a few side / small projects that I'm working on which 90% will never see the light of day. As well - I also have my weekly school assignments / projects, and finally client projects that I have on the go. I've been rolling the idea or question of how or what the best way would be to back up my projects. The solutions I've sought out so far: **github** which offers an outstanding service - I'm ok with my work being open source, however It's the school work and client work I might not want the public to be open to. github, of course has a payment plan - but let's face it, im a poor colleage student doing what I can to at least put KD on the table! Theres the **USB thumbstick** that I can take around with me, work off of or back up, but that requires it to be around constently. Theres **Dropbox** , but thats a little overkill since it already is a form of a version control system, as well - I have quite a few things on the go - putting everything within dropbox would eat a lot of space Finally, theres a **private server**. I have a mac mini setup as a media server and I was thinking that I could backup to that. Anyways - what are your guys thoughts, how do you handle backing up projects, not only for version control but for the everyday backups.


title: Tried teaching myself to program before college, accidently overwhelmed myself, tips?

text: I'm sixteen, I'm overly interested in programming, and I'm currently taking IT classes during my mornings in high school. Last year, I tried teaching myself to code. It was quite exciting, but all I did was watch TheNewBoston's videos on YouTube for Python. After his tutorials, I just did research, made some CMD programs, and that's it. After that, I got cocky and got my feet wet in many other languages. Java, C++, C#, Perl, Ruby... and it overwhelmed me. Which made it less fun to code. I want to go to college for a 2 year programming course. And I want to make writing code my profession. But how do you recommend I attack re-learning it all again? Start with Python? Don't even try? Also, I'm not 100% in math, but I'm good friends with a lot of programmers, who say they suck at math, but manage to code just fine. I'm not looking for negative feedback. I just want the proper head-start on things before college.


title: Why do we use to talk about addresses and memory of variable in C?

text: Why do we use to talk about addresses and memory of variable in C, where in other languages (like in Java, .Net etc) we do not talk about variable address and memory in a program, we will directly use the variables. But in C Language we are listening the word address and memory. How to explain this? I hope C is high level language designed over the assembly language. So C is a thin layer over assembly language (in assembly language we will use memory locations to store a variable and track a variable). But in other languages these addresses and memory related things are wrapped in that specific language, so that we will not listen these words.


title: Should adapters or wrappers be unit tested?

text: Suppose that I have a class that implements some logic:               public MyLogicImpl implements MyLogic {         public void myLogicMethod() {             //my logic here         }     }      and somewhere else a test class:               public MyLogicImplTest {         @Test         public void testMyLogicMethod() {             /test my logic         }     }      I also have:               @WebService     public MyWebServices class {         @Inject         private MyLogic myLogic;              @WebMethod         public void myLogicWebMethod() {             myLogic.myLogicMethod();         }     }      Should there be a test unit for `myLogicWebMethod` or should the testing for it be handled in integration testing.


title: How to deal with transactions when creating a database connection for each query

text: In line with this post here I am going to change my website to create a connection per query to take advantage of .NET's connection pooling. With this in mind, I don't know how I should deal with transactions. At the moment I do something like (psuedo code):               GlobalTransaction = GlobalDBConnection.BeginTransaction();     try     {         ExecSQL("insert into table ..")         ExecSQL("update some_table ..")         ....         GlobalTransaction.Commit();     }catch{         GlobalTransaction.Rollback();         throw;     }      ExecSQL would be like this:               using (SqlCommand Command = GlobalDBConnection.CreateCommand())     {         Command.Connection = GlobalDBConnection;         Command.Transaction = GlobalTransaction;         Command.CommandText = SQLStr;         Command.ExecuteNonQuery();     }      I'm not quite sure how to change this concept to deal with transactions if the connection is created within `ExecSQL` because I would want the transaction to be shared between both the insert and update routines.


title: What is the technical reason that so many social media sites don't allow you to edit your text?

text: A common complaint I hear about Facebook, Twitter, Ning and other social sites is that once a comment or post is made, it can't be edited. I think this goes against one of the key goals of user experience: giving the user **agency** , or the ability to control what he does in the software. Even on Stackexchange sites, you can only edit the comments for a certain amount of time. **Is the inability for so many web apps to not allow users to edit their writing a technical shortcoming or a "feature by design"?**


title: App in Mac app Store free for those who already have downloaded the iphone version?

text: I want the people who are using my iphone app to be able to download the Mac version(From the Mac app store) for free? and others pay for it! possible? any Ideas how to implement this?