title: Suggestions for tree (as a visualization tool) editing software?

text: I'm trying to generate a call tree for code I'm working on (I didn't write it) to help me understand it. I want to be able to manually enter each function and the functions it calls (as children), thus building the tree. But I'd like it to automatically organize and position the chart so that nothing overlaps without my having to move everything around every time I add something. For example, here's the structure of the kind of data I'd want to put in, in crappy Lispesque format:               ( initAll //root node       ( //root node's children - functions it calls         ( initDisplay () ) //this child is a leaf         ( initControlBar            ( //initControlBar's children - functions it calls              ( addButtons () )              ( setUpControlBarEvents () )            )         )         ( alertUserSystemReady () )       )     )      I guess it could be a graph tool (trees being a subset of graphs, of course), but I don't imagine a graph tool would have the ability to automagically put things on the right level. What I like about organizing this data as a tree is that there are distinct levels, which helps me visualize what's going on. I've tried yEd and LucidChart, but both were too manual for me. Since the tree is going to go pretty deep, I need something that can automatically restructure with the tree data. I also tried GraphViz, but couldn't get it working (I'm on Windows and didn't know what to do after the install). Google isn't helping much on the tree editor end - it's giving me pages like http://bioinfo.unice.fr/biodiv/Tree_editors.html which just have way too many to choose from. In this case I think using others' experience would be better, so I came here. So, anybody know of any tools that would get me closer to my goal? Thanks!


title: how to reduce or stop duplication of relation's entry in treeview

text: I want to create tree-view for display or show family member's relation. For this I created 3 tables i.e following.               familyDetails->[f_id,fname,lname]     relations -> [r_id,relation] .....//e.g father,mother,son,etc.     familyRelations ->[fr_id,fk_f_id1,fk_r_id,fk_f_id2]      //to show A is Father OF b.      Here problem is, if I say A is father OF B and C than it'll make one entry in `familyRelations` table. But here it will also create one more entry for B is daughter of A. So in opposite relation (e.g father->son or son->father, etc ) it'll create entry for all case. So if there are N no of people in family then it'll create N * N entries in familyRelations table. How to define relationship with other members. This flow is right or need to change? I am confused in this. So how to solve this problem. Or is there any another way?


title: Package software separately from content that is CC BY-NC-SA 3.0 license

text: I have content that is CC BY-NC-SA 3.0 (see http://creativecommons.org/licenses/by-nc-sa/3.0/), can software that uses it still be produced commercially and just let the user download the content separately? In other words, if I have commercial software that uses the content with CC license, can the software still be distributed as commercial and just not be distributed with that content... OR, would that still violate that CC license and the software therefore can't be commercially sold? If someone knows the answer or can point me to a place to find out the answer, I would really appreciate it. Thanks!


title: How do I learn the right approach to implement half a feature?

text: I lead a development team and I want to release our product as often as possible (Continuous Delivery). In many cases, we have to implement a feature that takes longer to implement than the time between releases. I still want people to commit their code on a daily basis (Continuous Integration). Many times implementing a new feature requires existing feature to be changed and the existing features, of course, still need to work, even if the new feature is not finished yet. If the developer uses the **right approach** , they can adjust existing features carefully and all of the above is not a problem. However, what IS the right approach actually? My own programming attuned mind tells me what to do for each individual case, but I need to learn more and I need some reading material that I can read and refer team members to read. Or any other method of learning the right way to learn this approach will do. So that's the question. **How do I make sure team members learn the right approach to implement half a feature?** I've searched for people claiming to have strategies regarding this, but haven't found it yet, except people writing a few random thoughts on the topic. Perhaps I'm not using the right search words or perhaps no one has made any authoritative guidelines on this. **UPDATE** I selected the best answer, but the nature of the question made it difficult to make one clear all-covering answer.


title: Business Equity for Code. Is it advisable to enter into such agreements?

text: I have been considering this approach for a project I am about to embark upon and would like to hear from other programmers about their experience in contributing code for equity. Has anyone been truly successful in such an endeavour.


title: What are bit operators good for?

text: Programming languages often come with various bit operators (e.g. bitwise left- and right shift, bitwise AND, OR, XOR...). These don't get used though very much, or at least such has my experience been. They are sometimes used in programming challenges or interview questions, or the solution migh require them, e.g.:   * Without using any equality operator, create a function which returns `true` when two values are equal   * Without using a third variable, swap the value of two variables These then again, probably have few **real world** uses. I guess that they should be faster because they directly manipulate memory on a low level. Why are such found in most programming languages? Any real world use cases?


title: Bits manipulation in C

text: I am now studying computer system in my college, and now we are learning about bits manipulation in C. And I am just curios, how can by learning bits manipulation can help us to make a reliable code ? what is it for when it comes to the real world problem? and in what way it is very useful in our program ? thank you


title: Advantage of using Swing over AWT

text: Why is Swing preferred over AWT? Which Swing component could be used for playing a video on it?


title: Are there any (free) video formats that include channels for arbitrary time-dependant data?

text: I'm in the process of writing an image analysis pipeline and I've hit a bit of a roadblock. Here's the 30,000-ft view:   1. Images arrive as base64-encoded PNG images over standard input   2. Images are decoded, and processed. I don't think the details are particularly relevant, but I am happy to offer specifics in the form of an edit.   3. When the analysis is complete, the **entire stream** must be concatenated into a seekable, timestamped format (that is, a video file of some sort) and saved to disk. My question pertains to `stage 3`. At this final stage of the pipeline, each frame will have a set of associated features that were extracted via the image analysis performed in `stage 2`. I would like for the final output format (the video format) to preserve this information alongside the frame that "owns" it. In other words, one should think about this as a separate channel that evolves alongside the video data, locked to the same time reference. This would notably allow me to treat features as time-series. Here's a simple diagram to further illustrate what I'm trying to achieve.               -0 ms--16 ms--32 ms--48 ms--64 ms- ... n ms ->  # time channel     -F1----F2-----F3-----F4-----F5---- ... Fn --->  # video channel     -1.1---3.6----5.0----2.6----3.1--- ... 11.2 ->  # data channel 1     -100---105----120----96-----101--- ... 52 --->  # data channel 2      As you can see in the above schema, there are two data channels (although, ideally, the format should support an arbitrary number of channels) whose values evolve over time. Note that the `time` channel need not be an actual channel, _per se_ , but was illustrated as such simply to show that video and data channels are represented as a function of time. At the very least I'd like to be able to populate each "index" of each channel with an int or a float. Ideally, however, I would like to be able to hold a reference to some binary data of arbitrary length. In addition to providing the above functionality, this hypothetical codec should support some form of modern video compression. Does such a thing exist?


title: "Viral" license that only blocks legal actions of user and developer against each other

text: I was thinking a lot about software licensing lately, because I would like to do some coding. I'm not an expert in all those licenses, so I came up with my own idea, and before I will put in on paper, I would like to make sure that I didn't reinvent a wheel, so maybe I would be able to use something that exists. Main idea behind my license is to guarantee freedom of use the software, but not "freedom to" (positive) (e.g. freedom to having source code), but "freedom from" (negative) (strictly from legal actions against you). It would be "viral" copyleft license. You would be able to without fear do everything you want with the software (and binaries e.g. reverse engineering), as long as You will include information about author and/or authors, and all derivative works will be distributed with the same license. I'm not interested in anything that would restrict a freedom of company to do something like "tivoization". I'm just trying to accomplish something that would block any legal actions of user and developer, targeted against each other, with the exception of basic attribution. Does exist something like that?


title: What is the best solution for an API class that could have different end points? (iOS)

text: What is the best approach for creating a singleton API class, where different requests could call different api providers and how to manage this? For instance you might have a singleton class 'API' that could have a couple of methods such as               getProduct     getImage     getUser      What is the best way to manage this, but in theory getProduct needs to call api.website1.com getImage needs to call api.website2.com/v1/ getUser needs to call api.website2.com/v2/ But there's nothing to say that getImage might end up using website1.com in future or that getUser might end up using /v3/ I'm trying to think of a good way to manage this where the endpoints (and credentials) could potentially change for the different request, but for a developer just consuming the singleton API class, they aren't fussed where it actually comes from. I think the right approach is to make sure the requests conforms to a particular interface (regardless of where it comes from e.g type User) but I think it's the config around instantiating the correct API request type and the right credentials that I'm struggling to get my head around. I'm guessing a factory that returns the correct provider would be a good way to go, but instructing that factory to return the correct provider is proving difficult. This is iOS based, but any conceptual ideas would be appreciated thanks


title: When should var be used instead of declaring an explicit type?

text: var Id = from value in Enumerable.Range(0, 100)                                   select value;                  IEnumerable<int> ids = from value in Enumerable.Range(0, 100)                                   select value;                            foreach (var v in Id)             {                 Console.WriteLine(v.ToString());             }                  foreach (var x in ids)             {                 Console.WriteLine(x.ToString());             }      Both will do the same job, but what is the difference?


title: Design Application to "Actively" Invite Users (pretend they have privileges)

text: I am designing an application where users message one another privately, and may send messages to any `Entity` in the database (an `Entity` may not have a user account yet, it is a professional database). I am not sure how to best design the database and the API to allow messaging unregistered users. The application should remain secure, and data only accessed by those with correct permissions. Messages sent to persons without user accounts serve as an invitation. The invited person should be able to view the message, act on it, and complete the user registration upon receiving an `InviteMessage`. In simple terms, I have:               User         misc user fields (email, pw, dateJoined)          Entity (large professional dataset):        personalDetails...         user->User (may be null)           UserMessage:        sender->User         recipient->User        dateCreated        messageContent, other fields.....          InviteMessage:        sender->User        recipient->Entity        expiringUrl        inviteeEmail        inviteePhone      I plan to alert the user when selecting a `recipient` that is not registered yet, and inform that he may send the message as an invitation by providing email, phone where we can send the invitation. Invitations will have a unique, one-time-use URL, e.g. `uuid.uuid4()`. When accessed, the invitee will see the `InviteMessage` and details about completing his/her registration profile. When registration is complete, `InviteMessage` details to a new instance of `UserMessage` (to not lose their data), and assign it to the newly created `User`. The ability to interact with and invite persons who do not yet have accounts is a key feature of the application, and it seems better to separate the invitation from the private, app messages (easier to keep functionality separate, better if data model changes).   * Is this a reasonable, good design?   * If not, what would you suggest?    * Do you have any improvements?   * Am I correct to choose to create a separate endpoint for creating invitations via the API?


title: Are there such thing as assembly SDK's?

text: I've never worked in assembly, but I was just curious if SDK's exist for assembly programming. For instance, if I wanted to create a linked list, are there libraries available that have already done this, or is everything typically done from scratch?


title: What to include in a report on software implementation and how?

text: I am currently writing an extended report on a software library I have written. The reviewer will be a professor at my univeristy. He knows basically what I had to do, but the report will be evaluated. I have produced some samples results with the library which I already plan to include in the work. What I want to know know is :     * What should I write about the library itself?   * How should I structure it?   * Which points need to be emphasized? Also, the professor is as allergic to mundane implementation details as a business manager.


title: How to teach pointers to beginners in C?

text: I'll hold a little presentation about C-Pointers in a small group of people with beginners programming skills, with no CS background. Just people who would like to learn something about coding and prefer a practical hands-on approach. In fact, they are using the C-Language to do so. We are about to introduce pointers and I am very careful about the scope for the first introduction, since pointers can be quite overwhelming and confusing for the uninitiated. So I am wondering, how would you approach this topic to make it fun and interesting? Do you have great examples that really help people to understand the concept of pointers? Hint: The audience doesn't know about strings and arrays yet. Scope-wise, here is what I've got so far:   * Example: A problem that shows the limitation C without pointers and why we need something more elaborate.     * Call by reference vs Call by value example?   * Very short introduction what a pointer is and how it is denoted in C. (* and & operators )   * The difficult part: How does a pointer work? Or: How to explain a technical problem to non-technical people?     * Looking for a real work example for a referencing system. Is a library a good example?     * What is memory and how does it interact with our code and variables?     * How does a variable look like in memory? (memory allocation)     * How is this variable accessed? (address referencing)     * How can I use a pointer to access memory?   * In dire hope, people can follow this train of thought:      * Live example and practice Things I would like to omit for a part2:   * Null-Pointer   * Pointer on Pointers   * Pointer arithmetic   * Adresses vs. Pointers   * Structs   * Arrays


title: Estimation of your backlog

text: How far in advance should you estimate stories in your backlog? My concern is that estimates that are 6 months out will become out of date as you develop features in the current sprint. I thought that with agile you re- estimate your current sprint.


title: How common are circular references? Would reference-counting GC work just fine?

text: How common are circular references? The less common they are, the fewer hard cases you have if you are writing in a language with only reference counting- GC. Are there any cases where it wouldn't work well to make one of the references a "weak" reference so that reference counting still works? It seems like you should be able to have a language only use reference counting and weak references and have things work just fine most of the time, with the goal of efficiency. You could also have tools to help you detect memory leaks caused by circular references. Thoughts, anyone? It seems that Python uses references counting (I don't know if it uses a tracing collector occasionally or not for sure) and I know that Vala uses reference counting with weak references; I know that it's been done before, but how well would it work?


title: Are trees organised by a "firstchild, nextsibling" structure? If not, why not?

text: Usually, tree data structures are organised in a way that each node contains pointers to all its children.                      +-----------------------------------------+            |        root                             |             | child1            child2         child3 |            +--+------------------+----------------+--+               |                  |                |     +---------------+    +---------------+    +---------------+     |    node1      |    |     node2     |    |     node3     |     | child1 child2 |    | child1 child2 |    | child1 child2 |     +--+---------+--+    +--+---------+--+    +--+---------+--+        |         |          |         |          |         |      This seems natural, but it comes with some problems. For example, when the number of child nodes varies, you need something like an array or list to manage the childs. By using only (first)child and (next)sibling pointers instead, we get something that looks like that:                      +-------------------+            |        root       |            | child    sibling  +--->NULL            +--+----------------+               |                  +----------------+    +----------------+    +----------------+     |    node1       |    |     node2      |    |     node3      |     | child  sibling +--->| child  sibling +--->| child  sibling +--->NULL     +--+-------------+    +--+-------------+    +--+-------------+        |                     |                     |      Oviously, this kind of structure can represent trees just as well, but it also offers some advantages. Most important is that we don't have to worry about the number of child nodes any more. When used for a parse tree, it offers a natural representation for a term like "a+b+c+d+e" without becoming a deep tree. Do collection libraries offer tree structures like that? Do parsers use such a structure? If not, what are the reasons?


title: Testing Java as Groovy

text: We're looking into improving our testing process for some of our applications, and the idea that's been put forward it to write unit tests in Groovy and automatically run them with Maven. The first application to get this treatment is written in Java, but I've been told that some of the classes being tested need to be renamed as ".groovy" files * and they will then be compiled as Groovy classes, not as Java classes. This renaming can all be done using Maven and Ant, but I'm concerned that if we compile our classes as Groovy classes, we're not actually testing them as Java classes, which is how they will be deployed. During the demo, it was also shown that Groovy does not compile to the same bytecode that Java does. There was at least one Groovy-specific member that was added, called "metaClass" (there were others, I didn't get a good enough look at the screen). Apparently this is necessary for the testing framework they want to use, which is named Spock. Am I right to be concerned about this? Does it matter? * I've been told this is for technical reasons that have to do with the way the application is built. I've been told that this does not apply to _all_ classes, but to some.


title: Is C#-4.0 an open standard?

text: The Ecma-334 (ISO/IEC 23270:2006) standard corresponds to the version 2.0 of the language. Specification of version 4.0 is freely available from Microsoft, but Microsoft's open specifications list only lists the Ecma (version 2.0) version. So what about all the good features added in the later versions (LINQ, lambda functions, etc)? Can one implement them in his compiler?


title: Applications with duplicate data - keep separate or combine into one set?

text: We currently have 3 similar, but slightly different applications that use the same data. We load the (same) data into each application that uses it. The applications are similar and use the same technology (Ruby on Rails) but were developed by different programmers. In consolidating this data, our management seem the benefit to using the same tools (gems, modules, etc) but does not seem aware of many other reasons why we should consolidate things centrally. I've worked in several different organizations including one position in Data Warehousing so the centralization of data seems like a no-brainer to me. The life-cycle of the data is the following year for the current paying customer, but then also longer term as we get the data from the various organizations that have it, over the years, and we'll want to compare one org and one year to others. However I want to put together a list of all the reasons to centralize (or not) this set of data. So far I have:   * reduce duplication of effort. When we implement a function we currently may have to do it in two places, increasing both the effort to implement the function in two places and also the cost of writing it twice.   * Quality of data. Creating two data set that have similar but different contents will lead to discrepencies between the two that will grow over time, reducing the value of the data. I am looking for a list of other reasons, particularly those that relate to the overall cost.


title: Unit testing on visualization (3D graphics) frameworks

text: This is a follow up to this question. There I was asking how to do unit testing when you have a library of scientific algorithms. I have a similar problem now but with a different project. I'm working on a 3D graphics engine framework abstraction for DirectX, OpenGl, WebGl, Silverlight, WPF, and basically whatever 3D API is out there, on C#, called Rendering .NET. The scenario is the following, the project is being developed by a small team of colleagues of mine, all working in the same office. We are all computer scientists, not much into the software engineering community and practices. I even had a hard time to convince to switch from Subversion to Git, and to publish the project on Codeplex. The project is getting big (around 80K lines of C#), and it now covers most of DirectX and OpenGl up to Shader Model 5.0, so its not a one man's project like the one described in the linked question. We also want to encourage the open source community to collaborate. So far we've been testing by writing small applications that involve initializing all devices and resources, setting up a scene, and drawing. The thing is, I don't know how to make it different, I mean, how to design small test cases that test specific features of the framework, like resource allocation, primitive tessellation, shader compilation, etc., without having to recreate the entire engine initialization. For some of these cases I can think of useful mocks, but in general, how can I test the correctness of a rendering algorithm when the output is visual (an image, or an animated scene)? Right now the most clever thing we have come up is to render the same scene to a software renderer, DirectX and OpenGl, and compare them pixel by pixel, but tiny variations of the APIs make the resulting images different enough to fail the tests without being actual bugs. So, what is the "correct" testing approach here?


title: Why are the Java 8 java.time classes missing a getMillis() method?

text: Java 8 has a whole new library for dates and times in the package java.time which is very welcome thing to anyone who has had to use JodaTime before or hassle with making it's own date processing helper methods. Many classes in this package represent timestamps and have helper methods like `getHour()` to get hours from timestamp, `getMinute()` to get minutes from timestamp, `getNano()` to get nanos from timestamp etc... I noticed that they don't have a method called `getMillis()` to get the millis of the time stamp. Instead one would have to call method `get(ChronoField.MILLI_OF_SECOND)`. To me it seems like an inconsistency in the library. **Does anyone know why such a method is missing, or as Java 8 is still in development is there a possibility that it will be added later?** http://download.java.net/jdk8/docs/api/java/time/package-summary.html > The classes defined here represent the principal date-time concepts, > including instants, durations, dates, times, time-zones and periods. They > are based on the ISO calendar system, which is the _de facto_ world calendar > following the proleptic Gregorian rules. All the classes are immutable and > thread-safe. > > Each date time instance is composed of fields that are conveniently made > available by the APIs. For lower level access to the fields refer to the > `java.time.temporal` package. Each class includes support for printing and > parsing all manner of dates and times. Refer to the `java.time.format` > package for customization options... Example of this kind of class:   http://download.java.net/jdk8/docs/api/java/time/LocalDateTime.html > A date-time without a time-zone in the ISO-8601 calendar system, such as > 2007-12-03T10:15:30. > > `LocalDateTime` is an immutable date-time object that represents a date- > time, often viewed as year-month-day-hour-minute-second. Other date and time > fields, such as day-of-year, day-of-week and week-of-year, can also be > accessed. Time is represented to nanosecond precision. For example, the > value "2nd October 2007 at 13:45.30.123456789" can be stored in a > `LocalDateTime`...


title: What "business things" should a programmer know about their company and team?

text: I spend a fair amount of time reading programming blogs, and it seems to be a popular belief that having business knowledge adds value to a programmer. I can see the reasoning for this:   * Understanding the business helps programmers make wise decisions   * Might encourage less "taking too long making everything perfect" and more "getting things done"   * etc. I'm currently an intern at a major company. I've learned loads of great technical things during my time here and I've definitely developed as a programmer. However, I feel like I don't understand my team's place in the ecosystem as well as I understand the technical stuff I'm actually doing. To remedy this problem, I'm planning a meeting with my manager. This seems like a great opportunity to learn about my company/team and become a more valuable contributor. I'm trying to come up with a list of questions to ask. So far I'm thinking of things like:   * Who are all of our customers?   * Could you describe our company's relationship with other companies? I want to make the most of this time to learn about the company and my team's role in it. So, what "business aspects" of my team are most important for me to learn about? What kinds of things should I ask about? Notes about my team:     * Much of my team's work is for internal use in the company   * Not a "customer oriented" team in that sense, though our customers are other teams in the company   * Much of my team's work consists of enhancing tools (adding features rather than developing whole new products) p.s - this question is similar to this question, but is different in the sense that I'm not asking what I need to know about business in general, but what I should learn about my specific company and team


title: What are the advantages of showing line numbers in a text editor?

text: I feel weird when I'm editing code in an IDE that does not have line numbers in the text editor. The questions I have are:   1. Are line numbers visually excessive, particularly when a find by line function exists in your IDE of choice?   2. What are the uses of showing line numbers?


title: Is there an alternative to HTML Web Sockets, now that Firefox 4 has disabled them?

text: I've been checking out some of the latest multiplayer engines in HTML all supporting multi-user games (Very nice) - I believe all these engines use Web Sockets for communication. > That’s why we’ve decided to disable support for WebSocket in Firefox 4, > starting with beta 8 due to a protocol-level security issue. Beta 7 of > Firefox has support for the -76 version of the protocol, the same version > that’s included with Chrome and Safari. Beta 8 of Firefox 4 will remove that > support. Anne van Kesteren of Opera also announced that Opera are dropping > Websocket support. We are confident that other browser developers will > follow. Source: Websockets Disabled in FireFox 4 I've just come accross the above, so no sockets in Firefox 4 or Opera.... thats big. Is anyone aware of an alternate or is it Chrome or do we need to just sit and wait for the next release of the major browsers. More info : Rocket Engine appears to work with all browsers including IE8 (http://rocketpack.fi/engine/) what will it be using as a method of communication?


title: "I have been put into testing, what is wrong with me?"

text: I don't have much real life experience with project development and testing, apart from small collegeprojects. During my software engineering lecture, from a bunch of notes, a simple statement caught my eye: > Myths of testing: > >   1. I have been put into testing, what is wrong with me? >   2. .. >   3. .. > I was like: Is this really a myth? Is this not for real? Don’t people in testing team want to be developers? Won’t they think why I am into testing, but not in development? Or people in development are better than me? **Why I think in this way:** because after all these years, in the end if I don't get to write my own software, but have to debug other people's code, won't someone be disappointed? But, on the other hand, maybe I am wrong. It's not just only to sit and debug other's code... There's much more. **Am I missing something?**


title: benchmarks for quasi real-time software

text: I'm wondering if there is any benchmarks which can help to understand real- time characteristics (response time) of non-real-time software. For instance C# application on Windows or MSSQL Server. I know that Windows is not real-time OS, however it does not prevent us to use it in Real-time system if there some additional real-time layer. Let's say we have some real-time system, which reads and store data from some ADC. Data are read from ADC and timestamped on FPGA w/ some real-time Firmware. That part of the system is responsible for taking samples from ADC with some precise interval (let's w/ 10kHz frequency) and for timestamping the data. Afterwards firmware pack samples into data package (let's say 0.1 sec) transfer data via TCP/IP to application on Windows machine. Windows machine should store the data and display it. Yes, application on windows is not real- time as well as TCP/IP connection does not guarantee data delivery in fixed time. For instance   * in some case data transfer might take 0.01sec and 1 sec in another case.    * Windows may interrupt application's threads for a few second.   * application might interrupt itself when garbage collector is working so as a result we may have a few second interrupt in the part of the system which is beyond Controller/Firmware. I.e. response time from non real-time subsystem is varying in some range. However this issue could be solved if there is buffer big enough on controller, so it can accumulate data waiting for response from non real time subsystem. In order to be sure that buffer on real-time subsystem is big enough to support non-real-time subsystem we need to understand response time probability distribution. Something like:   * response time <1sec in 80% cases   * 1sec    * 2sec    * 5sec    * 10sec  That is basically the question. Any benchmarks for Windows, C# or MS SQL? Any methodic? TPC does nice benchmarks for SQL Servers performance however they total performance, and do not consider response time AFAIK.


title: What's the difference between static and dynamic binding?

text: We are learning about methods in class, and I am having trouble especially with the concept of static vs. dynamic. Wikipedia says this: > Methods can be bound to a class at compile time (static binding) or to an > object at runtime (dynamic binding). Can anyone describe what they mean here?


title: What do you do to get your software design robust, flexible and clear?

text: I am still getting mature as a software engineering/designer/architect, as you may want to call. At this point in time, I am getting small projects, private projects and so on. What I noticed is that even though I think about the SW structure, design some diagrams, have they really clear in my mind when I start coding, at the end, my software is not flexible and clear as I would like to. I would like to ask you what kind of approaches, mechanisms or even tricks do you use, to get your software (and SW design) flexible, robust and clear (easy to understand and use). So.... Any ideas to give to a beginner?


title: Programming language popularity: Is there data on migration trends?

text: I'm looking for historical statistics showing approximately how many developers of some language X switch to language Y. It should be the kind of data that answers question such as:   * Are former VB6 developers using mainly C# or VB.NET now?   * Have many Java developers switched their main development language to Scala so far?   * etc. I'm not doing a study, I'm mainly curious. Is there some website or institution that collects and publishes such data?


title: Azure Storage Table design with multiple query points

text: I have the following Azure Storage Table. **PositionData table:**               PartitionKey: ClientID + VehicleID      RowKey: GUID      Properties:  ClientID, VehicleID, DriverID, Date, GPSPosition      Each vehicle will log up to 1,000,000 entities per year per client. Each client could have thousands of vehicles. So, I decided to partition by `ClientID` \+ `VehicleID` so to have small, manageable partitions. When querying by `ClientID` and `VehicleID`, the operation performs quickly because we are narrowing the search down to one partition. **PROBLEM:** The problem here is that sometimes I need to query on only `ClientID` and `DriverID`. Because it's not possible to perform partial PartitionKey comparisons, every single partition will need to be scanned. This will kill performance. I can't have a PartitionKey with all `ClientID`, `VehicleID` and `DriverID` because queries will only ever query on `VehicleID` OR `DriverID`, never both. **SOLUTION 1:** I considered having a value stored elsewhere which represented a VehicleID and DriverID pair, and then having a `ClientID + VehicleDriverPairID` PartitionKey, but that would result in hundreds of thousands of partitions and there will be much unioning of data between partitions in my code. **SOLUTION 2:** Have a partition for `Client + VehicleID` and another partition for `Client + DriverID`. This means that updating the table is twice as much work (two updates) but both queries will be fast. Also there will be redundant data. Do any of these solutions sound viable? Other solutions?


title: What are your advice, methods, or practices to take out the most from a day on-site at a customer?

text: We just deployed a large software that affects the way the user work-day looks like in many aspects. It changes a lot of things in the way they interact between eachothers. The developers of the team are taking rounds and spending one day at the customer's site to understand better what is a typical day for our user, and the learning process they go through. In this context, what How would you approach that day, what kind of questions do you ask, how do you observe the user. Are there defined practices that exist? Also what wouldn't you do? Did you have some bad experience out of this?


Frequently in my programming experience I need to make a decision whether I should use float or double for my real numbers. Sometimes I go for float, sometimes I go for double, but really this feels more subjective. If I would be confronted to defend my decision, I would probably not give sound reasons. When do you use float and when do you use double? Do you always use double, only when memory constraints are present you go for float? Or you use always float unless the precision requirement requires you to use double? Are there some substantial differences regarding computational complexity of basic arithemtics between float and double? What are the pros and cons of using float or double? And have you even used long double?


title: Should we test all our methods?

text: So today I had a talk with my teammate about unit testing. The whole thing started when he asked me "hey, where are the tests for that class, I see only one?". The whole class was a manager (or a service if you prefer to call it like that) and almost all the methods were simply delegating stuff to a DAO so it was similar to:               SomeClass getSomething(parameters) {         return myDao.findSomethingBySomething(parameters);     }      A kind of boilerplate with no logic (or at least I do not consider such simple delegation as logic) but a useful boilerplate in most cases (layer separation etc.). And we had a rather lengthy discussion whether or not I should unit test it (I think that it is worth mentioning that I did fully unit test the DAO). His main arguments being that it was not TDD (obviously) and that someone might want to see the test to check what this method does (I do not know how it could be more obvious) or that in the future someone might want to change the implementation and add new (or more like "any") logic to it (in which case I guess someone should simply test that **logic** ). This made me think, though. Should we strive for the highest test coverage %? Or is it simply an art for art's sake then? I simply do not see any reason behind testing things like:   * getters and setters (unless they actually have some logic in them)   * "boilerplate" code Obviously a test for such a method (with mocks) would take me less than a minute but I guess that is still time wasted and a millisecond longer for every CI. Are there any rational/not "flammable" reasons to why one should test every single (or as many as he can) line of code?


title: The Wikipedia animation for Maze generation using DFS isn't consistent wrt the written algorithm given there, isn't it?

text: Please have a look at this link: http://en.wikipedia.org/wiki/Maze_generation#Depth-first_search Here, the theoretical algorithm given is: > Consider the space for a maze being a large grid of cells (like a large > chess board), each cell starting with four walls. Starting from a random > cell, the computer then selects a random neighbouring cell that has not yet > been visited. The computer removes the 'wall' between the two cells and adds > the new cell to a stack (this is analogous to drawing the line on the > floor). The computer continues this process, with a cell that has no > unvisited neighbours being considered a dead-end. When at a dead-end it > backtracks through the path until it reaches a cell with an unvisited > neighbour, continuing the path generation by visiting this new, unvisited > cell (creating a new junction). This process continues until every cell has > been visited, causing the computer to backtrack all the way back to the > beginning cell. But I don't think the animation on it's right uses the same algorithm to generate the maze, though it's not incorrect. I feel the animation uses this algorithm:   1. Start with any unvisited cell, make it a part of the maze and mark it visited.   2. Add the unvisited neighbours of that cell to the set of cells that can be considered next   3. Choose any one of cells from the set and mark it visited.   4. Check if that cell does not have any neighbours that are visited except ONE (the one which caused this cell to be added to the set in the first place). Else go to 3.   5. Continue till all cells are visited. Am I wrong?


title: Documents to use on project development

text: I am lost on how to plan the development of a iphone mobile app, when building a specific mobile app for a client, i need to make a questionnaire for that same client and i also need to have a document to accompany the project development, something like a bug report file, and a app features document. My question is, for the experienced developers, what do you guys use to plan your entire development process? do you have any doc templates that you use to address these issues?


title: Using version control in an IDE

text: I write all (well, most) of my programs in an IDE, mostly it's netbeans. Should I just use Mercurial through the IDE, or is it better if I used the CLI instead? and why?


title: My first SLA(Service level agreement ) as a freelancer

text: I started to work freelance just a couple of months ago. My first client asked me to create a web app, to improve his business. I made a little specification about what i was able to do and also an approximation about how long it will take to prepare the application. We just have some no formal agreement where i told him a deadline when i will present the progress of the project. Also we did not agree any payment at all, since he said to me that he will pay me when the program is live. What is happening now, is that the program did not meet the deadline and i will present the progress one month after what we agreed. As you see we both made a mistake(myself first), but i hope it is not to late to fix it. I want to make an SLA, to include the amount i want to get paid for my work, and also detailed information about what he will get. I would appreciate if someone more experienced than me could give me some tips on what should i include in the SLA documment and also if can i get some recommendations for not making the same mistake in the future.


title: How do I weigh quality of code versus quality of product when deciding whether to add my open source app to my resume?

text: I've made significant, well written code contributions to an open-source project. Unfortunately, the project as a whole is both unpopular, and, to put things mildly, not particularly flashy. Unlike the poster of this HN message, I'm in the opposite boat - I'm proud of my contributions, but embarrassed by the end product. How would you weigh the quality of your contributions versus the quality of the end product versus the popularity of the end product when deciding if you should include it on your resume/portfolio or not?


title: How to deal with the MPL in a pragmatic way?

text: Until recently I always avoided the use of open-source code in my applications, because of the legal headache it gives me. I rather spent a fair amount of money and not worry about attribution (since most commercial components don't require that), than paying nothing, but spending a lot of time reading legal texts, never to be sure whether I was fully compliant. However, there is a ton of code out there that would be a shame to ignore. Also, sometimes the open-source solutions are of better quality than their commercial counterparts. The license I encounter most and find hardest to grasp, is the MPL. All FAQs state that it is no problem to compile the code into a closed-source application, as long as changes to the code are made available. Assuming that I will not make changes to the code, what other things are there to keep in mind? For example, copyright notices and attribution; am I required to include a bunch of files with all the different copyright notices? Should I double- size my About dialog and list all open-source components with their vendor website and so on? How do you deal with this? Please note that I have no problem with giving authors of code the credit they deserve. I would simply like to know what is reasonable, so I can take care of it in a pragmatic way, and no longer fear at least the MPL. Hoping for your experiences. ## Update To make my question more clear, I will use an analogy. Let's say I am going to write a book A, and I would like to use some parts of a book B that someone else has written. The author of B is fine with this, as long as I credit him (very much like a clause in the MPL). But how should I do that? Am I to put his name on the cover of mine and/or in the margin of every page where I use full paragraphs from him and/or where I use full sentences from him and/or where I use a couple of words from him and/or in a dedication section with sources? Or perhaps it would suffice to print his name in black letters on a black page, or in font size .00001? Luckily, for books there aren't as many ways to do it as with software, and there is some established practice. In the field of software, I have yet to discover any, so I'm asking here if I missed something.The point is not to give as little attribution as possible, but I'm looking for what's acceptable and fair; you wouldn't like to write a book in which each page is half-filled with attributions either... Attribution is only one of the terms that I find hard to concretize. What about making the code and the license texts available if I changed nothing? Do I link to the authors website, or mirror it on my own and link to that, or put it in my installer? And, **for example** , from the Firebird Project I have most files in one place, but a couple of DLLs are spread over the folders of my application. Would you suggest just to make a single folder with license texts and list which files are relevant to each? Is that enough? Is there a better way? A complete answers addresses all requirements of the MPL. :)


title: How to find out what Hackathons are coming up near me?

text: I just went to my first hackathon (London GreenHackathon) and I want to go to lots more. Specifically, hackathons that have a theme of helping people or making the world a better place in some way. I know about Random Hacks of Kindness and a couple of others but is there some central aggregator that will help me find out about hackathons? Also, if anyone else can suggest specific hackathon initiatives I should check out that would be handy too. I'm in London but obviously for other people reading this question other locations will be of interest.


title: Java API vs. Other APIs

text: I'm more at the novice end of the software developer spectrum, but nevertheless I've had exposure to quite a few programming languages and frameworks. From all the technologies I've used, I haven't found any with an API as well-structured and user-friendly as Java's. Why is this? Why is it that robust languages such as C++, Perl and Python do not have APIs that come even close to Java's?


title: C++ wrapper for "releasing" a singleton object

text: I have a class like this                   template <typename T, typename Policy>         AutoObjectRelease {     public:         AutoObjectRelease(T& obj):obj_(obj){}              ~AutoObjectRelease(){ Policy::Release(obj_); }     private:         T&  obj_;     }      I wonder how one would you name this class, as it seems to me this could be quite a common pattern. I also wonder in which other situations you would use such a class. In my case I use the singleton object only sporadically and I wanted to make sure it doesn't remain loaded for the duration of the application. What are your thoughts on this ? Another idea would be to make the singleton object reference counted, but don't know exactly what would be the benefits for a singleton object - it might only complicate the implementation (need to make it thread safe also)


title: How do you manage refactoring with a large code base and many developers?

text: I would like to prevent a situation where two developers refactor the same code simultaneously without talking about it first, probably using a tool of some kind, maybe an Eclipse plug-in. Can you help? We've got 4.5 million lines of code, and more than 20 teams of developers on four continents. Ideally I would like the second of the developers mentioned earlier to notice that someone else is working on the same piece of code and talk to the first one before modifying anything. Do you know of a solution?


title: Can Google search results be reused?

text: I am trying to develop an application much like a search engine and I will like to use Google search results and refactor them in my application. Can I re-issue Google search results my own way and should I expect some legal troubles doing that ?


title: Dealing with an often occuring dependency that is not related to the class

text: I'm using view classes for my templating. These view classes often require the Routing class to get URI's from other pages. You could actually say that the Routing should be available to every view class. What I'm wondering how would you deal with the dependency injection. Injecting it through the constructor would mean that you will have to include it with every view class in many controllers. This would seem wrong to me. You would also include it trough class extending but I don't think all views deserve a base class for just the routing library and it would able break the SOLID rules you do it because of a dependency that is not directly related to the child class. My last option would be injecting it trough a public variable that injects it at a single place just before the template rendering. How did you guys solve this problem? I'm looking for a clean non repetitive way.


title: Are monolith and microkernel design patterns or strategies?

text: What's the difference between a design pattern and a strategy? Is the monolith actually an anti-pattern?


title: Writing code vs Figuring out the answer to a problem?

text: Why is writing code when you encounter a tricky problem considered "bad" programming practice? And why is thinking a problem completely through on paper or in your head before you write code "good" ? From what I've been working with, I'm able to see problems in multiple different ways or special cases I didn't think of at first by typing out code and debugging than solving the problem completely first ? Also, I can't really find any appropriate hashtags for this. So any help is much appreciated!


title: How much time do you spend actually developing vs. infrastructure activites?

text: When I'm working I feel like most of the time I'm not doing actual work. For example after making a change to the code in order to test it, I have to first build the project, and start the server(say JBoss). Upon testing, I find that there is another small issue. So I bring down the server, make the changes, build again and start up the server again.The building and bringing the server up/down is not very useful work. Also, the IDE (let's say Eclipse) does things such as updating Maven indexes and building the workspace which take some more time to get things done. Have you come across this kind of situation? Do you have tips on how to overcome/bypass this? Any features on the IDE/build tools that can be helpful? Any architecture/application design/technology that attempts to overcome this?


title: Hiring a programmer much more qualified & experienced than yourself?

text: My employer is hiring a programmer - more specifically, I am interviewing and selecting the person who will fill the position. The best candidate right now is far more qualified than I am, older, and a lot more experienced. Other people I've talked to have said that hiring someone more qualified than myself is a really bad idea (my family included). And I get the feeling that other technical staff here have a similar attitude (considering that this applicant is also more qualified than they are). They're saying, or thinking, that hiring someone better qualified is going to hurt my and my current colleague's efforts to move up in the company, or are afraid that a Johnny-come-lately is going to steal the spotlight and current staff will be left behind as promotions are given out and new positions open up. Personally I'd love to work with this applicant, and learn from them. I'm confident enough in myself to not be afraid that someone new and more experienced is going to come in and start making me look bad. I'd like to use this as an opportunity to grow, and I don't think that being afraid of competition or of new people like this is rational or beneficial. Or maybe I'm just being naive. What do you think? And have you ever had an experience similar to this? How did it work out for you?


title: Relationships in a Chen ERD

text: I am working on a Chen ERD to model our organizations merchandise. Our central entity is a Style. We have supplemental entities of Color and Season. I am defining our assortment as the relationship between these three entities, and this relationship itself will have attributes and is defined by the three entities which participate in the mandatory relationship. The rules are;   * Many Styles can be offered in a Season, and a Style can be offered in many Seasons.   * Within a Season, a Style can be offered in Many Colors. I then have 2 other entities, one of which I believe is a weak entity, Climate, and the other may be weak, but I am not sure, this being Transaction Channel. I am thinking of these as relationships off of a relationship? Meaning, for a given Style/Color combination offered in a Season, it can be available through 1 or more Transaction Channels. Additionally, within a season, a given Style/Color combination can be intended for 1 or more Climates. Is it valid to have relationships off of relationships? Or does this requirement dictate that I should think of this Style/Color/Season relationship as an entity itself, and define the relationships to Climate and Transaction Channel off of this entity?


title: Are Ruby on Rails / Grails the fastest frameworks for getting sites up quickly?

text: I'm considering using Grails for a new website, but am open to other/new programming languages and frameworks. I have done development using J2EE/JSF2, ASP.NET, and PHP. Is Grails or Ruby on Rails pretty much the best way to get functionality up and running quickly? Some initial thoughts:   * DJango looks similar to RoR/Grails and I'd consider it   * GWT is an interesting concept but it doesn't seem like turnaround time is quite as fast Thanks, -Jon


title: Resources for Test Driven Development in Web Applications?

text: I would like to try and implement some TDD in our web applications to reduce regressions and improve release quality, but I'm not convinced at how well automated testing can perform with something as fluffy as web applications. I've read about and tried TDD and unit testing, but the examples are 'solid' and rather simple functionalities like currency converters, and so on. Are there any resources that can help with unit testing content management and publication systems? How about unit testing a shopping cart/store (physical and online products)? AJAX? Googling for "Web Test Driven Development" just gets me old articles from several years ago either covering the same examples of calculator-like function or discussions about why TDD is better than anything (without any examples).


title: How would you collect the ideas that needs to be discussed during time

text: What is the best way of collecting and/or keep tracking of ideas/issues that needs to be discussed in details and during the time? As an example, imagine within the team you're brainstorming about going for NoSQL, or you're discussing if Node.JS is an option for your team or not? Or some people are in favor of going for Erlang but others don't. Something that needs time and lot's of discussions to be finally decided in the end. Currently we're keeping everything either on email threads or on paper, but is there any better way that you can actually extract data later on in a simpler or more intuitive way? Something like what we have as Todo/Task Managers but with discussion abilities? P.S. One option is to use a private _forum_ software, but nobody likes it in our team. Maybe because most of them look old.


title: help me understand Rails and attributes as class methods

text: This is from the _Hartl Rails tutorial_. We are automatically logging in a user in the process of creating that user with a callback to `#create_remember_token`. It works great but there are some things, I am not clear on. Please bear with me as I'm thoroughly confused to the point that I don't even know how to ask my question. I have a user model:               class User<ActiveRecord::Base     ...     ...          before_create :create_remember_token     def User.new_remember_token       SecureRandom.urlsafe_base64     end          def User.encrypt(token)       Digest::SHA1.hexdigest(token.to_s)     end          private            def create_remember_token         self.remember_token = User.encrypt(User.new_remember_token)       end      ... I am confused about the `::new_remember_token` and the encrypt being methods attached to `User`. It looks as though they are attributes of `User` like `name`, `email`, `password` etc, because they are being accessed with dot notation. But they are defined like methods and seem to return a computed value. I don't understand, why an attribute of the `User` model is referred to with `self` for assigning `self.remember_token` and `User.encrypt` for accessing the class method. * * * **My question** What's the difference between the above and the following where `User`, is replaced with `self`. ?               class User<ActiveRecord::Base     ...     ...          before_create :create_remember_token     def new_remember_token       SecureRandom.urlsafe_base64     end          def encrypt(token)       Digest::SHA1.hexdigest(token.to_s)     end          private            def create_remember_token         self.remember_token = self.encrypt(self.new_remember_token)       end      ... I'm a novice in the _ruby_ language, but pretty good with javascript, so if there's a _js_ analog it might help me to put it in those terms.


title: Template for Knowledge Transfer

text: I have been working for more than a year for this company. Now they want me to create a KT Document for reference. Is there any template available for me to document the coding done by me..


title: How to Deal With The "Automation is Easy" Mindset?

text: The title says it all. Some employees in our company believe that automated tests are "easy" and that it "should take a day" to write suites of COM and UI tests. What can be done to counter this? Note: I'm not asking about how to promote automation. That isn't the problem. Automated testing and processes are being promoted and requested all the time here. The issue is that some individuals don't understand that automation is not "easy" nor is it "fast".


title: Best practices working with frameworks that invent their own types [more of a C/C++ question]

text: Is there a correct way to handle APIs that invent their own types? For example, WinAPI, QT, Boost. Many frameworks have their own integer and boolean types, along with more complicated data-types. So, is it better to use native C/C++ type like `bool` or alternatives like `QBool/BOOL/etc`., and native container types like `std::map/std::set/std::vector` vs reinvented ones like `QList/boost::something/ATL::map/etc`. And how do those choices respond to cross platform portability. TL;DR Which one `QBool IsInteresting(const QString &str)` vs `bool IsInteresting(const std::string &str)`?


title: Best practice for mapping between data/business/model and etc

text: What is the best approach to mapping between Entity, View Model or dataContract. For example I've seen the following modelling structures for SOA. **WCF** -> DataContract distributed to client. **Middle-tier** -> Models and Interface with then mapped to repository type and eventual a concrete class which implements a ORM. In some cases I've seen reflection used, others just setting the properties and third-party libraries like AutoMapper for C#. What is the most effective way to keep your system "easy to maintain" and functional or horses for courses? **EDIT:** Question wasn't focused on Microsoft, I've used SOA for java and the same problem happens regarding mapping. I'm asking about direct mapping vs. reflection and etc? Its really got nothing to do with ORMs. e.g.                   thesolution.models.interfaces         public interface IProduct { //bundle of properties and method signatures }              thesolution.models         public abstract class Product  implements IProduct { //implementation }              thesolution.repositories.sapMD         public class Product extends Product implments IProduct { //implements and do stuff}              thesolution.repositories.sapCRM         public class Product extends Product implments IProduct { //implements and do stuff}              thesolution.controllers           public class ProductController          {           public IActionResponse Save(IProduct product)           {               //save to sapMD repository               IAction actionMd = ((thesolution.repositories.sapMD.Product)product).Save();                     //save to sapCRM repository               IAction actionCrm = ((thesolution.repositories.sapMD.Product)product).Save();                    IActionResponse response = new thesolution.message.product.ActionResponse();                response.Actions.Add(actionMd);               response.Actions.Add(actionCrm);               return response;           }               }                thesolution.DataContracts           //XSD JAXB or etc.               thesolution.Services          //your service method          public class ProductServices ... {            public thesolution.DataContracts.ResponseAction Save(thesolution.DataContracts.Product product){              // so now how do you map back to IProduct manually, reflection or etc.          }          }


title: Should one test for algorithmic complexity? If so, how?

text: Let's say I am implementing something simple like searching a sorted list/array. The function (in c#) would look similar to:               static int FindIndex(int[] sortedList, int i);      I could implement and test this in terms of functionality, but for obvious reasons I would usually prefer a binary search over a linear search or something intentionally stupid. So my question is: Should we attempt to write tests that gaurantee performance in terms of algorithmic complexity and if so, how? I have started making arguments on both sides of the "should you" part of this question, but I'd like to see what people say without my arguments to prompt them. In terms of "how", that gets very interesting:) You could see parameterizing the comparison operator and having a test whose comparison operator counts comparisons or something like that. But just because you can doesn't mean you should... Has anyone else considered this (probably)? Thanks.


title: Best refresher material on Java Garbage Collection?

text: I haven't looked at Java Garbage Collection for a while and feel the need for a refresher on it. Anyone recommend a resource or two?


title: Does it help to be core programmer of a product (meant for social good) for getting into a PhD program at a top university?

text: I am working upon a product as core developer which will be launched in USA market in few months if successful. Can this factor improve my chances for getting accepted into a PhD program at a top university (say top 20 in US)? Normally good universities like CMU, Standford, MIT, Cornell are more interested in student's profile like research work, undergraduate school, etc. I am now passed out from very good university it's ranked in top 20 of India only. Neither did I do research work till now. But being one of founding member of company and developing product for same, I want to know if this factor can help and to what extent.


title: Should I rewrite the git history of a non-GPL project to remove GPL code that was later removed?

text: I have an MIT-licensed project that used to include a GPL JavaScript library which has since been removed. Is there any legal necessity to rewrite the revision history to completely remove this code?


title: Didactic approaches to teach versioning with Git

text: I have already taught versioning with Git, but I think it could be more enjoyable for the guys I teach if I use another approach to teach them. The guys I mentioned before were used to working with SVN and I tried to teach Git based on SVN. Not such a good idea. It seems that some guys/teams which use SVN need a re-education on version control when they're learning Git or another DCVCS. In another attempt, I tried to show a scenario where a development team try to work without a (D)VCS and then I showed how their lives could be easier if they used a (D)VCS. I had the impression that part of the audience left the presentation without a clue what I was talking about. I've taught other classes on other subjects without problems, so I think this is not a issue with me as a teacher, but with my method. I know Git and versioning as well I know the other subjects I've presented to the other classes. So, basically, how to teach Git/DCVCS? Start with some diffs/patches and manual versioning and then teach how it can be more productive with Git? Start with Git object model? Or try to start with some pretty commands and try to save some time? To be clear: I'm looking for approaches on how to teach DCVCS (focusing on Git) effectively, based on real experiences.


title: Where can I get the Petshop application implemented in WPF and ASP.NET (.NET 4)?

text: I need the famous Petshop application implemented in WPF and ASP.NET (.NET 4). An older version can be found here. Where can I obtain it?


title: finding the time complexity of the following program

text: I need to find the time complexity in terms of Big Oh notation for the following program which computes the factorial of a given number: The program goes like this:               public int fact(int n){            if (n <=1)         return 1;       else       return n * fact (n-1);     }      I know that the above program uses recursion but how to derive the time complexity for the above program? Please explain.


title: How can robots beat CAPTCHAs?

text: I have a website e-mail form. I use a custom CAPTCHA to prevent spam from robots. Despite this, I still get spam. Why? How do robots beat the CAPTCHA? Do they use some kind of advanced OCR or just get the solution from where it is stored? How can I prevent this? Should I change to another type of CAPTCHA? * * * I am sure the e-mails are coming from the form, because it is sent from my email-sender that serves the form messages. Also the letter style is the same.      For the record, I am using PHP + MySQL, but I'm not searching for a solution to this problem. I was interested in the general situation how the robots beat these technologies. I just told this situation as an example, so you can understand better what I'm asking about.


title: Usage of mix licensies in commercial use

text: I'm developing a CMS, inside it I use many various plugins/addons wich licenses mostly like MIT, GNU, GPL (such as jQuery, nivoSlider, DataTables and so on..). After reading those licenses I believe I can use them inside my CMS and charge users for my CMS. In my project I have a specific folder where I store all these plugins with their license and all notices. Is this the correct way? Or should I somewhere on my site notice the all plugins Im using with the path where they can be found in my project folder? What about if I would use my CMS as SaaS? The end users would not have the access to source files so I would not exactly be distributing it. Is it posible? And lastly, can I protect my own source files with the license? Wouldnt it collide with the other ones? I would like to protect it as much as I can at least in a legal way as I cannot really protect it as all PHP files are easy accessible. Thank you for any help. Also note that I have read a lot about license, but these are things I would like to confirm or to see if I misunderstood something.


title: Will JVisualVM degrade application performance?

text: I have doubts in JVisual VM profiler tool related to performance. I have requirement to implement a JVM Monitoring tool for my enterpise java application. I have gone through some profiling tools in market but all them are having some kind of agent file which we need include in server startup. I have a fear that these client agent will degrade my application performance will more. So I have decided to JVisual VM because this profiler tool comes with JDK itself but before implementing JVisualVM, does anybody faces any issues with JVisualVM profiler tool? As well as, is this safe if I implement in application?


title: How to avoid a singleton in this example?

text: I have a class Image and another one ImageStore. The Image it's just a value object containing the package name and the image name. The ImageStore does all the actual work: calculates the real path of the image (based on the package and image name) and loads it from the server. Now I have a quite big (and deep) hierarchy of nodes (this is a render engine for a game) so for example now I am in a group and I want to insert a new Image. I do:               var image = new Image("packageName", "imageName");      At this moment the Image doesn't have any size yet, as I don't want to hard code the image size (in this case this can be a tile, which is not always 64*32 for example) in my game view.   * when the Image is added to the Group _(I suppose the group is already attached to the Renderer)_ then the Group will be invalidated   * the Renderer will request a new frame render.    * it will parse the hierarchy tree of node and when it finds the Image I've added before    * it will ask the ImageStore _(or TileImageStore, this one not only stores the width and height but also the bottom center point of the tile. This only when the bottom center of the tile doesn't match the bottom center point of the real image.)_ for the ImageData;   * the ImageStore now loads the package, which also has the info about the width and height;   * it will apply the new width and height to the image and will set a flag as loaded. I would like to have somehow the ImageStore detached from the render. To be able to use only the Image and ImageStore without the need of the renderer. **Edit:** I want to do this because I would like to know the size of a image even when the image is not rendered. In order to get the image it has to ask the ImageStore for the size, anchor and imageData. The packages are like this:               package = {image01: {base64: "very very long string", width: 10, height: 20, anchorX: 1, anchorY: 10}}      Only after the ImageStore loads this big file is able to know the image width/height;


title: Computer science jobs that don't let you develop software outside of that job?

text: I'm 15, and I was talking to my friends about what we wanted our future careers to be. I told them that I would like to have a job in the computer science industry (more specifically software development), and in my free time develop indie games that I could sell on the Android store to pull in a bit more cash. They told me that the contract for lots of jobs will say something like: "As long as you are working for us, you cannot develop anything outside of what you are developing for us", or, even worse, "You can no longer develop anything by yourself for the REST OF YOUR LIFE!!!". I'd never heard anything like this before and it has me a little concerned. So my question would be, do lots of careers in the computer science industry make you have to accept this kind of stuff? About how many jobs would make you sign this contract? And perhaps a little more specific info. on what this contract really means? EDIT: Right now I live in Ontario, Canada. Let's assume this is also where I will be living when I become an adult. I do not in fact live in an igloo ;)


title: Using akka actors with service spring beans

text: Do you think that using akka actors in front of transactional service beans, is a good idea ? Actors are waked up by a facade used by a client application, and actor use a message to handle right service call. Is it a good practice ? This article (http://honeysoft.wordpress.com/2012/08/05/akka-actor-dependency- injection-using-spring/) is talking about using spring beans with akka actors. But I could not see the gain to use actors in front of (singleton) spring beans.


title: Developing a mobile interface for Website

text: I have a website developed in ASP.NET MVC. Now, I am looking forward to getting up a mobile interface for it. My knowledge in this regard isn't that great, so I will explain what is needed to be done. It's much like on the lines of StackOverflow or Programmers and following are the few points that need to be addressed.   1. Much like Stack Overflow, if a site is visited from mobile, auto-detection should happen and the mobile version should be displayed.    2. Do I need to setup some sub-domain like `m.mysite.com` and should I have the mobile site installed for this domain (SE sites don't do this now but Facebook does that)   3. Lastly, How to design the website that is easily readable on all sized of screens for mobile.


title: How to convince my coworkers that doing things right will save them time

text: I recently started at a new company, with a handful of programmers. Its a medium sized company, with around 70 employees, but IT only has 9-10, and there are 3 "programmers" beside myself. However, these guys have very limited experience and are doing a lot of stuff really terribly. For example, one of our projects is a PHP website. The majority of the code is stored in a 20,000 line PHP controller, with ~6000 lines of JavaScript embedded in the PHP. I keep making small suggestions here and there but nobody has been listening, everyone says they are too busy to implement my suggestions. The thing is, they shouldn't be that busy, and wouldn't be if things were done right. They spend most of their time fixing things that keep breaking. If each project was built correctly, I could do it all myself. What approach should I take to convince these guys or the manager that things need to change, and that changing things will save a bunch of time? Should I skip trying to convince my coworkers and go straight to the manager, with a business-y proposal on how the company will save a bunch of money if they start doing things correct?


title: What is the difference between routed events and attached events?

text: I am just going through the WPF concepts I came across these routed events, dependency properties and attached events. What are the concepts behind them and why are they called instead of .NET ordinary methods?


title: Should the search engine return a dictionary or strongly typed objects?

text: I'm building a search engine using Lucene.NET / Solr.NET, and I'm wondering should search hits be returned as a dictionary or strongly typed object.               public class SearchResult     {         public string SearchTerm { get; set; }         public List<Dictionary<string, object>> SearchHits { get; set; }         ...     }          // where search hit looks like this     Dictionary<string, object> searchHit = new Dictionary<string, object>     {         { "Name", "John Doe" },         { "Address", "Some street" },     };      vs               public class SearchResult     {         public string SearchTerm { get; set; }         public List<Foo> SearchHits { get; set; }         ...     }          // where search hit looks like this     var searchHit = new SearchHit     {         Name = "John Doe",         Address = "Some address"     };      I will be indexing different types of objects (People, Web pages, Files, etc.). Each object has a different set of properties (people have name and address, while web pages have URLs and titles), and search hits don't have the same set of properties as original objects (`WebPage` class has the `MainContent` property, but after indexing, the search hit that represents this object will have the `PreviewText` property (the first 300 characters of `MainContent` property with stripped HTML tags). I don't want to duplicate the code all over the place and have: `IPeopleSearchService`, `IWebPagesSearchService`, `IFilesSearchService`, etc. and corresponding search results: `PeopleSearchResult`, `FileSearchResult`, etc.               interface IFooService     {         FooSearchResult Search(string text);         void Index(Foo foo);         ...     }          interface IBarService     {         BarSearchResult Search(string text);         void Index(Bar bar);         ...     }     ...      I would like to have a more generic solution, but I don't like over- complexity. It should be readable and easily understandable by junior developer.               interface ISearchService<TEntity, TSearchHit>     {         SearchResult<TSearchHit> Search(string text);         void Index(TEntity entity);     }      How would you design such a system? Any help would be greatly appreciated!


title: Understanding C++ for windows desktop application

text: I've been programming C++ for almost a year, and I've written complex programs however there are a couple of programming features of C++ which I didn't cover up (Classes & pointers), however I felt ready to develop a desktop application. I didn't get any books nor did I find any REAL documentation. I said to myself "Practicing is the most important thing in programming. I'll do that". Obviously I didn't learn much. After 4 months of programming in Visual studio C++/CLI I barely understand what I'm doing. I know how to do very basic operations, converting data types, but I am clueless on how the program works, how I add anything except events or how I change my GUI in code and not in the GUI builder. What should I do? Practice didn't really help, I only know some very easy things since I started working with Visual Studio, but the rest of the concepts leave me clueless. Should I hit the books, or should I just keep practicing?


title: Price Updates via database logic

text: How do the big price comparison services allow to send emails directly if the price of a product meets your targeted price. They will email you automatically. Is it a cron job that scans a table, or is it something compounded into the database?


title: Confused on how to properly employ a Repository Pattern with Service/Business Layer on top

text: I'm building a ASP.NET Web Api 2 solution for learning purposes, and I've hit a snag. I was wondering if anyone could tell me what exactly it is that I'm missing. My Web Api solution has 4 Layers:   * Data, which contains the Data Models ( POCOs ), Fluent API Mappings, EF Context, Migrations and Seeding   * Repository, which implements CRUD for all Data Models and returns the business Models   * Domain / Service / Business which supplies the IRepository interface, and should hold services which implement the application's business logic. Also contains the Business Models.   * Web, the Web Api controllers and DI / IoC to tie everything together. References are as follows: Data < Repository > Domain Web references all 3 layers for DI. The idea behind the separate domain layer is that it is completely oblivious to anything that happens in the Data or Repository layer. It simply outlines its requirements by providing the IRepository for the Repository layer, and the Business Models that it wants to get as a result. It's up to the Repository layer to meet the Domain Layer's requests. **Here is my connundrum** :   * Since Domain has no ties to Data, it does not know anything about the structure of the Data model. This means that the repository layer needs to convert everything to the Business Model before returning it. - I suppose I could return it as a generic object, and then map the generic object to the business model inside the Domain Layer. Would that be more appropriate?   * Again, since Domain does not know anything about the Data Model, I can't pass any expressions to apply on the data set to my Repository. This means that for every property I want to WHERE, I'd have to create a POCO specific Repository with matching IBussinessModelRepository which outlines it's requirements, and then implement that requirement. This quickly gets tedius though, as it calls for a bunch of "GetByProp1", "GetByProp2" - monkey code central.   * What if I want to create a composite business model that requires a complex query to hydrate? Is my only option to create yet another IBusinessRepository with a matching Repository and then write the complex query in the repository layer? If that is the case, then it feels like the service layer is mostly just another step that passes along non-crud requests to specific repositories.   * ~~Is it proper for web api controllers to send requests directly to the repository? It would seem pretty silly to route all CRUD requests through the service layer, which just passes the request to the repository layer anyway.~~ No, it's not as the service layer should be the entry point for all operations. ( With Web just acting as a consumer of the services offered. )   * I currently don't use a Unit of Work because there is a lot of mixed opinions when it comes to UoW + EF. I'm not yet experienced enough to be on either side of the fence. Would a UoW be helpful in this scenario? I feel like I am missing a vital part in what makes this pattern / layer approach tick. I know that I could easilly proceed by cheating ( i.e. give service access to data specific stuff like the context ), but I'm more interested in learning how to do it the proper way. The research I have done so far yielded results that vary wildly:   * From the Repository using AutoMapper to change the type to the business model without actually executing the query, allowing the service layer to pass Business Model Expressions which can then be applied and then running the query, returning the mapped result -- sounds great, except that approach does not seem to work for me due to AutoMapper not being able to deal with my Models having recursive nav properties.   * To the service layer just interfacing directly with the POCOs. ( And thus having direct access to the DAL ) What am I missing? Edit to explain more about my code: **My Generic Repository on Github** contains CRUD methods like this one:               public abstract class RepositoryBase<TData, TDomain, TId> : IRepository<TDomain, TId> where TDomain : EntityBase<TId>, new() where TData : class, IDataEntity<TId>, new()     {         private readonly ShortStuffContext _context;              public RepositoryBase(ShortStuffContext context)         {             _context = context;         }              public IEnumerable<TDomain> GetAll()         {             return _context.Set<TData>().BuildQuery<TData, TDomain>();         }     }      BuildQuery is a LINQ Extension which either grabs all entities, or can take a expression to fetch a single entity and then uses ValueInjecter to map the Data Model to the Domain Model. The repository methods are requested by the Domain Layer via Interface:               public interface IRepository<TDomain, TId> where TDomain : EntityBase<TId>     {         IEnumerable<TDomain> GetAll();     }      The RepositoryBase is extended by Repositories for the individual POCOs, which currently sit empty, only providing TData, TDomain and TId to the Repository Base:               public class UserRepository : RepositoryBase<Data.Entities.User, User, decimal>     {         public UserRepository(ShortStuffContext context)             : base(context)         {         }     }      Which can be requested by the Domain Layer via Constructor Injection `IRepository<User, decimal> UserRepository` through a ninject `InRequestScope` binding.


title: The line between ByRef Parameters and Module Variables

text: This question was brought up during a Standards discussion, which should revolve around SOLID Principles for Object Oriented Development. In your experiences, have you seen benefits or drawbacks in either code readability or performance based on whether variables are passed ByRef vs Module-Level Variable? Obviously: If a method calls a submethod, which will not only use but also modify a parameter, it should be passed as a reference pointer (aka: ByRef). Based on this logic, some in my discussion are very strict to never use module-level variables. In response, I say we have a toolbox and should know when to use what tool. For example, a sub declares a variable. That sub calls a function, which calls a sub, which calls a function, which calls a sub, etc etc, and eventually that variable is changed 10 methods down the line. I'd say make that variable a module level, whereas some say pass it ByRef through your tree of methods. So where is the line when examining SOLID OOP Principles? Do you go with an extreme?:   Never use ByRef, or Never use Module-level Variables. Or do you set a routine depth?:   1-method, always ByRef; 2 deep, consider it; 3-depth, Module-level Variable. Or maybe a Branching Principle?:   If, in your list of methods, the variable is really only updated in one place then passed ByRef all the way back up to the original... ByRef them all. But if the variable is changed during multiple stages in multiple branches of the tree of methods, make it a module level. If the latter is the case, should that also mean 20 methods down the line, ByRef all the way back up to the original is still fine? Or maybe a hybrid of these possible rules. What's your take on it?


title: How is Devise's secret_key used?

text: I've been using Devise for a while now and have wondered how the secret key is used. I looked through the source for references to `secret_key`, but it wasn't clear to me exactly what we do with it. It seems to me that it might be related to session security?


title: Source of this quote about code reusage?

text: does someone know where this quote comes from? I don't know it literally, but I know what is is about. Something like: > Writing code more than once is a waste of energy and creativity. I think that it was in some article about the definition of hacking or so, but I can't find it.


title: Must-have tools and practices for an agile start-up

text: I've been working in the software industry for a few years now. I've seen Waterfall in practice, and I've seen several projects attempt Agile with varying degrees of success... which got me thinking. What are the bare-minimum requirements for an Agile startup to be successful? I'm thinking in terms of tools, practices, team roles (e.g., source control, automated testing, BA role). I'd like to be able to draft a list of tools/practices/etc that are absolutely essential for the long term sustained success of a startup wanting to do Agile. I ask because I'd like to start my own software company eventually. Most of my experience is in SCRUM so I'm naturally biased towards it and I've already developed an opinion of what the minimum requirements for a SCRUM team to function are. But, being only human, and being only one sample, I wouldn't be surprised if my opinion was flawed or incomplete. I'd appreciate any and all insight and experience. Thanks


title: Should I fork in case the upstream deletes

text: I'm creating an open source PHP project that reuses other open source code instead of reinventing the wheel. I'm using composer to pull these projects into my vendor folder. What happens if these vendors delete their repository & all traces of their code from the internet? Now composer can't download the project. Should I fork every project I'm depending on, and depend on the fork? Seems like a pain, but the only 'safe' way to ensure the vendor can't delete things my project needs to run.


title: Where to put interface in .Net

text: I have VB.Net project, with a class with a couple of abstract (mustoverride) properties, that I am thinking about moving into an interface. My question, is structurally how do I do this? Currently all of the classes that would be implementing this are derived from this base class, so it might make sense to put it in the same file. Or I could create a separate interface file and put it in the same directory as the base class. Another option, would be to create a separate directory for interfaces (of which the project currently has zero) and put the file the. After writing this up, I'm strongly inclined towards the second option. I've looked around, but haven't found any guidance on this. What would be the best option and why?


title: Is 'using' appropriate in a context where there is nothing to dispose?

text: In C#, `using` statement is used to dispose in a deterministic manner the resources without waiting for garbage collector. For example, it may be used to:   * Dispose SQL commands or connections,   * Close streams, freeing the underlying source like a file,   * Free GDI+ elements,   * etc. I noticed that `using` is used more and more in cases where there is nothing to dispose, but where it's just more convenient for the caller to write a `using` block rather than two separate commands. Examples:   * MiniProfiler, written by Stack Overflow team, uses `using` to denote blocks to profile:              using (profiler.Step("Name goes here"))     {         this.DoSomethingUseful(i - 1);     }      One alternative approach would be to have two blocks:              var p = profiler.Start("Name goes here");     this.DoSomethingUseful(i - 1);     profiler.Stop(p);      Another approach would be to use actions:              profiler.Step("Name goes here", () => this.DoSomethingUseful(i - 1));        * ASP.NET MVC also picked `using` for forms:              <% using (Html.BeginForm())        { %>            <label for="firstName">Name:</label>            <%= Html.TextBox("name")%>            <input type="submit" value="Save" />         <% } %>      **Is such usage appropriate?** How to justify it, given that there are several drawbacks:   * Beginners would be lost, since such usage doesn't correspond to the one which is explained in books and language specification,   * The code should be expressive. Here, the expressiveness suffers, since the appropriate usage of `using` is to show that behind, there is a resource, like a stream, a network connection or a database which should be released without waiting the garbage collector.


title: Do threads use virtual memory or real memory?

text: I was trying to optimize my Linux server to handle 10,000 threads per process while it does just 382 right now. As per this article the following formula is used to find out total possible threads:               number of threads = total virtual memory / (stack size*1024*1024)      This means threads store all their data in virtual memory. And to the best of my knowledge, virtual memory is swap space in a Linux machine which is stored on harddisk than RAM or cache. So my question is does our threads uses harddisk to store for processing/store its data. If yes, then doesnt this effect performance? Can we enhance the performance by putting in them on RAM or cache? How? If no, how exactly do threads works? **Update:** According to **useless's answer**, virtual memory is a system comprising roughly:   * physical memory (RAM)   * any swapfiles you have attached   * hardware support for translating virtual to physical addresses and issuing page faults when a virtual address isn't available in physical memory   * (kernel) software support for: managing the lookup tables used by that hardware handling those page faults by pulling pages in from swap on demand Thus, Everything that is on virtual memory is collectively on RAM(Real Memory) and Hard Disk(Swap Files). And as **James explain in his answer** decision on Ram vs HDD is taken by Kernel using algorithims such as LRU.


title: Client-side javascript: How to include third party frameworks?

text: When developing web apps you often build your app on top of some frameworks like Twitter's bootstrap. These frameworks come with `less/sass/stylus`, `javascript`, images and sometimes webfonts. I'm wondering how to embed these frameworks in my app. Most of my apps are build using some grunt tasks that compile my `coffeescript` and `stylus` to `javascript` respectively `css`. Because I'm not shipping third party code (e.g. frameworks) with my app I add them as a dependency. This allows me to install e.g. frameworks using a package manager like `npm` or `volo`. Handling small javascript libraries (which consist only of _one_ file, no assets) is easy. I install them in a vendor dir and update my require.js conf. But if the library has images or `less/sass/stylus/css` files attached I'm always struggling how to handle them:   * Paths to assets in the `css` files or `javascript` files of these libraries are often hardcoded (relative)   * `less/sass/stylus` has to be compiled (which I can do with a grunt task)   * Copy all third party assets into my folder structure?   * Should I include third party assets (`stylesheets`, `javascript`) in my own files and minimize them together?   * If I use `stylus` and the framework uses `sass` I have to install a lot of further dependencies I think I'm not the only one who has these problems so I'm looking for solutions, best practices or some general tips.


title: Shouldn't Location be a Value Object?

text: Eric Evan's DDD book, Cargo Shipping Example, pg. 168: > Location > > Two places with the same name are not the same. Latitude and longitude could > provide a unique key, but probably not a very practical one, since those > measurements are not of interest to most purposes of this system and they > would be fairly complicated. More likely, the Location will be part of a > geographical model of some kind that will relate places according to > shipping lanes and other domain-specific concerns. So an arbitrary, > internal, automatically generated identifier will suffice. Reason why author made `Location` an entity is because two different places could have the same name. But since it appears that `Location` is _immutable_ and thus won't change over time, wouldn't it be better if it was instead a Value Object? Thus: a) Why couldn't we ( instead of automatically generated identifier ) introduce an additional attribute describing an actual charasteristic of a location, which would help distinguish between the two places with the same name? Then we could make `Location` a VO. b) Even if we don't introduce an additional attribute describing an actual characteristic of a location, but instead we use an automatically generated identifier, couldn't we still consider `Location` as a VO, since the fact still remains that it is _immutable_ and that application would work the same even if it tracked several instances representing the same `Location`? c) From the quote it seems that author would designate `Location` as an _entity_ even if instead of automatically generated identifier we'd use _latitude_ and _longitude_ to help distinguish between different locations. Why? Thanks


title: Assigning strings to pointer in C Language

text: I am a new learner of C language, my question is about pointers. As far i learned and searched pointers can only store addresses of other variables, but cannot store the actual values(like integers or characters). But in the code below the char pointer c actually storing a string. It executes without errors and give the output as 'name'.               #include <stdio.h>     main()     {     char *c;     c="name";     puts(c);     }      can anyone explain how a pointer is storing a string without any memory or if memory is created where it is created and how much size it can be created. I tried using it with the integer type pointer               #include <stdio.h>     main()     {     int *c;     c=10;     printf("%d",c);     }      but it gave an error               cc     test.c   -o test     test.c: In function ‘main’:     test.c:5:3: warning: assignment makes pointer from integer without a cast   [enabled by default]     c=10;     ^     test.c:6:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘int *’ [-Wformat=]     printf("%d",c);     ^      Pointers stores the address of variable then why is integer pointer different from character pointer. If there is something i am missing about of pointers plz explain. Thanks in advance.