title: Is database version control practical?

text: The topic of database version control seems to come up at my work and in social discussion more and more often. But the truth is, I haven't met anyone actually DOING it. The only thing Googling the topic has ever yielded are expensive products/services. Is this really all there is? Does an open source (or at least a _standard_ , and not just "Version control from company x") solution exist for ANY type of database (transactional or otherwise)? I'm in love with the idea, but I don't know where to start looking.


title: What is (or where can i find) the algorithm to decode FLAC to PCM?

text: I'm trying to program a very basic FLAC player using 100% C# completely from scratch. My understanding of this type of thing is very limited, so I'm using this project as a way to learn about compression and decompression. I'm a computer science and math major currently in university, so I'm not adverse to learning whatever math may be involved. I've looked up the format specifications on xiph.org and I understand how the headers and all are structured, but I can't seem to find a concise explanation of how the audio compression works. How do I go about converting the frames to pcm? Sadly, my knowledge of C/C++ is extremely limited, as I only have experience with Java and C#. As such, trying to navigate the c++ code already out there is not a great starting point. I looked at FlacBox and learned quite a bit from it, but it's barely commented at all and I am lost trying to figure out how the conversion from flac to pcm works. So what should I read as far as math goes so I can get started with this? Where can I find a basic algorithm for converting the audio frames to wav? Thanks.


title: How is 'bolt-on' the same or different from add-on, extension, or module?

text: I hear the term 'bolt-on' used in many contexts, specifically in my organization where PeopleSoft is used extensively. I don't know exactly how it differs from an 'extension' of an existing product, a new module within an application, or an 'add-on' like you would purchase for a product you own. Is there a more formal definition of 'bolt-on' that I'm not familiar with?


title: How to design this better?

text: I'm developing a system using .NET which will be used by multiple users. Because of that, I need to identify on the database which data belongs to each user. Explaining with an example, imagine I have the entity `Product`. Then each user has its own products, and so in the database on the table of products we must be able to distinguish between products of each user. Saying that, my solution was to add on the database an extra column for each table for the user id. Now, on my code this was the same as adding on my repositories a parameter to receive the id of the user so that the repository would be able to locate the correct data. The concrete implementation of the repository to deal with relational databases just check those columns. The problem is that to be able to get those columns available on my repository, and on my ORM (in the case EF) I needed to add on each entity one property `UserID`. The problem is that if I think for a while this doesn't seem like a good solution. I'm coupling domain entities with details of how to persist data. More than that, I'm coupling each entity with the way I manage the access to the data and this seems a bad approach. So, concearning this, is there a better way to plan this? A way to make sure we can relate data to users and in the same time avoid those properties on the domain entities?


title: what is the best solution for this problem

text: I need help. We have website(PHP site) and it has different software(like shopping cart, chat software, ticketing software, blog,.... ).


title: Using Django to Create Child Sites

text: I am creating a series of small sites, I'm using the django framework. The theory goes a user comes to a master site, signs up, then he gets his own child site. Example:   * navigate to example.com   * user creates an account "mysite"   * user then gets his own site: mysite.example.com and he can configure this all he wants My question: * would it be better to have a "gold" version of the site that gets created for each site? for instance: cp ~/goldsite ~/mysite and change the database pointers appropriately ** the downside is if I ever have to do maintenance on a file, I would have to change all subsites. ...or * have one host and configure the database to support multiple sites. The DB might get messy. Any feedback would be great.


title: Is it ok to start with templates in MVC development?

text: I'm new to web development and I've started working on a project in my company that uses DJANGO. I feel it flexible to start my development straight first from the templates. I think it will be easier if I visualize things first. So my question: Is it okay to start with a template rather than starting with models first? Will I stumble on to any sort of confusions if I go by this method of development?


title: Testing a very specific function in a large, complex application

