title: Rails - How to use modal form to add object in one model, then reflect that change on main page?

text: I'm working on a Rails app and I've come across a situation where I'm unsure of the cleanest way to proceed. I posted a question on SO with code samples and such - it has received no answers, and the more I think about the problem, the more I think I might be approaching this the wrong way. (See the SO question at http://stackoverflow.com/questions/9521319/how-to-reference-form-when- rendering-partial-from-js-erb-file) So, in more of a generic architecture type question: Right now I have a form where a user can add a new recipe. The form also allows the user to select ingredients (it uses a collection_select which contains Ingredient.all). The catch is - I'd like the user to be able to add a new ingredient on the fly, without leaving the recipe form. Using a hidden div and some jQuery/AJAX, I have a link the user can click to popup a modal form containing ingredients/new.html.erb which is a simple form. When that form is submitted, I call ingredients/create.js.erb to validate the ingredient was saved and hide the modal div. Now I am back to my recipe form, but my collection_select hasn't updated. It seems I have a few choices here:   1. try and re-render the collection_select portion of the form so it grabs a new list of ingredients. This was the method I was attempting when I wrote the SO question. The problem I run into is the partial I use for the collection_select needs the parent form passed in, and when I try and render from the JS file I don't know how to pass it the form object.   2. Reload the recipe form. This works (the collection_select now contains the new ingredient), but the user loses any progress they made on the recipe form. I would need a way to persist the form data - I thought about manually passing the values back and forth, but that is sloppy and there has to be a better way...   3. Try and manually insert the tags using jQuery - this would be simple, but because I'm allowing for multiple ingredients to be added, I can't be certain what ID to target. Now, I can't be the only person to have this issue - so is there an easier way I'm missing? I like option 2 above, but I don't know if there's an easy way to grab the entire params hash as if I had submitted the main recipes form. Hopefully someone can point me in the right direction so I can find an answer to this... If this doesn't make any sense at all, let me know - I can post code samples if you want, but most of the pertinent code is up on the SO question. Thanks!


title: How to bypass Oauth2 authentication when the client and resource owner is the same entity?

text: We are currently working on using an API provided by Mercado Libre which is a maket place for selling various goods. Their APIs use OAuth 2.0 for authentication. The problem is that OAuth 2.0 as implemented by Mercado deals with the case that the Client application and the Resource owner are different entities. So if the client application wants to view all orders made by a seller for example it will require the user to authenticate himself first on Mercado before allowing the client application to get his data. This is a convenient flow if the client application and resource owner are different entities and the resource owner is using a browser to access the client app. However, in my case there will be now UI. The client app my are building will collect orders and other info from Mercado automatically with no user intervention as we own the data ourselves. **TL;DR** So in short I need a way to bypass the user authentication when using OAuth 2.0 without a UI.


title: How is Java used in the financial sector?

text: I am an student with good knowledge of Java, and I'd like to get into the financial sector. How is Java used there? How can a Java developer expect to break into the financial sector and find success? What types of systems should I be looking into?


title: Web development: no local server workflow

text: I'm considering the reengineering of my web development ecosystem. We use Git very successfully to deploy new changes to our Production, Staging, and Development servers. Traditionally, I've always had a copy of Apache on my local machine - in the interest of keeping my local machine as lean as possible, I'm considering running Apache in a non-local VM and syncing changes somehow. My initial thought was to run something like `rsync` and `cron` (Mac development system) to monitor the directory for file changes and then sync them up. I have been tempted to use a separate branch in Git and writing a hook to have the Apache server pull in the changes, but versioning all of my changes may be unproductive, particularly on very experimental additions. My question is, is there something I'm not considering in this workflow? This particular project requires ColdFusion, so am I going to realize significant benefits over not having Apache/CFIDE locally?


title: Is switching from a CVCS to a DVCS a considerable bandwidth save?

text: So, I'm in a big geographically-distributed company, we use perforce and I'm starting to make the case for a DVCS with a whitepaper I was requested to write. I was thinking that one of the arguments I could use is the bandwidth saved using a DVCS, and technically if there were binaries to download (there are, but they're not sync'ed every day) and enough developers downloading them one could see a substantial difference. Unfortunately that's an edge case and its all that I can think of (other than individual developers being able to work faster when diffing, committing locally, and all those other DVCS perks). So, **would there be an actual noticeable bandwidth save?, in what other cases?**. Free cookie to anyone with actual empirical evidence (confirming or refuting). **Edit:** It is just one of the arguments I'm trying to support and it's not at all the main one, I got at least 10 others... this is one of the "side- benefits" but I want to find out how real it is. Plus, I want to win over the IT guys =)


title: Ext JS code review check list

text: Can any one share a code review check list for Ext JS in common and specially for Ext JS 3.4 ?


title: Are High Level Design and Low Level Design documents needed to follow Agile development process?

text: Our team is developing a project using an Agile development process. All of our requirements are converted into product backlog items and task are broken down based on that. One of my team member suggested to maintain the High Level Document (HLD) and Low Level Document (LLD) for the requirement. Do we need to have these documents to follow the Agile process?


title: Why does my C++ (OpenMP) matrix operations code start incurring more cache misses running in parallel compared to Scala?

text: I have written code using C++ (OpenMP for parallelizing loops) which does lots of matrix operations. A single instance of the code runs very fast and completes in 0.2 seconds. For the same processing, code written in Scala (using Actors) takes around 3 seconds. The problem that I am facing is that when I run multiple instances of the C++ code in parallel, the running time increases very rapidly. The Scala code does not exhibit such behavior. Running parallel instances of the Scala code increases the time linearly. Using the Zoom profiler, I found that my C++ code starts incurring cache misses. A single instance of the code uses around 2 MB of memory. And the L3 cache in my machine is 3 MB. So it makes sense that multiple instances running in parallel will lead to cache misses. I don't understand why the running time of the Scala code does not get affected when multiple instances are running in parallel. All the matrices are dense matrices in both the C++ and Scala code.


title: Is it true that a stricter coding style is always better?

text: I am currently studying computer science and was wondering how strict coding styles are in industry, how much it differs between industries and if it is true that a stricter coding style is always better?


title: Advice on making sure e-commerce site is secure using PHP and MySQL

text: Like the title says, I would like some advice from knowledgable web developers on figuring out security issues for my e-commerce site. I am designing the database as well as the code that communicates with the database to make changes, etc. I have a few questions, but in general a good checklist on what to do to make the security pretty tight, seeing as I will be dealing with credit cards. I will not be storing credit card numbers. Links to good places would be helpful. My main concern is keeping the database secure. I am pretty new to web development, and I am just concerned about thst. I do have a question about the design of a database used for online transactions. Is there a better way to make the schema than to just put all the user info into one table: ex.               customer(customerid, firstname, lastname, username, password,              address, city, country, zipcode)      Would it be better to store user credentials in another table and link them with the customerid? Sorry if I am not getting too specific, but I am new to web development and mainly have experience in offline programming. Again my main concern is security issues. If anyone has a great article on security, that would do just fine as well. Thanks for your time!


title: Programmers will be designers in the future?

text: Is everything going to tend to powerful interface in the nearest future(I'm talking about desktop applications)? Console or simple GUI applications will not be popular? And does it mean that all programmers will have to become designers?


title: DB table with column for each datatype

text: I need to design a DB for storing key-value data. List of Key names isn't fixed and should expand at later point. I don't want to create a table with a column for each key, because I'll need to add columns frequently and it might grow too big, and I understood that the Entity-Attribute-Value design isn't efficient. I thought of the following type of table design, and I'm asking if it makes any sense and does anyone can come up with any drawbacks related to efficiency, table size or any other issue - Each column in the table is of a different data type; irrelevant columns for a key are NULL:               ID |DataType |KeyName |ValInt |ValSmallInt|ValBool |ValStr  |ValText  |ValDate     -------------------------------------------------------------------------------     1  |1 (int)  |Width   |100    |NULL       |NULL    | NULL   | NULL    | NULL     2  |1 (int)  |Height  |200    |NULL       |NULL    | NULL   | NULL    | NULL     3  |2 (bool) |IsActive|NULL   |NULL       |false   | NULL   | NULL    | NULL     4  |3 (text) |URL     |NULL   |NULL       |NULL    | NULL   | w.com   | NULL     5  |1 (int)  |Size    |4      |NULL       |NULL    | NULL   | NULL    | NULL     6  |4 (date) |Created |NULL   |NULL       |NULL    | NULL   | NULL    | 2/2/2012      Number of columns will be as the number of all datatypes (about 30?). The DataType column is a flag of type int which is used for the caller - it tells him what column to take the value from. Each row is actually a property of some object in other table. A set of rows makes a set of properties for that object and usually a SELECT will get the whole set.


title: Is it good practice on server/client systems to automatically install updates?

text: I'm working on an automated update system for a legacy server/client software package written in Delphi. The way I'm designing it is so the client's (customer's) server machine runs a service which...   1. periodically checks online for new versions   2. automatically downloads files   3. hosts latest version information for all client machines   4. hosts files for client machines to update Once this service has downloaded update files, it raises a flag in the database alerting all client machines that updates are available. BUT, the thing is, the server must be installed first. So, an administrator would see this message and approve the update. However, the administrator must schedule a time for it to install. At that scheduled time, the server will update its self. If everything was successful, it will raise another flag in the database for all client machines to also update. If anything happened, it will restore the backup which was made before the install. My question is... Is this good practice? Of course automated updates is a very good thing... **if done right**. This software is used in real-time in retail and wholesale environments, so if anything goes wrong during this scheduled installation, people could come to work the next morning to a broken system. The point is, no matter how automated I make this, an administrator still needs to ensure everything went smooth. Further issues...   1. client machines must know not only the database server info, but also their update server info.   2. server machine might be at another location which might require firewall configuration   3. database changes may give unforeseen results, which aren't known until something bad happens   4. client machines may be shut down and need to update once it starts   5. a list full of possible scenarios which may go wrong So in this situation, would you feel comfortable making a 100% automated updating system for a sensitive software? Because some of our clients have up to 50 client computers which need to be updated to match their server's database.


