title: What do you need to master a language and its technology?

text: > **Possible Duplicate:**   >  how to really master a programming language Let say about Java(just a sample, you can talk about C#, PHP, C++ ... it's just similar) and 10 (ten) levels, 1 is newbie and 10 is master. How can you identify someone at which level based on his knowledge? I do not tend to compare languages, I do tend to know what indicate a master or a newbie in a language _and its (language's) based technology_. Yeah, I know there aren't on earth a language stand alone, it always come with a technology with it. Let say in Java, you can memorize all of its keyword and syntax in just few days, but to _know_ it (I mean do something with it effectively), you must read the Oracle (Sun) javadoc many many times (I'm not mention the 3rd party product yet).


title: How can I  really master a programming language?

text: I know that learning a language, you can simply buy a book, follow the examples, and whenever possible try the exercises. But what I'm really looking is how to master the language once you've learned it. Now I know that experience is one major factor, but what about learning the internals of the language, what is the underlying structure, etc. There are articles out there saying read this book, read that book, make this game and that game. But to me this doesn't mean to master a language. I want to be able to read other people's code and understand it, no matter how hard that is. To understand when to use a function and when another, etc etc. The list could go on and on but I believe I've made the point. :) And finally, take whatever language as an example if needed, though best would be if C was taken as an example.


title: How can I develop a Package Manager for Embedded Systems?

text: I need to develop/use a package manager for an embedded Linux system with the following properties:   * A master fully controls which packages need to be installed (the slave has no possibility to ask the master anything)   * Download speed on the device is slow that not just everything from the master distribution can be download to the target   * Upgrading/Downgrading of packages must be possible   * It should be possible to replace the package manager on the system itself   * Possibility to replace the operating system itself   * It's easily to recover from failures (power loss, ...), especially relevant when considering the two points above   * Locks on the slave which have to be deleted manually are by no means allowed   * If a new (meta?) package replaces an old (meta) package and there are some unneeded packages left, they're removed, to save space on the device   * Define some form of order or dependency to install packages   * Perhaps some form of a recovery system is need (how to detect that it is needed, how to boot it, ...) Some points are just repeating other points, and some points are not necessarily something the package manager itself has to do. I started to copy ideas from dpkg (especially how it install files and renames them later to reduce the time frame where something bad can happen) and use the deb format for packages itself (not using all of the fields). I'm not sure myself, if this questions belongs to Programmers, but instead asking for a solution or anything like that, I'm more interested if other programmers faced the same problem and if there are any notable resources how this kind of problem is solved. Personally it happened to me too many times that embedded devices could be almost destroyed by a software update without any possibility (without special hardware) for recovery. Some links that may be relevant for others are the following ones:   * http://en.wikipedia.org/wiki/List_of_software_package_management_systems   * http://en.wikipedia.org/wiki/Ipkg I could as well provide a pseudo code alike description for what I intend to do.


title: In python, do we have class encapsulation at the level of the object?

text: I was bitten by using the `is` operator when i should have been using `==`. Am aware that the former tests for equality of the objects' identities and that the latter tests for equality of the objects' contents. Using `is`, i thought, also implicitly tests for the equality of the contents. For example `if a is b` is true, then the contents must be the same. This was the working assumption and i believe that it's still true. But what was discovered, and should have been known, is that if `if a is b` is false, then the contents of a and b may or may not be the same. Example (Python 3.3.3):               class Food:         def favourite_restaurant(self):             return "the foo diner"               if __name__ == '__main__':              fr = "the juice bar"         print('%r  is  %r: %r' % (fr, 'the juice bar', (fr is 'the juice bar')))         print('%r  ==  %r: %r' % (fr, 'the juice bar', (fr == 'the juice bar')))              f = Food()         result = f.favourite_restaurant()         print('%r  is  %r: %r' % (result, 'the foo diner', (result is 'the foo diner')))         print('%r  ==  %r: %r' % (result, 'the foo diner', (result == 'the foo diner')))      The first print block says:               'the juice bar'  is  'the juice bar': True     'the juice bar'  ==  'the juice bar': True      The second print block says:               result: 'the foo diner'     'the foo diner'  is  'the foo diner': False     'the foo diner'  ==  'the foo diner': True      It seems that objects instantiated within the instance of a class have their own group of ids, separate from objects outside the class. My understanding that encapsulation in python is really a matter for 'consenting adults'. Do we actually have encapsulation at some lower level?


title: Is there an imperative language with a Haskell-like type system?

text: I've tried to learn Haskell a few times over the last few years, and, maybe because I know mainly scripting languages, the functional-ness of it has always bothered me (monads seem like a huge mess for doing lots of I/O). However, I think it's type system is _perfect_. Reading through a guide to Haskell's types and typeclasses (like this), I don't really see a reason why they would require a functional language, and furthermore, they seem like they would be perfect for an industry-grade object-oriented language (like Java). This all begs the question: **has anyone ever taken Haskell's typing system and made a imperative, OOP language with it?** If so, I want to use it.


title: Javascript Rookie Question: Define Variables Inline

text: I'm proficient with HTML and CSS but I'm still pretty shaky when it comes to Javascript. That said, I've been able to build a site using the Internet Archive Book Reader, which relies on reader.js Here's a copy of one of my versions of reader.js https://gist.github.com/dylan-k/ed4efed2384e221d46cc It's a good site, but I find I have to repeat things a lot. Basically, I have one copy of reader.js for every page/book featured on the site. It seems there must be a better way. I re-use the script, making copies, just so that I can change lines `28`, `80`, `83`, `84`. Is there a way I could include just one copy of reader.js and then use a `<script>` tag to define these 4 lines for the individual pages?


title: How does session middleware generally verify browser sessions?

text: I've been using session middleware to build web apps for years: from PHP's built-in session handling layer to node's connect session middleware. However, I've never tried (or needed) to roll my own session handling layer. How would one go about it? What sort of checks are necessary to provide at least some modicum of security against HTTP session highjacking? I figure setting a cookie with a token to keep track of the session, and then perhaps some check to see that the originating IP address of the session doesn't change and that the client browser software remains consistent. Hoping to hear about current best-practices...


title: Estimating time remaining in a queue with multiple workers

text: I've been trying to figure out a way of calculating the estimated time remaining for an item in a queue when there are multiple workers processing items from the single queue. A client submits a job to the queue, but since processing can take some time I wanted to give an estimate of feedback. I know   * Number of items in the queue   * Position in queue   * Length of time an item takes to process*   * How many workers are running   * When each worker last completed a job I don't know   * How far along processing the worker is, only when it starts and ends** *Processing time is the 90th percentile processing time of past jobs within a reasonable time range. Not completely accurate but tends to overestimate slightly and is accurate enough for my needs.   **Workers are calling an external service so the best estimate of progress is time taken With a single worker I can use a function such as               estimated_seconds_remaining = (         (position_in_queue + 1) * average_processing_time_seconds     ) - (         average_processing_time_seconds - time_since_worker_last_finished_seconds     )      `(position_in_queue + 1) * average_processing_time_seconds` gives me the time it will take to process all the items in the queue plus the one that is currently being processed, then taking away `average_processing_time_seconds - time_since_worker_last_finished_seconds` gives me the estimated time remaining to process the current queue item. This works fairly well, and is accurate enough for reporting back since the variation in processing times is quite small. But, in production I'll be running multiple workers, so multiple workers will be processing items from the same queue. There will most likely be 3 or 4 workers running, but could be upwards of 10 at times. The simplest option is just modifying my formula so               estimated_seconds_remaining = (         (position_in_queue + 1)/number_of_workers * average_processing_time_seconds     ) - (         average_processing_time_seconds/number_of_workers - time_since_worker_last_finished_seconds     )      But this gives inaccurate and erratic predictions, since the estimates are being re-calculated every second to update the display the times jump up and down depending on when the workers all finish their jobs. Is there a simple way, with the information I have, to calculate a reasonably accurate prediction of the time remaining before an item from the queue is processed?


title: What is the absolute minimum set of instructions required to build a Turing complete processor

text: I have a general idea of how the processor handles instructions but spend my time working in mostly high level languages. Maybe somebody who works closer to the iron can provide some valuable insight. Assuming that programming languages are basically very high level abstractions of a processor's instruction set, what is the most basic set of instructions necessary to create a turing complete machine? _Note: I don't know anything about the diversity of hardware architectures but -- for the sake of simplicity -- lets assume it's a typical processor with an ALU (if necessary) and instruction stack._ *


title: Node.js API Architecture

text: I am currently working on a web app and want to design the interface between nodejs / mongoose and the backbone app. A short description of the app: A user signs up to the application and gets a user account where he can create an organization (e.g. footballclub). Within these organizations you can set up projects. Within these projects you can define tasks you could assign to somebody) I want to have a RESTful api for the app. My problem is: A user could have more than one organization, if i have an api for projects like GET /projects/   POST /projects/   GET /projects/:id   PUT /projects/:id   DELETE /projects/:id How do i determine to which organization the project belongs? Do i add a parameter to the api or do i send an extra field containing the id of the organization? Any help is appreciated!