text: I'm new to testing but wholeheartedly realize how important it is. The main issue is that my company has no top-down support for testing at all. That is we don't have any unit testing and just a bit of human testing (I hope I'm using the right terminologies). I have been trying to get testing started here and have to do it subtly because I'm often asked "when will feature X be done" and therefore can't start the week(s) long project of writing tests for all of our legacy code. Which would need to get rewritten just to provide seams for testing (if I have the concept of 'seams' right). I can, however, sneak a bit of time to test one function. Or at least I think I can. I'm writing code that basically processes quite a bit of data and then renders it using D3. I would like to write a test for one of the most important functions, `binData`. It takes one optional argument (the date to start binning from) and accesses a few properties like `this.rows` and `this.timestamps`. How would I go about doing that? I think I'll need to create a mock object to hold `this.data` and `this.timestamps` (and the other accessed properties). In fact, I imagine several different mock objects which would allow testing of several different datasets. But other than that I'm kinda stuck. In terms of frameworks I've heard of Mocha and Jasmine and Vows but don't know which would be best. I also don't know how to tie into the massive (and complex) class and module hierarchy and to meet each object's dependencies. That is, the function `binData` is in a file called, say, `dataBinner.js` which requires all sort of other functions in other files but doesn't explicitly include anything on it's own. Instead, it itself is included in a "manager" file which includes everything that dataBinner.js and the other modules will need. I suppose I'll need to find a way to instantiate everything necessary to test `binData`. I'm not afraid to do a bit (or a lot) of reading to better understand things. Any help regarding this specific task of writing a test for `binData` or the larger question of how to slowly implement testing in a non-test-friendly place would be much appreciated. CLARIFICATION I'm 100% on board, testing-wise. I know it's important and I know that my company is incorrect by not having testing. You'd expect emails that say "fixed regression caused by fixing bug 1413" would trigger something. Or that things that shouldn't take that long take waaaaaay too long ('cause it's spaghetti legacy code). What I'm asking is _given that_ how do I test my one function which relies on the legacy spaghetti code. That is, how does someone inject a bit of testing into a place without it? I'm guessing that I'll have to write my own testing framework because I'll have to create mocks for the spaghetti legacy code. So that I can instantiate my object and call my function outside of the scope of the application.


title: To which level Haskell's HDBC is lazy?

text: The HDBC documentation states: > fetchAllRows :: Statement -> IO [[SqlValue]]Source > > Lazily fetch all rows from an executed Statement. > > You can think of this as hGetContents applied to a database result set. > > The result of this is a lazy list, and each new row will be read, lazily, > from the database as the list is processed. > > When you have exhausted the list, the Statement will be finished. > > Please note that the careless use of this function can lead to some > unpleasant behavior. In particular, if you have not consumed the entire > list, then attempt to finish or re-execute the statement, and then attempt > to consume more elements from the list, the result will almost certainly not > be what you want. > > But then, similar caveats apply with hGetContents. > > Bottom line: this is a very convenient abstraction; use it wisely. > > Use fetchAllRows' if you need something that is strict, without all these > caveats. Then, I wonder, to which level does the laziness extend? Say, I can have                 conn <- connectSqlite3 databaseFilePath       rows <- quickQuery conn ("SELECT * FROM foo") []       mapM_ bar $ take n rows       disconnect conn      Will it actually only fetch `n` rows? Like, from the database point of view, will it be equivalent of `SELECT * FROM foo LIMIT (n)`? Because fetching all rows at the level of database driver and then `take`ing `n` of them seems to be silly and kind of defeats the purpose. If it's lazy up to the database itself, how's it implemented? Is it using cursors? I know there're several drivers for HDBC alone. I'm asking only about principle of implementation.


title: Using 'new' in a projection?

text: I wish to project a collection from one type (`Something`) to another type (`SomethingElse`). Yes, this is a very open-eneded question, but which of the two options below do you prefer? **Creating a new instance using`new`:**               var result = query.Select(something => new SomethingElse(something));      **Using a factory:**               var result = query.Select(something => SomethingElse.FromSomething(something));      When I think of a projection, I generally think of it as a _conversion_. Using `new` gives me this idea that I'm creating new objects during a conversion, which doesn't feel right. Semantically, `SomethingElse.FromSomething()` most definitely fits better. Although, the second option does require addition code to setup a factory, which could become unnecessarily compulsive.


title: Decoupling Server and Client using REST API

text: I was thinking about how I can decouple a web-application completely into a server-side and a client-side component. I want to decouple the app to the extent that I can host both components on seperate servers. So, for example, I would have:   1. Server 1 (API Server): A server-side component running on `Django` on something like Heroku or EC2.   2. Server 2 (Static Server): A client-side component running on `AngularJS` on a static server like S3 or CloudFront. The communication between these components will take place using a JSON REST API. **Questions:**   1. Is this approach common? advisable? > Does a company like Facebook or Twitter _mostly_ utilise the same API for > the webapp as it does for its mobile apps or its open API?   2. Is it a good idea to use oAuth2 for the login process? > So the user is redirected to a login page on **Server 1** (this is the only > page on Server 1) and then redirected back to **Server 2** with a token if > authentication succeeds. Is this the best approach? It seems like I am kinda > "breaking the flow" if I do this. Is this normal? The motivation for this is for me to be able to use the same API for my web, iOS and Android clients. Thanks!


title: Managing client-side and server-side validations in one place

text: I'm 100% on board with the case that one should definitely use both client- side and server-side data validations. However, in the frameworks and environments I've worked in, the approaches I've seen have never been DRY. Most of the time there's no plan or pattern - validations are written in the model spec, and validations are written in the form on the view. (Note: Most of my first-hand experience is with Rails, Sinatra, and PHP w/ jQuery) Mulling it over, it seems like it would not be difficult to create a generator which, given a set of validations (e.g. model name, field(s), condition), could produce both the necessary client-side and server-side material. Alternately, such a tool could take the server-side validations (such as the `validates` code in an ActiveRecord model) and generate client-side validations (such as jQuery plugins, which would then be applied to the form. Obviously, the above is just a "hey I had this idea" musing, and not a formal proposal. This sort of thing is surely more difficult than it seemed when the idea hit me. That brings me to the question: **How would you approach designing a "write once, run on server and client" technique for data validation?** Related subtopics: Do tools like that exist for any particular frameworks or client-server technologies? What are major gotchas or challenges with trying to maintain only one set of validations?


title: Should my multi-server RDBMS or my Application handle database Referential Integrity?

text: Should items like Foreign Keys, Constraints, Default Values, and so on be handled by the database management system (in this case, MS SQL 2005) or the application? I have heard opinions from both sides and I'm honestly not sure which way to go. There is a chance we will be spanning multiple servers/databases and I don't think Foreign Keys can be used across linked servers. In addition to that, there are some circular references in the database design which prevents me from using `ON UPDATE CASCADE` on everything. The database is MS SQL 2005 (possibly 2008) and all interactions with it should go through the application.


title: How to model a system to help my team grasp the project's bigger picture?

text: According to the software engineering point of view, I should model the system to make it easier for other people to understand well what they work on. To do so, I have used the Dia drawing program. But, after having used Dia for some time, I find that it falls short in helping me to correctly and efficiently model my project. How do you usually tackle this problem (modelling a project in the large) and what tools would you recommend for the job, and why?


title: Why some consider static analysis a testing and some do not?

text: Preparing myself also to ISTQB certification, I found they call static analysis actually as a static testing, while some engineering book distinct between static analysis and testing, which is the dynamic activity. I tent to think that static analysis is not a testing in the true sense as it does not test, it checks/verifies. But sure I would love to hear opinion of the true experts here. Thank you


title: Why does an unsigned int compared with a signed character turn out with an unexpected result?

text: Why does the following code output **y>x** when clearly 1>-1?               unsigned x=1;     signed char y=-1;          if(x>y){         printf("x>y");     }     else {         printf("y>x");     }      Please explain this result.


title: Is there a semi-scientific term for this filtering behavior?

text: I'm looking for the term that applies to a certain kind of filtering behavior. It's often used in webshop-like interfaces, where large amounts of data are filtered based on a selection of filter criteria. The most distinguishing feature is that _it's impossible to pick a filter criterium that leads to no results_ , as the filters that would do so are hidden with real-time updates. To see an example look at this boot finder section on the blue-tomato.com webshop. Is there a term for this kind of filtering?


title: How to verify the client's view is consistent with the remote model?

text: i'm designing a client-server system via web broswser and i have this problem: I send the data to the client via JSON, then the javascript view shows the stuff. Then the user takes actions and commands are sent back to the server. Usual stuff, the problem is what if the view's data is corrupted or old? One solution i thought is making a hash via SHA1 or some other algorithm of the full objects in the client's model, but JSON data is not ordered, also this adds delays to the system. How do google docs manages this kind of thing? Also, sending ALL THE DATA, every time the model is updated doesn't make sense, but how do i keep consistency by only sending changes? I think the whole problem is just one.


title: Paid open-source app

text: The question that bothers me is whether it is possible/feasible/reasonable to expect for an open-source app to sell well on the mobile market? Should I believe that my users will use my app, rather than build the checked- out version, and, more important, how can I deal with the competition if I make my app available under an OSS license? So far the only link on the subject I've found is http://blog.zachwaugh.com/post/17554643060/selling-open-source-apps however it deals with a Mac OS X app. I should mention my question does not focus on iOS, Android or another OS, it's about mobile applications in general. EDIT: The very reasonable question of whether my users are programmers has been asked.   I do not expect most of my users to be even remotely familiar with programming.


title: Minima of a convex list using binary search

text: A list is strictly convex if its elements first decrease then increase. How can I write a function in python that accepts a convex list and returns its minima in time complexity O(log(n)), n being the size of the list. (NO USE OF ANY BUILT IN FUNCTIONS OVER LISTS)


title: "Ever change the value of 4?" - how did this come into Hayes-Thomas quiz?

text: In 1989 Felix Lee, John Hayes and Angela Thomas wrote a Hacker's test taking the form of a quiz with many insider jokes, as “Do you eat slime-molds?” I am considering the following series:               0015 Ever change the value of 4?     0016 ... Unintentionally?     0017 ... In a language other than Fortran?      Is there a particular anecdote making the number “4” particular in the series? Did some Fortran implementation allow to modify the value of constants? Was this possible in other languages in common use at that time?


title: Why should I use reflection?

text: I am new to Java; through my studies, I read that reflection is used to invoke classes and methods, and to know which methods are implemented or not. When should I use reflection, and what is the difference between using reflection and instantiating objects and calling methods the traditional way?


title: Telecommuting from Australia - tax arrangements

text: I live in Australia, and I am currently looking at some of the remote job offerings in countries like US/UK. However I have very little understanding of what needs to be done to report that kind of income - i.e. do I need to get an ABN, pay payroll tax myself etc. If you had any experience in this area I would like you to share that.


title: Release an upgraded iOS app with a different revenue model

text: I am starting a new iOS project and initially plan release a simple free version to gather feedback. I don't intend to monetize or market this initial version. However, I believe "Version 2" of this app will be good enough to pay for. I would prefer to release Version 2 as an upgrade from Version 1 rather than release it as a separate app. This way I can reserve a name for the app. It will also be easier to keep everything in a single repository. Are there any downsides of this approach? It's my understanding that I can change the price of an app at any point in time, so it shouldn't be an issue transitioning to a paid app, should it?


title: Naming conventions for variables

text: When programming, what naming conventions do you use for your variables? I don't mean when the name of the variable should be obvious; ie. sum, total, first, last. But when you name variables that don't really fit into a category/obvious structure, what sort of names do you use? Is it, myVar1 or test1 or variable1, etc...?


title: How exactly do Patchers work?

text: Did a search for Patchers and didn't find anything. But seriously Patchers: How do they work? I've done some googling, and i've gotten mixed results. I mean it seems they probably have some way of going in and changing the files (maybe comparing what is different between the files) but it seems like there is probably more going on than that. Or is it really as simple as running a diff. vs another file....and then applying the changes?


title: XQuery & XML databases

text: I decided to learn XML from a professional book instead of reading tutorials online, after some research i decided to read "Beginning XML, 4th Ed" book and it was very interesting book and i recommend it to anyone want to learn XML, my question is: does reading & learning these chapters:   1. XQuery, the XML Query Language   2. XML and Databases really required for someone who is doing mainly: Hibernate/JPA for object/relational persistence? or in other words does learning XQuery & XML databases really required by the current industry standards skills ? Thanks in advance


title: Java and rest OOP languages - when to use super or this keywords

text: I have been programming java for like a year or more, and i have always used the `this` and `super` keywords. And yesterday my mate read one source of mine, and told me not to over use it unless you are overriding the method.               class A extends JPanel {          public A {              super.setSize(400, 400);// instead of not using super keyword          }     }      But what he meant on how to use it, is this:               class A extends JPanel {         public A {             super.setSize(4,4);         }              public void setSize(int a, int b) {}     }      So the language will know that your constructor calls the parent method and not local. Should i only use the the keywords in this situation only or use the keywords everywhere for better readibly? I know that `this` keyword is returning the whole local instance including the parent and all of its parents and interfaces. And the `super` keyword returns the instance of the parent class and all of its instances (parents and interfaces). But my question is, should you always use these keywords?


title: Which websites to use for presenting free open source applications?

text: After releasing a new free open source application, I would like to present it to as many people as possible. What are web sites (directories) which one should use to present free open source applications? Looking for a list of sites like Freshmeat, Sourceforge, ...


title: Android: Considering an ORM tool

text: I am developing an Android app in which I have to add chat functionality. Also, I have to save the chat history. I will accomplish this task using SQlite. But, I am not sure whether should I consider using an ORM like GreenDAO or ORMLite or I should use traditional way of persisting data in SQLite. Actually, I am not clear when should go for using an ORM and how do I get benefit from it.


title: Best Practices and Etiquette for Setting up Email Notifications

text: If you were going to set up a Email Alerts for the customers of your website to subscribe to, what rules of etiquette ought to be followed? I can think of a few off the top of my head:   * Users can Opt-Out   * Text Only (Or tasteful Remote Images)   * Not sent out more than once a week   * Clients have fine-grained control over what they receive emails about (Only receive what they are interested in) What other points should I consider? From a programming standpoint, what is the best method for setting up and running email notifications?   * Should I use an ASP.NET Service? A Windows Service? What are the pitfalls to either?   * How should I log emails that are sent? I don't care if they're received, but I do need to be able to prove that I did or did not send an email.


title: Is HDTV good as a programmer's monitor?

text: I'm wondering if someone has any experience with programming on an HDTV. I'm trying to decide between dual pc monitor vs one big HDTV, like 32" (or maybe even dual hdtv). The nice thing about hdtv is that they cost alot less than an equivalent sized pc monitor. I will specifically be using this for programming and graphics (photoshop, etc). I'm just wondering if HDTV is bad if I use it as a workstation b/c maybe it's worse for the eyes or not really good for programming (b/c maybe the fonts won't be crisp enough), etc. Any thoughts? Thanks


title: Is Extreme Programming (XP) the best way of learning from experts?

text: I have been involved in many development models, and have found XP to be the best for a new programmer from the aspect of learning, as the collaboration between the team members is very high and the opportunities to share knowledge are great. What are the expert opinions on this?


title: Who can change the View in MVC?

text: I'm working on a thick client graph displaying and manipulation application. I'm trying to apply the MVC pattern to our 3D visualization component. Here is what I have for the Model, View, and Controller: Model - The graph and it's metadata. This includes vertices, edges, and the attributes of each. It does not contain position information, icons, colors, or anything display related. View - This would commonly be called a scene graph. It includes the 3D display information, texture information, color information, and anything else that is related specifically to the visualization of the model. Controller - The controller takes the view and displays it in a Window using OpenGL (but it could potentially be any 3D graphics package). The application has various "layouts" that change the position of the vertices in the display. For instance, one layout may arrange the vertices in a circle. Is it common for these layouts to access and change the view directly? Should they go through the Controller to access the View? If they go through the Controller, should they just ask for direct access to the View or should each change go through the controller? I realize this is a bit different from the standard MVC example where there a finite number of Views. In this case, the View can change in an infinite number of ways. Perhaps I'm shattering some basic principle of MVC here. Thanks in advance!


title: Object oriented programming concepts

text: > Specifically, programming without inheritance is distinctly not object- > oriented; we call it programming with abstract data types. I found this great line from Grady Booch's "Object-Oriented Analysis and Design With Applications" book. So in order for a program to be an OO one, are inheritance, abstraction, encapsulation, and polymorphism(?) must-to-be things? Could anybody please explain me?


title: Which EXPLAIN SELECT is better -- the one in PostgreSQL or the one in MySQL?

text: Or are the two basically the same when it comes to figuring out how to build the right indexes?


title: Putting semicolons after while and if statements in C++

text: How come in C++ when you put:               while (expression);      the while loop doesn't run no matter if the expression is true or not. However if you put:               if (expression);      the statement runs no matter if the expression is true or not. It seems like they should both behave the same way.


title: How does this normalized example work?

text: I had the following DB schema:               Customer   Car     Rental     -------   ----     ------     Name      Name     Car_ID     ID        ID       Customer_ID                        Date      This is said to be non normalized as the date can repeat (multiple customers can rent a car at the same day). So the teacher said it should be like:               Customer  Car Date     ------    --- ----      and linked with foreign keys. Well I do not get that - how can I then simply enter that "John rented a BMW on 2/3/2013"?


title: How do I efficiently store all OpenStreetMap data in an indexed way?

text: I have a PBF file that contains the following information about a country:   * Nodes, each with their own longitude, latitude and properties; used to store points in a 2D space.   * Ways, each with their properties, they are connected through nodes; used to store roads, boundaries. While this file is only 80 MB in its compressed form, it's 592 MB when uncompressed and stored in a DB. Yeah, and that's only for one country, Belgium. Imagine storing France, Germany and Italy alongside. * * * Let's take a single highway for example, from Antwerp through Brussels to Charleroi. This would consist of a ton of nodes to store all the turns in the highway, but do I need all these turns? I doubt it. Let me tell you what I want to be able to do:   * I want to view the map at different zooming levels; major cities, minor cities and street level at least.   * I want to be able to get routing information between two points.   * I want to be able to compute the nearest road to my GPS location.   * Search for a location, by means of an index in the database. But most importantly, **the database shouldn't be too big as it will be stored on a mobile device**. * * * So, I thought about a combination of two techniques:   * Image tiles for viewing purposes, to working around storing/processing all the individual nodes.   * Storing the endpoints of roads for routing information, alongside information about the road. The problem with this is that I can't compute the nearest road to my GPS location with only this information; imagine that a bend in a highway, I can't determine that I'm on the highway with just the two endpoints. I was thinking about storing intermediate nodes between endpoints but that would be very costly to generate, I think. Also, determining the endpoints of roads (that are like a T-split) is most likely not even that easy as I need to figure out whether I need to store the midpoint at the top of that T-split or not. So, viewing is easy using image tiles; but I can't find an easy way to do routing and GPS location finding, what kind of storage technique should I be looking into? I find it a bit inconvenient that a `80 MB` file turns into a database of `592 MB`, I want to reduce that size a much as possible... What can I do to do this as efficiently as possible? In terms of disk and CPU. I'm targeting a WP7...


title: Splitting up a single project into libraries

text: I am working on a project/application that I feel is not very well organized, and parts of it intertwine in different ways. Everything works, but I can see things are not very modular. _Is it reasonable to split up an application into various libraries, even if they might not be reused by another application?_ Just the mere thought of splitting it up into libraries reveals many problems with the current system. I feel it will encourage better design, and future reuse (There are talks of a new project that seems it could benefit from at least some of these libraries). My concerns are   * How will it affect perfomance?   * How far should I go in splitting things up?   * If three libraries all depend on each other, is there a point in making them libraries? (perhaps it suggests a re-architecture of the modules) My question seems to go against the wisdom of this answer, in that _Dynamic libraries should never be created for a single app_. Then the question becomes- how to ensure modularity in a large application? Thanks! **EDIT:** It seems I have used the term "shared library" too much, so I removed it to imply any kind of library (either static or dynamic). The essence of the question is whether to split stuff up into any type of libraries.


title: Oracle Enterprise JavaBeans (EJB) Developer Certification

text: I would like to gain the "Oracle Enterprise JavaBeans (EJB) Developer" certification. According to this page I have to take a number of classes each of which costs up to a couple of thousand GB£. Is this really the only way to obtain the certification? Can I not just buy a certification guide book from amazon and just sit the requisite tests? At the moment I have no Java EE experience and I'm finding it impossible to get interviews for the jobs I'm interested in. I'm hoping this will at least help me get my foot through the door.


title: SQL-99 specification, is it specified to first order the result and limit it afterwards?

text: If I wrote this in MySQL               SELECT * FROM foo ORDER BY bar LIMIT 1      it would first order the result and limit it afterwards. I always get the lowest bar. I wonder if this is specified like this in SQL-standards and how to check that? All I found are some BNF's which do not explain how something should work, but only what syntax is valid.


title: Need to make my code more readable to the other programers in my team

text: I am working a project in **delphi 7** and I am creating a installer for the application, there are Three main parts.   1. **PostgreSQL** installation/uninstallation   2. **myapplication** ( setup of myapplication is created using nsi) installation/uninstallation.   3. **Creating tables** in Postgres through script(batch files). Every thing runs fine and smoothly, but if something fails I have created a logger which will log every step of the process,   like this               LogBook.Log('[POSTGRESQL INSTALLATION]  :  [ACTION]:Postgres installation started');      The function `LogBook.Log()` This will write the contents to a file. This is working nicely, but the problem is this has messed up the code as in it has become difficult to **read** the code as one ca only see the `LogBook.Log()` function call everywhere in the code an example                if Not FileExists(sOSdrive+'\Mapannotation.txt') then      begin         if CopyFile(PChar(sTxtpath+'Mapannotation.txt'), PChar(sOSdrive+'\Mapannotation.txt'), False) then            LogBook.Log(2,'[POSTGRESQL INSTALLATION] :  [ACTION]:copying Mapannotation.txt to '+sOSdrive+'\ sucessful')            else            LogBook.Log(2,'[POSTGRESQL INSTALLATION] :  [ACTION]:copying Mapannotation.txt to '+sOSdrive+'\ Failed');      end;      if Not FileExists(sOSdrive+'\Mappoint.txt')      then        begin          if CopyFile(PChar(sTxtpath+'Mappoint.txt'), PChar('c:\Mappoint.txt'), False) then            LogBook.Log(2,'[POSTGRESQL INSTALLATION] :  [ACTION]:copying Mappoint.txt to '+sOSdrive+'\ sucessful')        else            LogBook.Log(2,'[POSTGRESQL INSTALLATION] :  [ACTION]:copying Mappoint.txt to '+sOSdrive+'\ Failed');      end;      as you can see there are lots of `LogBook.Log()` calls,   before it was                if Not FileExists(sOSdrive+'\Mapannotation.txt') then         CopyFile(PChar(sTxtpath+'Mapannotation.txt'), PChar(sOSdrive+'\Mapannotation.txt'), False)       if Not FileExists(sOSdrive+'\Mappoint.txt')      then        CopyFile(PChar(sTxtpath+'Mappoint.txt'), PChar('c:\Mappoint.txt'), False)      this is the case in my whole code now.   its difficult to read. can any one suggest me a nice way to unclutter the calls to log? like   1. Indenting the ' LogBook.Log()` call   like this                 if Not FileExists(sOSdrive+'\Mapannotation.txt') then          begin              if CopyFile(PChar(sTxtpath+'Mapannotation.txt'), PChar(sOSdrive+'\Mapannotation.txt'), False) then             {Far away--->>}                   LogBook.Log(2,'[POSTGRESQL INSTALLATION] :  [ACTION]:copying Mapannotation.txt to '+sOSdrive+'\ sucessful')        else             {Far away--->>}                   LogBook.Log(2,'[POSTGRESQL INSTALLATION] :  [ACTION]:copying Mapannotation.txt to '+sOSdrive+'\ Failed');        end;        2. Separate **unit** like `logger`   This unit will have all the log messages in a `switch case` like this               Function LoggingMyMessage(loggMessage : integer)           begin     case  loggMessage of          1         :  LogBook.Log(2,'[POSTGRESQL INSTALLATION] :  [ACTION]:copying Mapannotation.txt to '+sOSdrive+'\ sucessful');     2         :  LogBook.Log(2,'[POSTGRESQL INSTALLATION] :  [ACTION]:copying Mapannotation.txt to '+sOSdrive+'\ Failed');        150        :  LogBook.Log(2,'[somthing] :  [ACTION]: somthing important);          end;      so I can just call the LoggingMyMessage(1) where ever required. Can anyone tell me which is a better and cleaner approach to logging this way?


title: Managing codebase for basic and pro edition of a project

text: I have a project which will have basic and professional edition. The professional edition will have all the features of the basic edition. I am using git to manage the project's codebase. I consider that I will fork repo of the basic edition after I completed it. Then, I will start to code the professional edition on the forked repo. My problem is that if there would be a bug in the basic edition in the future, I don't want to fix the bug in the basic edition and professional edition twice. How to handle this situation?


title: How can we make agile enjoyable for developers that like to personally, independently own large chunks from start to finish

text: We’re roughly midway through our transition from waterfall to agile using scrum; we’ve changed from large teams in technology/discipline silos to smaller cross-functional teams. As expected, the change to agile doesn’t suit everyone. There are a handful of developers that are having a difficult time adjusting to agile. I really want to keep them engaged and challenged, and ultimately enjoying coming to work each day. These are smart, happy, motivated people that I respect on both a personal and a professional level. The basic issue is this: Some developers are primarily motivated by the joy of taking a piece of difficult work, thinking through a design, thinking through potential issues, then solving the problem piece by piece, with only minimal interaction with others, over an extended period of time. They generally complete work to a high level of quality and in a timely way; their work is maintainable and fits with the overall architecture. Transitioning to a cross- functional team that values interaction and shared responsibility for work, and delivery of working functionality within shorter intervals, the teams evolve such that the entire team knocks that difficult problem over. Many people find this to be a positive change; someone that loves to take a problem and own it independently from start to finish loses the opportunity for work like that. This is not an issue with people being open to change. Certainly we’ve seen a few people that don’t like change, but in the cases I’m concerned about, the individuals are good performers, genuinely open to change, they make an effort, they see how the rest of the team is changing and they want to fit in. It’s not a case of someone being difficult or obstructionist, or wanting to hoard the juiciest work. They just don’t find joy in work like they used to. I’m sure we can’t be the only place that hasn’t bumped up on this. How have others approached this? If you’re a developer that is motivated by personally owning a big chunk of work from end to end, and you’ve adjusted to a different way of working, what did it for you?


title: How to get into web coding?

text: I don't know how to get into this area, or more specifically, become a website maker. Here's what I now   * html   * some java script   * C#   * and a little of everything else (php, css, xhtml, ect.) I've been on w3schools.com for a while reading and doing the tutorials and I've become much more knowledgeable about websites since I started. But when I compair what I've learned from w3schools to a website template I downloaded I notice things in this template that w3schools never even mentioned. What I'm wondering is whats the best way to go about becoming a web coder on your own, would it continuing w3schools be good? Or just download template read through them and figure out how the code works? One more question, I noticed these all use SQL, how do I go about learning SQL? and sorry, I lied, one more question, whats the best step process when learning web code? like what order, html then css then php? or html then xhtml then css? that kinda thing. thanks, Robert Edit: A website like this is my goal in this area: geforce.com Do you think making a website like this is difficult from a expert's view?


title: Should I invest time learning Coffeescript?

text: I am a freelancer and I earn my bread and butter by helping others write better java-script code. I have good experience with most of the JavaScript frameworks around. I am wondering if it is worth for me to invest time in learning coffeescript. Who should learn it and who need not ?


title: Implications of crediting a book source in a code file available under an open license

text: I'm writing some OS software just for funsies, and it's licensed using MS-PL (ie, do pretty much anything you want with it). It's a project from which I'm using many different sources (lots of personal reading/research going into it) and I'm crediting the original book/writer in the comment header(s) of the files as applicable. I'm doing it so that if anyone actually decides to read or use the code, they can refer to the original sources that inspired the work. Of note:   * I own a copy of each source   * All of the sources are able to be purchased by the general public (amazon)   * As far as I can tell, none of the books explicitly state that the code is licensed   * None of the code is copied verbatim. I've translated it all from various languages (mostly C++) to C#, and when appropriate I've added exception handling etc.  I'm just wondering if there are any implications of sourcing these books in a freely open source application/library.


title: Best practices for retrofitting legacy code with automated tests

text: I'm about to take on the task of reimplementing an already defined interface (a set of C++ header files) in a relatively large and old code base. Before doing this, I would like to have as complete test coverage as possible, so I can detect reimplementation errors as early and easily as possible. The problem is that the already existing code base was not designed to be easily testable, with (very) large classes and functions, a high degree of coupling, functions with (many) side effects, etc. It would be nice to hear of any previous experience with similar tasks, and some good and concrete tips on how you went about retrofitting automated tests (unit, integrations, regression, etc.) to your legacy code.


title: Introduce unit testing when codebase is already available

text: > **Possible Duplicate:**   >  Best practices for retrofitting legacy code with automated tests I've been working on a project in Flex for three years now without unit testing. The simple reason for that is the fact that I just didn't realize the importance of unit testing when being at the beginning of studies at university. Now my attitude towards testing changed completely and therefore I want to introduce it to the existing project (about 20000LOC). In order to do it, there are two approaches to choose from: 1) Discard the existing codebase and start from scratch with TDD   2) Write the tests and try to make them pass by changing the existing code Well, I would appreciate not having to write everything from scratch but I think by doing this, the design would be much better. What would be your approach?


title: How to unit test large legacy systems?

text: > **Possible Duplicate:**   >  Best practices for retrofitting legacy code with automated tests When working in large legacy systems (large systems with no unit testing ever) I often come across people saying use unit testing as a tool against possible bugs. I wonder if somebody have tried it on large systems with no unit testing at all. Of course it is easy to say unit testing helps ,but in large systems it can hugely time consuming process. It can take months if not years to fully unit test each part of the application . When you are asked to make a functionality which is modification of existing functionality or adding new functionality to the application, how would you go about it? Of course there will be lots of instances where code in different classes will look similar and you would want to re-factor those classes which without proper unit testing can and most likely will open a can of worms. So how would you go about unit testing large applications? And what other measures would you use to reduce possible bugs from your coding (of course some bugs will probably remain anyway)?


title: Is Scrum based on 'daily reporting'?

text: Google translates '早请示晚汇报' as 'Consult early and late reporting' or 'Ask for instructions to report back later'. Bing translates as 'Early and late reporting'. Some translated content: > The politics invaded all aspects of daily life during the **Cultural > Revolution** , as **早请示晚汇报**. Every day at a political activity or ceremony, > everyone, after getting up or reported to work/study, had to " _consult the > great leader Chairman Mao_ ," about that day's work, study. At the end of > the day/before going to bed, everyone had to _confess_ to the "Great Leader > Chairman Mao," that day's work/learning. **Late reporting** is called " > _confessing his/her sin_ ," because a day's work or study certainly would > contain errors, which delayed revolutionary work; hence, the person would > confess, " _I am sorry, great leader_ ", akin to " **confessing his/her > sin**." However, as "confessing one's sin," has a serious religious > undertone to it, so it was not considered appropriate and was renamed to " > **late reporting.** " Anywhere people gathered--schools, army, cadre > schools, community centers that provided three meals per day--everyone > involved had to appear for the **collective report**. Here is another excerpt that sounds beautiful even after machine translation: > Anyway, several times a day for several years removed from the > "instructions", "reporting" so that "life" of this short period of time is > finally free of political control winding all the time, everyone has a sense > of relief. Ref: Lin Zhao, a blog entry, a news paper article I feel compelled to be certain that this practice is definitely the source of 'Scrum' process. Some of these similarities cannot simply be ruled out as coincidences. My question is,   "Is there really a relation? If so, should we read some mission statements before we begin work, and we have stand-ups at the end of the day, before we leave?"


title: Webserver / DB / Application - Best way to setup the system for performance

text: I have a turbogears app that I am bringing live that uses a postgresql DB on the back end. From a performance issue am I better off having the DB and app on separate server or on the same server? If on the same server and I better off having the DB on a separate physical drive?


title: What is one correct architecture when using a DB with multiple clients?

text: We have a legacy system with data stored in a SQL database. Several clients connects to this database using a web service. The web service expose a lot of "commands" to query the database and to "do" operations. So far, so good. However, new operations need to be added and the web service cannot be extended. We can add a new service that would implement the operations from the old one (somewhat easy) and add our own operations. At the same time we want to enhance the performance of the web service by having multiple requests bundled as one request (the responses would come out as a bundle too). One desirable outcome would be to isolate the application from the web service using programming interfaces and a somewhat generic messaging (or whatever) mechanism. We are contemplating several ways to effectively support multiple clients: enterprise service bus, a request/response service layer, ORM with client/server architecture... Has anyone been confronted to such issues and what did you end up with?


title: What happens if I do not explicitly state "This program comes with absolutely no warranty"?

text: And lets say, my application is a simple feed reader. Does my app really have to include the no warranty notice?


title: Do I need to know servlets and JSP to learn spring or hibernate or any other java web frameworks?

text: I've been asking a lot of people where to start learning java web development, I already know core java (Threading,Generics,Collections, a little experience with (JDBC)) but I do not know JSPs and servlets. I did my fair share of development with several web based applications using PHP for server-side and HTML,CSS,Javascript,HTML5 for client side. Most people that I asked told me to jump right ahead to Hibernate while some told me that I do not need to learn servlets and jsps and I should immediately study the Spring framework. Is this true? do I not need to learn servlets and JSPs to learn hibernate or Spring? All of their answers confused me and now I am completely lost what to learn or study. I feel that if I skipped learning JSP and servlets I would missed a lot of important concepts that will surely help me in the future. So the question, do I need to have foundation/know servlets and JSP to learn spring or hibernate or any other java web frameworks.?


title: Project management tool built into visual studio

text: My friend and I are working on a project together in visual studio, and we are using subversion for source control. We have used php based project management tools before for task and bug tracking, but we find it inconvenient to go to work in visual studio for hours then have to go find the website and log in and report on what we already made commit notes for, especially since sometimes we are working off line and then have to remember to go back and update the trackers. We are wondering if there is a project management tool (or set of tools) that is built into (slash an add-on) Visual Studio that will work with AnkhSvn allowing multiple people to maintain and track tasks.


title: Which format is best for the first prototype not on paper?

text: Console app (my favorite), quick & sloppy form, MS Paint (for GUI); what works best most of the time for your standard application? why?


title: Generating stats from large data set

text: I would like to do a following: I have a fairly large data set, say billions of rows, each row having multiple binary columns. I would like to generate estimated stats with some certainty about those rows. Stats would have a simple form: how many rows are there with columns 1, 7 and 10 set. Obviously going through entries is not a viable solution. To be honest, I would prefer not touch the data set at all when I have to provide an estimation. I would like to precompute everything and then used precomputed data to answer questions about the data set. Do you know of any algorithms/techniques of solving such problem?


title: Is it good to keep the bugfix comments within the code?

text: My team is using clear-case as the version control. The project which I am working is not started 7-8 years back. During the entire life time of the project we had several releases bug-fixes service packs etc. The issues are tracked using the bug tracking system and most of the people who work on the bug-fixes follows a routine of enclosing the comment in START/END block with the date, author, bug-id etc. I feel this is quite irrelevant and making the code cluttered and uneasy to maintain and these are the things which must be part of check-in comments/labels etc, where we can keep additional life cycle information of the work product. What's the best practice to be followed? Some of the reviewers of the code insist to out the comments about the bug and fixes to ease out their life. In my understanding they must review the files by mapping it to a view and get the change log of the branch and review it. It would be helpful if I can get some best practices on submitting the updated code for review.


title: Importance of algorithms in a telephonic interview

text: I had taken a telephonic interview and the interviewer has given some problem for which I was supposed to give him the algorithm. Since its was a telephonic interview and I had no paper or pen, so I could not give him the correct solutions. So I got bit demotivated that my problem solving skills are very low (I have a decent exp on developing software). How do you overcome these kind of situations and suggestions to improve algorithm skills especially while facing these kind of tactical interviews.


title: Protecting an Application with Logins

text: I am a beginner Java programmer, and have tried searching for a way to set up a login system with my Java application. The application is a game and I do not want people to just upload it to a website so others can down load and play. I want to use something like MySQL to make the user authenticate in order to use the application. Does anyone have a suggestion?


title: Color schemes generation - theory and algorithms

text: I will be generating charts and diagrams and I am looking for some theory on color schemes and algorithm examples. Example questions:   * How to generate complementary or analogous colors?   * How to generate pastel, cold and warm colors?   * How to generate any number of random but distinct colors?   * How to translate all that to the hex triplet (web color)? My implementation will be in AS3 but any examples in pseudocode are welcome.


title: How can Lisp produce an iterative process from a recursive procedure?

text: I am starting to learn Lisp, using the SICP book. The authors mention that a procedure (i.e. function) can be recursive or iterative. Additionally, the process those procedures will generate will also be recursive or iterative, and that, surprisingly, a recursive procedure can sometimes generate an iterative process. The example given is the factorial procedure, which is a recursive procedure, but which generates an iterative process:               (define factorial n)         (iter 1 1 n))          (define (iter product counter max-count)         (if (> counter max-count)             product             (iter (* counter product)                   (+ counter 1)                   max-count)))      And here's a quotation from the book: > One reason that the distinction between process and procedure may be > confusing is that most implementations of common languages (including Ada, > Pascal, and C) are designed in such a way that the interpretation of any > recursive procedure consumes an amount of memory that grows with the number > of procedure calls, even when the process described is, in principle, > iterative. The implementation of Scheme we shall consider does not share > this defect. It will execute an iterative process in constant space, even if > the iterative process is described by a recursive procedure. **Question** : I understood the principles involved (i.e. the what) but I still don't understand how the Lisp interpreter/compiler will generate an iterative process from a recursive function, being able to calculate it using constant space, and why most other languages are not able to do it.