title: Get entities ids from two similar collections using one method

text: I've got two lists:               List<Integer, ZooEntity> zoos;     List<Integer, List<ZooEntity>> groupOfZoos;      These operations will return collections of values:               Collection<ZooEntity> cz = zoos.values();     Collection<List<ZooEntity>> czList = groupOfZoos.values();      What I want to achieve is to get list of all zoo ids.               List<Integer> zooIds = cz ids + czList ids;      Of course I can create two methods to do what I want:               public List<Integer> getIdsFromFlatList(Collection<ZooEntity> list) {         List<Integer> ids = new ArrayList<Integer>();         for (ZooEntity z : list) {             ids.add(z.getId());         }         return ids;     }          public List<Integer> getIdsFromNestedList(Collection<List<ZooEntity>> list) {         List<Integer> ids = new ArrayList<Integer>();         for (List<ZooEntity> zList : list) {             for (ZooEntity z : zList) {                 ids.add(z.getId());             }         }         return ids;     }      As you can see those two methods are very similar and here is my question: Is it good to create one method (for example using generics) which will get ids from those two lists (`zoos` and `groupOfZoos`). If yes how it should look like? If no what is the best solution? BTW. This is only the example. I've got very similar problem at job and I want to do it in preety way (I can't change enities, I can change only `getIds...()` methods).


title: Should I store False as Null in a boolean database field?

text: Let's say you have an application that has a boolean field in its `User` table called `Inactive`. Is there anything inherently wrong with just storing false as null? If so can you please explain what the down side should be? I have discussed this with someone a few months ago and we both agreed it shouldn't matter as long as you do it consistently throughout the app/database. Recently, someone I know was emphatic that "true" `true` or `false` should be used, but they didn't really give an explanation as to why.


title: Syntactic sugar regarding function parameters

text: Are there any modern programming languages where you don't have to specify types for each parameter in a function's definition? Ex:               procedure P(a, b, c, d: integer)      vs               void P(int a, int b, int c, int d)      Is there a good reason why the latter form is so popular? Why don't more languages allow you to specify the type of all your parameters at once, like the first form?


title: Error checking in actor-based paradigm

text: I have an existing Scala application that I am trying to refactor in order to use Akka. One of the problems I have is how to manage error-checking in actor- based applications. Usually error-checking is done through one of two mechanisms:   * either one returns a value indicating an error condition, such as `Option[A]` or `Failure[A]`, or   * by the use of exceptions. Neither of these style seems particulary useful here. On the one hand, actor messages are usually "fire and forget", hence there are no return values. [One can have a return value using Futures, but it certainly not customary to ask for futures on every message.] On the other hand, processing of the message usually happens on another thread, so that one cannot catch an exception arising from the processing of a message. One could simulate the first mechanism by sending back error or confirmation messages, such as               class FooActor extends Actor {       def receive = {         case Foo => ...           if (errorCondition) sender ! ErrorMessage       }     }      But if one has to do this for every actor, it becomes a lot of boilerplate and it seems a poor man's simulation of stack unwinding. > What is a good strategy to recover from errors in actor-based applications?


title: What's the difference in content between Chris Okasaki's 1996 thesis and 1999 book, Purely Functional Data Structures?

text: I want to read Purely Functional Data Structures. I've easily found the thesis (which is freely available as a PDF), but see that there's a book available also. So I'd like to know what the differences are, if any, between these two publications.


title: Shuffling algorithm with no "self-mapping"?

text: To randomly shuffle an array, with no bias towards any particular permutation, there is the Knuth Fischer-Yeats algorithm. In Python:               #!/usr/bin/env python     import sys     from random import randrange          def KFYShuffle(items):         i = len(items) - 1         while i > 0:             j = randrange(i+1)  # 0 <= j <= i             items[j], items[i] = items[i], items[j]             i = i - 1         return items          print KFYShuffle(range(int(sys.argv[1])))      There is also Sattolo's algorithm, which produces random cycles. In Python:               #!/usr/bin/env python     import sys     from random import randrange          def SattoloShuffle(items):         i = len(items)         while i > 1:             i = i - 1             j = randrange(i)  # 0 <= j <= i-1             items[j], items[i] = items[i], items[j]         return items          print SattoloShuffle(range(int(sys.argv[1])))      I'm currently writing a simulation with the following specifications for a shuffling algorithm:   1. The algorithm is unbiased. If a true random number generator was used, no permutation would be more likely than any other.   2. No number ends up at its original index. The input to the shuffle will always be A[i] = i for i from 0 to N-1   3. Permutations are produced that are not cycles, but still meet specification 2. The cycles produced by Sattolo's algorithm meet specification 2, but not specification 1 or 3. I've been working at creating an algorithm that meets these specifications, what I came up with was equivalent to Sattolo's algorithm. Does anyone have an algorithm for this problem?


title: it is a good approach to implement dependency injection in a desktop app?

text: Well, the thing is that I am just about to create a Desktop App (with .NET windows forms) And now I just wonder if it would be really a wise choise to use any IoC (StructureMap,Ninject,Spring .Net), I have used them before for Asp.Net web applications but what makes me doubt now is the fact that working with windows forms my business entities will persist when I navigate through tabs and unlike than web forms or mvc apps where it would be necesary to inject my business entity for every new request that is performed, I mean this because of the Asp.Net page life cycle where is performed the initialization and controls instantiation. Maybe I am misunderstanding the point of using an IoC, so please tell me what do you think would be a better choise?


title: Can I WTFPL/CC0 parts of a GPL code?

text: I know I should not expect a lawyer's notice here, but programmers advices would suit me well enough. I want to publish a program which is derivated from a GPL-licensed program. I understand from the GPL legal notice that the whole work is to be licensed under GPL as well. Now, I'd rather publish my work under a more permissive license — namely, I don't care about attribution. It seems to me that CC0 or WTFPL licenses, for instance, don't need the work to be considered as a whole, right ? So as they are compatible with the GPL, in principle I could just say something like (in addition to the GPL notice) the following : > This work is GPL as a derivative work of foobar. In addition, modifications > with regards to the original foobar are WTFPL/CC0. Would this be valid licensing ?


title: What is the correct way to handle debug output in Java?

text: As my current Java projects grow bigger and bigger, I feel a likewise growing need to insert debug output in several points of my code. To enable or disable this feature appropriately, depending on the opening or closure of the test sessions, I usually put a `private static final boolean DEBUG = false` at the beginning of the classes my tests are inspecting, and trivially use it this way (for example):               public MyClass {       private static final boolean DEBUG = false;            ... some code ...            public void myMethod(String s) {         if (DEBUG) {           System.out.println(s);         }       }     }      and the like. But that doesn't bliss me out, because of course it works but there could be too many classes in which to set DEBUG to true, if you are not staring at just a couple of them. Conversely, I (like - I think - many others) wouldn't love to put the whole application in debug mode, as the amount of text being output could be overwhelming. So, is there a correct way to architecturally handle such situation or the most correct way is to use the DEBUG class member?


title: Better solution then simple factory method when concrete implementations have different attributes

text: abstract class Animal {       function eat() {..}       function sleep() {..}       function isSmart()     }          class Dog extends Animal {       public $blnCanBark;       function isSmart() {         return $this->blnCanBark;       }     }          class Cat extends Animal {       public $blnCanJumpHigh;       function isSmart() {         return $this->blnCanJumpHigh;       }     }          .. and so on up to 10-20 animals.      Now I created a factory using simple factory method and try to create instances like this:               class AnimalFactory {       public static function create($strName) {            switch($strName) {               case 'Dog':                 return new Dog();               case 'Cat':                 return new Cat();               default:                 break;            }       }     }      The problem is I can't set the specific attributes like blnCanBark, blnCanJumpHigh in an efficient way. I can send all of them as extra params to create but this will not scale to more then a few classes. Also I can't break the inheritance because a lot of the basic functionality is the same. Is there a better pattern to solve this?


title: Web-programming vs Hardcore-programming

text: Why questions about HTML/CSS/JS/etc(Web-programming et al) collect more views and answers than those about, for instance, automata theory? Does this mean that the huge part of programmers are just "intermediate" programmers? (This is not sarcasm, I really interested!)


title: "Build your own website" - Developing a CMS with Vague Requirements on a Tight Deadline

text: I'm a Java developer in charge of making a product which allows clients to "build their own site". I've spent a lot of time looking into Liferay, as I don't have any experience in building CMSs, and want to either use it, or get ideas of how to build a decent system. The time line is short, requirements are vague, yada yada Is Liferay a good technology to work with when showing the client (who may be very low on computer expertise) a user interface to build a site? The thing is, I want the power and flexibility to avoid the learning curve in building a CMS like product, but I don't want to waste time learning a new technology only to find its over-kill, or can't do the simple - but uncommon and unimplemented - things that we are asked to add as features Ideally I'd like to provide multiple web interfaces to the core API to build the sites - one that is very powerful, and another that is watered down and easy to use.


title: Are C or C++ The Only Viable Languages for a GC

text: ### Background I have just finished writing a compiler for a functional language compiling to the JVM as a learning project. However, since I'm just doing this to learn, I thought it might be interesting to write a native backend and a RTS for it. As I've been planning out what this new backend will look like, the one point I'm stumbling on is the garbage collector. I've implemented the compiler in Haskell. But I have no desire to write the GC in Haskell since, while it may be possible, it'd suck. ### Question I've looked at several FOSS garbage collectors prior to posting and most of them were implemented in good old ANSI C. Is this still the most accepted choice for writing a GC nowadays? I've seen that this site tends to frown upon questions with multiple answers so I hope this will make it more specific: If some startup was writing a professional grade gc today, are the only viable choice for them C or C++? It's my first question here so please comment and let me know if this question is ill-suited for for programmers.


title: Code Reuse and Abstraction in FP vs OOP

text: I've been told that code reuse and abstraction in OOP is far more difficult to do than it is in FP, and that all the claims that have been made about Object Orientedness (for lack of a better term) being great at reusing code have been flat out lies So I was wondering if anyone here could tell me why that is, and perhaps show me some code to back up these claims, I'm not saying I don't believe you Functional programmers, it's just that I've been "indoctrinated" to think Object Orientedly, and thus can't (yet) think Functionally enough to see it myself To quote Jimmy Hoffa (from an answer to one of my previous questions): > The cake is a lie, code reuse in OO is far more difficult than in FP. For > all that OO has claimed code reuse over the years, I have seen it follow > through a minimum of times. (feel free to just say I must be doing it wrong, > I'm comfortable with how well I write OO code having had to design and > maintain OO systems for years, I know the quality of my own results) That quote is the basis of my question, I want to see if there's anything to the claim or not


title: Software development based on a reference implementation

text: Lets say I have library "A2" as a dependency in a project. Library "A2" is derived from library "A1"(A2 is a fork of A1 with some modifications to the original source code) where someone has done few changes to the library "A1" 's source code. Lets say there is a new version of "A1" I want to use the new version but no modification to its sourcecode at all. I am planning to identify what are the changes done to the original library when deriving library "A2" out of it and decorate the latest version of the library with those changes. Is it a good approach to solve this? if not can someone suggest the best approach to solve this kind of problems?


title: Evolution of the Win32 API

text: Has the Windows 32 API changed much over time? Does the Charles Petzold book "Programming Windows, 5th Edition" from 1998 still contain relevant information, or is most of it obsolete/outdated? What are some prominent examples of recent additions to the Windows 32 API (if there are any)?


title: Do you use i-->0 for backward loops?

text: Some people write               for (int i=N; i-->0; ) doSomething(i);      instead of               for (int i=N-1; i>=0; --i) doSomething(i);      for backward loops. The `--> "operator"`1 looks very confusing at the first glance, but it's trivial:   `i-->0` simply parses as `(i--)>0`, and once you get it, you see it immediately. The main disadvantage is the strange look. The advantage is that you'll get it always right (unlike the more verbose version offering the possibility to forget something, which really happened to me a couple of times). _What do you think about using the`--> "operator"`?_ * * * 1First time I saw the funny term in a comment to this question today.


title: Where do we put "asking the world" code when we separate computation from side effects?

text: According to Command-Query Separation principle, as well as Thinking in Data and DDD with Clojure presentations one should separate side effects (modifying the world) from computations and decisions, so that it would be easier to understand and test both parts. This leaves an unanswered question: where relatively to the boundary should we put "asking the world"? On the one hand, requesting data from external systems (like database, extental services' APIs etc) is not referentially transparent and thus should not sit together with pure computational and decision making code. On the other hand, it's problematic, or maybe impossible to tease them apart from computational part and pass it as an argument as because we may not know in advance which data we may need to request.


title: Where do I publish a program?

text: I have finished designing a little application for Pandora and I am not sure how I can get it out and share it with everyone. What should I do to help advertise it to the public and let other people use it? As of right now it is free, and I hope to keep it that way, so I don't want to spend any money to give it out. I had actually designed this application just for personal use, but hey, why should I be the only one to use it?


title: About insertion sort and especially why it's said that copy is much faster than swap?

text: From Lafore's "Data Structures and Algorithms in Java": (about insertion sort (which uses copy + shift instead of swap (used in bubble and selection sort))) > However, a copy isn’t as time-consuming as a swap, so for random data this > algo- rithm runs twice as fast as the bubble sort and faster than the > selectionsort. Also author doesn't mention how time consuming shift is. From my POV copy is the simplest pointer assignment operation. While swap is 3x pointer assignment operations. Which doesn't take much time. Also shift of N elemtns is Nx pointer assignment operations. Please correct me if I'm wrong. Please explain, why what author says is true? I don't understand.


title: Undergrad internship career path

text: I am a CS student currently searching internship positions that are important to my future career. I am passionate about web design and development and it is really what I think my niche is in the programming world. I recently got offers between two companies - the first one, in an offshore company as a web developer where I am expected to study C# and AJAX (along with the basics: HTML, CSS, JS/JQuery, PHP, MySQL) and the second one specializes in Java and Agile software dev't. I am better in PHP than Java. It is obvious that I would pick the first one but I'm still on the fence because the second one is known to give solid training and foundation to both interns and employees while the first will expose me further to what I want to do. Which should I pick - **solid software development training and application** or an **real life application of a web developer's job** for my internship? **[UPDATE]** As of 25 May 2012 To everyone, next week will be the last of my internship. I went with the Java/Agile company and that decision changed my career path and life in general a lot. My fear of Java is now gone, instead it made me love the language better and everything during the internship training just solidified my passion to be a web developer. Thank you all!


title: Does EF mean you might never have to use SQL or design database tables again?

text: Does Entity Framework mean you might never have to use SQL or design database tables again? Is this what "persistence ignorance" means? I am new to EF and ORMs in general, and I would like to understand how much of it is hype and how much is reality.


title: How can I mirror an SVN trunk repository into a regular network folder?

text: Me and a small team of engineers are considering using SVN to store our electrical schematics and parts libraries; currently we just have a network folder where we put all of our files. Our company also has a separate SVN server that we have access to. I was wondering if there was some way that we could use the SVN repository to store our files and schematics, but then somehow have the trunk SVN repository be automatically mirrored into a non-SVN network folder like we currently have. The reason I am asking for this is because sometimes non-technical people need to access our schematic data, and we don't have enough resources to teach everyone how to use SVN. This way we could have everything under revision control, as well as allowing other people to continue accessing the data in the same way that they are used to.


title: How do you define a project for a web developer?

text: I am primarily a web designer, and a very rookie web developer. Say I have a comprehensive web app I want developed through a freelancer on Odesk.com What is the best way to effectively communicate the entire project, goals and requirements? Wireframes, spec sheets? Any examples/templates on this would be greatly appreciated.


title: Does it make sense to avoid a framework when building a large webapp with PHP?

text: Being a PHP web application developer for several years now, I've had my share of MVCs and frameworks. At first I thought they were the best thing since sliced bread; everything seemed to be very easy to implement. Now however, it seems that the more complex the application gets, the more hassle the framework introduces, so I have to develop workarounds to overcome them. Such workarounds are usually pretty daunting and complex since I have to delve down into the framework core code and make changes so that it behaves the way I want. For example, in one of my projects where I use Slim(C)+Idiorm(M)+Twig(V) (which I believe is very flexible), I have to create a custom function just to display dynamic data in parent templates; without a framework I could have simply executed mysql_query() in the included file. Okay, frameworks are cool if I'm creating a simple company profile website; I can just whip some code in one night and they're usually ready by the morning, and the amount of good coding practice and design patterns I've learned from them is very valuable. But really, for a complex web application like an all-in-one web based school management system, frameworks usually get in the way of my business process like in the example above. So my question is: is it okay to just go back to basics, and use standard PHP code and libaries for doing my next project where there might be a gazillion frameworks and libraries, provided I can sufficiently use good coding practices and follow sensible design patterns like MVC? My development team is pretty small: only 2 programmers and 1 designer. The other programmer agrees with my thoughts above.


title: How can I avoid using my own name in the identifiers, packages, or namespaces of open sources projects I create?

text: I do a lot of development in my own time. These projects I work on are all just for fun and learning (so far). I commonly do Java development with Maven but I have also been known to dabble in .NET and Python. All of the projects I work on use open source licenses, although most of them are not on any public code repositories. Java/Maven development requires me to use a unique `groupId` (e.g. "com.mydomain") and a unique `package` (directory) structure, usually containing the `groupId` while .NET development encourages unique `namespaces` in which I use similar conventions to the Java `package` concept. To ensure uniqueness, I usually just use one of my domain names with the parts reversed (e.g. "ca.jessewebb"); I believe this is a very common practice. I am in the initial stages of creating a new, open source, Java/Maven project (let's call it "newproj") and I would like to put it on GitHub. My username on GitHub is "jessewebb" so this will give it a URL like: `https://github.com/jessewebb/newproj`. I don't want to bother registering the "newproj.com" domain name so I decided to use "ca.jessewebb" and "ca.jessewebb.newproj" as the `groupId` and `package`, respectively. It occurred to me that the presence of my personal identity in the code and as part of the project's home (in the GitHub URL) will likely cause a potential contributor to think twice about getting involved with my project. This is a problem, I don't want it to be _my_ project. I would prefer if I could, instead, convey the message that I do not own the project. Now, in all honesty, it really isn't that big of a deal because I doubt my projects will garner much community involvement but I also see this as even **more** of a reason to avoid any possibility of deterring would-be contributors. For another example, I created a Google Code project a few years ago (let's call it "oldproj"). When I created the project, I knew I was going to host it on Google Code so I used the `groupId` and package name of "com.googlecode.oldproj", which is the reverse of the default domain name Google Code provides every new project. This turned out to be a not-so-great idea; a year or so later, I moved the code to a different repo and I had to rename these identifiers (well I didn't _have_ to but...). At the time, I didn't own any domain names and I ended up buying the domain name "oldproj.com" and I used it. I liked this because it gave the project its own identity and I wasn't stamping my name on the code everywhere. I could have just as easily registered the "jessewebb.ca" domain name and used "ca.jessewebb.oldproj" as the package name but I didn't because I had the same concerns back then too. So my question is... How can I avoid using my own (domain) names when creating open source projects while still maintaining uniqueness of packages/namespaces? As projects gain more momentum, it makes sense to register the domain names but it seems silly and a waste of money to do this earlier on. I realize that I don't actually have to **own** the domain name to use it in the code but that feels wrong and can lead to a squatter snatching it from under you in the meantime. What do other people do about this dilemma? Are there examples of popular (widely used, large community, etc.) open source projects that contain the original developer's identity as part of its own identifier(s)?


title: Learning frameworks without learning languages

text: I've been reading up on GUI frameworks including WPF, GTK and Cocoa (UIKit). I don't really do anything related to Windows (I'm a Mac and Linux guy) or .NET, but I'd like to be able to throw together GUIs for various operating systems. We are in the enviable position now of having high level scripting languages that work with all of the major GUI toolkits. If you are doing Linux GUI programming, you could use GTK in C, but why not just use PyGTK (or PyQt). Similarly, for Java, one can use JRuby. For Mac, there's MacRuby. And on .NET, there's IronRuby. This is all fine and good, and if you are building a serious project, there are tradeoffs that you might encounter when deciding whether to, say, build a WPF app in C# or in IronRuby, or whether you are going to use PyGTK or not. The subjective question I have is: what about learning those frameworks? Are there strong reasons why one should or should not learn something like WPF or Cocoa in a language one is familiar with rather than having to learn a new language as well? I'm not saying you should never learn the language. If you are building Windows applications and you don't know C#, that might be a bit of a problem. But do you think it is okay to learn the framework first? This is both a general question and a specific question. I've used some Cocoa classes from Ruby and Python using things like PyObjC and there always seems to be an impedance mismatch because of the way Objective C libraries get built. Experiences and strong opinions welcome!


title: How to determine what throws an exception

text: Whenever I encounter crashes, the exact type of the exception usually already gives enough info to easily find the culprit. **FileNotFoundException** will hardly occur while using sockets. Now recently I encounterd a **SystemNotSupportedException** and had no idea where it could come from, still don't. Also I cannot reproduce it, so I am designed to find it by detective work, rather than just running the debugger and crashing that thing. I checked through MSDN's article on this exception, hoping to maybe find something like "this type of exception is usually thrown in connection with file operations / integer-math / riding dinosaurs to Taco Bell / you-get-it", to no avail as MSDN only associates the other way around which is commonly more useful indeed. So here's my question:   Is there a lookup-table or something that allows me to determine what operations could cause a specific exception?


title: Difference between a Quality Engineer and a Tester

text: In a software firm there are three kinds of jobs   1. Software Developer   2. Software Quality Engineer   3. Software Tester The role of a software developer is quite clear but what's the difference between the jobs done by a Software Quality Engineer and a Software Tester? It's very strange for me why there is so much of a difference in the salary levels of a Software Quality Engineer and a Software Tester.


title: How to store / not to store passwords

text: I am building an web site which will allow users to aggregate the information stored in their online profiles ("data feeds") in one place. I am wondering - what is the accepted (from a secureness point of view) way to store user name / password information in a my database? Normally I would derive a salted-hash value from a password and would store this, but that obviously would not work in this case, as "data feeds" websites would need an actual password. Storing the credentials it in a clear text is not an option, as it would be a huge security risk. Not storing passwords in a database, asking users to type them in at the beginning of each session and then keeping them in a in-session memory does not seem like a viable option either, as it would be too much trouble for users to enter the same passwords many times again and again. So far it seems that the only option is to encrypt passwords somehow, but I don't know what are the best design patters for such option. Or perhaps there is way to deal with that problem, I haven't even considered ... What would you recommend?


title: What's the computational complexity of the Groovy unique() method?

text: **Question 1** What's the computational complexity of the Groovy `unique()` method? **Question 2** How could I have figured it out by myself? The `unique()` method is defined in the class `DefaultGroovyMethods`. The source code can be found here: org.codehaus.groovy.runtime.DefaultGroovyMethods. Can you point me to the piece of code which illustrates the answer to question 1?


title: Refactoring from Python to Ruby with a BSD v3 license?

text: There is a project that is written in python which works great and is under the BSDv3 license. I wanted to use it as a base template for a ruby project instead of starting from scratch. I'd be refactoring (converting) the code from python to ruby, as if the author wrote a ruby gem along with his python library. My question is what proper credit should be given to the python lib author?   Just mention that the gem is based off the python lib or more extensive?


title: Are Java applets worth learning?

text: I'm on the way of learning Java myself. I find most of texts giving emphasis to Java applets. I got confused about the importance. Is it something widely used? Do I need to spend more time on it?


title: Checking equality of a request parameter

text: I have a codes table that stores name value pairs and a group name. So for this example let me demonstrate with two rows, each row would represent one value in the same drop down. Group Name = 'Drop_Down_1' Name = 'Value 1' Value = 'This is my value' Group Name = 'Drop_Down_1' Name = 'Value 2' Value = 'This is my value 2' This value would be apart of a drop down on a webpage. When selected and submitted the backend code would get the value 'This is my value', if that value in the drop down was selected. Now depending on the drop down selection I want to do something. So now i need to compare the string in the request command to something. What I do NOT want to do is something like this:                   if(requestParam.equals('This is my value') {             do something         }         else if(requestParam.equals('This is my value 2') {             do something else         }      Now I can query the database and get the appropriate codes back and check against those for equality. But How would i know what action to perform?


title: What would it take to get developers to pay for something that is already freely available as open source?

text: For example, I know that open-source versions of IL readers/writers exist such as Cecil, and Microsoft's (closed source) CCI. What would it take to get developers to pay for something that is already freely available? I have always wanted to start my own ISV by writing my own tools and selling them in the open market, but it's hard to gauge the demand, given that free alternatives already exist. Does anyone else have any successful experiences selling a commercial version of an open-source product?


title: How would you represent an object that can be of multiple types, when storing it as a document in MongoDB?

text: Somewhat related to this question, say that I have an object category which, depending on which type of object I have, has different restrictions on what it contains. (if you can reword the previous sentence to make more sense I'd appreciate it) For example               var SomeSchema = new Schema({       _id: ObjectID,       [... large number of common fields ...]       type: //Restricted somehow to members of a fixed array       data: //depending on type, this might be restricted - sometimes an integer, sometimes array, etc...     });      What's the idiosyncratic method for defining this type of schema? Is it appropriate to define a single schema, and handle the types inside of it's members, or am I better off with separate schema for each type?


title: How to simulate an ATM terminal in a POS

text: Recently I started same projects to improve my programming skills, so I tried to develop a point of sale software. I started to bay the required hardware (ticket printer, Barcode Scanner….) to make my personal lab, but I’m unable to find how to implement the payment process using an ATM terminal. Is there any possibility to simulate the payment process whiteout having the equipment?


title: On naming conventions: would you recommend short names or longer, more descriptive names?

text: I'm consistently being asked by a colleague to shorten my identifiers (class names, mostly). We use CamelCase and rarely if ever use 4 words in a name, but I often get requests to shorten from 3 to 2 or even from 2 to 1. I favor the most descriptive name and am able to find one of acceptable length, 95% of the time that is 3 words or less. **Would you try to go shorter?** Recently it occurred to me that he may not have auto-completion, but would not ask him this because I wouldn't like to offend him. He's a vi/vim guy which made me thinking....


title: Should event listeners be held in weak references?

text: Usually event listeners shouldn't outlive object that registered them. Does it mean that event listeners should be held by weak references by default (stored in weak collections by the object listeners are registered on)? Are there valid cases when listener should outlive its creator? Or maybe situation like that is a mistake and it shouldn't be allowed?


title: Dealing with technical debt and nearing release

text: Say you have a project that is a tangled mess. No code structure and breaking one area breaks the entire thing. Fixing one area breaks another area. The closest you can fix things is writing the code that's almost like redoing the entire thing. But then, **the release is in the next week**. Here's some facts that actually worsen the situation:   * There's very minimal testing. Makes breaking hard to find.   * The code has no structure. Imagine one app has everything _in one file_.   * No documentation. Very hard to replicate server requests when there's no documentation about the parameters to send, and what to expect. What should one do to address this situation? The best thing to do is extend the project release, but I'm not the one who calls the shots. I did comment on the issue though.


title: How to track features in a big project ?

text: I am currently working on a project of my own for a little over 2 months (not much time on my hands). The purpose of this project is to be able to remotely update all of my Linux systems from one graphical application. The problem I am having is I am building two applications: the client and the server. As the size of both the programs increases, I am finding it harder to manage what needs to be done. While coding I am trying to think of things that need to be done and with the addition of another program it's starting to make my head spin. **Is there any technique by which I can track the features: yet to be implemented and currently under development features in a big project?**


title: Add javascript to all pages (for caching), or only to the pages that require the scripts (for a smaller page size)?

text: I'm using bits of javascript on my website for an image gallery, smooth scrolling, etc. These scripts are not used on every page (not every page has an image gallery for example). However, the scripts aren't very big and most users will have to download them eventually (the image gallery is very central to the website). Now what would be the pros and cons of these two (mutually exclusive) ways of including the scripts:   * add them to every page (so that they'll all be cached after one page view)   * add them only on the pages on which they are used (so they're cached only when they're needed, but some pages will take a little longer)? I'm not asking for opinions, I'd just like to know if there are any pros and cons I've overlooked.


title: Why one would commit changes to version control every three minutes?

text: The frequency of commits depend on two factors:   * the developer himself: some developers tend to commit often, others may spend hours without committing,   * the current work: the same developer may have to commit very frequently when effectuating risky refactoring operations or similar tasks, and quite rarely when working on other parts of the codebase. From what I observed, beginners tend to commit one or two times per day on average. Developers with a few years experience are probably committing once per hour on average. Committing every fifteen minutes is probably the best thing to do, but I've rarely seen this commit frequency. **Question:** I've spotted in Google Closure Library logs that it has commits nearly every three minutes from the same developer. What are the benefits of such high frequency? Are there consequences on the way the code is written? Is it related to the fact that at Google, codebase is compiled and tested on servers and so one should commit the code to see if it compiles and passes all the unit and integration tests?


title: Migrating old Asp.net 1.1 project to mvc 3 or 4

text: we have to migrate a very old project that are having more than 500 web forms and 400 tables and it is hugely depends on stored procedures, the current specification is:   1. Asp.Net : .NET version 1.1   2. language: VB   3. uses 2 Tier architecture (UI and business(includes DataAccess also))   4. xml is used to pass the data between UI and Biz layer   5. For data access sql queries and stored procedures are used that fetch data as dataset.   6. Finance related domain.   7. a lot of javascript for validation Planned specification:   1. Asp.net 4.0 with c#   2. MVC 3 or 4 Now my questions are   1. Is it possible to implement mvc only for UI layer, if possible then how to use current business layer? Also we don't have class and properties because it uses xml to pass data, also we have to use same legacy database.   2. We don't want to use Entity framework, because of performance, legacy database(not properly designed), uses more than 700 stored procedure.   3. how to create model i.e Domain level or project level because my solution contains 14 projects?   4. Is it possible to implement Repository pattern in separate layer?


title: What is the best toolset for developing an enterprise application for SMBs?

text: Need a Free, Fast(development and runtime) and Reliable(transactions and locking) tool set for creating an enterprise application for SMBs. I'm thinking of an application framework + UI framework + DB which will help me in developing the software faster. As it is known, business softwares need lot of similar UIs to be created. My idea is ...to create a new form with N number of fields and connecting it to the database for basic CRUD operations within 30min to 1hr. I got the taste of Intersystems Cache technology stack with an app framework on top of it. To be frank...it is amazing... I'm looking out for something similar to this in opensource. Any suggestions?


title: Better design for a generic doubly linked list around which I plan to make different wrappers?

text: I am currently writing a C code for a doubly linked list(dll) around which I want to write wrapers for implementing stack, queues etc. instead of writing separate codes for all of them. I'll be using `void *` for making it possible for the doubly linked list to work with any data type. The idea is basically the same as this implementation of stack using pointers in my github. I am thinking of 2 different designs   * Placing the size of elements alongwith the maintenance data. That would make coding easier but any instance of dll would be able to use only a particular data type.   * Placing the size of element in the nodes. That would make it more general but I have concerns whether this approach would be easier to use? This is the confusion that I wanted to clear before implementing any particular one. If there is any confusion regarding what I am trying to implement then please ask and I'll clarify.


title: Realistic time to learn new framework/API

text: I have my ideas, but I always feel that I'm overly pessimistic. So I'd like to hear more opinions. How much time do you need to start coding using a new framework so that your code is production ready and not become a support nightmare later on for: Say large scale frameworks:               ATL/MFC/STL/WTL/.NET/COM/BOOST      And small scale frameworks/APIs:               MSXML/Silverlight/ADO/LIBXML/WIN32/OpenGL/DirectX/CUDA      What are your estimates for both types, [from;to] for both senior/junior developers. Any ideas on what can decrease the learning time say: `Book>API doc`, or `Tutorials>Book`


title: What kind of a test is a "consistency check"?

text: Some or all of the tests I write and run are checks for consistency e.g. assert that if I create a new user account, that the account that was created actually has the same name as the name that was submitted in the registration. And now for checking that I implemented a pagination correctly, I suppose I can check that for any given large resultset, getting the "next page", sometimes repeated times and not only once, will eventually lead to the same last page as getting the last page directly (which is done another way than stepping through one page at a time, going directly to the last page in done by using the reversed order and getting the first page from the reversed order. In our projects we try to follow test-driven development but sometimes I think it is not exact whether a test is a unit test or an integration test when in fact both the integration tests and the unit tests are mostly or only "constistency checks". I didn't see any other type of test than for consistency (both the unit tests and the integration tests do assertions), but it seems that mocking is used more in integration tests than in unit tests and than a unit test is smaller and for a single component or method while an integration test is "larger", but that is still not an exact difference. So what kind of a test is a consistency check? Is it a unit test or an integration test?


title: What do I need to know before approaching a web developer/ developing team?

text: I have little experience in website programming. However, I have an idea for a website that I would like to make real. It would have many of the same features that a site such as TripAdvisor uses, but obviously on a smaller scale, and its main feature being a user rating system. Whilst it would be ideal for me to learn how to do it myself, I feel it would be unrealistic given the complexity and time consuming nature of it. Therefore, my question is what will I need to know and understand before I approach a web developing team?, i.e., what are the questions that they will ask me when I sit down to talk with them about my idea? On a slightly separate note, what are the legal restrictions on creating a website that has already been done? There are a small number (2 or 3) of websites that I would be essentially doing the same as, but in my opinion, I would be providing the users with far more useful features in a more user friendly manner.


title: Design Pattern for Data Validation

text: What would be the best design pattern for this problem: I have an Object A. Object A can either be registered or deleted from the database depending on the user request. Data validation is performed before registration or deletion of the object. There are a set of rules to be checked before the object can be registered and another set of rules for deletion. Some of these rules are common for both operations. So far, I think the Chain of Responsibility design pattern fits the most but I'm having trouble implementing it.


title: My Programming Challenges

text: I love programming and I can't imagine living without it. The problem is when I am developing my own unique algorithms I find it difficult to properly co- ordinate my thinking and I spend more than the reasonable time trying to visualize the solution, although I usually find the solution. I think spending that much time on sometimes "not that hard" algorithm show's that my thinking strategy might be wrong. Have you experienced similar issues? How do you solve it? Or am I wrong? Please advise me.


title: Compatibility between Class Diagram and Sequence Diagram

text: Do the `message` being passed between `objects` in `Sequence Diagram` match with the `methods` in `Class Diagram`?


title: How do crackers determine number of iterations of a Hashing algorithm?

text: Does a cracker need to know the number of iterations a hashing algorithm uses to compute a hash? If they don't know it, how do they figure it out? How much longer does it take to figure it out, than if they didn't know? I can only guess that they try a number of the most common passwords, and try it with different iterations, and see what amount of iterations returns the most correct passwords. Would this even work though?


title: Problem combining SlidingMenu and ExpandableListView

text: As said i'm trying to combine SlidingMenu (https://github.com/jfeinstein10/SlidingMenu) with an ExpandableListView, but i'm having an issue that i don't know how to fix, so i'm hoping some one here can. I'm currently setting the layout for the menu by 'setMenu(resId)' function, which sets the correct layout for the slide menu, but the problem is that it only sets the XML file layout, which simply includes a and nothing else (So all i get is a white screen).   All other data and settings for the ExpandableListView are set in my SlideMainMenu.java file, but this is never called when setting the XML layout for the slide menu. So how can i make sure my .java file is called when my XML file is inflated?   It's most likely very easy, but at the moment i just can't seem to figure it out. I should mention that i'm fairly new to Android/Java, and i'm learning as i go.. setMenu function:               menu.setMenu(R.layout.expand_listview_main);      Start of SlideMainMenu.java               public class SlideMainMenu extends Activity {              ExpandableListAdapter listAdapter;         ExpandableListView expandableListView;         List<String> listDataHeader;         HashMap<String, List<String>> listDataChild;              @Override         protected void onCreate(Bundle savedInstanceState) {             super.onCreate(savedInstanceState);             setContentView(R.layout.slide_left_main_menu);                  Toast.makeText(getParent(), "SlideMenuInit success", Toast.LENGTH_LONG).show(); // TEST                  expandableListView = (ExpandableListView) findViewById(R.id.ExpandableListView_Main);             prepareListData();             listAdapter = new ExpandableListAdapter(this, listDataHeader, listDataChild);             expandableListView.setAdapter(listAdapter);


title: Why does the assignment operator assign to the left-hand side?

text: I began teaching a friend programming just recently (we're using Python), and when we began discussing variable creation and the assignment operator, she asked why the value on the right is assigned to the name on the left, and not vice-versa. I had not thought about it too much before, because it seemed natural to me, but she said that left-to-right seemed more natural to her, since that's how most of us read natural languages. I thought about it, and concluded that it makes code much easier to read, since the names that are assigned to (which the programmer will need to reuse) are easily visible, aligned on the left.               aligned = 2     on = 'foo' + 'bar' + 'foobar'     the = 5.0 / 2     left = 2 + 5      As opposed to:               2 = aligned      'foo' + 'bar' + 'foobar' = on     5.0 / 2 = the      2 + 5 = right           # What were the names again...?      Now I wonder if there are other reasons as well for this standard. Is there a history behind it? Or is there some technical reason why this is a good option (I don't know much about compilers)? And are there any programming languages that assign to the right side?


title: How do professional application developers use version control systems, like GIT and Subversion?

text: I am a beginner developer and I have been wondering from the start, how do professional use tools like GIT and Subversion (I don't have a very good understanding about these tools), to fulfill their project's needs. If they do use it, how would I set up something like that? My applications are not so large and I am not working in a team yet, would they be of huge help to me? There are questions on this site about how to use the tools, but I need beginner support.


title: Why creativity is consider a bad practice by architects?

text: If you do something creative (for example I did a new approach to logging) is consider a bad practice. the good practice in Java is to put static field logger in every class. My approach creates static 5 static field in a single class (less code) and just calls methods that have access to it. I don't care about my logging framework, its just an example. I feel that any best-practice that is forced for no good performance or clean code reasons is bad-practice. I understand for example that all data that can change should be in xml or properties files, because later if you need to manually change WAR is easier to change .xml than .class. You could regenerate WAR, but than it would make putting constans in xml and properties look pointless.


title: How much does a web developer need to know about Linux?

text: I was just wondering if a typical PHP developers needs to be very familiar with Linux. I am studying Linux right now and I believe some of linux knowledge is not required for a PHP developer job (not sure if I am right about that). For example, vi or shell programming. In sum: what should I learn about Linux if I only want to land a PHP developer job.


title: When did the first "REST"-model and friendly URL web technology come to be?

text: Everyone knows that the "current" way to do things is to have user-readable URLs. Like: http://example.com/blog/edit/1234 Rather than: http://example.com/blog.php?action=edit&id=1234 When exactly did people start making web technologies handling this though? I remember in the dark ages of the early 2000s, I don't remember ever seeing a friendly URL. In fact, I think Stackoverflow (in 2008/9) may have been the first time I noticed them. When exactly did this become so popular, and what were the first servers/frameworks built with friendly URLs in mind? I'm interested as well in when rewriting to friendly URLs became common, and when serving friendly URLs natively became common


title: How to handle this unfortunately non hypothetical situation with end-users?

text: I work in a medium sized company but with a very small IT force. Last year (2011), I wrote an application that is very popular with a large group of end-users. We hit a deadline at the end of last year and some functionality (I will call funcA from now on) was not added into the application that was wanted at the very end. So, this application has been running in live/production since the end of 2011, I might add without issue. Yesterday, a whole group of end-users started complaining that funcA that was never in the application is no longer working. Our priority at this company is that if an application is broken it must be fixed first prior to prioritized projects. I have compared code and queries and there is no difference since 2011, which is proofA. I then was able to get one of the end-users to admit that it never worked proofB, but since then that end-user has went back and said that it was working previously......I believe the horde of end-users has assimilated her. I have also reviewed my notes for this project which has requirements and daily updates regarding the project which specifically states, "funcA not achieved due to time constraints", proofC. I have spoken with many of them and I can see where they could be confused as they are very far from a programming background, but I also know they are intelligent enough to act in a group in order to bypass project prioritization orders in order to get functionality that they want to make their job easier. The worst part is is that now group think is setting in and my boss and the head of IT is actually starting to believe them, even though there is no code or query changes. As far as reviewing the state of the logic it is very cut and dry to the point of if 1 = 1, funcA will not work. So, this is the end of the description of my scenario, but I am trying not to get severally dinged on my performance metrics due to this which would essentially have me moved to fixing a production problem that doesn't exist that will probably take over 1 month. I am looking for direct answers to this question. This question is not for rants, polling, or discussions as this is not the format for StackExchange. Please don't downvote me too terribly it is pretty common on this specific site of stack, I am looking for honest answers to this situation and I couldn't find a forum more appropriate.


title: Research topics for starting and optimizing a high-traffic website

text: I bury a good deal of my ideas for fear that I don't know enough about scaling web applications and high-traffic websites. That said, I'd like to know of any general topics to research in order to ensure that your web app doesn't break / slow down when you start getting to Twitter-level traffic. I'm looking for research topics with, preferably, additional resources. For example: **Make sure you optimize SQL queries (seeHigh Performance MySQL Optimization)**


In an oft-cited (if dated) reference for C# coding standards (pdf; from Lance Hunt), the statement is made, > 33\. Avoid invoking methods within a conditional expression. I've not seen this recommendation elsewhere, including in the .NET guidelines (here or here). Unlike the other very reasonable guidelines in Hunt's document, this suggestion seems unintuitive to me. Can someone provide a justification for it?


title: Easily moving both direction of time during a rebase

text: After I have written some commits, I very often `git rebase -i` over them, in order to test them, if necessary split them, take parts form one commit and `squash` them to another, more appropriate one. But there is a problem. Say, today I am hunting for a bug, that 5 recent commits are causing. I rebase interactively on the last known to work (bear with me, not using `git bisect` for a reason). The next commit introduces the bug, but is a big mess some unrelated code. So I `git reset HEAD~` and then form several internally logical commits. Here is the problem. I do not know which is the first problematic commit. So I select `edit` for all commits when rebasing. After I am done with the problematic commit, I have a couple of commits in the past, that I would like to test further. Currently, I do `git rebase --continue` many times, until the rebase is complete, and then rebase interactively again. This has a few problems:   * It is tedious. At the very least, I would like a command that rebases to the top of the branch, skipping all `edit` declared commits.   * Neverending merges. I need to merge often, and would prefer to first do the meaningful job of splitting the original commit, and only after that `git commit --ammend` the latter commits in order to be compatible with the edited hystory. * * * **TL;DR;** How can I achieve this bi-directional traversal on a branch, while at the same time, creating, removing and amending commits? Or is this workflow conceptually wrong?


title: Is ZeroMQ a good choice to make a Python app and a C# managed assembly work together?

text: I have a task that involves talking to a .NET-based API (namely AutoCAD) to retrieve data, send commands, and react to events. I want to separate the API operations and the proper program logic (largely already implemented in Python) by using natural tools for both: a C# DLL for the former and a Python app for the latter. To connect these two pieces, I began exchanging JSON in ZeroMQ messages. I'm at early development stages but having recently discovered that ZeroMQ does not guarantee message delivery/order, I have reservations about whether this is a feasible way to go. Right now my app is a very basic REQ/REP pair and I plan to handle reacting to events and executing different commands by adding some sort of 'recipient-function' field to my message format. The reason that I want to use ZMQ is that I might be able to scale the software into a larger, multi-user, distributed solution sometime. I am a lay programmer so I would ask for your advice about this architecture. Should I just go ahead with it and plan to deal with message reliability/ordering when problems appear? Should I consider developing some kind of a REST wrapper around ZMQ?


title: Can I use open source libraries in my project which is released into the public domain?

text: I am writing a Windows Phone application which I intend to release into the public domain (the source code and releated resources, that is). My application does, however, use a few third party open source libraries (statically linking to them). Does releasing my code into the public domain make any difference regarding the licenses of the open source libraries I use or would I have to make sure my (un)license is compatible with the open source licenses, the same way I would have to if I released the source code using an open source license (or kept the code closed source, for that matter)? I releasing my code into the public domain doesn't make any difference, how do I know if an open source license is usable with code released into the public domain?


title: Is it safe to convert Windows file paths to Unix file paths with a simple replace?

text: So for example say I had it so that all of my files will be transferred from a windows machine to a unix machine as such: `C:\test\myFile.txt` to `{somewhere}/test/myFile.txt` (drive letter is irrelevant at this point). Currently, our utility library that we wrote ourselves provides a method that does a simple replace of all back slashes with forward slashes:               public String normalizePath(String path) {        return path.replaceAll("\\", "/");     }      Slashes are reserved and cannot be part of a file name, so the directory structure should be preserved. However, I'm not sure if there are other complications between windows and unix paths that I may need to worry about (eg: non-ascii names, etc)


title: Is there any point in distributing separate .NET 3.5 and 4.0 assemblies?

text: I want to distribute a .NET library that is .NET 3.5 compliant. The library holds references only to external managed libraries that are targeted against .NET 3.5 client profile or lower. Is there any point in distributing my library as separate .NET 3.5 and 4.0 targeted assembly?


title: Exception handling in a program that needs to run 24/7

text: I have read that we should only catch exceptions that can be handled, which makes catching the base exception class (C# in this case) a bad idea (on top of other reasons). I am currently part of a project in which I so far have yet to see anything but the base exception being caught. I mentioned that it is considered bad practice to do so, but the response was "This service needs to run 24/7, so that is the way it is.". Since I did not have a good response for how to properly handle exceptions in a program that needs to run 24/7, I am now here. I have not managed to find any information / suggestions on how to deal with exception handling in "critical" programs / services that needs to run around the clock (and in this case I believe it may be ok if the service is down for a minute or two, so not even critical). I understand it depends on the exact nature of the program. The requirements for a program that can cause life threatening issues are quite different compared to a log scanner for an online game. Two examples: 1: A type-ahead service for customers of the Brittish railways, used when they searching online for railway stations. 2: A program that automatically controls the railway switches for the above railways based on realtime information provided from various sensors in the tracks, trains etc. The first program would probably not cause a major issue if it went down for a minute or two, wheras the latter could cause human casualties. Suggestions on how to deal with each? Pointer to where I can find more information and thoughts on this issue?


title: how to write safe code if you are the only developer

text: I have been working in a hedge fund firm for two years and I am the only person who writes almost all the codes. So far, luckily there is no software glitch or bug causing money lost. However, it is not guaranteed that it never occur. I am just wondering if there is a way to write safe code. Of course, unit test is one of the ways. But some of the tests cases are not easy to test and some situations may only occurs in a specific day e.g. busy trading day and the program cannot handle it. FYI my company will hire a less senior develop in the coming months. EDIT: Regarding the safety, the program is not allow to send numerous erroneous orders to the market like Knight Capital . To an extreme extend, program crash is far more better than it. Since I am the developer and also the tester, the software is ready to release that is based on my decision. I agree that tester is required. However, I have a concern that is the tester need to know the whole logic of the trading system which is confidential stuff.


title: SAP / ABAP training issues as a junior programmer

text: I recently got my Computer Science degree and was recruited by an SAP Partner as a "SAP NetWeaver Consultant" (at least that's what the boss calls me). The job placement stated that no previous experience in SAP nor ABAP was essential, and it also stated that the employee would be trained accordingly. I have zero background in SAP and ABAP (nor do I have any worth mentioning working experience as I'm 21 years old), I'm working with this company for one month (the only employee of the company is the boss actually). The first task I had to do was to create a new development package, including domains, data elements, structures, tables, table-types, classes, interfaces, function groups, reports, the customization of a number of BADi implementations, etc., of a system that was optimized and redesigned (by the boss). How I accomplished the above (still trying actually), was by having one or two examples by the boss of how to create each of the aforementioned things. Most of the above were no problem at all, but now that I have moved into coding, I have some huge issues. First of all, as mentioned above, I have no previous experience with SAP nor ABAP, that means that I'm ignorant when it comes to the capabilities of the language, the syntax, statements, etc., and everything around SAP NetWeaver and the ABAP Development Workbench. I have to create some simple nested loops for fetching some specific components of each of the objects contained in a structure, which structure is contained in another structure and is included in a table type. For instance... I have a function that derives all the rental objects included in a contract, and for each of the rental objects, I have to derive some specific components of all their architectural objects. While this would be easy to accomplish in a language that I already have some expertise. I have some pretty hard time trying to do it with my current skills in ABAP. I mean, even the difference in the LOOP functions messes with my ability to code, even the fact that I'm trying to comply with the naming conventions addressed by the client makes me look at everything twice for understanding what I'm actually writing. I can't even handle the debugger properly. I am sorry for all the information provided above, but I had to introduce you to the situation before asking my question. All the boss has given me is an ABAP Objects book and the access to the system of course. Is that what I should expect by training? While the boss was rather amazed at how fast I could re-create all the development objects to the new package, and make all the appropriate changes in the documentation, translation, naming etc..., he now thinks that I don't know what a structure, table or loop is. And the fact is, that I do know all the above, but not in ABAP... I do not know how to proceed or how should I approach my issue, the boss can't waste much time with me, as he is all the time running to clients and also designing and implementing add-ons by himself. Should I expect something more from his part?


title: A deque based on binary trees

text: This is a simple immutable deque based on binary trees. What do you think about it? Does this kind of data structure, or possibly an improvement thereof, seem useful? How could I improve it, preferably without getting rid of its strengths? (Not in the sense of more operations, in the sense of different design) Does this sort of thing have a name? Red nodes are newly instantiated; blue ones are reused. Nodes aren't actually red or anything, it's just for emphasis. ![http://goo.gl/KzOFR](http://i.stack.imgur.com/76kzH.png) Note that right deques do _not_ take O(n). Any access to an element in the deque depends on how long ago it was inserted. You can perform any enqueue or concat operation at O(1). You can also use the 'weight' of each non-leaf node to change the orientation of the tree, such as to make all right access costly and left access cheap, or to provide O(logn) access to either end. This process takes O(n) worst case, depending on the initial orientation of the tree. Alternatively, I could 'search' for the lightest node into which to insert a given node, turning all operations into O(logn) operations.


title: Closest location - Heapify or Build-heap

text: So lets say we have a set of gps data points and your current location. If asked to give the closest point to your current location we can utilize a heap with the distance being the key. Now if we update the current location, I suspect that only a few of the keys will change enough to violate the heap property. Would it be more efficient to rebuild the heap after recalculating the keys or to run heapify (assuming that only a few of the keys have changed enough). It is assumed that we don't jump around with the new location (new current location is close to the last current location).


title: Entity and pattern validation vs DB constraint

text: When it comes to performance: What is the better way to validate the user input? If you think about a phone number and you only want numbers in the database, but it could begin with a 0, so you will use varchar: Is it better to check it via the entity model like this:                @Size(min = 10, max = 12)      @Digits(fraction = 0, integer = 12)      @Column(name = "phone_number")      private String phoneNumber;      Or is it better to use on the database side a CHECK (and no checking in the entity model) for the same feature?


title: C++ and the use of old Visual Studio versions

text: Based on the behavior of some of our customers, I have come to wonder if many c++ development shops decided to just stop at vs2005. Is this just a quirk of the dozen or so large organizations that we deliver DLL+IMPLIB to, or is there a general groundswell of disinterest in the industry at large in upgrading? Note that there's no MFC at work here, just a Windows compile of C++ code that is also delivered on linux and whatnot. And the question is, "Is it my imagination, or is it that big companies that build things like search engines in C++ have just stopped upgrading?" **NOTE** None of the answers so far appear to report actual personal experience with making a decision to upgrade or not, but rather either offer general principles or report very vague hearsay.


title: Are trivial protected getters blatant overkill?

text: Something I really have not thought about before (AS3 syntax):               private var m_obj:Object;     protected function get obj():Object     {         return m_obj;     }          private var m_str:String;     protected function get str():String     {         return m_str;     }      At least subclasses won't be able to set m_obj or m_str (though they could still modify m_obj). **My question:** Is this just blatant overkill? * * * This Programmer's question: When or why should one use getters/setters for class properties instead of simply making them public properties? has been suggested as a duplicate. That question is different because it only addresses public vs. private properties and whether a property should be wrapped with getters & setters. For my question, I'm focusing on _protected_ variables and how inheriting classes would interact with those variables. So the alternative implementation would be:               protected var m_obj:Object; //more accessible than a private variable with a protected getter     protected var m_str:String; //more accessible than a private variable with a protected getter      My question is similar because I am talking about using _trivial_ protected getters to block _subclasses_ from writing to the variables, but to allow them all other access.   In languages like AS3, this will even allow them to make any changes to mutable object variables, as long as the references themselves are not modified.


title: Variable names for Contact Information bits

text: I am in the middle of refactoring code and would like to get some ideas on variable naming so that my new names clearly represent the data they hold. I have a class called `ContactMethod` which makes sense to me; each instance is a different way to contact someone. My problem comes when naming the properties of `ContactMethod`. For example, one instance might be a Fax number of 555-555-5555 while another could be an Email address of bob@email.com; I've got a property called `contactMethodType` to hold the values "fax" or "email", but I don't know what to call the "555-555-5555" or "bob@email.com" part. Has anyone here created a good generic name for this piece of contact information? _(PS - the old convention was to call it a "Phone" with fields "phoneType" holding the "fax"/"email" value and "phoneId" holding the number/address. Yuck.)_


title: Implementing objects with several equivalent representations

text: I am wondering if there are patterns, references or useful resources about how to implement objects that may have several equivalent representations. For example: Suppose I want to implement a `Rectangle`, and I will instantiate it using its `length` and `width`:               class Rectangle:         def __init__(self, length, width):             self.length = length             self.width = width      and suppose now I also want to have the possibility to instantiate the `Rectangle` using its `diagonal` and `area`. My main concern is that I don't want to store redundant information in the object (in this case, these four properties), only the bare minimum possible to define it. Suppose too I might want to retrieve one set of properties having created the `Rectangle` using another:               r = Rectangle(length=3, width=4)     assert r.diagonal == 5      This is what I've tried so far:               class Rectangle:         def __init__(self, **kwargs):             params = set(kwargs.keys())             if params == set(['length', 'width']):                 self._length = kwargs['length']                 self._width = kwargs['width']             elif params == set(['area', 'diagonal']):                 self._area = kwargs['area']                 self._diagonal = kwargs['diagonal']             else:                 raise ValueError('Invalid input arguments')              @property         def length(self):             if hasattr(self, '_length'):                 return self._length             elif hasattr(self, '_area') and hasattr(self, '_diagonal'):                 length, width = ad2lw(self._area, self._diagonal)                 #r = Rectangle(length=length, width=width)                 #return r._length                 return length             else:                 raise NotImplementedError('No converter available')              # Same with other three properties               def ad2lw(area, diagonal):         # Obscure math         return l, w      Is this any known pattern or is there a standard way to do it?


title: MVC in a desktop application - can the View ever hold a reference to the Model?

text: (I'm specifying this is a desktop application so people wouldn't refer specifically to web implementations of MVC). The title says it all pretty much. In an MVC structure - **can the View _ever_ hold a reference to the Model?** Or should the Controller be used as a 'middleman' for communication between the View and Model - always - and in both directions? If the answer is "no, it can't" - **why?**


title: Fine Line: Readability Vs Speed

text: Is there a line between readability vs compile or processing speed? Aside from the extreme cases, I wouldn't think it would be even worth saving that little bit extra in favor of legibility... For example; a bad idea, in my opinion would be removing all the comments on a 'finished' product to gain a little extra speed.


title: Have you dealt with space hardening?

text: I am very eager to study best practices when it comes to space hardening. For instance, I've read (though I can't find the article any longer) that some core parts of the Mars rovers did not use dynamic memory allocation, in fact it was forbidden. I've also read that old fashioned core memory may be preferable in space. I was looking at some of the projects associated with the Google Lunar Challenge and wondering what it would feel like to get code on the moon, or even just into space. I know that space hardened boards offer some sanity in such a harsh environment, however I'm wondering (as a C programmer) how I would need to adjust my thinking and code if I was writing something that would run in space? I think the next few years might show more growth in private space companies, I'd really like to at least be somewhat knowledgeable regarding best practices. What happens to a program if radiation, cold or heat bombards a board that sustained damage to its insulation? I think the goal is keeping humans inside of a space craft (as far as fixing or swapping stuff) and avoiding missions to fix things. Furthermore, if the board maintains some critical system, early warnings seem paramount. How does one gain experience in this through testing and trial & error (barring the launch of your own personal satellite?)


title: How does recording video and playing it back in realtime work?

text: I am looking to understand how recording video (and audio) and playing it back in realtime work (on the same pc or over a network)? I understand for a file stored on the disk. You read it and play it back but in recoding, you don't know how long the file is, when it will end etc. Can someone explain it, preferably using some code (or psudocode)? Thanks


title: Android -> Ruby Server Interface -> Mongodb

text: I've been wrecking my brain about this for a few days. I'll run my scenario by you and hopefully you can help me. In my head this is how it goes: I have an Android App. I want my Android App to make (function) calls to a MongoDB database via a Ruby Interface on the Server. e.g. Android app sends a HTTP GET ? with the function name, let's say getFriends for this user Ruby Interface receives this request from the app, grabs a thread from a thread pool and calls the appropriate function call implemented in Ruby, to the Mongodb. Ruby Interface gets results from Mongodb and sends a HTML POST to the Android app. So that's how I think it works. I know about the ruby driver for mongo db, and interacting with the mongodb from ruby but, how do I make a ruby back end listen for incoming messages and should these messages be done through sockets or a http interface ala Net::http in ruby?


title: Should we create classes just to group properties

text: I am designing a bit of software that will integrate with our enterprise system using web services. We are dealing with work orders that are needed to maintain equipment. We have a bit of a disagreement in regards to the structure of the contract. There are two methods on my side, I would like a single work order class with all properties related to the work order in it. example (simplified)               WO - class       Number - property       Description - property       WarrantyStatus - property       WarrantySettlementDate - property       LabourSteps<LabourStep>[] - list property       Children<WO>[] - list property      On their side, they want to create a work order class, but for each logical group of data, they want to create another class to wrap the properties. example (simplified)               WO - class       WOHeader - class         Number - property         Description - property       Warranty - class         WarrantyStatus - property         WarrantySettlementDate - property       LabourSteps<LabourStep>[] - list property       Children<WO>[] - list property      Now they will have approx 8 classes in the full definition that they want to create all with a few properties in each. This seems a bit over the top to me and has a bit of a code smell or anti pattern feel to it. For my example, I have two classes, WO and LabourStep. They have 4 classes for the same thing WO,WOHeader,Warranty,LabourStep. There will only ever be one WOHeader per WO and the same for Warranty. My one seems far simpler to manage changes (add a new property to WO and thats it), but is less human readable. On their side, The structure is a little more easier to read by a human, but it feel like its pushing a logical view onto the contract the doesn't really belong. And to add a new property potentially requires a modification to the WO and the creation of a new class if a new logical group was added. These extra classes are only there to group properties. What is the right way to go? ======EDIT========== Frank - I completely agree with your thoughts and it is the way I approach my development. Except in this case, the third party monolithic enterprise system we are integrating with has been written in a very generic way to try and cater for as many businesses as possible. The data is spread across three tables in a one to one mapping with the majority in one table. There is barely any validation. There is no concept of a "Warranty" object/thing in that system. Its just 3 properties against a WO. All the web service will do is act like a data store, with the WO persisted as a whole. e.g. getWO() updateWO() createWO(). There will never be get/updateWarranty() methods. It's all just one blob of data to read/persist. On our side, we never use the result directly from web services even if they are our own. We convert them into proper models and then use those. To us a data contract is very different to a model. There is no business logic in the data contract, its purely a container to get data from one part of the system to another without closely coupling them. That means we can easily change to persist to a database instead of a web service and all its needs to do is match the interface of the web service. This also allows us to modify our own models which may even include results from multiple web services without having to worry about being restricted to or changing the format of the data contracts. So when I think in those terms, Having the data contracts split into WOHeader or WOWarranty classes just doesn't make any sense. It will never used in that way, not even by them. Its just there for a nice logical group of properties that mean nothing by themselves. A region block around those properties would have the same net effect. Labour steps and equipment details however, make a lot of sense to be in separate classes as they are separate entities and not just properties of work orders.


title: Does boostrapping limit the achievable speed of the new compiler?

text: I have a good grasp on how the C compiler was boostrapped from itself and how that must have been very efficient, since the first pre-bootstrapping version was written in assembler, which is as low level as you can get. BUT today we have a very different situation, with languages first written on other relatively high-level languages (e.g. Clojure). Question 1: I have a hard time imagining that the **bootstrapped compiler could be _faster_ in anything than its non-bootstrapped counterpart. Is this possible?** Question 2: Especially once you take the step in which you write then new version of your compiler in your new language: **Can any inefficiencies that existed in the non-bootstrapped code be fixed or is the code generation of the new compiler haunted by those forever?** That matters even more since you can’t easily go back and fix those afterwards!


title: How to keep background requests in sequence

text: I'm faced with implementing interfaces for some rather archaic systems, for handling online deposits to stored value accounts (think campus card accounts for students). Here's my dilemma: stage 1 of the process involves passing the user off to a thrid-party site for the credit card transaction, like old-school PayPal. Step two involves using a proprietary protocol for communicating with a legacy system for conducting the actual deposit. Step two requires that each transaction have a unique sequence number, and that the requests' seqnums are in order. Since we're logging each transaction in Postgres, my first thought was to take a number from a sequence in the DB, guaranteeing uniqueness. But since we're dealing with web requests that might come in near-simultaneously, and since latency with the return from the off- ste payment processor is beyond our control, there's always the chance for a race condition in the order of requests passed back to the proprietary system, and if the seqnums are out of order, the request fails silently (brilliant, right?). I thought about enqueuing the requests in Redis and using Resque workers to process them (single worker, single process, so they are processed in order), but we need to be able to give the user feedback as to whether the transaction was processed successfully, so this seems less feasible to me. I've tried to make this application handle concurrency well (as much as possible for a Ruby on Rails app), but now we're in a situation where we have to interact with a system that is designed to be single process, single threaded, and sequential. If it at least gave an "out of order" error, I could just increment (or take the next value off the sequence), but it's designed to fail silently in the event of ANY error. We are handling timeouts in a way that blocks on I/O, but since the application uses multiple workers (Unicorn), that's no guarantee. Any ideas/suggestions would be appreciated.


title: Class Design and Structure Online Web Store

text: I hope I have asked this in the right forum. Basically, we're designing an Online Store and I am designing the class structure for ordering a product and want some clarification on what I have so far: So a customer comes, selects their product, chooses the quantity and selects 'Purchase' (I am using the Facade Pattern - So subsystems execute when this action is performed). My class structure:                  < Order >                 < Product >                    <Customer >      There is no inheritance, more Association < Order > has < Product >, < Customer > has < Order > . Does this structure look ok? I've noticed that I don't handle the "Quantity" separately, I was just going to add this into the "Product" class, but, do you think it should be a class of it's own? Hope someone can help.