title: Is it common for business analysts (or other non-development team members) to have stories tracked alongside developers?

text: We're using JIRA with Greenhopper, and currently our business analyst has tasks for their analysis which will eventually lead to new stories placed in the backlog, running alongside the stories for the current sprint, and it feels kind of messy - especially because they don't overlap the workflow for the development stories. Is it common for this to be the case? Should it be? It feels like the analysis ought to be an external process that feeds in to the product backlog, not something that tags along the sprint backlog, but I am new to scrum. I consulted the scrum guide and didn't see anything explicit, and while we don't really have a Product Owner (although at times I would say our manager fills that role, other times so does the business analyst), I guess I could also phrase the question as: Should Product Owners track their tasks next to the stories that the development team works on?


title: What does "polyadic" mean in the context of functional programming and type systems?

text: And how does it (or does not) correspond to "polymorphic"? Occasionally I see this notion like in: Implement and represent polyadic operations. I checked Wiktionary but it only gives a general meaning, not specific to functional programming.


title: C++ IDE and tools with Clang integration

text: Recently I've read this blog about Google integrating Clang parser into their code analysis tools This is something in which C++ is at least a decade behind other languages like Java, but now that llvm-clang is almost C++ iso-ready, I think its possible for C++ code analysis tools to begin using the C++ parser effectively, since it has been designed from the ground up precisely for this I'm wondering if there are existing open source or known commercial projects taking this path, integrating with Clang to provide higher-level analysis tools?


title: Best practice to return a long string in a stub

text: I have some methods im trying to test which use a StreamReader dependency that i mock using Rhino mocks. But it is a large xmlFile. In the spirit of unit testing im trying to keep away from using a test file in my test project. On the other hand copy-pasting 100 lines of xml into my test class seems sort of ugly. What is the best practice when returning large strings using a stub.


title: Is "Computer Science != Software Engineering" an excuse to teach programming poorly?

text: We've all heard it; whenever there's a discussion about CS grads having poor development skills someone eventually says, > Computer science isn't software engineering. The problem that I see is that programming and software development _are_ taught in CS courses. They're just commonly taught poorly. If it's being taught, then why not teach it right the first time? * So I would like to see what the opinions are on 2 questions:   1. Is the CS != SE argument a copout or excuse for not properly teaching programming skills.   2. Regardless of your answer to question 1; if you were in the almighty position of making such a decision: would you force an emphasis on proper teaching of programming in CS courses? *. I have a suspicion, based on anecdotal evidence I obtained throughout my education, that most academics in the field haven't had to write code to be maintained and haven't maintained code, and as a result don't have the knowledge/skills to teach it effectively.


title: A colourblind member of our team

text: My team relies a lot on colour within our code to outline features that need to be worked on (we colour lines of code that need attention). We have a close friend who is colourblind and wants to join our team. What can we do to highlight what needs work without using colour? We have about 25 people on the team that are all accustomed to the line colouring system and we have found it to be most efficient.


title: Is a coding standard even needed any more?

text: I know that it's been proven that a coding standard helps enormously. However, there are many different tools and IDEs that will format to whatever standard the programmer prefers. So long as the code's neat/commented (and not a spaghetti mess), I don't see the need for a coding standard. Are there any arguments for the development of a coding standard (we don't have one, but I was looking into creating one)?


title: What is this called?

text: I'm hoping there's a book or something out there for me to get... If I have a class that has Collection as an instance variable, what is that method of coding called? A design pattern? If so, where can I find more information on it? As I've been working with this mentor, he's really helped me understand my programming weakness and that weakness is thinking in terms of collections or relationships between objects. It just seems so difficult for me right now and I need to read to become smarter. My mentor is a great guy, but I'm starting to feel like I need to learn more on my own.               public class Evaluation     {         private List<Criterion> criterion = null;              public Evaluation()         {             criterion = new List<Criterion>();         }     }


title: Am I Unit Testing or Integration Testing my Stored Procedures?

text: I have had many occasions recently where I have needed to maintain complex stored procedures and functions. These were broken already, usually in fairly subtle ways - there were very few occasions where you would call the SP with valid parameters and it just plain didn't work. My solution was to evolve a framwork that executes the stored procedures inside a transaction, after initializing the database to the initial conditions I needed, then testing for the expected result, also within the same transaction. The transaction was rolled back at the end of the test. This has worked very well. But some would call this "integration testing" since it involves integrating with the database. I call it unit testing, since I tested individual components and individual test cases for those components, and since I completely controlled the initial state of the database. But where should the line be drawn? Is this integration testing or unit testing? Is there a practical reason why this sort of test is a bad idea? If this is "only" integration testing, does anyone have suggestions on how to do actual "unit tests" on these stored procedures?


title: Would it be possible to publish my code on an official site with a third-party library?

text: I'm building a rather large and extensive wrapper in Delphi for an email system called Mandrill. There are wrappers for this API in many other languages, but not for Delphi. So, I'm hoping to produce the first full wrapper. The problem is, I'm utilizing a third-party JSON parser called superobject. I'm afraid that if I complete this wrapper, I won't be able to provide my code for Mandrill to share, because of this third-party library. If I do complete this wrapper, is there any chance that Mandrill will be able to legally publish it on their site, based on the fact that I'm using superobject? Or would I need to parse my own JSON to be applicable? PS - I mean this question in a general concept, not necessarily for my precise scenario, but in general, if I use a third-party library, can I legally post it with my code on another third-party's site?


title: Entities optional relations: separate classes or single class?

text: Lets focus on a domain object that is related to **more** other (different!) entities. Sometimes we need one relation and sometimes the other. Let's be agile and say: we don't know in a front how many other relations there will be. In other words: we have object **A** that is related one-to-one to **B** and one-to-many to **C** and again one-to-one to **D** and so on. Now, when developing the presentation tier, it often needs a lot of data to display; like table of **A** with **B** , or on other place one **A** with many **C** and so on. How we gonna model these relationships? Here is an example: `Competition`. Sometimes it comes and needs to be used with e.g. `Venue`. Sometimes with e.g. `List<Event>`. Since you care about performances, let's also say that the related objects (`Venue` and list of `Event`s) come from the single input/repository method/finder method/one SQL join (however you call it) - and that they can be _injected_ into `Competition` using some mapping tool. This way we express the actual relationship between the entities. Question: should we keep both relations/references in the `Competition` class and ignore the other when one is used, or we should make many separate classes - one for each relation? (It doesn't matter if it is 1-1 relation or 1-many, the question is the same.) In other words, should we have: **[A]** Everything in the single class. Getter methods do represents relationships. It's on us to fill the object if relation is needed.               class Competition {         ... competition data...              private Venue venue;         public Venue getVenue() {             return venue;         }              private List<Event> events;         public List<Event> getEvents() {             return events;         }     }      But then, when your application method return a `Competition` you don't know what relations are populated and you have to figure that out by looking the application methods code or by method name (e.g. `findCompetitionWithEvents...()`). **[B]** For each relationship we have a type or interface. One way to do so, without interfaces for the simplicity of this example, is:               class CompetitionVenue extends Competition {         private Venue venue;         public Venue getVenue() {             return venue;         }     }      and               class CompetitionEvents extends Competition {         private List<Event> events;         public List<Event> getEvents() {             return events;         }     }      Now the type speaks by itself what relationship is returned and therefore application method that returns it guarantees that relation exists. But then each relationship would have its own class or interface; EDIT: **[C]** Each relationship is represented using a generic class like `Tuple<Competition, List<Event>>` and `Competition` does not have the getter for list of events?


title: Can you/should you develop components for ASP.NET MVC?