title: Is it considered bad practice to have PHP in your JavaScript

text: So many times on this site I see people trying to do things like this :               <script type="text/javascript">       $(document).ready(function(){               $('<?php echo $divID ?>').click(funtion(){            alert('do something');          });            });     </script>      I don't think that this is some sort of pattern that people naturally fall into. There must be some sort of tutorial or learning material out there that is showing this, otherwise we wouldn't see it so much. What I'm asking is, am I making too big a deal of this or is this a really bad practice? **EDIT :** Was speaking to a friend of mine about this who often puts ruby in his JavaScript and he brought up this point. Is it ok to dynamically place application wide constants in your JavaScript so you don't have to edit two files. for example...               MYAPP.constants = <php echo json_encode($constants) ?>;      also is it OK to directly encode data you plan to use in a library               ChartLibrary.datapoints = <php echo json_encode($chartData) ?>;         or should we make an AJAX call every time?


title: DDD: Domain Model Factory Design

text: I am trying to understand how and where to implement domain model factories. I have included my `Company` aggregate as a demo of how I have done it. I have included my design decisions at the end - I would appreciate any comments, suggestions, critique on those points. **The`Company` domain model:**               public class Company : DomainEntity, IAggregateRoot     {         private string name;         public string Name         {             get             {                 return name;             }             private set             {                 if (String.IsNullOrWhiteSpace(value))                 {                     throw new ArgumentOutOfRangeException("Company name cannot be an empty value");                 }                      name = value;             }         }              internal Company(int id, string name)         {             Name = name;         }     }      **The`CompanyFactory` domain factory:** This class is used to ensure that business rules and invariants are not violated when creating new instances of domain models. It would reside in the domain layer.               public class CompanyFactory     {         protected IIdentityFactory<int> IdentityFactory { get; set; }              public CompanyFactory(IIdentityFactory<int> identityFactory)         {             IdentityFactory = identityFactory;         }              public Company CreateNew(string name)         {             var id = IdentityFactory.GenerateIdentity();                  return new Company(id, name);         }              public Company CreateExisting(int id, string name)         {             return new Company(id, name);         }     }      **The`CompanyMapper` entity mapper:** This class is used to map between rich domain models and Entity Framework data entities. It would reside in infrastructure layers.               public class CompanyMapper : IEntityMapper<Company, CompanyTable>     {         private CompanyFactory factory;              public CompanyMapper(CompanyFactory companyFactory)         {             factory = companyFactory;         }              public Company MapFrom(CompanyTable dataEntity)         {             return DomainEntityFactory.CreateExisting(dataEntity.Id, dataEntity.Name);         }              public CompanyTable MapFrom(Company domainEntity)         {             return new CompanyTable()             {                 Id = domainEntity.Id,                 Name = domainEntity.Name             };         }     }        1. The `Company` constructor is declared as `internal`.   **Reason:** Only the factory should call this constructor. `internal` ensures that no other layers can instantiate it (layers are separated by VS projects).   2. The `CompanyFactory.CreateNew(string name)` method would be used when creating a new company in the system.   **Reason:** Since it would not have been persisted yet, an new unique identity will need to be generated for it (using the `IIdentityFactory`).   3. The `CompanyFactory.CreateExisting(int id, string name)` method will be used by the `CompanyRepository` when retrieving items from the database.   **Reason:** The model would already have identity, so this would need to be supplied to the factory.   4. The `CompanyMapper.MapFrom(CompanyTable dataEntity)` will be used by the `CompanyRepository` when retrieving data from persistence.   **Reason:** Here Entity Framework data entities need to be mapped into domain models. The `CompanyFactory` will be used to create the domain model to ensure that business rules are satisfied.   5. The `CompanyMapper.MapFrom(Company domainEntity)` will be used by the `CompanyRepository` when adding or updating models to persistence.   **Reason:** Domain models need to be mapped straight onto data entity properties so that Entity Framework can recognise what changes to make in the database. Thanks


