title: How to say effectively to a manager that you missed the 'deadline'

text: > **Possible Duplicate:**   >  I cannot reach my deadline. What to do? My manager is a very deadline specific person. Even though I am a trainee, he insists on a deadline for every small assignment that he gives. Now it so happens that I miss the deadline. And boy, he doesn’t like that at all! So how do I say that i missed the deadline without inviting his wrath? How to stop getting into his bad books? P.S. I am not being lazy. Just that the assignments that he gives are not easy stuff, plus I am doing it in Delphi, which is new to me.


title: Is it better to build HTML Code string on the server or on the client side?

text: The result of the following process should be a html form. This form's structure varies from one to user. For example there might be a different number of rows or there may be the need for `rowspan` and `colspan`. When the user chooses to see this table an ajax call is made to the server where the structure of the table is decided from the database. Then I have to create the html code for the table structure which will be inserted in the DOM via JavaScript. The following problem comes to my mind: Where should I build the HTML code which will be inserted in the DOM? On the server side or should I send some parameters in the ajax call method and process the structure there? Therefore the main question involves good practice when it comes to decide between Server side processing or client side processing. Thank you!


title: How can I test PHP skills in a interview?

text: My company needs to hire a PHP developer, but nobody has PHP knowledge in my company and we find difficult to test for PHP skills. If it were a C/Java developer I would ask him to write a quick implementation of the Game of Life, but PHP is a completely different language. I saw this test with interest: http://vladalexa.com/scripts/php/test/test_php_skill.html Anyone else has more suggestions?


title: How do you limit whitespace differences for developers using different IDEs/environments?

text: I've used UltraEdit for years and never had a problem with sharing code with fellow developers whether they worked on Windows, Mac, Linux, Eclipse, Visual Studio -- what have you... But now I am in an office where some developers are using emacs and they complain profusely about the white space differences my code "introduces". I have UltraEdit set to write to files as UNIX-style (no Windows returns), but it seems the whitespace renders differently for the emacs developers. Since I don't use emacs (or vi), its a pain for me to try to figure out why this is impacting them, but I more so just want them to shuttup! lol This is even causing problems in SVN/Diff! Any thoughts on how to fix this? Forget about everyone using Emacs because thats not gonna happen lol.


title: while(true) and loop-breaking - anti-pattern?

text: Consider the following code:               public void doSomething(int input)     {        while(true)        {           TransformInSomeWay(input);                if(ProcessingComplete(input))              break;                DoSomethingElseTo(input);        }     }      Assume that this process involves a finite but input-dependent number of steps; the loop is designed to terminate on its own as a result of the algorithm, and is not designed to run indefinitely (until cancelled by an outside event). Because the test to see if the loop should end is in the middle of a logical set of steps, the while loop itself currently doesn't check anything meaningful; the check is instead performed at the "proper" place within the conceptual algorithm. I was told that this is bad code, because it is more bug-prone due to the ending condition not being checked by the loop structure. It's more difficult to figure out how you'd exit the loop, and could invite bugs as the breaking condition might be bypassed or omitted accidentally given future changes. Now, the code could be structured as follows:               public void doSomething(int input)     {        TransformInSomeWay(input);             while(!ProcessingComplete(input))        {           DoSomethingElseTo(input);           TransformInSomeWay(input);        }     }      However, this duplicates a call to a method in code, violating DRY; if `TransformInSomeWay` were later replaced with some other method, both calls would have to be found and changed (and the fact that there are two may be less obvious in a more complex piece of code). You could also write it like:               public void doSomething(int input)     {        var complete = false;        while(!complete)        {           TransformInSomeWay(input);                complete = ProcessingComplete(input);                if(!complete)            {              DoSomethingElseTo(input);                     }        }     }      ... but you now have a variable whose only purpose is to shift the condition- checking to the loop structure, and also has to be checked multiple times to provide the same behavior as the original logic. For my part, I say that given the algorithm this code implements in the real world, the original code is the most readable. If you were going through it yourself, this is the way you'd think about it, and so it would be intuitive to people familiar with the algorithm. So, which is "better"? is it better to give the responsibility of condition checking to the while loop by structuring the logic around the loop? Or is it better to structure the logic in a "natural" way as indicated by requirements or a conceptual description of the algorithm, even though that may mean bypassing the loop's built-in capabilities?


title: Separating validation from persistence in models?

text: Models in an MVC application gets kind of hard to test when validation of data and persistence of data is baked together in the model. I would like to test those separately to prevent doing integration testing instead of actual unit testing. What patterns are available to keep validation and persistence separated?


title: Organizing single page code well with Notepad++

text: I've a c# file that will contain, most likely 10,000+ lines of code. I'd like to break this file into tabbed segments, so I can organize each method into a certain tab and label the tab something like : initial setup, helper functions,execution logic,list structures,global variables, etc. If I were using PHP I would have separate files and use include(); to include the separate files. What can be done, following the same style, with c#?


title: What's the best way to modularize a User schema so it's generic

text: I have a database design question. Basically I want to be able to create a schema for a User model, then use this User model in other models that extend User but I want to design it in such a way that it's generic enough to be used in every application. For example a Profile or Account model might extend User, and in both cases they will be different based on the web application you are designing but the core credentials of User should never be different across any web application. What fields do you think should be in the User model? I think the bare minimum to successfully handle authentication would be:   * email (the login unique identifier)   * salt (obviously!)   * password (duh)   * lostToken (a hash to verify lost password functionality)   * role (member, admin, editor, etc.. IMO this list of roles would differ between sites however it's too important to the User model not to have here?) Now we get into other interesting fields that are still very very useful:   * createdAt (when the account was created)   * ipAddress (track the ip when the account was created)   * refererUrl (which site it came from)   * lastLoggedIn (the last time the user logged in)   * isOnline (is the user currently online) And even more fields that are still pretty useful:   * username (might not be used on every site)   * number of consecutive logins (similar to the stack network) I think anything else like social data (likes, votes, profile views), badges/achievements, the last time they updated their profile/account/whatever, and other info like their name belong in the per- site Profile model. What do you think? Edit: I fully understand that this question is partly subjective but I do think there's definitely room for discussion.


title: Is it OK to use sample code from blogs, GitHub, etc... in commercial applications?

text: When searching the web for a solution to a particular problem, I often find a perfect solution posted on someone's blog, or in a public repository (GitHub, Google Code). Most of the time, the code has no copyright information, nor does the author mention any sort of attribution rules. I'm pretty sure short snippets are fine, but what if I copy a handful of classes verbatim (again, no copyright notices, TOS, attribution requests, etc...)? Am I under any legal obligation to the original author?


title: Is there a performance benefit to using immutable objects in a scripting language?

text: As I understand it, writing your objects in an immutable style can help the performance of your program for compiled languages, as the compiler tends to rewrite your code in single static assignment form under the hood anyway. Is there a performance benefit to using immutable objects in an interpreted language like Python or PHP? I understand there may be readability or code quality benefits from immutability, but I am asking specifically about performance.


title: Is it OK to mix C and C++ in an interview?

text: If I am asked in an interview to write down some code, should I completely stick with C++ or is it acceptable to "mix" the two to write easy code as it comes to my mind? I'll explain it: if I'm asked to create a "stack" data type, a C++ class is perfectly suited, while if I need to parse some strings a strtok/sscanf is far easier than STL. On the other hand, if I need a generic container STL and templates are the way to go. Everything can be done in C or in C++, but in an interview I can't code everything or remember every standard/STL function. What is an acceptable tradeoff?


title: Using "Google Guava" in coding interviews

text: I attended a in-person interview recently and performed well. But surprisingly I got rejected. When I asked the HR for reason, he contacted the technical interviewer and told me that I was syntactically wrong while coding. I used Google Guava for coding. So my code looked like this: `List<String> items = Lists.newArrayList()` instead of `List<String> items =new ArrayList<String>();` I know that the code will compile and work as expected.Is it ok to use third party libraries like Google Guava in interviews?


title: Architecture for Social Graph data that has a Time Frame Associated?

text: I am adding some "social" type features to an existing application. There are a limited # of node & edge types. Overall the data itself is relatively small (50,000 - 70,000 for each type of node) there will be a number of edges (relationships) between them (almost all directional). This, I know, is relatively easy to represent with an SDF store (such as BrightstarDB) or something like Microsoft's Trinity (or really many of the noSQL options). The thing that, I think, makes this a unique use case is that each relationship will have a timeframe associated with it (start and end dates). Right now, I'm thinking of just storing this in a relational structure and dealing with the headaches of "traversing the graph", but I'm looking for suggestions on a better approach (both in terms of data structure and server):               Column     ================     From_Node_ID       Relationship     To_Node_ID     StartDate     EndDate      Any suggestions or thoughts are welcomed.


title: How can I teach Java theoretically from distance?

text: I will be in the position of teaching Java theoretically, (it will not contain a screen and typing, all things that I will have is a paper and a camera so they can watch my hands while I am writing). Any ideas of what topics I should cover if I'm teaching this way?


title: Best way for an external (remote) graphics designer to style ASP.NET MVC 4 app?