text: Following from the previous question I've started to wonder - is it possible to implement "Components" in ASP.NET MVC (latest version)? And should you? Let's clarify what I mean with a "component". With that I mean a "control" (aka "widget"), similar to those that ASP.NET webforms is built upon. A gridview might be a good example. In webforms I can place on my form a datasource component (one line of code), a gridview component (another line of code) and bind them together (specify an attribute on the gridview). In the codebehind file I fill the datasource with data (a few lines of DB-querying code), and I'm all set. At this point the gridview is a fully functional standalone component. I can open the form, and I'll see all the data. I can sort it by clicking on the column headers; it is split into several pages; I can drag the column headers around and rearrange columns; I can turn on "grouping" mode; etc. And I don't need to write another line of code for any of it. The gridview, as a component, already has all the code tucked away in its classes and assemblies. I just place it on the form, initialize it, and it Just Works. At some times (like sorting or navigation to a different page) it will also perform ajax callbacks to the server, but those too will be handled internally, with my code having no knowledge at all about it. And then there are also events that I can attach if I want to get notified when something happens. In MVC I cannot see a way of doing this cleanly. Sure, there are the partial views, but those only handle half of the problem - they render the initial HTML. Some more can be achieved with client-side Javascript (like column re- arranging), but when the grid needs to do an ajax callback (say, to fetch the next page of data), my code will have to get involved and process that request. At best I guess I can provide some helper methods to process it, but I'll have to write the code that calls them, and also provide a controller method with signature matching the arguments of that callback. I guess that I could make some hacks with global events or special routes or something, but that just seems... hackish. Unelegant. Perhaps this is not the MVC way? Although I've completed one project in it, I'm still far from being an MVC expert. But then what is? In the intranet application that we're building there are dozens upon dozens of such grids. Naturally I want them all to have a unified look & behavior, and I don't want to repeat the same code all over the place. So what's the "MVC" approach to this problem?


A little confused with the notion of stateful/stateless architectures. Forgive me if I'm unclear. Questions: Can we consider a clients interaction with a web server to be stateful if the web server maintains state via session variables or cookies? What if we assume that any change to this information comes from the client side any way and doesn't depend on other users?   * What about amazon's web store? Although state may change and not be reflected automatically to the client... if the client attempts to operate on stale data, the system recognizes this and acts appropriately. Is this purely stateless still? Or somewhere in between?   * What if we added a layer of java script that constantly polled the server every second to keep the client side updated? At an abstract level wouldn't this be considered stateful because the client will continuously have an updated state? Definitions/Models I'm trying to work with: Stateless architecture of websites: HTTP is a stateless protocol. The client makes an HTTP web request. The server calculates/processes the request and returns back to the client the appropriate information which the current state of the website. While the client has that information, the website can change state and these changes won't be reflected back to the client side until the client makes another web request. Stateful architecture: The client can simply operate assuming that any data that is seen represents the actual state of the server.


title: When getting a list of files to process, should I store them to a list of string, or a list of Stream?