title: How to solve this problem- Neural Net? Fuzzy? Other?

text: Hi I have a programming problem that I would like to solve using some artificial intelligence technique. I really dont know where to start. I would like some guidance as to what methodology to pursue. Lets say I have 10,000 images of random people, and I need to detect elderly people in images. I might have algorithms like wrinkle detector, glasses detector, walking cane detector, missing teeth detector, skateboard detector, Playstation detector, etc. Each algorithm does a scan independently and outputs a number from 0 to 10 on the likelihood it thinks the image contains that item. Lets assume that works. There might be 100 different algorithms. My set of 10,000 images would be divided by a human into two groups, those that contain an elderly person, and those that do not. Now I need to develop a system that takes the series of values from the algorithm modules, when given an image to analyze, and calculates a single value that represents the likelihood that an image has elderly people in it or not. During training I would like it to be able to automatically build rules by analyzing all the algorithms' outputs. For example:   * If wrinkle detector, glasses detector, walking cane detector and missing teeth detector all output a high number, then output a high number.   * If wrinkle, glasses, cane and teeth detectors are high, but playstation and skateboard detectors are also high, then output is neither low nor high.   * hands detector and clothes detector should be essentially ignored as old and young people both have those (hopefully) What type of technology should I be implementing for the automated rule building system? Is this better solved by a neural network system? A fuzzy logic system? Something else? Thanks for any advice.