text: My customer has his own graphics designer he wants to use to style his web application we're building in ASP.NET MVC 4. Our solution is in Bitbucket, but if he can't run it what choices do we have? I doubt he uses Visual Studio 2012. One idea is for us to publish to our solution to a file system, send it to him, have him create a local IIS website on his machine (assuming he isn't using a Mac). Mocking data or pointing to a test SQL in Azure isn't a problem. Then he can make changes to .css and .cshtml files. Will this even work? The point is that he needs to be able to test his changes. I know he can modify the views and just check-in. But he needs to deliver a working design. So it seems inefficient. The graphics designer will have access to our test site so he can see how it works, what data we have and fields. Another idea is for him to build a static mock site using just HTML/CSS. Later I'd integrate his styles into customer's solution, split his html into partial views which we use and add Razor syntax. Again, we'd like to leverage graphics designer for all of this. Is there a best practice documented around this subject? How do other teams deal with this situation?


title: Desktop application, dependency injection

text: I am thinking of applying a real dependency injection library to my toy C#/GTK# desktop application. I chose NInject, but I think this is irrelevant to my question. There is a database object, a main window and several utility window classes. It's clear that I can inject the database into every window object, so here DI is useful. But does it make sense to inject utility window classes into other window classes? Example: I have classes such as:               class MainWindow {…}     class AddItemWindow {…}     class AddAttachmentWindow {…}     class BrowseItemsWindow {…}     class QueryBuilderWindow {…}     class QueryBrowserWindow {…}     class PreferencesWindow {…}     …      Each of the utility classes can be opened from MainWindow. Some utility windows can also be opened from other utility windows. Generally, there might be a really complex graph of who can open whom. So each of those classes might need quite a lot of other window classes injected. I'm worried that such usage will go against the suggestion not to inject too many classes at once and become a code smell. Should I use some kind of a service locator object here?


title: How does std::string in c++ allocate memory?

text: I've noticed that the string library doesn't require one to allocate space before writing the input/output. How does the string library allocate that memory dynamically, i know of the 'new' keyword in c++ and 'malloc' in c but when i try something like this, my program stops working.               char* str = new char[strlen(str) + 1];     cin>>str;      i can't get it to work that way, how does the string library work? I also know of vectors in C++ but not a big fan of using them, i would like to know if there's a way to dynamically allocate memory without having to allocate a size before, something close but not as sophisticated as the string.h library. How does the string library get unlimited input from user without the programmer specifying buffer size?


title: Change management's mind?

text: As a programmer working in an insurance office, I have a nasty little management hierarchy which is making programming much harder. At current, our IT department rates a three on The Joel Test, which worries me. I'd like to fix this, but management enforces an insanely aggressive release schedule. Basically every project is due "yesterday". As a result basic planning is nearly impossible. Best practices like planning, documentation, and testing are all overlooked on every project we attempt. So far, I've tried a myriad of methods. Everything from trying to frighten them with worst case scenarios, to referring to industry standards for advice on how to proceed on a subject. I'm at the end of my rope. So the question is, what methods have worked for other programmers to change how management views programming. My biggest fear is that it is simply impossible to make them see the light, and the solution is "work somewhere else".


title: Learning to program by immersion?

text: I've long realized that the best way to go about learning another (natural) language is by immersion - you can learn Spanish in a classroom, but you'll never be as fluent as someone living in Spain (over an extended period of time who is interested in actually learning Spanish). I was curious if the same was true for people who are new to programming. Now, I know that not all of these are specific to programming, but the general public at least generally associates these things with "computer geeky". Would switching to Linux be a good choice? Would using Git (or some other type of VCS) be a good choice? What about joining online forums and IRC? What about writing unit tests or working on larger projects? I know that in the past programming and computer science was introduced in a very sterile environment. You started in a university classroom with a well known curriculum and book (say, _Structure and Interpretation of Computer Programs_ ), say for a few "hackers" who started young (and often with BASIC or the like). I've noticed that the actual experience of a software developer is more complicated than just knowing a language (and how to use it), there's a whole lot in between, and a whole lot to learn. Do you think it's better to start programming by immersion? Not necessarily all at once, but rapidly introducing new "concepts" that professionals make use of? Or is it better to start slowly and academically?


title: Can I advance my career in the USA if I lack local networking?

text: I'm a web developer with 10 years of experience in the Microsoft stack. I was brought to the US by my company, but my contract has ended. I want to continue pursuing a career in the US, but it seems there's a focus on networking while still in college. Due to my foreign education, my networking occurred elsewhere. However, because of this network effect, it seems most developers in the US only have to apply to one or two jobs throughout their career. Am I handicapped by not having a professional network in the US?


title: Reading and conditionally updating N rows, where N > 100,000 for DNA Sequence processing

text: I have a proof of concept application that uses Azure tables to associate DNA sequences to "something". Table 1 is the master table. It uniquely lists every DNA sequence. The PK is a load balanced hash of the RK. The RK is the unique encoded value of the DNA sequence. Additional tables are created per subject. The PK is a load balanced hash, and the RK is the unique value of the DNA sequence. Assume that the quantity of RKs here is many order of magnitudes smaller than the Master table. Each subject has a list of N DNA sequences that have one reference in the Master table, where N is > 100,000. It is possible for many tables to reference the same DNA sequence, but in this case only one entry will be present in the Master table. **My Azure dilemma:** I need to lock the reference in the Master table as I work with the data. I need to handle timeouts, and prevent other threads from overwriting my data as one C# thread is working with the information. Other threads need to realise that this is locked, and move onto other unlocked records and do the work. Ideally I'd like to get some progress report of how my computation is going, and have the option to cancel the process (and unwind the locks). **Question** What is the best approach for this? I'm looking at these code snippets for inspiration: http://blogs.msdn.com/b/jimoneil/archive/2010/10/05/azure-home- part-7-asynchronous-table-storage-pagination.aspx http://stackoverflow.com/q/4535740/328397


title: Critique of the IO monad being viewed as a state monad operating on the world

text: The `IO` monad in Haskell is often explained as a state monad where the state is the world. So a value of type `IO a` monad is viewed as something like `worldState -> (a, worldState)`. Some time ago I read an article (or a blog/mailing list post) that criticized this view and gave several reasons why it's not correct. But I cannot remember neither the article nor the reasons. Anybody knows? **_Edit:_ The article seems lost, so let's start gathering various arguments here.** I'm starting a bounty to make things more interesting. _Edit:_ The article I was looking for is Tackling the awkward squad: monadic input/output, concurrency, exceptions, and foreign-language calls in Haskell by Simon Peyton Jones. (Thanks to TacTics's answer.)


title: Hard declarations in Haskell (á la C)

text: http://susam.in/blog/clumsy-pointers/ How can be solved different declarations puzzles with Haskell? `void x1(int *)` A function which has int * argument and return type void. `void (*x2)(int *)` Pointer to a function which has int * argument and return type void. `void (*x3())(int *)` A function that returns a pointer to a function which has int * argument and return type void. `void (*x4(void (*)(int *)))(int *)` A function which has a pointer to a function that has int * argument and return type void as argument, and returns a pointer to a function which has int * argument and return type void. `void (*x5(void (*[10])(int *)))(int *)` A function which has an array of 10 pointers to functions that has int * argument and return type void as argument, and returns a pointer to a function which has int * argument and return type void. `void (*(*x6)(void (*[10])(int *)))(int *)` A pointer to a function which has an array of 10 pointers to functions that has int * argument and return type void as argument, and returns a pointer to a function which has int * argument and return type void. `char (*(*x7())[])()` Function returning pointer to array[] of pointer to function returning char. `char (*(*x8[3])())[5]` Array[3] of pointer to function returning pointer to array[5] of char.


title: iOS - Unit tests for KVO/delegate codes

text: I am going to design a MVC pattern. It could be either designed as a delegate pattern, or a Key-Value-Observing(KVO), to notify the controller about changing models. The project requires certain quality control procedures to conform to those verification documents. My questions:   1. Does delegate pattern fit better for unit testing than KVO?   2. If KVO fits better, would you please suggest some sample codes?


title: How to you "sell" support as an career option

text: We find it relatively easy to hire developers to work on various projects. The problem arises when the project is finished but still needs to be supported. We really battle to get people to join the support team. It's seen as dead- end, career-limiting, boring, second-class etc. Currently, we get round this by getting the project team to assign some of their team to the support team for a while. Part of the assignment is to do a "brain dump" of the project so that the support team understands it. This works as long as the assignment is only for a fixed period. Trying to hire people to work in support full-time is a problem. There are few applications and the calibre is not particularly high. (The financial reality though is that support can be very lucrative for a company and once you get a reputation, you get approached by other companies to do their support even though you weren't involved in the original development.)


title: C++ job interview questions?

text: I am expecting a job interview for a C++, what kind of questions should I expect? I have been programming with C for 5 years. I know what OOP is and I have been reading about it for some time. But it is most likely I can miss important details because I do not do anything real on C++. Best Regards,


title: Is Java much harder to "tweak" for performance compared with C/C++?

text: Does the "magic" of the JVM hinder the influence a programmer has over micro- optimisations in Java? I recently read in C++ sometimes the ordering of the data members can provide optimizations (granted, in the microsecond environment) and I presumed a programmer's hands are tied when it comes to squeezing performance from Java? I appreciate a decent algorithm provides greater speed-gains, but once you have the correct algorithm is Java harder to tweak due to the JVM control? If not, could people give examples of what tricks you can use in Java (besides simple compiler flags).


title: When does "proper" programming no longer matter?