text: for a list of files, coming from a list like from a file dialog is it better to store the list as a list of strings or should I convert each file to opened Streams stored in a List? For example                       List<string> files = new List<string>();                  List<FileStream> fileStreams = new List<FileStream>();                  foreach (Stream f in fileStreams)             {                 //process stream             }                  **VS**                  foreach (string s in files)             {                 //open filestream                 FileStream fs = new FileStream(s, FileMode.Open);                      //process             }


title: Why aren't plain-text markup languages (like LaTeX or Markdown) more popular in the software development process?

text: I'm currently an intern at a government contractor and am getting the (obnoxiously unavoidable) feeling that Word is the de-facto standard in the software development process. Its binary format makes it very difficult to collaborate on documents in the way I am used to collaborating on a code base. The use of plain text markup (with such languages as LaTeX, Markdown, ReStructured Text, _etc._ ) allows for a diff-friendly document that works well with the normal workflow of a developer. As for comments where the language doesn't support them (eg Markdown), there are many existing solutions that allow collaborative comments on code bases (eg GitHub, Bitbucket) that could _easily_ be applied to other plain-text files containing markup. I understand the need to cooperate with technologically illiterate management necessitates some sort of graphical interface to everything, but such interfaces exist for most of these formats. (For example, LaTeX has a 'fork' of sorts called LyX that puts a graphical front-end to a plain-text, LaTeX- like syntax. This file, even though primarily graphical in its editing, is _still_ diff-friendly. (Inception comment: it also has Word-style comments.)) Many of these solutions could yet be used instead of Word, and the vast majority are free or open-source. However, we use Word even for our own internal documentation that nobody else sees. We work with text for a significant chunk of our career---why is documentation so special?


title: Multiple Data Types for Single Variable in C

text: I am trying to implement basic cons, car and cdr of SCHEME in C. I have made a simple program that allows me to cons two integers as shown in the main program. However, I want my program to be able to cons a 'consed object' with a digit as well as cons a 'consed object' with another 'consed object' as shows below:   * (cons 2 3)   * (cons 2 (cons 2 3))   * (cons (cons 2 3) (cons 2 3)) Since the limitation arises because the data in the struct is of type int, is it possible to have a variable accept multiple data types in C? If yes, how? If not, is there another way to deal with this issue? Here is my code:               #include <stdio.h>     #include <string.h>          typedef struct cons_object {     int data;     struct node* next;     } cons_object;          cons_object* cons(int x, int y )     {     cons_object* car = NULL;     cons_object* cdr = NULL;     car = malloc(sizeof(struct cons_object));     cdr = malloc(sizeof(struct cons_object));     car->data = x;     car->next = cdr;     cdr->data = y;     cdr->next = NULL;     return car; /*returns the pointer car*/     }          int car(cons_object* list) /*takes in a consed object*/     {     cons_object* car = list;     int y;     y = car->data;     return y;     }          int cdr(cons_object* list)     {     cons_object* cdr = list;     cdr = cdr->next;     int z;     z= cdr->data;     return z;          }          int main ()     {     int y = car (cons(33,42));     printf("%d\n",y);     int z = cdr (cons(3,4));     printf("%d\n",z);     return 0;          }


title: MVC: "User" model gets big and crowded. Should methods that do CRUD operations on one-to-many relationship data be in different models?

text: In most MVC web projects there is a User class. Many times a user has something else in a one-to-many relationship, i.e. orders. If we have a user class that has many orders, should methods that add, edit or delete orders for a user be placed in the user class, or in a separate Order class? i.e. 1.               user.add_order(order_name)   //Instance method      vs 2.               Order.add_order_for_user(user_id, order_name)   //Static method      or alternatively, 3.               order = new Order(user_id,order_name)     order.save()      (Also, in the case of option 3, should this be combined with option 1 and put in that method)? My main issue with option 1 is that the user model tends to get huge in terms of size. Does this violate SRP? For instance, in one of my projects a user has many "things" like friended users, feeds, uploaded files, warnings, punishments, and the list goes on. I'm basically adding CRUD methods for all those "things" that a particular user has many of, in the User class itself. Is this a bad thing, and should I spread out the CRUD methods to different classes? However, one of the advantages for option 1 is that I can control logic in those CRUD methods using the attributes of the current user object, without having to query the user. For instance, if I have a method "add_file" I can check to see if the user's total file space used (an attribute of User) is less than a max without having do do another query.


title: Categorize tasks/bugs by risk of changes

text: The project I'm currently working on has an issue: bugs and tasks are often assigned to people who are too new or too inexperienced and their work ends up producing more bugs down the road. The problem is that parts of our software are much more "dangerous" to work on than others due to code quality issues. I've been trying to combat this issue by estimating the risk associated with tasks and paying close attention to which developers get assigned which tasks. We use JIRA so I started labeling issues to keep track of this estimation. I've noticed that I've ended up using several metrics to categorize a bug/task:   * How clear/straightforward it is. E.g. whether it's something that will need a lot of design work or just a simple UI bug fix.   * How maintainable the affected area of the code is. Is it a well-designed area or a big ball of mud.   * How much of the program I think will be affected by the required change. My labels are kind of messy since I didn't have a clear idea when I started what the possible categories would be and I still don't. I'm thinking about requesting a new field be added (something like "Risk") so that we can require an estimate before assigning the work to someone. Has anyone dealt with this sort of thing before?


title: Commercial product using a GPL OS

text: we are planning to create a commercial product. The product consists of some MCUs and a small computer (we are developing on a Raspberry Pi at the moment). The computer needs an operating system as we would like keep things like WLAN and booting as simple as possible. We created some software that runs on this computer (node.js application). The most operating systems like Arch Linux are licensed under the GPL. The product we would sell contains the computer with pre-installed OS and software. This system operates as a central access point to MCU devices and is able to control them. We use other's software in our product. We do not modify their source code. The product (the computer part) consists of a computer, an OS and software we create.   1. How does the use of an OS affect our own code (licence)?   2. Is there a possibility of avoiding GPL for our own code? eg. shipping the software separated?   3. Are there any effects to other components of our product, eg. the MCU part?   4. The node.js application delivers a WebApp to the client where it is executed. Are there any effects (As we would like to sell parts of the code as an additional App on the App Stores)? I know we make use of the work of the community and i respect this. The problem is: The software alone is kind of useless without the MCU devices. I do not expect a legal advice.


title: How do statically typed languages handle test discovery?

text: I come from a Python background, so I'm used to pretty automatic test discovery. For example, the `py.test` library automatically locates any files which begin with `test`, finds classes whose names start with `Test` inside of the those files, and then calls all the functions whose names start with `test_` in those classes. This type of test discovery is enabled by Python's deep support for reflection and dynamism. These features are often absent in statically typed languages, because they're difficult to make integrate with the type system. Therefore, I'm interested in hearing about what approaches statically typed languages use to make test discovery simpler?


title: How can I improve my application's memory use?

text: I am writing a C# application, and can see the memory usage increasing as the running time of the application increases. Are there any tools or techniques I could monitor my application's memory use, identify memory leaks and generally improve my application's memory use?


title: Looking for terminology for the relation of a subject and a predicate

text: While writing some predicates for collection filtering I have stumbled over the choice of the right words for the relation of the subject and the predicate (English is a foreign language for me). What I ended up writing was "Subjects **matching** this predicate..." This seems to be incorrect, since predicates are functions and not regular expressions. But saying "Subjects for which this predicate returns true..." sounds awkward to me as well.. So what would be the correct term?


title: Random List of numbers in C

text: I have just started a C programming course and so far have only done the basics like `printf`, read a little on variables etc on the course book. The teacher has tasked us with writing a program that will take a value entered by the user, this will be the number of students in the class (25 at the moment but can be variable). It will then list the number of students randomly and place them in 3 columns. The purpose is to sort students into groups of 3 randomly, then display on the screen in columns. Now my question is not for the code that defeats the object of me attempting the exercise, but how to structure it. I can see that using an array can be used to display the list, but really after some pointers on how best to approach the problem in blocks, then I can attempt to program each block.


title: Repository Pattern: Doctrine2 vs Microsoft Entity Framework?

text: I have been using Symfony2 with Doctrine2 for some years. I have recently started using Microsoft's Entity Framework with MVC5. From my Symfony2 experience I understand that a repository's job is only to retrieve and return objects, no additional operations like Saving. Now every examples I have seen for EF has a method Save/Update as part of the repository. For symfony I have been creating manager classes as follows:               interface IManager     {         function getClassName() ;         IRepository getRepository() ;         function Save(object);         function Update();     }      So I pass around the manager, if I need to retrieve objects I call the repository directly. If I need to save I call the manager's save method. Is a repository supposed to support save/update? What do you think of my IManager class, should I also use it for EF?


title: Is it a good idea to return a default value if a field in a query cannot be found?

text: At the place I work we are using a SafeReader class that wraps an IDataReader. One of the 'features' is that if the field you are trying to access wasn't in the query then it just returns a default value. So I am working with some code that is already in place, but apparently never fully worked as it accesses fields that aren't returned from the stored proc it's calling but it didn't throw any exceptions since the SafeReader kindly returned default values. I personally don't like this because it means that when there are mistakes in the code (someone forgets to include a field in the query, or perhaps a misspelling) then it's harder to catch. My question is whether this violates any general 'best practices' of development or object oriented programming ideals? Or does this seem perfectly reasonable?


title: How managers choose programming languages

text: It's not a secret to anyone that managers can and often will impose the programming language that will be used for a project. Being a programmer myself, I have never been able to understand this. But now I think I do: I've just had a revelation when Joel Spolsky said on the podcast that they should use QuickBooks because "every accountant in the world knows it". This struck me as being very similar to "chose Java because every programmer in the world knows it". Now that I've seen the same issue from another perspective,I don't know much about accounting, but I do know something about programming, I'm wondering how a programmer can help make sure the right programming language is chosen for a project?


title: How should a programmer get what they need/want from a systems administrator?

text: In what ways would people recommend a programmer communicate the need for newer, more up to date libraries to system administrators. At our organization the programmers often do many system administration tasks such as system updates, installation of software, management of software, recovery of specific systems after failures, etc. Programmers are currently limited by the age of some of the systems available and would like newer OSes and subsequently libraries available to them. What is a good way to communicate these desires to the SAs who are, in the end, in charge of deciding what OSes to install. Edited to simplify the whole question. Thanks.


title: What have my fellow Delphi programmers done to make Eclipse/Java more like Delphi?

text: I am a veteran Delphi programmer working on my first real Android app. I am using Eclipse and Java as my development environment. The thing I miss the most of course is Delphi's VCL components and the associated IDE tools for design-time editing and code creation. Fortunately I am finding Eclipse to be one hell of an IDE with it's lush context sensitive help, deep auto-complete and code wizard facilities, and other niceties. This is a huge double treat since it is **free**. However, here is an example of something in the Eclipse/Java environment that will give a Delphi programmer pause. I will use the simple case of adding an "on-click" code stub for an OK button. **DELPHI**   * Drop button on a form   * Double-click button on form and fill in the code that will fire when the button is clicked **ECLIPSE**   * Drop button on layout in the graphical XML file editor   * Add the View.OnClickListener interface to the containing class's "implements" list if not there already. ( _Command+1 on Macs, Ctrl + 1 on PCs I believe_ ).   * Use Eclipse to automatically add the code stub for unimplemented methods needed to support the View.OnClickListener interface, thus creating the event handler function stub.   * Find the stub and fill it in. However, if you have more than one possible click event source then you will need to inspect the View parameter to see which View element triggered the OnClick() event, thus requiring a case statement to handle multiple click event sources. **NOTE: I am relatively new to Eclipse/Java so if there is a much easier way of doing this please let me know.** Now that work flow isn't all that terrible, but again, that's just the simplest of use cases. Ratchet up the amount of extra work and thinking for a more complex component (aka widget) and the large number of properties/events it might have. It won't be long before you miss dearly the Delphi intelligent property editor and other designers. Eclipse tries to cover this ground by having an extensive list of properties in the menu that pops up when you right-click over a component/widget in the XML graphical layout editor. That's a huge and welcome assist but it's just not even close to the convenience of the Delphi IDE. Let me be very clear. I absolutely am not ranting nor do I want to start a Delphi vs. Java ideology discussion. Android/Eclipse/Java is what it is and there is a lot that impresses me. What I want to know is what other Delphi programmers that made the switch to the Eclipse/Java IDE have done to make things more Delphi like, and not just to make component/widget event code creation easier but any programming task. For example:   * Clever tips/tricks   * Eclipse plugins you found   * other ideas? Any great blog posts or web resources on the topic are appreciated too. \-- roschler


title: Are macros values, data types, identifiers, variables, constants, or ...?

text: Macros exist in many programming languages, for example, C.   1. A data type is a set of values with operations on the values. Are macros values, or data types?   2. Are macros identifiers, variables, or constants?   3. Are macros something not belonging to a programming language, and something that will be translated to the programming language in the preprocessing step of compilation? Thanks,


title: If we can do functional programming with Python, do we need a specific functional programming language?

text: Using generators and lambda, we can do functional programming with Python. You can also achieve the same thing with Ruby. So the question is: why do we need specific functional programming languages such as Erlang, Haskell, and Scheme? Is there anything different that these specific functional programming languages provide? Why can't we just use Python for functional programming?


title: Calculate statistics for web application

text: I'm planning to add a couple of usage statistics to my web application. Some common things like: registered users, amount of comments/posts, etc. over time (last 24 hours / last week / last month / last year) which I want to display graphically to all admins.   I know that I can retrieve all information from database queries, but I have a bad feeling going over "old data" over and over again. Example: _Yesterday, I requested the amount of users who registered for an account the last year. Admin XYZ requests the same statistic today._ A simple select-all-users-reg-date-last-year query would be redundant and cause much database traffic, right? **What is the best approach of calculating statistical data like this?**


title: Why is Reflector such an essential utility?

text: Reading the brouhaha surrounding Reflector going paid got me thinking about the product and its uses. Many people seem to consider it an essential tool. I have to admit, I haven't used Reflector in years. I mean, there's documentation for both the .Net APIs and the third party components I use. In the past, whenever a colleague pulled Reflector out of his tool belt, I got the sense he was headed into the weeds. Reading all the passion around Reflector is leading me to question if I'm really missing something here. Why do you need something like Reflector so often that you consider it an essential tool? I can see it being needed on very rare occasions, but not enough to be considered an essential tool. Please enlighten me.


title: What is the easiest way of viewing an RGB byte array as an image?

text: I have a byte array stored in a file. I want the quickest, easiest way of viewing the image whether it is writing code or using a utility or web page.


title: Machine code JITs and the Execution Disable bit

text: How is runtime-generated machine-code (such as the output of a JIT), actually executed by the CPU if the CPU/OS has an Execution Disable bit? As far as I know, many modern processors and Operating Systems include support for an NX bit, (including Intel and ARM), which prevents machine code that is stored at any address _other_ than the code section of a compiled binary from being executed. Clearly, this is a nice security advantage, because it prevents shell-code injection attacks. But how do JIT engines, like LLVM, which dynamically generate machine-code, get around this?


title: Is handwriting out code an efficient way to learn a programming language?

text: In my C++ intro class last semester, all of our tests were paper/pencil and we had to write out code with a pen or pencil in order to answer questions. It seemed counterintuitive at the time, but also made sure students knew the answer down to the last semi-colon. Given that handwriting notes is an essential practice in learning other topics both in the class room and at home, how productive is handwriting code examples and documentation?


title: Semantic Versioning and splitting apart a library, providing a bundled build

text: I've got a nice, fairly popular JavaScript library that is following Semantic Versioning. The current library has a few dependency libraries, which are available either as separate downloads or as part of a single bundled download. I see a need to head down this path further. I want to extract additional, smaller libraries out of the one larger library. Each of these extracted libraries would be available as separate files, or inside of the one bundled build, again. If I go down this path of extracting the libraries, and providing a bundled version of the final code, does this require a full version change in semantic versioning? Would I have to bump from 1.x to 2.x? My first thought it no: I will not change any public API, so I don't have to change the major version number. But then I wonder... well, I am restructuring a lot of things, even though the final API for the bundled version would be the same. Is there a clear answer from semver on something like this? Do I need to bump first, second or third dot? Or something else?


title: Why should we NOT do frequent deployment in PROD or to test server?

text: I was instructed by my project manager that frequent deployment in PROD or to test server should be avoided. But I don't understand why? We roll our testing copy to PROD on every sprint end but suddenly client would ask a simple change to the existing application which would require a re-deployment. When every thing was well tested and QA approved. why should we avoid frequent deployment? How it was done universally?


title: What are the best practices for rapid prototyping using exclusively HTML/CSS/JS

text: I'm developing a **prototype** of a web application. I want to only use HTML, CSS and Javascript. I prefer to use my text editor and not having to learn (or pay, for that matter) a new tool like Axure. What would be, to your mind, the best practices? To me there are many qualities for a good prototype:   * Quickly developed   * Easy to improve   * Fair fidelity as regards UX (this disqualifies tools like Omnigraffle or PowerPoint that are more dedicated to wireframing) I trying to learn as quickly as possible, but I would like to know, based on your experience, on how you managed to be both quick and agile. Reference:   * http://www.boxesandarrows.com/view/prototyping-with


title: Navigating Code in Visual Studio

text: OK, so my class file is getting rather large, and that's a code smell. But until I can refactor it out, I need to get a handle on it. Primary options:   1. Code Regions.   2. Splitting into partial classes. I have never really liked code regions. They take time to write, and it seems I am always folding/unfolding the regions to find something. I like the partial class idea. Say for example, all public and private properties go into a partial class when they become too many. Does this make sense? The bottom line is that I just need to be able to find methods and properties rapidly, ie navigate code. So, really what I am asking is what is the best way to navigate code?


title: Computer Science: Arts or Science?

text: Various colleges and universities may offer a degree in Computer Science either as an Arts or a Science. What differences are there between the two? Would recruiters and those who conduct interviews favor one over the other? _(Bachelor of Arts vs Bachelor of Sciences etc...)_ **Update** \- Just wanted to add this link to Joel Spolsky's site to give a better frame of reference: BA or BS in Computer Science


title: Github-like "pull requests" without Github

text: I work as an analyst for a financial institution, which, due to data sensitivity, will not store any data in the cloud. However, I'm having some success getting my team to use Git for code management. I was wondering whether there was any way to implement Github-like pull requests in our own server. The specific feature I'm interested in is the ability to submit a changeset _for comments_ , without actually having it merged into a given branch. I like the workflow of (1) submit changes, (2) have changes reviewed and commented on, and (3) either accept the commit or reject it. Can this be implemented (even better, can this be _easily_ implemented) on our own servers?


title: Synchronizing local and remote cache in distributed caching

text: With a distributed cache, a subset of the cache is kept locally while the rest is held remotely.   * In a **get** operation, if the entry is not available locally, the remote cache will be used and and the entry is added to local cache.   * In a **put** operation, both the local cache and remote cache are updated. Other nodes in the cluster also need to be notified to invalidate their local cache as well. What's a simplest way to achieve this if you **implemented it yourself** , assuming that nodes are not aware of each other. **Edit** My current implementation goes like this:   * Each cache entry contains a time stamp.   * Put operation will update local cache and remote cache   * Get operation will try local cache then remote cache   * A background thread on each node will check remote cache periodically for each entry in local cache. If the timestamp on remote is newer overwrite the local. If entry is not found in remote, delete it from local.


title: API access question

text: **FIRST, THE SCENARIO** We have an internal system that is effectively split into 2 very separate parts across 2 sub-domains, our back-end administrative system for internal access only we will call this admin.example.com and our public-facing interface for customers via our website - lets call this www.example.com/customers We have built a series of APIs with PHP in the back-end system for the public interface to access, the APIs are split into multiple files based around the type of activity that is being performed and are also used in the admin interface, these are held in admin.example.com/apis/activity_api.php we have no problems here. We also have API keys that are in-use, 1 for the front-end and one for the back-end so we can determine access levels without thinking about it. **SECOND, THE ISSUE** Now you know the structure of the application here is the issue, we are using jQuery AJAX to call the APIs but I don't like placing the API keys here as they are publicly visible and anyone with a little programming knowledge will be able to pull a huge range of data, at the same time we need to use them. Note that the issue is only in the public interface. What I am thinking of doing is calling a connecting script in PHP with AJAX that is stored locally on our public facing server, this would do a few things   1. Check the referrer, if it comes from example.com/customers/ or www.example.com/customers/ it continues, if not the request is killed with an unauthorized error   2. Gets the variables posted by the AJAX requests   3. Restructures the variables for the API (e.g. receives `$_GET['request']` then reconstructs as `$_GET['req']`)   4. Adds the API key that is held as a variable within the PHP to the string   5. Uses `file_get_contents()` to make the actual request to the API, this would in turn populate the connecting PHP script with the required returned API data to the site My questions are   1. Have I missed anything in this concept?    2. Are there any flaws that haven't been thought about?    3. Are there any compelling reasons why this type of structure should not be used?  I appreciate the input! **WHAT I HAVE DONE** I really want to thank you guys for your help and comments on this, you have pointed out what I missed and that was the purpose of posting the question in the first place. You also helped me spot the obvious weaknesses. I have just written an algorithm that has taken into account HMAC principles. As with anything in this space there is room for unauthorized access but I believe my algorithm minimizes it. The basic process we're going with is as follows   1. 2 keys have been created, a private and public key   2. The public key is hashed first    3. A base calculation is carried out on part of the current time stamp   4. 2 random keys for the get request are generated that will be used to transport the access keys, to determine the request keys a mathematical calculation is carried out on the base calculation in step 3, the result is then split into 2 parts, the 2 parts are verified as unique and converted to the final values, 1 part belongs to the public access key and the other to the private access key key   5. 9 unique public values, plus the private access key issued are then taken, they are re-ordered based on a final calculation on the base value in step 3 creating a "signature" so to speak   6. The signature is then hashed and assigned to the private get key generated in step 4 On a quick calculation and basic testing, each request will be valid for approximately 27 seconds (give or take a few milliseconds) - enough time to process everything needed but not enough for much more. As the calculations are fairly basic the server load hasn't gone up an inch - I have only tested with 10 connections per second for 5 minutes however, I am going to run a series of load tests on it over the next 24-hours that will range from 20 request per second to 400 requests per second and compare with load test results taken last week. So what my new algorithm does in a nutshell is disguises the public and private keys by hashing both - however after time the public access key will be obvious unless I assign an algorithm to randomize it, it assigns both access keys random get request keys and has a short validity time based on the request. It doesn't need to store any data in cookies or sessions. In addition, with exception to the login API, all requests are going via a PHP connector that requires the user to be logged in. I spent more time explaining what I'm doing than actually creating it! Thanks again for your help guys, it helped me open my eyes a bit more and reminded me about what I had forgotten.


title: DCVS and Bug Database

text: I am considering implementing the following policy and would like to run it by the community before implementing it: All mercurial commits must have a bug id corresponding to our bug reporting database. All commits immediately preceding a push for a new feature must have a bug id (it's a new feature but the id is still a "bug id" in the database) This will do several things. First, it will ensure that an entry is always put into the bug database for all code changes. Second, it will provide a diff of each change made for each bug fix. This would also simplify commenting in the mercurial commits and put most details about the commit into the bug report. Do you know of any reasons why this would be a bad idea? Also, do you think I should make some additions to this policy?


title: Why don't companies ship multiple modules within a mobile app? Are there concerns about tight coupling?

text: **Preface:** My question does _not_ exclusively pertain to Google and it doesn't exclusively pertain to iOS. I'm only using Google and iOS as examples because they are familiar to many. I could have just as easily used 'Company X', apps 'A', 'B', 'C', 'D', and 'E', and 'Android', but I wanted to keep my question rooted in the real world with a tangible example. * * * In the iOS app store, Google has many apps. At a glance, I can see 'Google Search', 'Google+', 'Google Maps', 'Google Earth', and 'Gmail'. But I wonder - **Why didn't Google simply create a 'Google' app which can provide all of the functionality that these five apps provide?** The black menu bar at the top of each Google webpage makes this possible on the web; so why don't they make this possible by way of a menu button at the bottom of one "global" Google app?   * Is Google concerned about tight coupling between the apps?   * Is Google concerned about tight coupling between the _teams_ that develop the apps?   * Is Google concerned about app size?   * Is Google concerned about the memory footprint or CPU load that such a monolithic app might incur when it is loaded? * * * [Not a rant. Merely playing devil's advocate.] In spite of many advantages, some iOS critics say that multiple pages of apps leave the iPhone and the iPad feeling "cluttered". This is particularly relevant to my question because it seems a bit much to expect a user to know about (and manage) so many Google mobile offerings. From a product standpoint, and arguably a usability standpoint, it seems like it would be wise to ship a single app. * * * ![Google's Black Menu Bar](http://i.stack.imgur.com/q2h8Z.jpg) * * * If you're curious, I own an iPhone and a Nexus 7; so I'm not wedded to either of the two major mobile platforms. And I have a real problem to solve here - Whether to bundle multiple apps inside of one large app, or to distribute separate bits of functionality in multiple apps. * * * **EDIT:** In response, to @MichaelT's comment   * While there is indeed a 2GB size limit for apps, the size of your sandbox is only limited by the remaining capacity on the device.


title: How can I improve this design so that I don't need to dynamically scan classes at runtime?

text: I'm in the middle of a redesign on the part of my current project that deals with user permissions and authorization. I have an interface named `IUserPermissions` that encapsulates this information. One part of a user's permissions are the **Roles** which they are a member of. I'm trying _not_ to violate the Open/Closed Principle by adding every possible role to `IUserPermissions` as a property like this:               interface IUserPermissions {         bool IsAdmin { get; set; }         bool IsDeveloper { get; set; }         // Many more...Yuck.     }      I feel that having an interface like this would suit the OCP better:               interface IUserPermissions {         ICollection<IRole> Roles { get; }         bool IsInRole<T>() where T : IRole;  /* (For convenience; Would probably be                                                  implemented as an extension method) */     }     interface IRole {         string Name { get; }     }     public class AdminRole : IRole {         public string Name { get { return "Admin"; } }     }      Where I'm falling down is how to _implement_ something like this. I'm using the ASP.NET Roles API as the backing store, meaning I'll be given a `string[]` of role names for the user. My `IUserPermissions` implementation would have to start with this collection of strings and somehow work _backwards_ , then instantiate a bunch of appropriate `IRole`s to populate the `Roles` property. This could be done by scanning the assembly for `IRoles` with a parameterless constructor, instantiating them, and reading their `Name` property, but...ugh. How can I fix this design so that I don't _have_ to do this?


title: Sharing knowledge in activity-based working

text: My workplace will soon be shifting to the concept of 'activity based working', which moves from the idea of IT teams, BA teams, PM teams, etc to project- based work where people from across all facets of IT and the business involved on a project sit and work together. As a result, you wouldn't be sitting with your normal team colleagues on a day-to-day basis and sharing knowledge in that sort of organic way with the rest of your dev team won't really be happening. What ways would you recommend to help preserve that team collaboration and knowledge sharing when people will not physically be co-existing alongside their teammates any longer? Not to mention preserving that 'geek spirit' (bad term perhaps) that sees devs encouraging and coaching each other to find better designs and solutions. I've already thought about online collaboration tools such as Trello or Mingle, plus wikis or software such as Confluence to help collaboration and discussion. But I'd be interested to hear peoples opinions on what else could be done, or their own experiences with this approach to day-to-day work.


title: Does reading code and reading about code help in self -development?

text: As my profile will tell you, I am in my second year of a 4-year Software Engineering program. (Long post, skip to the end for the short version) * * * First, a little background. I started coding in C++ about 5 years ago. Ever since then, I was sure that I wanted a life in code :) In my last 2 semesters, I wrote quite a bit of code which included about 30-40 algorithmic problems along with some basic AI code each semester, all of this other than my coursework which also was somewhat code intensive. For the past 2-3 months though, I have not written any code. I have been reading others' code, reading about code, finding bugs in code, exploring libraries, going through documentation, exploring different languages and spending considerable time on SO, but i have _not written any code_. Either due to a lack of motivation or gasp, _interest_ , I am not sure. Now, I am feeling even worse, as none of this is stuff that I can write on a CV (internship season is round the corner in my college, which is critical for getting a job next year). Plus, I also think I havent developed my skills as much as i should have in the past few years. * * *   * So, essentially, is reading about code rather than coding actually helping me develop ?    * Is there any way it can help me in my current short-term career prospects ?


title: Recommended Java source code reading

text: Like every author needs to read a lot of classical literature to develop his own style, and like every chess player read and analyze former champions games before, I think also every programmer needs to read a lot of high quality code. When it comes to Java source code, what are your recommendations as "reading". Which open source projects, libraries in the past you found yet easier to grasp and easy to read but also very good examples of what "high quality" code looks like?


title: How should I architect a personal schedule manager that runs 24/7?

text: I've developed an ADHD management system for myself that's attempting to change multiple habits at once. I know this is counter to conventional wisdom, but I've tried the conventional for years & am now trying it my way. (just wanted to say that to try and prevent it from distracting people from the actual question) Anyway, I'd like to write something to run on a remote server that monitors me, helps me build/avoid certain habits, etc. What this amounts to is a system that:   * runs 24/7    * may have multiple independent tasks to run at once    * may have tasks that require other tasks to run first    * lets tasks be scheduled by specific time, recurrence (ie. "run every 5 mins"), or interval (ie. "run from 2pm to 3pm")  My first naive attempt at this was just a single PHP script scheduled to run every minute by cron (language was chosen in order to use a certain library, but no longer necessary). The logic behind when to run this or that portion of code got hairy pretty quick. So my question is how should I approach this from here? I'm not tied to any one language, though I'm partial to python/javascript. Thoughts:   * Could be done as a set of scripts that include a scheduling mechanism with one script per bit of logic...but the idea just feels wrong to me.   * Building it as a daemon could be helpful, but still unsure what to do about dozens of if-else statements for detecting the current time


title: How do I let programmers know something useful?

text: Quite often I go through pain to discover how to do something useful, in this case how to get PHP running on Google App Engine without the 'resin.jar too big' problem, but I have nowhere to let people know. In this particular case, the web answers were incomplete, outdated or plain wrong. I could create a blog, but it's overkill. I just want let programmers know a quick solution/approach. I'm not sure it's the done thing to ask a question and then answer it. In short, it'd be nice to be able to just dump a sort of combined question/answer/snippet, then let others comment as usual, shoot it down, like it, whatever. How do the rest of you approach this? Cheers, Shane


title: JMeter API testing

text: We usually test the web apis using jmeter by writing test scripts. Is there a way to create a software which will automatically generate test scripts for testing ? Jmeter will be used as a backend for testing. And the software which we will create will be in the frontend, as an interface.


title: Making applications build system-aware

text: Build systems for web applications are great: they give dependency management, code minification, and the ability to use tech like SASS or CoffeeScript that require pre-processing. However, I find actually using build systems to be ugly and annoying... you need to make sure developers have the build tools installed, that the versions they have installed are compatible with your configurations, and that any dependencies of the build tools(SASS compiler, jsmin, etc) are met. Getting a new developer onboarded now requires a suite of tools to be installed on their local system. We can fight this by using virtualization: a system like Vagrant can allow the setup of developer systems to be codified. There's a clear series of steps to create a developer environment with all dependencies, or a machine image that's already set up and can simply be installed and run. **My goal is to make the build system non-intrusive. I would like developers to not even necessarily have to be aware of the build system in order to hack on a project. This might be unrealistic.** With Vagrant, you might accomplish this by having a "watch" service of your build system automatically run and re-build the files whenever they change. That's good, but what about a local-system developer who doesn't want to run Vagrant? They have to remember to run a separate process whenever they sit down to develop. One approach I've not seen is to make the application build system aware. It seems to violate a separation of concerns, however with modern web development it seems we are already tightly coupled to our build systems: without running the build script, will you be able to run your web app and see anything meaningful? Will your static assets be in place? Is there a compelling reason **not** to have your application look at its build status and rebuild itself when necessary, when in development mode? When running the development server, the application could be build-system aware and build its assets if needed. This doesn't get away from the dependency requirements on the developer system. I don't have a concrete idea of what I'm looking for yet, but I feel like build systems for web apps aren't quite "worked out" yet. I hope to can have a good brainstorm here.


title: Different scoring algorithms for different competition elements

text: I am creating a scoring system for a competition that is somewhat obscure, but it resembles the Olympics in terms of its high-level structure. Therefore, I will ask my question in terms of an abstracted, fictional version of the Olympics, since everyone can relate to that to some degree. Assume the following hierarchy of classes and score rollups:   * Event class has one or more Sports (e.g., the 2012 Olympics has Decathlon, IndividualMedley, etc.) and one or more EventScores (one EventScore per Team per Event calculated by adding up the team's SportScores for a particular Event)   * Sport class has one or more Elements (e.g., Decathlon has Shotput, Javelin, etc.) and one or more SportScores (one SportScore per Team per Sport calculated by adding up the team's ElementScores for a particular Sport)   * Element class has one or more Rounds (e.g., Shotput has Throw1, Throw2, etc.) and one or more ElementScores (one ElementScore per Team per Element calculated by adding up the team's RoundScores for a particular Element) The scoring algorithm (let's call it the CalculateRoundScore() method) of a particular RoundScore depends on the Element to which the Round belongs. Examples:   * Shotput element: CalculateRoundScore(double ThrowDuration, double ThrowDistance, double GruntVolume) { algorithm; }   * Javelin element: CalculateRoundScore(double ThrowDuration, double ThrowDistance, double GruntVolume) { algorithm (different from Shotput algorithm even though parameters are the same, which would seem to eliminate overloading as a viable option); }   * 100MeterDash element: CalculateRoundScore(double Time, bool FalseStart) { algorithm; } Although I am seeking general architecture guidance, here are some of my specific questions:   * How do I associate different CalculateRoundScore methods to different Elements?   * Should I use interfaces, inheritance, overloading, or some other approach?   * In which class(es) should the various CalculateRoundScore methods be located? Conceptually, I can imagine each Element being an ICalculateRoundScore interface. However, that only makes sense if I create a different class for each different element, which doesn't seem right. It feels like I need some kind of a lookup in which the Round class picks its particular CalculateRoundScore method depending on the Element to which it belongs, but I'm not sure what would be the correct object-oriented way to do this.


title: In Java, why use bit hacks when non-bitwise technique it is more readable?

text: Is there any legitimate use for bit manipulation hacks in higher-level languages such as Java? I can see them being useful in speed-sensitive low-level and computation- intensive programs, e.g. graphics processing or crypto functions. I guess that's why all collections of them are in C. However, getting to think about them in terms of higher-level design I cannot think of any point where I would, for example, write the following in a Java program:               r = y ^ ((x ^ y) & -(x < y));      rather than:               r = (x < y) ? x : y;      The first line looks more like an obfuscation than an improvement. And most applications have different kinds of bottlenecks - most commonly networks or disc access, so much so that any potential improvement gained by using a bitwise hack would be so tiny that it is completely ignorable. This line of thought was provoked by a recent SO question in which someone was asked about a bitwise hack in Java during a interview. I agree as much as anyone that it's always better to write faster code, but considering that it becomes much less readable, especially by someone not familiar with bit hacks, is there any kind of application in which it is legitimately worth it? This question is not about bitwise _operators_ in general, but more specifically about bitwise _hacks_ , and even more specifically about bitwise hacks _in Java_. By _bitwise hack_ I mean a manipulation that has a trivial and/or obvious implementation, but which can be done slightly faster/better with some clever bitwise manipulation -- which in most cases makes it _near-unreadable_ to someone not used to bitwise hacks. * * * There are similar looking questions: Importance of bitwise thinking and What are bit operators good for? The answers in these questions talk about bit manipulations in general, which yes, have a lot of clear and useful applications; especially in _other_ languages like C. While this may seem similar, my question was about having them _versus_ using the non-bitwise technique in Java. In the other questions this is not addressed at all.


title: Defining formula through user interface in user form

text: I am a student and developing a simple assignment - windows form application in visual studio 2010. The application is suppose to construct formulas as per user requirement. The process: It has to pick data from columns of Microsoft Access database and the user should be able to pick the data by column name like we do in a drop down menu. and create reusable formulas in it ( configure it once and can change it again). followings are column titles from database that can be picked for example. e.g Col -1 : Marks in Maths Col -2 : Total Marks in Maths Col -3 : Marks in science Col -4 : Total marks in science Finally we should be able to construct any formula in the UI like (Col 1 + Col 3 ) / ( col 2 + col 4) = Formula 1 once this is formula is set saved and a name is assigned to it by user. he/she can use the formula and results shall appear in a window below. i.e He would be able to calculate his desired figures (formula) by only manipulating underlying data on the UI layer....choose the data for a period and apply the formula and get the answer Problem: It looks like I have to create an app where rules are set through UI....... this means no stored procedures are required in SQL.... please suggest the right approach.


title: Shared Development Space

text: Currently the company I work in gives each developer their own development virtual machine. On this machine (Windows 7) they install the entire stack of the product (minus database) this stack is normally spread amongst multiple machines of differing OS (although moving towards windows 2008 and 2008r2) So when a developer has a new project they are likely to be updating only a small piece of their stack and as such the rest of it can become out of date with the latest production code. The isolation from others means some issues won't be found until the code goes into shared test environments/production. I'm suggesting a move from functional testing on these isolated machines to plugging machines into a shared environment. The goal being to move towards a deployment thats closer to production in mechanism and server type. Developers would still make code changes on their Win7 vm and run unit/component testing locally but for functionally testing they would leverage a shared enviornment. Does anyone else use a shared development environment like this? Are there many reasons against this sort of sandbox environment? The biggest drawback is a move away from only checking in code when you've done local functional testing to checking in after static testing. I'm hoping an intelligent git branching strategy can take care of this for us.


title: What's the point of the Prototype design pattern?

text: So I'm learning about design patterns in school. Many of them are silly little ideas, but nevertheless solve some recurring problems(singleton, adapters, asynchronous polling, ect). But today I was told about the so called 'Prototype' design pattern. I must be missing something, because I don't see any benefits from it. I've seen people online say it's faster than using "new"' but this is doesn't make any sense, since at some point, regardless how the new object is created, memory needs to be allocated for it ect. Furthermore, doesn't this pattern run in the same circles as the 'chicken or egg' problem? By this I mean, since the prototype pattern essentially is just cloning objects, at some point the original object must be created itself (ie, not cloned). So this would mean, that I would need to have an existing copy of every object that I would ever want to clone already ready to clone? Seems stupid to me. Can anyone explain what the use of this pattern is? Original post: http://stackoverflow.com/questions/13887704/whats-the-point-of- the-prototype-design-pattern


title: Is having 'Util' classes a cause for concern?

text: I sometimes create 'Util' classes which primarily serve to hold methods and values that don't really seem to belong elsewhere. But every time I create one of these classes, I think "uh-oh, I'm gonna regret this later ...", because I read somewhere that it's bad. But on the other hand, there seem to be two compelling (at least for me) cases for them:   1. implementation secrets that are used in multiple classes within a package   2. providing useful functionality to augment a class, without cluttering its interface Am I on the way to destruction? What you say !! Should I refactor?


title: Finding co-maintainers for open source projects

text: I have a number of open-source projects that have gotten some significant usage and would like to find co-maintainers so that I am not a bottleneck when it comes to maintenance and support requests and to get other perspectives on how the project should evolve. Where should I look for co-maintainers, what should I look for in a co- maintainer, and how should I go about bringing them up to speed on the code and maintainer responsibilities?


title: Why is multithreading often preferred for improving performance?

text: I have a question, it's about why programmers seems to love concurrency and multi-threaded programs in general. I'm considering 2 main approaches here:   * an async approach basically based on signals, or just an async approach as called by many papers and languages like the new C# 5.0 for example, and a "companion thread" that manages the policy of your pipeline   * a concurrent approach or multi-threading approach I will just say that I'm thinking about the hardware here and the worst case scenario, and I have tested this 2 paradigms myself, the async paradigm is a winner at the point that I don't get why people 90% of the time talk about multi-threading when they want to speed up things or make a good use of their resources. I have tested multi-threaded programs and async program on an old machine with an Intel quad-core that doesn't offer a memory controller inside the CPU, the memory is managed entirely by the motherboard, well in this case performances are horrible with a multi-threaded application, even a relatively low number of threads like 3-4-5 can be a problem, the application is unresponsive and is just slow and unpleasant. A good async approach is, on the other hand, probably not faster but it's not worst either, my application just waits for the result and doesn't hangs, it's responsive and there is a much better scaling going on. I have also discovered that a context change in the threading world it's not that cheap in real world scenario, it's in fact quite expensive especially when you have more than 2 threads that need to cycle and swap among each other to be computed. On modern CPUs the situation it's not really that different, the memory controller it's integrated but my point is that an x86 CPUs is basically a serial machine and the memory controller works the same way as with the old machine with an external memory controller on the motherboard. The context switch is still a relevant cost in my application and the fact that the memory controller it's integrated or that the newer CPU have more than 2 core it's not bargain for me. For what i have experienced the concurrent approach is good in theory but not that good in practice, with the memory model imposed by the hardware, it's hard to make a good use of this paradigm, also it introduces a lot of issues ranging from the use of my data structures to the join of multiple threads. Also both paradigms do not offer any security abut when the task or the job will be done in a certain point in time, making them really similar from a functional point of view. According to the X86 memory model, why the majority of people suggest to use concurrency with C++ and not just an async approach ? Also why not considering the worst case scenario of a computer where the context switch is probably more expensive than the computation itself ?


title: Loops in real-life problems

text: I'm learning C as my first programming language. I'm confused on how do loops work in real-life. In programming every function has a reason. example - if/else statements are used if we have conditions. Nesting if/else statements are used if we have conditions inside a condition(more condition). I am going to try my best answering this using a real-life problem. I tend to understand better using Facebook as an example. Let's say a user is signing up for Facebook. We don't want users signing up of age less than 13 years old. If users age is less than 13, it should terminate the sign up page and give a reason saying "Sorry, you're too young". Do we use if/else statement behind situation? Please correct me if I'm wrong. Now, Loops are used for shortening up the program/application. What's the real-life analogy behind this? Using Facebook as an example. Can 'News Feed' be a strong example of using Loops?


title: Writing a PHP wrapper for Javascript to safely access REST API

text: I am looking for signposting help to secure my API keys when accessing a database over REST API from Javascript on a webpage. I have read that in order to secure the API key I need to create a wrapper in PHP that will basically insert the API key into the request to allow the JS on webpage to access the database. Question:   1. Do I understand the concept correctly - re API keys and PHP?   2. Where can I get more info on the wrapper, maybe a tut or something? Thank you for your help. Regards, Nix


title: Creating an in-house single source software development team

text: Our company wants to create a single department for all software development efforts (rather than having software development managed by each business unit). Business units would then "outsource" their software needs to this department. What would you setup as concerns/expectations that must be cleared before doing this? For example:   * Need agreement between units on how much actual time (FTE) is allocated to each unit   * Need agreement on scheduling of staff   * need agreement on request procedure if extra time is required by one party   * etc... Have you been in a situation like this as a manager of one unit destined to use this? If so, what were problems you experienced? What would you have or did implement? Same if you were the manager of the shared team. Please assume, for discussion, that the people concerned know that you can't swap devs in and out on a whim. I don't want to know the disadvantages of this approach; I know them. I want to anticipate issues and know how to mitigate the fallout.


title: How do bug reports factor in to a sprint?

text: I've been reading up on Scrum recently. From my understanding, a meeting is held before the sprint starts, to decide what gets moved from the product backlog to the upcoming sprint backlog. Once a feature is completed in the current sprint, it will go into the "Ready to QA" bucket, and it's at this point that I'm getting confused. Do bug reports go back into the product backlog? I assume they can't go back into the sprint backlog as we've already decided what work will be done for this cycle? What happens when QA finds a bug? Where does it go?


title: What is faster and preferable way for variable assignment in ruby?

text: I am a RoR developer and want to clarify some doubt about ruby variable assignment. In ruby we have two ways for variable assignment.               str, arr, num = "Hi", [1, 2], 3      and               str = "Hi"     arr = [1, 2]     num = 3      I know that the first way will go slower than second way but, I want to know that as per ruby language, which way is preferable and performance reliable?


title: Does "cc", "vv", "^^" have a special meaning in code?

text: Occasionally in code at GitHub I see tags "cc", "vv" and "^^". Do these have any special meaning? Example:               // cc MaxTemperatureMapper Mapper for maximum temperature example     // vv MaxTemperatureMapper     import java.io.IOException;          import org.apache.hadoop.io.IntWritable;     import org.apache.hadoop.io.LongWritable;     import org.apache.hadoop.io.Text;     import org.apache.hadoop.mapreduce.Mapper;          public class MaxTemperatureMapper       extends Mapper<LongWritable, Text, Text, IntWritable> {          {snip}          }     // ^^ MaxTemperatureMapper      From https://github.com/tomwhite/hadoop- book/blob/master/ch02/src/main/java/MaxTemperatureMapper.java


title: Checking preconditions or not

text: I've been wanting to find a solid answer to the question of whether or not to have runtime checks to validate input for the purposes of ensuring a client has stuck to their end of the agreement in design by contract. For example, consider a simple class constructor:               class Foo     {     public:       Foo( BarHandle bar )       {         FooHandle handle = GetFooHandle( bar );         if( handle == NULL ) {           throw std::exception( "invalid FooHandle" );         }       }     };      I would argue in this case that a user should not attempt to construct a `Foo` without a valid `BarHandle`. It doesn't seem right to verify that `bar` is valid inside of `Foo`'s constructor. If I simply document that `Foo`'s constructor requires a _valid_ `BarHandle`, isn't that enough? Is this a proper way to enforce my precondition in design by contract? So far, everything I've read has mixed opinions on this. It seems like 50% of people would say to verify that `bar` is valid, the other 50% would say that I shouldn't do it, for example consider a case where the user verifies their `BarHandle` is correct, but a second (and unnecessary) check is also being done inside of `Foo`'s constructor.


title: Which comments instantly ring alarm bells when a programmer says them?

text: Similar to my question about easily spotted warning signs in code I think sometimes comments programmers make can tell you quite a lot (of not good things) about them in a short period of time. The scariest I've heard recently (from a senior) is: > I could use source control, but it'd slow me down Also, although not in the same category when I see something listed at the top of someone's CV and I ask them about it: > Oh, I didn't really use that but I was just in the same room as people using > it. Duh! Then why is it featured prominently on your CV??? Finally I quite often interview people with what looks like an excellent set of skills on paper. Sometimes these are excellent developers, but some of them when asked about a topic will rattle through a dictionary definition like a machine gun (and probably a better definition than I would be able to say if put on the spot like that). Then when asked to explain even really, really simple things to do with that topic are totally unable to (usually coming up with something totally wrong, followed by a repeat of the dictionary definition). I suspect that these are developers who have been in teams where they're not treated well and so have had no opportunity to act independently - which results in their learning being very superficial. What other things have you heard that tell you that a programmer is, er, let's try and think of a nice way of saying this...still taking the first steps towards being great?


title: Trivially Sortable Encoding for Arbitrary-Precision Decimals

text: I'm looking for a reasonably(*) space-efficient way to encode arbitrary- precision decimals (e.g. BigDecimal), such that when sorting the bit-pattern of the encodings lexicographically, the numbers will be sorted numerically. This is related to this Stackoverflow question. One simple/naive approach to this would be to convert the number to some IEEE- like representation with some 8-byte exponent (which is what RR in the NTL does?), but obviously this is quite an inefficient(*) representation. Is there perhaps some other approach to this? Are there any optimizations possible for arbitrary-precision Integers? The encoding need not support any other operations than sorting (and, if possible, decoding the number again). (*) By reasonably speace-efficient I don't mean cramming bits together into bytes like IEEE-754 does. I just don't want to have any unnecessarily large fields that will remain mostly empty in a large number of situations (as would be the case with an 8-byte exponent). The motive for this is that the (encoded) number will later on be processed by this scheme, which takes a few milliseconds per byte to run. The runtime-efficiency of the encoding/decoding on the other hand isn't much of an issue (anything less than 10 ms for 128 bytes of data will still be overshadowed by the runtime of the OPE scheme liked above). (Also note, this should be a decimal representation, so there are to precision-issues due to "binary stuff".)