title: Scrum: Writing the time it took to complete a task

text: In my organization when we move a task to the "Done" column we write the number of hours it took to complete the task. It can be useful when during retrospective the team tries to understand why certain stories took longer to implement than anticipated. However it is also burdensome and developers feel somewhat micromanaged or stressed when they have to do this. What do you do in your teams? What do you recommend?


title: When practicing collective code ownership, can there be experts of each component?

text: Consider a complex and extensive software component; for example a multi- language text rendering engine, an IPC framework, a scheduler that can handle multiple time zones, a module full of complexities caused by the need to stay backwards compatible, etc... It requires a lot of knowledge of the details to maintain and extend such a component without introducing bugs with every code change. It is also often helpful to know the bug history when receiving a new bug report. Moreover, it requires thorough knowledge about the component's design to be able to maintain its consistency after future extensions, and it is good to know the rationale behind past design decisions. You might try to document this kind of knowledge, but it would require a lot of time and effort, it would rapidly become outdated and hence untrustworthy. Worse, everybody would still need to keep that written documentation in his/her mind. It seems to me that for such components, it is best to have someone that has in-depth knowledge, as one cannot thoroughly know and keep up with the code produced by a whole group of people without an excessive communication and learning overhead. I wonder whether the practice of collective code ownership allows for such experts, as it seems to me that it would require some kind of "weak code ownership". And if not: how can it succeed without a massive amount of duplicate work?