text: I've been building an android game in my spare time. It's using the libgdx library so quite a bit of the heavy lifting is done for me. While developing, I carelessly selected datatypes for some procedures. I used a hashtable because I wanted something close to an associative array. Human readable key values. In other places to achieve similar things, I use a vector. I know libgdx has vector2 and vector3 classes, but I've never used them. When I come across weird problems and search Stack Overflow for help, I see a lot of people just reaming the questions that use a certain datatype when another one is technically "proper." Like using an ArrayList because it does not require defined bounds versus re-defining an int[] with new known boundaries. Or even something trivial like this:               for(int i = 0; i < items.length; i ++)     {         // do something     }      I know it evaluates item.length on every iteration. However, I also know items will never be more than 15 to 20 items. So should I care if I evaluate items.length on every iteration? I ran some tests to see how the app performs using the method I just described versus the proper, follow the tutorial and use the exact data types suggested by the community. The results: Same thing. Average 45 fps. I opened every app on the phone and galaxy tab. No difference. So I guess my question to you is this: Is there a threshold when it no longer matters to be proper? Is it ok to say - "so long as it gets the job done, I don't care?"


title: I should have used a factory method instead of a constructor. Can I change that and still be backwards-compatible?

text: **The problem** Let's say I have a class called `DataSource` which provides a `ReadData` method (and maybe others, but let's keep things simple) to read data from an `.mdb` file:               var source = new DataSource("myFile.mdb");     var data = source.ReadData();      A few years later, I decide that I want to be able to support `.xml` files in addition to `.mdb` files as data sources. The implementation for "reading data" is quite different for `.xml` and `.mdb` files; thus, if I were to design the system from scratch, I'd define it like this:               abstract class DataSource {         abstract Data ReadData();         static DataSource OpenDataSource(string fileName) {             // return MdbDataSource or XmlDataSource, as appropriate         }     }          class MdbDataSource : DataSource {         override Data ReadData() { /* implementation 1 */ }     }          class XmlDataSource : DataSource {         override Data ReadData() { /* implementation 2 */ }     }      Great, a perfect implementation of the Factory method pattern. Unfortunately, `DataSource` is located in a library and refactoring the code like this would break all existing calls of               var source = new DataSource("myFile.mdb");      in the various clients using the library. Woe is me, why didn't I use a factory method in the first place? * * * **Solutions** These are the solutions I could come up with:   1. Make the DataSource constructor return a subtype (`MdbDataSource` or `XmlDataSource`). That would solve all my problems. Unfortunately, C# does not support that.   2. Use different names:              abstract class DataSourceBase { ... }    // corresponds to DataSource in the example above          class DataSource : DataSourceBase {      // corresponds to MdbDataSource in the example above         [Obsolete("New code should use DataSourceBase.OpenDataSource instead")]         DataSource(string fileName) { ... }         ...     }          class XmlDataSource : DataSourceBase { ... }      That's what I ended up using since it keeps the code backwards-compatible (i.e. calls to `new DataSource("myFile.mdb")` still work). Drawback: The names are not as descriptive as they should be.   3. Make `DataSource` a "wrapper" for the real implementation:              class DataSource {         private DataSourceImpl impl;              DataSource(string fileName) {             impl = ... ? new MdbDataSourceImpl(fileName) : new XmlDataSourceImpl(fileName);         }              Data ReadData() {             return impl.ReadData();         }              abstract private class DataSourceImpl { ... }         private class MdbDataSourceImpl : DataSourceImpl { ... }         private class XmlDataSourceImpl : DataSourceImpl { ... }     }      Drawback: _Every_ data source method (such as `ReadData`) must be routed by boilerplate code. I don't like boilerplate code. It's redundant and clutters the code. Is there any _elegant_ solution that I have missed?


title: How can I multiprocess my program?

text: I wrote a program which scrape internet sites. It is pretty straigtforward because it process link one by one. With the limiting factor of the internet speed, the process is rather slow. I wonder, how can I make it multiprocess? The modules of python is confusing. I don't know the difference between subprocess and multiprocess. I've heard that multiprocessing is difficult and ineffective because of the GIL since python 2.x. I am using Python 3.2, so I wonder if things have been improved.


title: Help with DB Structure, vOD site