title: Pattern to use to relate multiple data sources to different user data widgets

text: I have an client x server intranet application the basically gets data from the server, format it and send that data to the client for display. At the server we are using ASP.NET C# running on IIS and at the client we have Javascript widgets. The client x server requests are done through ajax calls. I have lots (100+) of server objects, that can be shown into 10 different formats in the browser though different graphical widgets. So, basically we have the following structure: ![enter image description here](http://i.stack.imgur.com/JJLxc.png) So, for every server object I need, at nnnWidgetDataGetter objects, to do some data transformation to widget data format to be sent to the client. Every widget can request data from all objects of the server. Using a normal approach, I would have to write tons of methods, one for each server basic class times each datagetter class. To avoid writing hundred of methods with similar behaviour, we decided to use a dynamic approach at the DataGetter classes (static classes), where the business object is evaluated at runtime, data is gathered from this object, formatted and sent to the client. The problem is that using dynamic object creation and invokation we loose the Intellisense, so the code is turning very big and difficult to understand and maintain. After a while we found out that we´re not using the correct approach and started thinking about sw patters that would help us solve this. So we are looking for the correct pattern to solve this issue that would keep a typed structure where Intellisense could work and that avoid us to write hundred of different methods. We appreciate very much any kind of help.


title: How to route messages between clients using a central server in Python

text: I've got three Raspberry Pis sitting around. I want 2 of them to be able to chat while the 3rd routes the messages (acts as a server between them). The general flow of events should be something like this:   * Server starts running on Pi #1   * Pi #2 starts running and connects to the server (who's IP will be static I guess) with a name he chooses. Pi #3 does the same as #2.   * Pi #3 can then, knowing the name of Pi #2, send a message to Pi #2 using ... something. This is the general outline of what I want to achieve. I'm not sure what the server that runs on Pi #1 should be (I've heard of webserver frameworks like Flask but I don't have enough knowledge to determine if they fit my needs). I'm also not sure on what I should be using for the client side (Pi #2,3). I could probably use sockets but I assume there is a better / easier way.


title: Do software licenses (ie, MIT) need to be included with the executable?

text: Whenever a software license reads: `... The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.` Does this mean you have to include it with the executable (the version customers get) or just the source code (for the programmers)? Sorry if this is a silly question, but it doesn't clearly state what "the Software" is referring to, and I can see people maybe wanting credit for it. If you don't have to include the license with the executable, do you need to give credit in your executable release some other way, like some other kind of copyright notice that just says "Copyright "? Is there a specific format to that?


title: Range searching with WebGL

text: Is it possible to use somehow WebGL to fasten up 1d range searching? I need to find overlapping date intervals, and I thought that 3d games usually have a very similar problem by rendering frames... _I read ofinterval trees as an alternative if this idea does not work, but I am open for suggestions...   Btw. if stackoverflow would be a better place for this question, pls let me know!_


title: Liskov substitution and abstract classes / strategy pattern

text: I'm trying to follow LSP in practical programming. And I wonder if different constructors of subclasses violate it. It would be great to hear an explanation instead of just yes/no. Thanks much! P.S. If the answer is `no`, how do I make different strategies with different input without violating LSP?               class IStrategy     {         public:             virtual void use() = 0;     };          class FooStrategy : public IStrategy     {         public:             FooStrategy(A a, B b) { c = /* some operations with a, b */ }             virtual void use() { std::cout << c; }         private:             C c;     };          class BarStrategy : public IStrategy     {         public:             BarStrategy(D d, E e) { f = /* some operations with d, e */ }             virtual void use() { std::cout << f; }         private:             F f;     };


title: How to store Role Based Access rights in web application?

text: Currently working on a web based CRM type system that deals with various Modules such as Companies, Contacts, Projects, Sub Projects, etc. A typical CRM type system (asp.net web form, C#, SQL Server backend). We plan to implement role based security so that basically a user can have one or more roles. Roles would be broken down by first the module type such as: -Company -Contact And then by the actions for that module for instance each module would end up with a table such as this:               Role1 Example:              Module   Create  Edit        Delete   View         Company   Yes    Owner Only    No     Yes         Contact   Yes    Yes           Yes    Yes      In the above case `Role1` has two module types (Company, and Contact). For company, the person assigned to this role can create companies, can view companies, can only edit records he/she created and cannot delete. For this same role for the module contact this user can create contacts, edit contacts, delete contacts, and view contacts (full rights basically). I am wondering is it best upon coming into the system to session the user's role with something like a: `List<Role> roles;` Where the `Role` class would have some sort of `List<Module> modules;` (can contain Company, Contact, etc.).? Something to the effect of:               class Role{     string name;     string desc;     List<Module> modules;     }      And the module action class would have a set of actions (Create, Edit, Delete, etc.) for each module:               class ModuleActions{     List<Action> actions;     }      And the action has a value of whether the user can perform the right:               class Action{     string right;     }      Just a rough idea, I know the action could be an enum and the ModuleAction can probably be eliminated with a `List<x, y>`. My main question is what would be the best way to store this information in this type of application: Should I store it in the User Session state (I have a session class where I manage things related to the user). I generally load this during the initial loading of the application (global.asax). I can simply tack onto this session. Or should this be loaded at the page load event of each module (page load of company etc..). I eventually need to be able to hide / unhide various buttons / divs based on the user's role and that is what got me thinking to load this via session. Any examples or points would be great.


title: Android From Local DB (DAO) to Server sync (JSON) - Design issue

text: I sync data between my local DB and a Server. I'm looking for the cleanest way to modelise all of this. I have a com.something.db package That contains a Data Helper and couple of DAO classes that represents objects stored in the db (I didn't write that part)               com.something.db     --public DataHelper     --public Employee              @DatabaseField e.g. "name" will be an actual column name in the DB              -name              @DatabaseField              -salary              etc... (all in all 50 fields)      I have a com.something.sync package That contains all the implementation detail on how to send data to the server. It boils down to a ConnectionManager that is fed by different classes that implements a 'Request' interface               com.something.sync     --public interface ConnectionManager     --package ConnectionManagerImpl     --public interface Request     --package LoginRequest     --package GetEmployeesRequest      My issue is, at some point in the sync process, I have to JSONise and de- JSONise my data (E.g. the Employee class). But I really don't feel like having the same Employee class be responsible for both his JSONisation and his actual representation inside the local database. It really doesn't feel right, because I carefully decoupled the rest, I am only stuck on this JSON thing. What should I do ? Should I write 3 Employee classes ?               EmployeeDB        @DatabaseField e.g. "name" will be an actual column name in the DB        -name        @DatabaseField        -salary        -etc... 50 fields               EmployeeInterface        -getName        -getSalary        -etc... 50 fields               EmployeeJSON        -JSON_KEY_NAME = "name"   The JSON key happens to be the same as the table name, but it isn't requirement        -name        -JSON_KEY_SALARY = "salary"        -salary        -etc... 50 fields      It feels like a lot of duplicates. Is there a common pattern I can use there ?


title: Reasonable Number of Directed Graph Nodes and Edges

text: How many directed graph nodes are typically represented in the browser? I'm working with some large data-sets with nodes and edges more then 400,000. I'm wondering if I am going down a fruitless path trying to represent them in the browser via arbor.js or similar JS libraries. What's the most effective way to allow a large number(large relative to my domain of real estate transactions, maybe 1-10,000) of users to visualize and browse a large directed graph of up to 500,000 records?


title: I don't understand why algorithms are so special

text: I'm a student of computer science trying to soak up as much information on the topic as I can during my free time. I keep returning to algorithms time and again in various formats (online course, book, web tutorial), but the concept fails to sustain my attention. I just don't understand: why are algorithms so special? I can tell you why fractals are awesome, why the golden ratio is awesome, why origami is awesome and scientific applications of all the above. Heck I even love Newton's laws and conical sections. But when it comes to algorithms, I'm just not astounded. They are not insightful in new ways about human cognition at all. I was expecting algorithms to be shattering preconceptions and mind- altering, but time and time again they fail miserably. Perhaps I am doing something wrong in my approach. Can someone tell me why algorithms are so important to programming?


title: Should you make private properties?

text: private string mWhatever;          private string Whatever     {         get         {             return this.mWhatever;         }         set         {             this.mWhatever = value;         }     }      I've seen some people who make properties for every single member, private or not... does this make any sense? I could see it making sense in 1% of the cases at times when you want to control access to the member inside the class containing it because if you didn't use properties for every member it would lead to inconsistencies and checking to see if the member has an access or not (since you have access to both in the scope of the class).


title: Best practices for constants

text: How do you guys handle constants, especially in Java (static final) and C++ (define)?   * Do you use dedicated headers (C++) or classes (Java) for all constants?   * Do you turn all literal values into constants or just those you want to use in multiple places? This is probably a bit subjective, so I'm especially interested in the reasons for your approach.


title: Modeling a Student Application/Committee Relationship

text: I'm developing an ERD for a graduate student manager program (it's for a university class, so it's a fairly trivial implementation). In this snippet of the model, I'm trying to work out the 'application' and 'committee' entities/relationships. Basically, a committee - comprised of staff members - can be formed and assigned to review an application. Here are the entities I've come up with:   * **application:** Comprised of a student's application data submitted through a form (student id, date submitted, degree, etc.).   * **committee:** Self-explanatory. Group of staff members that can review applications.   * **staff_member:** Any faculty member.   * **committee_membership:** An associative entity I've created to resolve the many-to-many relationship between committee and staff member since a committee can have many staff members, and a staff member can belong to many committees.  Is this an effective implementation of what I'm trying to do? I'm still trying to wrap my head around associative entities and when they are needed. It seems strange to have the 'committee' table with a single column. Also - and I know I've given you limited information - do my relationships look generally correct? ![enter image description here](http://i.stack.imgur.com/6fo25.png)


title: How does datomic handle "corrections"?

text: **tl;dr**   * Rich Hickey describes datomic as a system which implicitly deals with timestamps associated with data storage   * from my experience, data is often imperfectly stored in systems, and on many occasions needs to retroactively be corrected (ie, often the question of "was a True on Tuesday at 12:00pm?" will have an incorrect answer stored in the database) This seems like a spot where the abstractions behind datomic might break - do they? If they don't, how does the system handle such corrections? * * * Rich Hickey, in several of his talks, justifies the creation of datomic, and explains its benefits. His work, if I understand correctly, is motivated by core the insight that humans, when speaking about data and facts, implicitly associate some of the related context into their work(a date-time). By pushing the work required to manage the implicit date-time component of context into the database, he's created a system which is both much easier to understand, and much easier to program. This turns out to be relevant to most database programmers in practice - his work saves everyone a lot of time managing complex, hard to produce/debug/fix, time queries. However, especially in large databases, data is often damaged/incorrect (maybe it was not input correctly, maybe it eroded over time, etc...). While most database updates are insertions of new facts, and should indeed be treated that way, a non-trivial subset of the work required to manage time-queries has to do with retroactive updates. I have yet to see any documentation which explains how such corrections, or retroactive updates, are handled by datomic; from my experience, they are a non-trivial (and incredibly difficult to deal with) subset of time-related data manipulation that database programmers are faced with. Does datomic gracefully handle such updates? If so, how?


title: Password reset process

text: So I'm working on my first password reset mechanism. I'm going with what I understand to be a fairly common procedure:   1. User clicks "Forgot Password"   2. User is prompted for email address   3. If the entered email address is valid, send an email with a reset link to it   4. Reset link uses a token of some kind to identify the user account and keep its details secure   5. When password is reset, generate a new token and save it to the user account I feel like this should be pretty secure, but I was wondering if anyone could provide any insights that I may not be considering at this point.


title: A good name for ValueObject that contains database update/create column values

text: We all know these fields, database admins so like to add:   * UserCreated & DateCreated   * UserUpdated & DateUpdated They need to be displayed in the UI so I want to put them in some `ValueObject` but I can't come up with a good name to call the class...


title: Builder Pattern: When to fail?

text: When implementing the Builder Pattern, I often find myself confused with when to let building fail and I even manage to take different stands on the matter every few days. First some explanation:   * With _failing early_ I mean that building an object should fail as soon as an invalid parameter is passed in. So inside the `SomeObjectBuilder`.   * With _failing late_ I mean that building an object only can fail on the `build()` call that implicitely calls a constructor of the object to be built. Then some arguments:   * In favor of failing late: A builder class should be no more than a class that simply holds values. Moreover, it leads to less code duplication.   * In favor of failing early: A general approach in software programming is that you want to detect issues as early as possible and therefore the most logical place to check would be in the builder class' constructor, 'setters' and ultimately in the build method. What is the general concensus about this?


title: Best way to reuse common functions between ASPX pages ?

text: I have a bunch of functions that are used across multiple ASPX files. I want to condense these down to one file to be used for all the ASPX files. I have a few ideas but I want to know what the accepted method to doing this would be. I have an idea to just create a class to put them in. However, I was wondering if i could put them in a ascx page, but that does not look like the solution I'm looking for. Is there a accepted method for this type of situation?


title: Sports Programming

text: Other than programming, I'm addicted to sports. I'd like to integrate the two together. What are different programming languages that companies like ESPN use to work with stats? What techniques are used to do this, and how can I get going with it myself?


title: Does the ray tracing algorithm involves rasterization of image?

text: I am constructing a ray tracing algorithm , i know that the first step is to develop camera and view plane specifications. Now is the next step performing rasterization algorithm on image before a BVH tree is constructed so that intersection tests can be performed? Kindly Guide


title: How to structure a project that supports multiple versions of a service?

text: I'm hoping for some tips on creating a project (ASP.NET MVC, but I guess it doesn't really matter) against multiples versions of a service (in this case, actually multiple sets of WCF services). Right now, the web app uses only some of the services, but the eventual goal would be to use the features of all of the services. The code used to implement a service feature would likely be very similar between versions in most cases (but, of course, everything varies). So, how would you structure a project like this? Separate source control branches for each different version? Kind of shying away from this because I don't feel like branch merging should be something that we're going to be doing really often. Different project/solution files in the same branch? Could link the same shared projects easily Build some type of abstraction layer on top of the services, so that no matter what service is being used, it is the same to the web application?


title: What are the so-called "levels" of understanding multithreading?

text: I seem to remember reading somewhere some list of 4 "levels" of understanding multithreading. This _may_ have been in a formal publication, or it _may_ have been in an extremely informal context (even like in a Stack Overflow question, for example). Unfortunately I don't remember who referred to them or precisely what they were. I seem to recall that they were roughly like:   1. Total ignorance   2. Awareness mixed with incompetence   3. Relative competence mixed with fear   4. True understanding My intention is to refer to these levels in a blog post I'm writing, with a reference; but I can't for the life of me remember where I first encountered this list. Brief Google searches have proved unfruitful.