text: I have a video on demand style site that hosts _series_ of videos under different _modules_. However with the way I have designed the database it is proving to be very slow. I have asked this question before and someone suggested indexing, but i cannot seem to get my head around it. But I would like someone to help with the structure of the database here to see if it can be improved. The core table is Videos:               ID       bigint(20) (primary key, auto-increment)     pID      text        airdate  text        title    text        subject  mediumtext     url      mediumtext     mID      int(11)     vID      int(11)         sID      int(11)      pID is a unique 5 digit string to each video that is a shorthand identifier. Airdate is the TS, (stored in text format, right there maybe I should change that to TIMESTAMP AUTO UPDATE), title is self explanatory, subject is self explanatory, url is the hard link on the site to the video, mID is joined to another table for the module title, vID is joined to another table for the language of the video, (english, russian, etc) and sID is the summary for the module, a paragraph stored in an external database. The slowest part of the website is the logging part of it. I store the data in another table called 'Hits':               id      mediumint(10)   (primary key, auto-increment)     progID  text     ts      int(10)      Again, here (this was all made a while ago) but my Timestamp (ts) is an INT instead of ON UPDATE CURRENT TIMESTAMP, which I guess it should be. However This table is now 47,492 rows long and the script that I wrote to process it is very very slow, so slow in fact that it times out. A row is added to this table each time a user clicks 'Play' on the website and then so the progID is the same as the pID, and it logs the php time() timestamp in `ts`. Basically I load the entire database of 'Hits' into an array and count the hits in each day using the TS column. I am guessing (i'm quite slow at all this, but I had no idea this would happen when I built the thing) that this is possibly the worst way to go about this. So my questions are as follows:   1. Is there a better way of structuring the 'Videos' table, is so, what do you suggest?   2. Is there a better way of structuring 'hits', if so, please help/tell me! Or is it the fact that my tables are fine and the PHP coding is crappy?


title: The problems with Avoiding Smurf Naming classes with namespaces

text: I pulled the term smurf naming from here (number 21). To save anyone not familiar the trouble, Smurf naming is the act of prefixing a bunch of related classes, variables, etc with a common prefix so you end up with "a SmurfAccountView passes a SmurfAccountDTO to the SmurfAccountController", etc. The solution I've generally heard to this is to make a smurf namespace and drop the smurf prefixes. This has generally served me well, but I'm running into two problems.   1. I'm working with a library with a `Configuration` class. It could have been called `WartmongerConfiguration` but it's in the Wartmonger namespace, so it's just called `Configuration`. I likewise have a `Configuration` class which could be called `SmurfConfiguration`, but it is in the Smurf namespace so that would be redundant. There are places in my code where `Smurf.Configuration` appears alongside `Wartmonger.Configuration` and typing out fully qualified names is clunky and makes the code less readable. It would be nicer to deal with a `SmurfConfiguration` and (if it was my code and not a library) `WartmongerConfiguration`.   2. I have a class called `Service` in my Smurf namespace which could have been called `SmurfService`. `Service` is a facade on top of a complex Smurf library which runs Smurf jobs. `SmurfService` seems like a better name because `Service` without the Smurf prefix is so incredibly generic. I can accept that `SmurfService` was already a generic, useless name and taking away smurf merely made this more apparent. But it could have been named `Runner`, `Launcher`, etc and it would still "feel better" to me as `SmurfLauncher` because I don't know what a `Launcher` does, but I know what a `SmurfLauncher` does. You could argue that what a `Smurf.Launcher` does should be just as apparent as a `Smurf.SmurfLauncher`, but I could see `Smurf.Launcher being some kind of class related to setup rather than a class that launches smurfs. If there is an open and shut way to deal with either of these that would be great. If not, what are some common practices to mitigate their annoyance?


title: Why are F# exceptions generally not suffixed with 'Exception'?

text: In .NET, it is idiomatic to suffix exception types with `Exception`. But most, if not all, sources I have seen for custom exception types in F# don't follow this idiom. Most seem to use the suffix `Error`. From F# For Fun and Profit               exception MyFSharpError1 of string     exception MyFSharpError2 of string * int      From Microsoft Documentation*               exception MyError of string      The book 'Expert F# 3.0', co-authored by Don Syme, has an example that doesn't even seem to follow any idiom:               exception BlockedURL of string      Why don't custom exceptions in F# follow the standard idioms for .NET? Is it because of the OCaml heritage? * Link is to Google cache, as I cannot connect to MS at the time of writing.


title: What is the difference, between a server and a mainframe?

text: To me, it seems as though "mainframe" is a somewhat dated term; is it simply an older synonym of "server," or does it server a purpose more similar to a cluster/supercomputer?


title: What is a good technique to prevent unauthenticated users from accessing controller methods?

text: I have an event(s) controller:               class Event extends CI_Controller{             public function index(){        }             public function foo(){        }             //Shouldn't be able to use this method unless logged in        public function bar(){        }               }      And I'm trying to organise my code so it's fairly tidy and straightforward. Just now I have a controller named `MY_Controller` so that only authenticated users can access the methods(`edit_event()`,`add_event()`) of any controllers extending it. However, some of the methods in my controller need to be accessed by unauthenticated users (such as `get_event()`). What is a good way of handling this? Should I make two completely separate controllers or extend from the basic event controller and add authenticated methods? Previously I've had a manager controller that handled all methods which required authentication such as `add_user`,`delete_user`,`add_doc`,`delete_doc`. But it became blotted very quickly and wasn't easy to update or modify the controller (plus it was messy and didn't seem to follow good programming etiquette).


title: Converting a user management system to use ajax

text: I am currently building a website, which until quite recently was purely PHP. However I am now making trying to have the site use more AJAX, to lessen the page reloads. In PHP I had a lovely object orientated user class with methods for updating data, logging out, and so on. When a user logs on this would be stored as a session variable, and then any page that wishes to do anything the user could just grab it from the session and call it's methods. Clearly this use of php objects and the session doesn't really work with ajax. However I don't want to have to scrap storing the user in an object (which neatens things up somewhat), so don't just want to go down the route of defining a ton of js functions that grab the current username, and use the to do mysql queries through ajax. Am I being stupid here, and what route would people recommend I take.


title: Who Owns an Idea on the Web?

text: Let us say that person "A" mentioned an idea for a software project on the web (ie. in a forum). Person "B" sees this idea and implements it. Can person "A" claim ownership of the idea? Has person "B" done something illegal by implementing the idea that person "A" posted?


title: TDD in JavaScript

text: I'm about to participate in a Coding Kata and I would like to do it in JavaScript. What tools and libraries do I need for TDD in JavaScript?


title: Strategy for avoiding duplicate object ids for data shared across devices using iCloud

text: I have a data intensive iOS app that is not using CoreData nor does it support iCloud synching (yet). All of my objects are created with unique keys. I use a simple `long long` initialized with the current time. Then as I need a new key I increment the value by 1. This has all worked well for a few years with the app running isolated on a single device. Now I want to add support for automatic data sync across devices using iCloud. As my app is written, there is the possibility that two objects created on two different devices could end up with the same key. I need to avoid this possibility. I'm looking for ideas for solving this issue. I have a few requirements that the solution must meet: 1) The key needs to remain a single integral data type. Converting all existing keys to a compound key or to a string or other type would affect the entire code base and likely result in more bugs than it's worth. 2) The solution can't depend on an Internet connection. A user must be able to run the app and add data even with no Internet connection. The data should still resolve properly later when the data syncs through iCloud once a connection is available. I'll accept one exception to this rule. If no other option is available, I may be open to requiring an Internet connection the first time the app's data is initialized. One idea I have been toying around with in my head is logically splitting the integer key into two parts. The high 4 or 5 bits could be used as some sort of device id while the rest represents the actual key. The fuzzy part is figuring out how to come up with non-conflicting device ids that fit in a few bits. This should be viable since I don't need to deal will millions of devices. I just need to deal with the few devices that would be shared by a given iCloud account. I'm open to suggestions. Thanks. Update: After giving this some more thought, I've decided to take the short term hit and do this the right way. Using a GUID is definitely the best long term option for this. Using this approach eliminates the need to do any of the various options to deal with handing out key ranges or translating keys once an Internet connection is made. My original requirement prevented the GUID option because neither SQLite nor iOS support a simple, 128-bit integer type. Since I have a large existing code base that is written such that my keys are simple integer types, it will require a major refactoring of both the code and the database schema. In the end, I've decided that the short term pain of doing this refactoring out weighs the long term issues of dealing with a klunky solution. Taking the hit now gives me a much simpler and less error prone solution that will last the long term.


title: How to add precedence to LALR parser like in YACC?

text: _Please note, I am asking about writing LALR parser, **not** writing rules for LALR parser._ ## What I need is... **...to mimic YACC precedence definitions. I don't know how it is implemented, and below I describe what I've done and read so far.** * * * For now I have basic LALR parser written. Next step -- adding precedence, so `2+3*4` could be parsed as `2+(3*4)`. I've read about precedence parsers, however I don't see how to fit such model into LALR. I don't understand two points:   * how to compute when insert parenthesis generator   * how to compute how many parenthesis the generator should create I insert generators when the symbols is taken from input and put at the stack, right? So let's say I have something like this (`|` denotes boundary between stack and input):   1. `ID = 5 | + ...`, at this point I add open, so it gives   2. `ID = < 5 | + ...`, then I read more input    3. `ID = < 5 + | 5 ...` and more    4. `ID = < 5 + 5 | ; ...` and more    5. `ID = < 5 + 5 ; | ...` At this point I should have several reduce moves in normal LALR, but the open parenthesis does not match so I continue reading more input. Which does not make sense. So this was **when** problem. And about **count** , let's say I have such data `< 2 + < 3 * 4 >`. As human I can see that the last generator should create 2 parenthesis, but how to compute this? After all there could be two scenarios:   * `( 2 + ( 3 *4 ))` \-- parenthesis is used to show the outcome of generator   * or `(2 + (( 3 * 4 ) ^ 5)` because there was more input Please note that in both cases before 3 was open generator, and after 4 there was close generator. However in both cases, after reading `4` I have to reduce, so I have to know what generator "creates".


title: header file to convert speech to text

text: I'm doing a project on speech to text with omap processor in utlp kit. There is an API to record my voice and it converts my voice to pcm and is stored in a buffer. I have a few English words which I've recorded and converted into an array now I wanted to know how to compare the spoken word in the form of pcm with the array I have created. Or is there any header file or is it possible to `cprint` the pcm as a text.


title: initializer_list combined with other parameters

text: Suppose I have a class which takes a parameter of type `T` and a collection of parameters of type `U` in the constructor. The following solution works:               struct Q     {         Q(T t, std::initializer_list<U> us);     };      Creating an instance of this class would then be: `Q q {t1, {u1, u2, u3, u4} };` But this looks kind of unclean to me. Is there a better solution than this one?


title: Is good Grammar a prerequisite for your development team?

text: I understand that this may be primarily opinion based, but I also think it is an interesting question and would like to hear others' viewpoints on the subject. I recently became the senior developer for a large company, and inherited what I can only describe as a less-than-adequate code-base. Whilst I won't go in to detail as to why most of it was terrible, something that _did_ stand out, was the huge amount of spelling errors. One of the more notable ones, was "Actual" spelled "Acutal". This was pervasive in functions, classes, stored procedure names, and column names. To me, this is a clear indication of lack of care and due diligence with respect to ones' work. I believe that if code is littered with these kind of things, the programmer in question is not paying attention. I understand there is a caveat if the programmer in question is perhaps not a native-English speaker (in this case, they were) - but simple code reviews should pick these things up. As developers, we spend a lot of time making sure that our work is functionally correct, optimal without over-optimising, and finally - easy for another person to pick up and work with. Code that is littered with spelling errors is a sign (given the caveat mentioned above), that the programmer is not paying attention and that those errors might also indicate a lack of understanding of the problem being _solved_. Much the same way that any spelling errors on a CV is an instant red-flag situation. What do you guys think of this? Should we be bothered about English grammar within the code-base? Does it matter? Is it indicative of the attention-span of the developer, or is there no correlation that could be reliably drawn? (Note: I understand people do program in other countries, and I have used English as an example here. I also respectfully understand that someone whose first language was _not_ English may find it difficult. This question is aimed at those who _should know better_ )


title: Can I consider interface methods as abstract methods?

text: I was thinking about that, and I had some doubts. When I declare an interface, for example:               public interface MyInterface     {        public void method1();        public void method2();     }      Could these interface methods be considered abstract? What I mean is that the concept of an abstract method is: > An abstract method is a method that is declared without an implementation > (without braces, and followed by a semicolon). So, could these methods be considered abstract? They are not "pure" abstract methods as I'm not using the `abstract` word, but conceptually, it looks like they are. What can you tell me about it? Thanks.


title: Uses for System.gc() in Java

text: In Java, there is a method called `System.gc()`, which calls the garbage collector (or rather, "suggests" to the JVM to run the GC). Are there valid reasons to call this method? I'm thinking that it would be evident of bad software design.


title: Avoiding IllegalStateException in MVP when view is not ready yet

text: In an effort to improve my coding skills I am trying to make use of the MVP pattern in one of my first Android applications. It is going well but I have hit one issue that I am not sure what is the "proper" way to deal with. I have a View class that contains a Google Map object. It also contains a "spinner" that allows the user to select among a number of modes for centering the map.   * case 0 is center on a particular user marker   * case 1 is center on the center of the group of markers When the user selects one of these modes the presenter is notified and depending on the mode, works with the model to figure out what new center of the map should be and then tells the View to recenter the map. The problem is that when the device is rotated the whole "system" is restarted and one of the first things that happens is the android system sets the spinner to the state it was in before it was rotated. This triggers the recenter method which tries to recenter the map before it is ready. My quick fix for this was to check something in the Model class that should only be true if the map is ready, i.e. there are markers that should have been displayed already.               public void centerOnModeSelected(int position) {         centerOnModeIndex = position;         if (mMapMarkers.size() > 0 ) recenterMap();          }      What I am planning on doing is this: In the presenter constructor, I would have a field               private Boolean mapIsReadyForUpdates = false;      and a method               public void setMapIsReadyForUpdates() {          mapIsReadyForUpdates = true;     }      and then I would have the View call that method after it has added some markers to the map, or whenever I can be sure It is ready to accept the methods that are currently generating the exceptions. I guess the other option is to hold that state in the view itself and then block the calls to the map object based on the view's state. My current methodology is to not have the view maintain state, the presenter is maintaining the state. I am assuming others have dealt with situations in MVP were a view my not be in a state were it can accept calls to particular methods. Can someone help me understand the trade-offs with my 3 solutions, or suggest a better solution? My "quick fix" works, but seems like a hack. If there are no markers there is no need to recenter the map, but the fact that markers exist does not mean the map is ready to be updated either. **UPDATE** Since the presenter completely controls the view, it knows when the map is ready to be updated, so all I needed to do was to create a field in the presenter (as mentioned above), and then set it to true, once I was sure I created the map in the view. Then check that field before calling any methods that would try to update the map. I guess this makes perfect sense for the MVP pattern.


title: How should I bring my C++ back up to date with modern developments?

text: How should I bring some very rusty C++ up to date, as I'm sure the language and best practices have evolved? I realise this might be close to being off- topic so let my clarify some details. About 10 years ago I think I was quite a good C++ programmer, I'd devoured the Scott Meyers books, I could solve the puzzles in the lint adverts in Dr. Dobbs. I was probably a bit of a language lawyer. I've been programming mostly Java, some python for the last 10 years so my OO skills are still up to scratch. But having joined a company where C++ is common I've realized I have to admit to myself I am both really rusty, and there are language features now which are either new or a lot more common than I remember - things like namespaces etc. I realise reading and writing code (especially pairing) is a good way to get up to speed, but is there any other resource people would recommend in this to give me an accelerated head start. Book? Web-page? Tutorials? To summarize:   * Recommendations for C++ specific refresher resources?   * Not OO/programming generally.   * Things in addition to just reading and writing code.


title: Are there any reasons not to use distributed version control in a corporate setting?

text: > **Possible Duplicate:**   >  What does SVN do better than git? In an effort to push coworkers toward a distributed VCS, I'd like to first understand why it is **not** a good change from a practical perspective. Why might a centralized VCS be preferred over a distributed one in a corporate setting?


title: if you were asked to answer to the question " what is the difference between the English language and a programming language" how you will respond?

text: Basically in both cases you have:   * a well defined vocabulary   * a syntax to respect   * they both can express a business logic   * they can define semantics I don't think that will be fair to say "A programming language is only useful for a PC" or something like that. I just can't find a real answer, but we can feel the difference, it's strange.


title: ORM has schema to generate classes, does the reverse exist?

text: In Entity-Framework, you can create a DB schema, and then generate your ORM classes. Is there any software that does this in reverse? For example you create a few classes that have relationships, and software generates a database schema with the relevant primary and foreign key relationships?


title: For a Javascript library, what is the best or standard way to support extensibility

text: Specifically, I want to support "plugins" that modify the behavior of parts of the library. I couldn't find much information on the web about this subject. But here are my ideas for how a library could be extensible.   1. The library exports an object with both public and "protected" functions. A plugin can replace any of those functions, thus modifying the library's behavior. Advantages of this method are that it's simple and that the plugin's functions can have full access to the library's "protected" functions. Disadvantages are that the library may be harder to maintain with a larger set of exposed functions and it could be hard to debug if multiple plugins are involved (how to know which plugin modified which function?).   2. The library provides an "add plugin" function that accepts an object with a specific interface. Internally, the library will use the plugin instead of it's own code if appropriate. With this method, the internals of the library can be rearranged more freely as long as it still supports the same plugin interface. This could also support having different plugin interfaces to modify different parts of the library. A disadvantage of this method is that the plugins may have to re-implement code that is already part of the library since the library's internal functions are not exported.   3. The library provides a "set implementation" function that accepts an object inherited from a specific base object. The library's public API calls functions in the implementation object for any functionality that can be modified and the base implementation object includes the core functionality, with both external (to the API) and internal functions. A plugin creates a new implementation object, which inherits from the base object and replaces any functions it wants to modify. This combines advantages and disadvantages of both the other methods.


title: What languages should I know if I'm interested in building web applications?

text: I'm interested in developing for the web and I'm curious what languages should I know besides html, css, javascript, php/python/ruby. I don't know much about c# or java to make a decision whether to learn them or not, are they used much in the field I'm interested in? What other technologies should I look into ?


title: What are technical writing principles?

text: As a programmer, technical writing is an important skill to me. I get a lot of fun from it. I also learned from some good technical articles and books. What I need are technical writing principles or rules to refresh my mind. Any relevant article, tutorial, and presentation are welcome, and your own experience will also be great!


title: How to properly deprecate methods in Java?

text: Today I lost a method that I was using since my co-worker redefined it to take its superclass instead. So after synchronizing with the repository I had trouble. Would it had been better in this case to use some annotation like `@Deprecated` instead of removing the method so that I would get an error message telling my that the method was deprecated? Can a version control system or an IDE work around situations like this by deprecating methods instead of deleting them?


title: How do I know if I am using Scrum methodologies?

text: When I first started at my current job, my purpose was to rewrite a massive excel-VBA workbook-application to C# Winforms because it was thought that the new C# app will fix all existing problems and have all the new features for a perfect world. If it were a direct port, in theory it would be _easy_ as i just need to go through _all_ the formulas, conditional formatting, validations, VBA etc. to understand it. However, that was not the case. Many of the new features are tightly dependant on business logic which I am unfamiliar with. As a solo programmer, the first year was spent solely on deciphering the excel workbook and writing the C# app. In theory, I had the business people to "help" me specify requirements, how GUI looks and work, and testing of the app etc; but in practice it is like a contant tsunami of feature creep. At the beginning of the second year I managed to convince the management that this is not going anywhere. I made them start from scratch with the excel-VBA. I have this "issue log" saved on the network, each time they found something they didn't like about the excel-VBA app, they will write it in there. I check the log daily and consolidate issues (in my mind) mainly into 2 groups: (1) requires massive change. (2) can be fixed in current version. For massive change issues, I make a copy of the latest excel-VBA and give it a new version number, then work on it whenever I can. For current version fixes, I make the changes in a few days to a week, and then immediately release it. I also ensure I update the same change in any in-progress massive change future versions. This has gone on for about 4 months and I feel it works great. I made many releases and solved many real issues, also understood the business logic more and more. However, my boss (non-IT trained) thinks what I am doing are just adhoc changes and that i am not looking at the "bigger picture". I am struggling to convince my boss that this works. So I hope to formalise my approach and maybe borrow a buzzword to confuse him. Incidentally, I read about Agile and SCRUM, about backlog and sprints. But it's all very vague to me still. **QUESTION (finally):** I want to tell him that this is SCRUM! But I want to hold my breath first and ask whether my current approach is considered SCRUM or SCRUM-like? How can I make it more SCRUM-like? Note that I have only myself, there's no project leader or teams.


title: Review before or after code commit, which is better?

text: Traditionally we performed code review before commit, I had an argument with my colleague today, who preferred code review after commit. First, here's some background,   1. We have some experienced developers and we also have new hires with almost zero programming experience.   2. We'd like to perform fast and short iterations to release our product.   3. All team members are located at the same site. The advantages of code review before commit I've learned:   1. Mentor new hires   2. Try to prevent errors, failures, bad designs early in the development cycle   3. Learn from others   4. Knowledge backup if someone quits But I've also had some bad experiences:   1. Low efficiency, some changes may be reviewed over days   2. Hard to balance speed and quality, especially for newbies   3. One team member felt distrust As to post-commit review, I know little about this, but the thing I'm most worried about is the risk of losing control due to lack of review. Any opinions? **UPDATE:**   1. We're using Perforce for VCS   2. We code and commit in the same branches (trunk or bug fixing branches)   3. To improve efficiency, we've tried to split code into small changes. We've also tried some live dialog review, but not everyone followed the rule. This is another problem though.


title: How to find a programming mentor?

text: I decided to learn programming. I've been reading SO for few days, and I think I will start with C++, as I read some articles. I am aware of loops, arrays, program logic and objects a little and I need someone to look me over and help me with small questions I get when doing my first projects. So here is the question - where do I find such guy? I don't got any friends who program and all. EDIT: 2 years later, I am still looking for mentor. I did not actively code just started 3 months again. I work on Objective-C and iOS programming and game programming with Cocos2d. If you want to become my mentor, drop me a or comment.


title: Finding a Programming "Mentor"

text: > **Possible Duplicate:**   >  How to find programming mentor? I've been programming for a while. I've read several books, have tried out several languages (Perl, Ruby, Python, C++, .NET, HTML, CSS, JavaScript, SQL), and have taken tons of advice and I feel like I have greatly progressed, fast. But I feel like I would've learned more if I had a mentor. Well... not a tmentor. More of someone that can guide me, and somebody that I can ask if I had a problem. Yes, StackOverflow is great, Programmers-SE is amazing, and there are huge community's for languages, but it isn't the same as having a "mentor". So, where can I find one? Like I said, I'm not looking for someone who will teach me everything, or somebody who I will have to meet once a week. Just emails here-and-there. Nothing major. Of course I would _like_ it to be free. But where and who? Is there a website or organization that can help me? Somebody you know? Thanks so much!


title: Do all programmers going through a steep learning curve?

text: I don't have many peers who work as a programmer or at least who are social enough to share some parts of their precious knowledge, so I have little to none to compare with. I tend to learn new things by myself, but each time I started to learn A, it got hooked up with B, which ends up hooked up with X, etc. In the end, I learn almost nothing but that programming for a newbie is painful. The first part of the learning curve seems insanely steep for a beginner like me which at some point seems to be irrelevant. Am I a bad programmer to have experienced this? Or is there a fellow programmer out there who has experienced this and survived, and care enough to share how? Edit : Since it marked as duplicate, I checked the question link given. The only thing that is similar between my question and the given one, is we both is quite alone in our programming field. But what I asked is this, is all programmer going through this steep learning curve? And if they do (which means I am not necessarily a bad programmer), how do they survived through it?


title: Defining a standard

text: How would you go about defining a standard? I am defining a protocol for a sort of thing that does not exist yet and I would like to create an RFC for it, and use a well-known port number provided by IANA. How do I start?


title: How to explain programming to a non-programmer?

text: > **Possible Duplicate:**   >  How do you share your craft with non programmers? I tend to think that I might get such a question in the future... How should I answer to it in layman terms?


title: What to teach a 12-year-old VB programmer about programming in general

text: I am mentoring a 12-year old in programming. He has started to do some VB (.net) (2008) and is making simple WinForms programs, but does not get some of the basic concepts (loops, functions, datatypes) Coming form a C/C++ background, I don't know where to start I don't think he's is up to c/c++ or java quite yet


title: How do you portray to non programmers what programming involves?

text: I get casually asked a lot to take a couple days to teach someone how to program. Most people really think they can learn what I know in a few days. When I tell them I have been doing this for many years and I can't teach them to be a programmer in a few days, they look at me like I am being a jerk and just don't want to help them. I think this is because when I say I am a programmer, or I programmed _this_. I truly think most people do not realize that I mean I wrote the code that makes it up. I think that they think I mean I configured it, like when you say, "I programmed my VCR." Does anyone else think this? Whats your experience?


title: I have a hard time explaining what I learn

text: > **Possible Duplicates:**   >  How do you share your craft with non programmers?   >  How to explain programming to a non-programmer?   >  How do I become more articulate? I love programming and I like to learn everything I read about the subject. However, I'm having a hard time explaining what I've learned to someone who does not know anything about programming or even to a fellow programmer. There is a quote by Albert Einstein that goes something like this:                If you can't explain it to a six year old, you don't understand it yourself.       or                If you can't explain it simply, you don't understand it well enough.      Does anyone else find themselves in the situation I'm in? This can also affect my job interviews; when someone asks me to explain some concepts that I know but can't put it well enough in words, they might think I'm not well prepared when in fact I am but I'm crippled by my inability to explain myself. How can I overcome this and be more articulate?


title: How do you share your craft with non programmers?

text: Sometimes I feel like a musician who can't play live shows. Programming is a pretty cool skill, and a very broad world, but a lot of it happens "off camera"- in your head, in your office, away from spectators. You can of course talk about programming with other programmers, and there is peer programming, and you do get to create something that you can show to people, but when it comes to explaining to non programmers what is it that you do, or how was your day at work, it's sort of tricky. How do you get the non programmers in your life to understand what is it that you do? NOTE: this is not a repeat of Getting non-programmers to understand the development process, because that question was about managing client expectations.


title: Can Dependency Injection used as an alternative to Reflection for creating instances

text: There is a piece of .net C# code which use Reflection to create an instance using `Activator.CreateInstance()`. This is an old piece of code and runs on the top of Enterprise Library. Is it a better idea to replace this with Dependency Injection to create objects? Is there any Pro's and Con's for either approach?


title: LUA vs Shell scripting vs C for cgi-scripting on embedded devices

text: I am going to try CGI scripting for implementing a web based Graphical User Interface on an embedded device. What advantages does LUA scripting have over shell scripting or C for implementing dynamic HTML files? Which one do you think is easy-to-use from developer's perspective. My GUI will comprise of some form based HTML pages. Some times, I would like a C program to run corresponding to an action performed on the GUI and then display result of the program to the user on GUI. Will shell scripting suffice in such a scenario or will I 'have to' use LUA? I have some experience with shell scripting actually.


title: VPN or TLSv1 for securing a programs protocol from field device to mainframe

text: I am working on a product that requires devices to exists anywhere in the world hooked up to the internet though cell modems or on WLAN lines which communicates to a server(s) that exists elsewhere in the world. _When deigning the networking portion of the program i cant figure what the best option is for securing the communication between the server and end device._ From my searches iv'e come up with two options. **Option 1:** _Using a host to host vpn connection between the two devices._ **Pros:** VPN software seems to be well tested and does not require extra programming for the network protocol. The IT department is more comfortable with it because of using software that is already tested and they comfortable with vpn. **Cons:** Since my end devices are linux on OMAP platforms cross compiling the vpn software if not already done could be tricky. Dealing with firewalls and routers behind the end devices network. Setup of the connection can be tricky. **Option 2:** _Implementing the TLSv1 protocol in my program to deal with the encryption._ **Pros:** Does not require extra software to be running on the device. Only relies on the encryption libraries as a dependency. Don't have to worry about dealing with nats and firewalls because the protocol will only require one tcp port to be open. **Cons:** Extra coding to the network software. IT is skeptical because our program is responsible for securing the protocol. **FYI:** For implementing the TLSv1 i would use http://www.gnu.org/software/gnutls/


title: What should be done on git while migrating new distribution and packet manager?

text: In the project I am working, we are using Freebsd and we are creating our software packages for it. Now we are planning to change distribution to Centos and rpm for packet manager. Since our codes are not platform independent, we have to make many change on it. Also we will continue to use freebsd until migration is completed. What is the best git usage way for this type of migration. Should we use a new branch or a new repository?


title: Softpedia published some of my open source projects — how to react?

text: _(FYI: I've just moved this question over from Stackoverflow on recommendation.)_ I just received a few emails, informing me that softpedia.com has added some of my "products" to their "database of scripts, code snippets and web applications". My products are in this case some smaller open source projects, which I have hosted and published on github. Now I'm wondering how to react to this. This site is indirectly making money of my free work through ads on three pages before the actual download. They also seem to "invent" version numbers and I can't find out if they're hosting the latest or all versions of my projects. — I can see how this could lead to problems in the future, since I don't control what's "the latest" everywhere. On the other hand I don't mind some extra publicity. I want as many people as possible to know about the projects, use them, fork them and hopefully improve them. The projects in questions are really fairly small, but this might not be the case in the future for me and/or other people reading this question. I'm sure that this must have happened to others around here. What's your opinion? Should I try to get the downloads removed? * * * **Update 1** I've requested the removal and mentioned that I don't feel that Softpedia can provide the right environment for this kind of project. Their team got back to me instantly with a friendly email saying, that they'll remove the links for now: > If you are worried that your projects won't be updated, then I must tell you > that I have them bookmarked in my RSS reader, so any version changes will be > forwarded to me when needed. So I promise I'll keep your script up to date > as soon as I see an update in the repository. I have to say, that I appreciate this kind of reaction quite a lot and so I sent them another email, describing in more detail what I'm worried about and what bothers me. I also stated, that I'm aware that my license clearly permits them to host the projects in any case, but that I'd be even happy if they would host the projects as long as they could convince me of a few details and maybe make some small changes to the way the projects are represented. — Let's see where this goes. * * * **Update 2** After discussing with their contact and requesting some changes regarding display of version (they had given the possibility to do so) and authorship they put the projects back up on their site. All in all a positive and definitely interesting experience.


title: Advice sought: highly technical app idea - do I employ someone or do it myself?

text: I'm a TV producer in London but also an enthusiastic amateur coder and web designer. I started with VB6 and then moved onto C/PHP/Obj-C. I've got a couple apps in the app store, I mess around a lot with Arduino, create php CMS from scratch - but I've certainly never worked professionally as a coder. I've got an iPad app idea which I'd like to spend time and money, but it involves animation and modelling, creating a timeline UI, working with multiple camera views. Put simply, it's a complex OpenGL app, well beyond my skills. _To be clear, this isn't a zombie slasher or fantasy adventure clone - it's an app I know that thousands of well-paid TV industry pros and media students would want to spend money on._ I'd like to know from those with experience of taking a complex app from idea to delivery, whether themselves or through a dev agency, if you genuinely believe an app is worth building should you spend 12 months learning the skills and hacking early versions together - or should you get serious and employ people with money raised from various sources. Perhaps a Kickstarter? With the latter in mind, what is a reasonable amount of money you would pay for a pair of programmers to achieve this, in say six months? Standard pay for a competent opengl coder? It may well be a case of using out-of-uni programmers and splitting the company with them, plus modest expenses. I think I'm in a fortunate position that I can at least contribute to the project, through graphics, audio, marketing - just not the real heavy stuff. Any advice genuinely appreciated, Mike.


title: Django application strategy

text: I have been working a while on a Django project which has been growing a bit lately. I have been think a bit about what strategy to use to make it easier to handle. One thing I would like to get some input on would be if I should split my application into several smaller applications. That would make my view and model files smaller and separate some of the concerns. One thing that bothers me with this is that in my applications I would have several helper methods that will be used across applications. Also some models will also have to be shared/used across applications. Would this make sense? This doesn't go well with the separation of concerns I was hoping to achieve by splitting my app in several smaller apps. What would be a good approach for sharing helper methods, models etc. across applications?


title: What degree of low-level programming can be achieved with Languages like Go?

text: Go and D provide garbage collection, and yet they claim to be system programming languages. What degree of low-level programming can be achieved with languages having garbage collection? For low-level programming, I mean close to the hardware or being able to:   1. Runs directly in limited memory, with no latency, and performs well. An example would be operating system kernels.    2. It runs on a software base, but still has to perform well. An example would be system utilities.


title: Why this code create object as interface?

text: In am reading Spring in Action (3rd edition) and here a snippet from it:               ApplicationContext ctx=new ClassPathXmlApplicationContext("springidol.xml");                 Performer performer=(Performer)ctx.getBean("poeticDuke");                 performer.perform();      It doesn't has any problem,however, when the author introduce the init-method and destroy-method:               <bean id="poeticDuke"             class="com.springinaction.springidol.PoeticJuggler"             init-method="turnOnLights"             destroy-method="turnOffLights">      Somehow the output only got the init-method but not the destroy-method. Then I realized that the context call destroy-method upon its close and I tried to code as following:                   ApplicationContext ctx=new ClassPathXmlApplicationContext("springidol.xml");                     Performer performer=(Performer)ctx.getBean("poeticDuke");                     performer.perform();     ctx.close();      It doesn't compile because the interface ApplicationContext doesn't have the method close. It only work as following:               ClassPathXmlApplicationContext ctx=new ClassPathXmlApplicationContext("springidol.xml");                     Performer performer=(Performer)ctx.getBean("poeticDuke");                     performer.perform();     ctx.close();      Why did the author wrote it that way?


title: Accurate calculation of a raster image's boundary length

text: I have a rasterized image that contains two colors: white and black. The black portion is entirely connected and looks like a big blob. Is there a good way to estimate the length of the boundary between the regions? One method I have considered is to simply count how many "edges" of the rasterized grid have a different color on each side. However, for e.g. a purely diagonal line, this will overestimate the distance of the boundary by a factor of sqrt(2). Is there a better method for estimating the boundary length which does not have this problem?


title: Should I use JavaFx properties?

text: I'm usually very careful to keep my Model, View, and Controller code separate. The thing is JavaFx properties are so convenient to bind them all together. The issue is that it makes my entire code design dependent on JavaFx, which I feel I should not being doing. I should be able to change the view without changing too much of the model and controller. So should I ignore the convenience of JavaFx properties, or should I embrace them and the fact that it reduces my codes flexibility.


title: Is creating database index part of design, implementation or optimisation process?

text: There are a few questions around this subject:   * Is creating all indexes at the start (design) over engineering?   * In reality, I've added indexes after performance issues were found and we 'explain plan' and add indexes as needed (i.e. not for all relationships). Should I just skip creating indexes before it's needed because performance issues will show up anyway and probably the indexes that's already been created aren't being used?   * Should indexes be treated as part of requirement/specification? Sometimes I see performance requirements, which is usually vague or random. If they're part of specification, then should managing indexes be part of implementation? I want to make it a bit clearer and more background. In development, usually the different phases involve different kinds of people (e.g. architects, seniors and juniors). It'd be unusual for juniors to be responsible for the design, for example. So, when some tasks overlap, it becomes unclear who's responsible if, for example, a query takes 2 second. Defining development phases and responsibilities are also important for non- programmers, e.g. project managers or product owners, because they are needed for planning and costing. A project manager might want to higher an architect to do all database related task only at the start and for a short time. If after product launch, it's found that performance is poor, the PM would like to know who's responsible. I hope you get the idea.


title: How do you let a user choose the app database location?

text: Writing software for a client, and one of their requirements was that the user be able to specify where the application database is stored, be it on the local network or in an online repository. I can let them choose where to put it, but how do I store that information in the application? I guess I don't understand how to persist changes in an application that is already deployed. This is my first piece of software, so I've never been through the deployment process. Written in C# for Windows.


title: What metrics should be used to measure memory consumption of a program for performance test?

text: I am asked to provide performance statistics for a program, one of them being memory consumption. I noticed that in perfmon or in .NET API there is apparently many variable related to memory usage, such as private bit, working set, page file, etc. What are the difference, and which one should we use for measuring performance? If the vendor claims that the memory consumption of the program is improved in version X, what value can be used to validate this?


title: Drawbacks to entirely Ajax driven CMS

text: I'll try to keep this question as specific as possible.. I'm about to start building an API for an upcoming project. I'm currently thinking PHP/Symfony2. It will be a farily simple HTTP-based api for CRUD on the site's models (and relationships between them). There will also need to be a CMS for users. Traditionally when building a CMS (if it's bespoke) I'd just use some standard MVC based approach, but for this particular project I'm thinking I could build it using Ajax calls to the API that will already exist. My question is essentially to decide which way to go, but to keep it specific I'd like to know what drawbacks there might be. In favour of this, it should reduce duplication of controller logic, why have `/api/model/save/` and `/cms/model/save` doing very similar things? Currently the only two drawbacks I can think of are that:   * It may be hard to support a wide range of browsers. For this particular scenario, this shouldn't be a problem - but who knows what might happen in the future?   * Some parts of the site would require traditional PHP logic or an extension to the API (for any parts not part of the core API itself), for example to handle admin authentication. Is there anything I've missed, some overwhelming reason not to take this approach?


title: How to find a scaling expert?

text: The web application is in ASP.NET and Sql Server and is growing much faster than anticipated. Where can I find an expert who has previously had experience of going from a small website to solution used daily by thousands? Someone who can review our system and give us advice on performance improvements and updating our coding practices.


title: Linux kernel development

text: I am trying to understand the linux kernel and there is one thing that is puzzling me for quite a while. As linux is used across variety of platforms (like smartphones,desktop,supercomputers etc) and also on various architectures, so does the same kernel code is used by all or a different one and also since it includes some assembly codes so it must be architecture specific. so do the developers in linux community apply patches to a single kernel or there are multiple versions of kernel each for different architecture and platforms?


title: What is the most elegant way to handle a loop between two systems integrated remotely by webhook events?

text: So I'm developing this small engine that does a remote integration between two systems in order to sync data, both systems have webhooks for create & update events, and both have APIs (one is REST one is XML), so it is an event-based integration rather than a typical batch one. My problem is that if System A creates an entry and fires a webhook that the engine catches, if the engine doesn't find it, then it creates a comparable entry in System B which triggers a create webhook, which then the engine catches as a new request... and you see my problem. Same scenario could happen for an update webhook (actually this one is more likely to happen). I'm guessing I'm not the first person on the earth to encounter this problem, so I'm wondering what would be an elegant way of handling this given that I cannot modify the APIs, nor inject custom metadata in the messages that could help me catch the loop. FYI, the integration is between two issue tracking systems.


title: What exactly is the build number in MAJOR.MINOR.BUILDNUMBER.REVISION

text: What I think about Build Numbers is that whenever a new nightly build is created, a new BUILDNUMBER is generated and assigned to that build. So for my 7.0 version application the nightly builds will be 7.0.1, 7.0.2 and so on. Is it so? Then what is the use of a REVISION after the build number? Or is the REVISION part being incremented after each nightly build? I am a little confused here... do we refer to each nightly build as a _BUILD_? The format is mentioned here: AssemblyVersion - MSDN


title: Should I go to a job interview even though I know I won't get it?

text: Here is the opportunity I've been given. I'm currently a freelance web developer and completely self-taught. I have but an NVQ in Business Administration. However, I am passionate and committed to programming and building websites and applications, of which I've been doing for a good 3-4 years. Instead of being offered an interview, I've been offered a day trial for what could turn into a 6 month contract. The pay is good, but I'm more thirsty for the commercial experience. Thing is, I know there are gaps in my knowledge. I lack fundamental programming concepts, I never studied computer science and I use google to find optimal solutions to problems I come across. I feel more experienced programmers in the team will see this almost instantly. But will they sympathize having hopefully been at my level once? I'm thirsty to grow and I've spent a good 15 hours a day working in web development and honing my skills - but they are very particular. I know html, css, javascript, jquery, ajax, php, git...I'm a good developer but I don't think I'm good enough for someone to pay me £100/day. The way the trial works is during the first half of the day I am introduced to the team and the different departments. During the second half, in the afternoon, I am given a 'live task', a duty I'd perform if I'd be working there. I already know in advance it has something to do with converting a word document into html using php..it seems like they are trying to bend the language to do something it isn't meant to do, and the first place I'd start is Google to research php libraries. Advice? Should I go even though I know I probably won't make it past the first day and probably embarrass myself, just for the experience? Will this help me grow as a programmer? I don't want to waste people's time. I will still give it my all. Appreciate input from people who have been in similar situations.


title: how to deal with clients who don't know any programming skills

text: Have you ever handled a Client who doesn't know anything about programming or no technical skills who doesn't even know how to turn on a Computer? What he only have is the idea, which is a great one, but doesn't know how to implement it so he hired some programmers to implement his idea. Some over excited programmers likes the idea and eager to implement it without thinking of any possibilities that a problem might occur. Now both parties (Client and developer) have agreed on something after plotting a timeframe of the project and benifits. And then there comes the part where you are almost finish the project, and your client comes across with another idea and wants to implement it. And as a developer you know the possibilities of implementing that, and you found out that it would destroy 50% of what you've done and needs to extend the timeframe for atleast 50% of the one you agreed on. As for the clients side, it is just a little feature that needs to be added, and because I'm nearly done with everything, he thought it is just a brick that needs to be placed on the wall, unfortunately that brick is in the middle of the wall.


title: 100K curl requests

text: I am using curl_multi_exec to process over 100K requests. I do 100 requests at a time because curl_multi_exec can only handle 100 requests at a time to eventually get to 100K requests. We have added multiple servers to this system to spread the load [we are using load balancing]. What is the best way to have curl handle 100K requests and make use of these additional servers? What is the downside (other than time) of handling that many requests on one server? How can I use the additional servers to help handle those requests? I was thinking about having each server handle a batch of requests (like one server handles 500 requests, another 500, another 500, etc.. To elaborate- basically, we are using curl to send out over 100K requests to third party servers. The problem with only using 1 server is that there is a memory limit in the number of requests 1 server can handle. So we decided to add additional servers, but we are not sure how to design this system to use curl to handle that many requests.. The third party server is an API like Facebook; they are aware that we will be making that many requests to their servers. For load balancing, we use Rackspace cloud server, basically the load balancer directs incoming requests to separate servers.


> **Possible Duplicate:**   >  Whats the difference between a Software Architect, a Software Engineer, and > a Software Developer (Programmer)? I have had many discussions about the role of a software architect and did not reach a conclusion. So I decided to change the question. What the difference of Skills between a Dev Senior and a Software Architect?


title: Whats the difference between a Software Architect, a Software Engineer, and a Software Developer (Programmer)?

text: I'm reading through the CNN article about the highest paying jobs in America. A software architect is listed as #1. A software engineer listed as #9. And a software developer (programmer) is listed at #35. I think it's valid to replace computer scientist with programmer, right? Prior to this I always saw "Software Engineers" as being the title for experienced programmers and team leads. But where then does a "Software Architect" fit in and what exactly do they do? I read the CNN descriptions but they don't really satisfy me so I'm assuming I can get more thorough and experienced descriptions from the awesome user base here. Thanks in advance for any and all responses received.


title: "Do it right, against customer's wishes" - how is it called?

text: We know the optimal situation of negotiating corrections of specifications with the customer, getting the specs to do what the client wanted, not what they said or thought they wanted. That's negotiating, explaining. Sometimes, we're unable to convince the client. We're forced to produce broken as designed. This, called "demonology" by merit of mages summoning demons and demons fulfilling their wishes very literally, causing the mage's demise as result, is another approach that will leave the customer very dissatisfied once they realize their error, and of course try to pin the blame on the developer. Now I just faced a very different approach: the customer created simple specs that fail to account for some critical caveat, and is completely unwilling to fix them, admit the obvious errors and accept suggested corrections. The product made to these specs will be critically broken, and possibly might cost human lives. Still, it's too late to drop the contract entirely. The contract has punitive clauses for that, ones we can't really accept. The boss' decision? We do the work right and lie to the customer that we did it according to the specs. The algorithms in question are hidden deep enough under the surface, the product will do the work just fine, won't fail in the caveat situation, and unless someone digs too deep, they will never discover we didn't break it as requested. Is there some common name for this tactics of execution of specs?


title: Display large amount of data to client through pagination

text: I have a web application in which i need to show a big number of data or records for clients. Now i 'll use pagination but i was wondering should I:   1. Load all the data once then pagination, sorting and sarching 'll be easy..But it 'll takes big time(using local DB it takes up to 9 sec.)   2. Or each time i show new page(from the pagination) i make a new request to server and then new request to DB to get the next records..But then what if the client click on `Prev` button, i 'll make a new request to get data that I had previously..Should i cach data that are loaded before and how if that's good technique?  So load all data once or make a new request every time i need data that maybe have been loaded before. I'm using ASP.NET MVC SPA with durandaljs and knockoutjs


title: Who is responsible for the development of Java?

text: When I google about Java, the companies most mentioned are Sun, Oracle and IBM. I know that Oracle bought Sun, and the Java official website is Oracle domain, so I can assume that Oracle is the official Java developer. But after a little research, IBM also provides many tutorials and documents about Java. Why is this? Is IBM also involved in some development of Java?


title: audio and video data in RTP

text: Suppose a user wants to transmit both audio and video to another user, whose formats are AMR for audio and H.264 for video. Does the user have to transmit audio and video packets always separately? Meaning that it is not possible to mix audio and video within the same RTP packed, is that correct? If this is true I guess the RTP protocol will need to know the SSRC of both audio and video to be able to check the sync of the two streams.


title: Compound container for storing output from a parser

text: Consider a hierarchical structure like this               directory         [              [item_0;item_1;...;item_n]              [item_0;item_1;inner_directory[...];item_m]              other_directory                  [...]         ]      A directory contains   * An array of strings (delimited by ';' in input data)   * A map from name to sub-directories (the name of the directory is followed by '[')   * An array of unnamed sub-directories The directory can be described by this class:               class Directory         {         public:             //Appropriate operations         private:             std::vector<std::string> items;             std::map<std::string, Directory> named_dirs;             std::vector<Directory> unnamed_dirs;         };      However:   * The Directory class requires three sets of operations, resulting in a large class definition   * A copy operation will be recursive Can the data be stored in a better way avoiding at least the first point?


title: On mobile is there a reason why processes are often short lived and must persist their state explicitly?

text: Most mobile platforms (such as Android, iOS, Windows phone 7 and I believe the new WinRT) can kill inactive application processes under memory pressure. To prevent this from affecting the user experience applications are expected to save and restore their state as their process is killed and restarted. Having application processes killed in this way makes the developers job harder. On various occasions I've seen a mobile app that would:   * Return to the welcome screen each time I switch back to it.   * Crash when I switch back to it (possibly accessing some state that no longer exists after the process was killed)   * Misbehave when I switch back to it (sometimes requiring a restart or tasks killer to fix)   * Otherwise misbehave in some hard to reproduce way (e.g. android service killed and restarted at the _wrong_ time) I don't really understand why these mobile operating systems are designed to kill tasks in this way especially since it makes application development more difficult and error prone. Desktop operating systems don't kill processes like that. They swap out unused pages of memory to mass storage. Is there a reason why the same approach isn't used on mobile? Mobile hardware is only a few years behind PC hardware in term of performance. I'm sure there are very good reasons why mobile operating systems are designed this way. If you can point me to a paper or blog post that explain these reasons or can give me some insight I'd very much appreciate it.


title: scalablity of Scala over Java

text: I read an article that says Scala handles concurrency better than Java. http://www.theserverside.com/feature/Solving-the-Scalability-Paradox-with- Scala-Clojure-and-Groovy > ...the scalability limitation is confined specifically to the Java > programming language itself, but it is not a limitation of the Java platform > as a whole... > > The scalability issues with Java aren't a new revelation. In fact, plenty of > work has been done to address these very issues, with two of the most > successful projects being the programming languages named Scala and > Clojure... > > ...Scala is finding ways around the problematic thread and locking paradigm > of the Java language... How is this possible? Doesn't Scala use Java's core libraries which brings all the threading and locking issues from Java to Scala?


title: questions on a particular algorithm

text: Upon searching for a fast primr algorithm, I stumbled upon this:                 public static boolean isP(long n) {          if (n==2 || n==3) return true;          if ((n&0x1)==0 || n%3==0 || n<2) return false;          long root=(long)Math.sqrt(n)+1L;         // we check just numbers of the form 6*k+1 and 6*k-1          for (long k=6;k<=root;k+=6) {              if (n%(k-1)==0) return false;              if (n%(k+1)==0) return false;          }          return true;      }         My questions are:   1. Why is long being used everywhere instead of int? Because with a long type the argument could be much larger than Integer.MAX thus making the method more flexible?   2. In the second 'if', is n&0x1 the same as n%2? If so why didn't the author just use n%2? To me it's more readable.   3. The line that sets the 'root' variable, why add the 1L?   4. What is the run-time complexity? Is it O(sqrt(n/6)) or O(sqrt(n)/6)? Or would we just say O(n)?


title: How to fit testing in Scrum sprints and how to write user stories in Scrum

text: I am the development team lead of a new project at my company. This is the first project where the company will use Scrum. We have a waterfall/iterative SDLC. The BAs write requirements docs, hands over to dev and test, dev start developing and will release to testing in iterations. Testers take long time to test a release by which devs continue development but also bug fixes for the current release. I have a few questions   1. In a sprint with say 5 stories when do you release for testing ? Is it as soon as a story is completed by dev or after all stories are completed but before end of sprint giving test the required time to test.    2. If the BA writes user stories what should be the detail. Traditionally it takes long time to write a spec with all UI layout, behaviour, text etc to be finalised. I guess my question is how to write stories that are implementable and testable.   3. Our test team is non-technical. How important it is to have automated UI testing for Scrum. The UI is based on WPF. I have solid development experience using agile methods (TDD, code reviews, refactoring etc.) but new to scrum. edit: By iterations I mean that if there are 100 requirements we may release to testing when we have finished 30, 35, 35 requirements rather than wait till all 100 requirements have been completed.


title: How do you integrate Testing into a Scrum process?

text: This is really perplexing me. We have a 'definition of done' and it includes dev 'done', unit tests 'done', dev test 'done'. However we also have a user acceptance test that needs to be 'done' but the business wants to know when users stories are complete so that they can see stuff (the uat really isnt a priority until release). But because this is outside of the initial done (where we pass our user stories) how can we say its done? And where does this fit into estimating? Where can I find information on integrating testing with a scrum process? I think I need to read up this...