title: Using π, φ, λ etc. as variable names while programming?

text: This is a function in the d3.v3.js file (the graph library D3.js):                 function d3_geo_areaRingStart() {         var λ00, φ00, λ0, cosφ0, sinφ0;         d3_geo_area.point = function(λ, φ) {           d3_geo_area.point = nextPoint;           λ0 = (λ00 = λ) * d3_radians, cosφ0 = Math.cos(φ = (φ00 = φ) * d3_radians / 2 + π / 4),            sinφ0 = Math.sin(φ);         };         function nextPoint(λ, φ) {           λ *= d3_radians;           φ = φ * d3_radians / 2 + π / 4;           var dλ = λ - λ0, cosφ = Math.cos(φ), sinφ = Math.sin(φ), k = sinφ0 * sinφ, u = cosφ0 * cosφ + k * Math.cos(dλ), v = k * Math.sin(dλ);           d3_geo_areaRingSum.add(Math.atan2(v, u));           λ0 = λ, cosφ0 = cosφ, sinφ0 = sinφ;         }         d3_geo_area.lineEnd = function() {           nextPoint(λ00, φ00);         };       }      I was completely taken aback that the programmers used π, φ and λ as variable names. Surprisingly, these variables were accepted even by Notepad (ie: it didn't turn into junk/unrecognized characters).   Is it good practice to use such variables? I can see that they're very intuitive and searchable too, but a bit unnerving.


title: 1-click software release

text: I am rewriting a vb6 installer into NSIS. One of my priorities is to compile- to-release in the least number of steps possible; ideally, a one click process, in which all needed files are included, registered, and put in the right folders. At the moment, I am creating several folders. One for app_path files, one for system_files, etc. So, every time that a file is modified or a new file added, I just drop it in the right folder and recompile. However, if a completely new file is included, steps like registering a DLL still need to be implemented in code. Any suggestion on how to improve this approach?, or on how to design a one- click compile-to-release process? EDIT: The original installer was created using the Package and Deployment wizard from Visual Basic 6.0. Every time that I need to release my software, I found my self updating and adding files, updating the respective lst file, and repackaging everything (CAB files, dlls, etc) into one exe in order to release it from our website. It is a cumbersome process. Additionally, due to pure design. The original software has been copy pasted in several projects, creating several application and its respective VB6 installers (repeating a lot of common files). Ideally, there would be one single installer, which allows the installation of the different executable and manages all the shared files among them.


What is the difference between `update` and `upgrade` in the context of application software?


title: Freedom of Speech vs. Computer Security

text: Over the Summer I found a cookie put on my computer by the school's network that seemed like it could be a problem. It stored authentication information and (long story short) I found if you put in other people's easily attainable information, you become signed in as them. Slow but sure, I discovered 3 security exploits that, when working together, compromised ALL security on the website. In theory I could sign in as teachers, access any student's email (with capabilities to send), adjust all grades, anything I wanted to do, I could do. They have since fixed this error, not only is the cookie gone, but the site is replaced with a Microsoft Sharepoint foundation instead of their "roll your own" system. I didn't research this to take advantage of the exploit. I did it because these exploits would allow MY information to be viewed by ANYBODY, a student of the school or not. So I went to my School's IT so that they would fix it. They did, and almost a month after they fixed, I decided to write a 2 page-ish article on my blog. I'd link to that page now except that the head of IT has asked that I take the page down. He claims we agreed that I'd never talk about the exploit to anybody outside of IT. I know I never agreed to that because since square one I wanted to take credit for my 3 or 4 weeks of hard investigation and work, I fully intended on telling people about the problem. I wrote my article with discretion. I never mentioned the school's name and it had very little subjective content, it was primarily how I found the exploits, what they were, and how they could be used. The idea was that if I talked about it from the point of view of the discoverer, it'd show insight into how to develop against it. The school was very appreciative that I did not use these exploits and that I came straight to them with the intention of fixing it. I only blog about Software Development concepts. Finding security holes in the wild like this is a perfect subject for my blog. Also, I want to make a name for myself in the cyber security world, Bruce Schneier linked me to an article in his blog talking about how if you want to make a name for yourself in the cyber security, you need to break ciphers, find security holes and fix them, and such. In short, I feel I deserve credit for the hard work I did, they feel that the school's image is more important even though the security hole is more than fixed. What's the best way to go about getting my credit here? I have posted a pseudo censored version in the mean time. UPDATE: no more pseudo censored version, I just put up a new article that's a little more ambiguous about it even being a school. New article can be found here.


title: What algorithm browsers follow to remember values for form controls?

text: You can have different HTML `input` elements on a single HTML `form` and all of them, have their associated remembered values (values that you've entered in those fields); Is it related to the `id` or `name` attribute of the `input` element? No. Proof? Your email address appears on many `input` elements across different websites, and all those fields have different `id` and `name` attributes. So, there is a mystery here I don't understand. How browsers remember values for HTML form controls? What is the algorithm? How they know that they should show your email on _this_ control and not on _that_ control, while controls are both HTML `input type=text` elements?


title: Difference between reverse lookup tables and rainbow tables

text: Using Reverse Lookup Tables, you create a lookup table consisting of the password hash of user accounts. Then you use another table which consists of hashes with guessed passwords. Then you compare the two to see if the hashed password of compromised user account matches hashed password in lookup table. Using Rainbow Tables, it appears to be the same technique except the lookup table is smaller so you can search through them quicker. What is the real difference between reverse lookup tables and rainbow tables?


title: What is the term that means "keeping the arguments for different API calls as similar as possible"?

text: There is a word which I can never remember... it expresses a design goal that API calls (or functions or methods or whatever) should be as similar as reasonably possible in their argument patterns. It may also extend to naming as well. In other words, all other things being equal, it is probably bad to have these three functions:               deleteUser(email)     petRemove(petId,species)     destroyPlanet(planetName,starName)      if instead you could have               deleteUser(userId)     deletePet(petId)     deletePlanet(planetId)      What is the word for this concept? I keep thinking it's "orthogonal" but it definitely isn't. Its a very important concept, and to me it's one of the biggest things that makes some APIs a joy to work with (because once you learn a few things you can pretty much use everything without looking at doco), and others a pain (because every function is done inconsistently).


title: Are all programming problems algorithm problems?

text: I like how "Introduction to Algorithms" by Cormen et al. conveys knowledge. One reason is that everything has to do with programming problems and the book is not implemented in any particular programming language. This language independency provides focus on the ideas in general. So my question is, as it says in the title. Is every solveable programming problem solveable by thinking in this algorithmic fashion. No matter which language, field, etc ? If yes, give arguments, else, give arguments! I have not implemeted many complex programs with GUI, AI, Graphics, etc ... But are these types of problems also a matter of thinking out good algorithms?


title: Use of versioned objects/data to handle program version compatibility?

text: Is there a common name for the practice of keeping a version number on your data, so that different versions of your program can identify, for example, "current", "legacy", and "too-old-to-deal-with" versions of the same type of object? As discussed here: Strategy for backwards compatibility of persistent storage.


title: Is there canonical jUnit reference documentation?

text: I can't seem to find any kind of complete reference for jUnit. The only way I've managed to find to know about all the features in jUnit is to check out all the release notes for it. For example there is no mention of @Rules in the official page unless you count the blog posts. But for that you first need to know a feature exists to search for it. Is there a canonical reference for jUnit? What's the best method for learning about jUnit features? What I've tried:   * jUnit Cookbook \- Really basic, very few features covered   * The official FAQ \- Covers more but it doesn't have @Rules or anything covered there. Updated last time in 2006


title: Who should control navigation in an MVVM application?

text: Example #1: I have a view displayed in my MVVM application (let's use Silverlight for the purposes of the discussion) and I click on a button that should take me to a new page. Example #2: That same view has another button that, when clicked, should open up a details view in a child window (dialog). We know that there will be Command objects exposed by our ViewModel bound to the buttons with methods that respond to the user's click. But, what then? How do we complete the action? Even if we use a so-called NavigationService, what are we telling it? To be more specific, in a traditional View-first model (like URL-based navigation schemes such as on the web or the SL built-in navigation framework) the Command objects would have to know what View to display next. That seems to cross the line when it comes to the separation of concerns promoted by the pattern. On the other hand, if the button wasn't wired to a Command object and behaved like a hyperlink, the navigation rules could be defined in the markup. But do we want the Views to control application flow and isn't navigation just another type of business logic? (I can say yes in some cases and no in others.) To me, the utopian implementation of the MVVM pattern (and I've heard others profess this) would be to have the ViewModel wired in such a way that the application can run headless (i.e. no Views). This provides the most surface area for code-based testing and makes the Views a true skin on the application. And my ViewModel shouldn't care if it displayed in the main window, a floating panel or a child window, should it? According to this apprach, it is up to some other mechanism at runtime to 'bind' what View should be displayed for each ViewModel. But what if we want to share a View with multiple ViewModels or vice versa? So given the need to manage the View-ViewModel relationship so we know what to display when along with the need to navigate between views, including displaying child windows / dialogs, how do we truly accomplish this in the MVVM pattern?