_id
stringlengths
1
6
title
stringlengths
15
150
text
stringlengths
30
21.8k
188528
How do I transparently cache data in intermediate stages of processing?
I am working with MATLAB on a model reduction algorithm. It is basically a data processing pipeline. ckt = generate_ckt(ckt_properties); freq = generate_fpoints(fconfig); result = freq_dom_sim(ckt,freq); red_ckt = run_PRIMA(ckt, red_order); Each of these are potentially time consuming activities, being that the data I work with is pretty big (10000 × 10000 matrices). So in a previous implementation I had all of these as separate scripts that I had to execute one by one (manually or run a master script). Each of these stored the data in `.mat` files. The next program would read from this and write its own result in another directory. And so on. What I would like to use is a framework that can store the dependencies between various pieces of data, such that at any point of time I can just ask it to generate the output. It should : 1. Check if the variable is present in the workspace. 2. If it is, check if its consistent with the expected properties (check with the `config` data) 3. If not, load from file (the exact path to the file will be pre-specified). 4. Check if its consistent with the expected properties. 5. If not, compute it from the command associated with it. (pre-specified) I would like this to be recursive, so that effectively I run the last module and it automatically runs checks and actually computes only those pieces of data that are not already available and consistent. Can you give some suggestions on how to design this? If it is already called something (I assume it must) please point me to it.
188527
Using the mouse as a multi-tool creates heavy conditional logic for executing commands, how do I change this?
The feature is in many different types of editing programs where a mouse click may have completely different commands to execute (using the Command Pattern) Currently I have an overarching `determineClickCommand(clickFocus)` function. The body essentially looked like this: var command = null; var args = null; if (clickFocus == x) { if (x.state == state) { args = // Code to detemine args command = new CommandA(args) } else { command = new CommandB() } } else if (clickFocus == y) { args = blahablah; command = new CommandC(args) } else if (clickFocus == z) { command = new CommandD() } ...etc..etc...etc... command.execute() Which was fine when I was prototyping, but I'd like a more elegant solution. Particularly since at some point, I'm going to want to take advantage of right-click/middle-click, which could add a third nested if statement My first idea is to create a `AbstractClickScope` class with a `determineClickCommand()` method to be overridden in each concrete scope subclass. This breaks the problem into more maintainable classes, but the extensive conditional logic is the exact same. And if I were to decide to have many 'scopes' then a new class each time would be very annoying. Or maybe have some sort of command factory class as opposed to a method? This isolates Command creation to a very specific part of the code. Any other ideas? Or known implementations? Just throwing ideas out there and looking for more info as I think through this.
147678
Is there a way to track data structure dependencies from the database, through the tiers, all the way out to a web page?
When we design applications, we generally end up with the same tiered sets of data structures: 1. A persistent data structure that is described using DDL and implemented as RDBMS tables and columns. 2. A set of domain objects that consist primarily of data structures, usually combined with business-rule level logic, that are implemented in a programming language such as Java. 3. A set of service layer interfaces that directly support use case implementations (which use the domain data structures as parameters), implemented as EJBs or something equivalent in another programming language. 4. UI screens that allow users to **C** reate, **R** etrieve, **U** pdate, and (maybe) **D** elete all manner of data structures and graphs of data structures, with numerous screens and with multiple UI widgets, all structured to support the same data structures. But if you want to change the data structures in any of these tiers, it always seems _extremely_ difficult to assess the impact(s) the change will have across the application. UML can help, but tracing through diagram after diagram is not a real solution to this problem. The best I have ever seen was a homespun data tracking spreadsheet document that listed all of the data structures and walked the relationships from tier-to-tier. Is there a tool or accepted approach that makes it easy to identify a data structure in any tier and easily obtain a list of all dependent: * database table and column data structures * domain object data structures * service layer interface methods and parameter data structures * screen & UI component data structures
185332
How do I know if I have enough unit test coverage to remove an integration test?
I'm working on a legacy system (by that I mean it was written without tests). We've tried to test some of the system by writing integration tests that test functionality from the outside. This gives me some confidence to refactor parts of the code without worry about breaking it. But the problem is these integration tests require a deploy (2+ minutes) and many minutes to run. Also, they are a pain to maintain. They each cover thousands of lines of code and when one of them breaks it can take hour(s) to debug why. I've been writing lots of unit tests for these functional changes I've been making lately, but before I commit I always do a new deploy and run all integration tests, just to make sure I didn't miss anything. At this point I know my unit tests and some of the integration tests are overlapping what they test. How do I know when my good unit tests are adequately covering a bad integration test so that I can delete that integration test?
131736
How can I convince a team member to use a web framework?
The question is this and the detail follows: **is there anything I can say/bring up, as a programmer, to bring him to my side?** I'd love to hear valid arguments for both sides on this one, but mostly suggestions for how to talk him around. * * * My situation is this: I'm working on a team project on my degree course, building a mid-sized website as a prototype for the university. All are considered equals in the group and there is no one appointed leader so the answer to this problem can't be "pull rank". All are equals, however there is a huge gap in knowledge between members. The team member in question and I are both capable developers, though he holds no industry experience. The other three members are less capable, and two have opted out of development entirely. All three have declined to comment on the situation due to lack of knowledge. As as a group, we are coming to decide on what technologies to use in the implementation of the website; specifically, whether to use a PHP framework (Code Igniter) or not. I am arguing in favour, citing: 1. Not reinventing the wheel 2. Well written and tested code base to work from 3. Getting going (the deadline is closer than we'd like) 4. Speed of development 5. Sound and maintainable design patterns and good practices He is arguing in favour of working in the way he's used to: * Writing bespoke, one-time functions in to a "library" file as when he needs them * Functions for data access and rendering that data the page, getting/setting to and from session and get/post data etc * Having 1 file per page (resulting in no separation of concerns amongst control, presentation and data) His reasons against using are framework are mostly based on him not being able to see the point: he can do all those things already. The framework doesn't change that, it just makes it harder because he has to learn the framework; he doesn't want to use code he hasn't personally written. He has also said that it "doesn't matter the quality of the code base, since the project is only a prototype and will never be maintained". For me, that is _no excuse_ to write unmaintainable code. I can see why he makes those arguments, but I hold issue with his "lack of concern over maintainability" and his "disregard for good design", or even separation of concerns. However, I suspect he has never studied design patterns, so I don't know how effective demonstrating why his method could prove unmaintainable would be. I want to get going on this project, but I don't want to do it without regard for everything I've learnt over the years. As I said before, there is no possibility of pulling rank here, nor are other team members willing to pitch in. Should I just back down and do things his way? Is he too stubborn and inexperienced to know better? Or am I being the stubborn one here? TL;DR Inexperienced team member is being stubborn, how can I win him over?
25857
What questions should I ask on a work environment survey?
As a result of reading Peopleware, I'm thinking of sending a survey out to our programmers to determine how they feel about their office environment. One obvious question is whether the office is too noisy or not. **What other questions should I ask our programmers about their work environment?** I'll post the final survey I put together onto this thread.
25856
Are high office partitions as effective as private offices?
I'm currently reading DeMarco and Lister's Peopleware, and I've been struck (as everyone is) by their comments about noise reduction via using private offices, and the effect this has on productivity. Private offices are probably not going to happen at my workplace, but I'm wondering if high cubicle partitions (say, 6 feet) might be nearly as good? I imagine they wouldn't deflect quite as much noise, but they would have _some_ effect. One down-side is that the center cubicles would have less natural light. That seems quite a big downer to me. I'd be interested to hear what peoples experiences are.
196477
How to port cli c++ program with GNU libraries from windows to Linux
I need to implement some graph partitioning algorithms for my thesis. I have mostly Windows experience. I would like to know if it is hard to migrate c++ console program to Linux. I want to program it on Windows but I want to test and compile it on Linux as well. It will be pure cli application, with no use of windows APi or anything. I just need to use some external libraries. Specifically GNU linear programming kit and GNU scientific library GSL. I found out, there are windows versions of these libraries, what does it mean for me?, should I compile it on Windows with windows version package and on Linux with linux package. I would like someone to bring a bit clarity to this, I am really not very experienced programmer, so any advice will help. Also I would like to ask, if there is diference if I use Visual Studio for programming or some other IDE in matter of portability issues. Thanks in advance for any help.
186584
Annexes in Ada95
I want to know the differences between normative and informative annexes in Ada 95. I am just able to find a list of each of them but not the differences. What are the differences?
196471
Does JMF have support with Xuggler
i am working on a project consisting of sending and receiving streaming multimedia.So,i have installed JMF, but i have seen that JMF has 32 bit library as mine is 64 bit so i wanted to use Xuggler for streaming videos. Can anyone clarify me about the support of Java Media FrameWork with Xuggler..
184807
Branch vs decision coverage question
ISTQB does not distinct between these (it reads "Branch/decision coverage") but some sources do say it is different. I would have two question. The essential one is about the difference. And the other one - does this whole concept belongs under the unit testing? Or white box testing? Thanks From the ISTQB: > branch coverage is closely related to decision coverage and at 100% coverage > they give exactly the same results. Decision coverage measures the coverage > of conditional branches; branch coverage measures the coverage of both > conditional and unconditional branches. The Syllabus uses decision coverage, > as it is the source of the branches. Some coverage measurement tools may > talk about branch coverage when they actually mean decision coverage. (c) > ISTQB foundation book.
156013
how can python interpreter recognize code block
The most unusual aspect of Python is that whitespace is significant instead of block delimiters (braces → "{}" in the C family of languages), indentation is used to indicate where blocks begin and end. how can python interpreter recognize code block ?
216220
String Formatting with concatenation or substitution
This is a question about preferences. Assume a programming language offers these two options to make a string with some variables: 1. `"Hello, my name is ". name ." and I'm ". age ." years old."` 2. `StringFormat("Hello, my name is $0 and I'm $1 years old.", name, age)` Which do you prefer and why? I have found myself using both without any clear reason to pick either. Considering micro-optimizations is not within the scope of this question. **Localization** has been mentioned as a reason to go with option #2 and I think it's a very valid reason and deserves to be mentioned here. However, would opinions differ based on aesthetic viewpoints?
66740
What language should I seek to learn if I would like to develop for Windows?
What language should I seek to learn if I would like to develop for Windows? Not command-line stuff (obviously, I guess) but with Windows Forms and such? I've used C before (when working with Rockbox), but that's it. Up until now, I've used Autoit (for basic, simple stuff), but I'm looking for something that has more flexibility and is popular inside of the PC software industry. Plus, I didn't like how easy it was to crack Autoit programs. I'm also a web developer/designer, just to throw that out there. Thanks in advance!
74973
Weaknesses with different types of NoSQL databases
Here's my question: What are the weaknesses with different types of NoSQL databases? Specifically, what're the weaknesses of key-value stores, graph data stores and document stores? I've had an easy time finding strengths, but documents on weaknesses seem to be scarcer. Edit: In comparison to each other, and to relational databases.
74970
How do I use programming experience at a non-programming position on my resume for a programming position?
I currently work in tier 2 support for an ISP, but don't want to remain here indefinitely. My overall ambition is to be a programmer as it is what I really love to do. The problem is that I came to this conclusion later in my career path and have had only the chance to go back to school to earn an AS in Computer Science and have had no positions as a programmer. Being out of college for a long time now makes it very hard to go after a low level position as I don't have a BS (and realistically at this point, it won't happen for a while, if at all) and employers only seem interested in fresh graduates. I have had the opportunity recently to work on some special projects at my current position that involve coding in my preferred languages to solve various problems. I have now written various tools using a multitude of languages to solve these problems. Now I am not necessarily what I would consider competent in these languages, but I can get around them and I know all the fundamentals (autoit, vb.net, python, perl, pascal, c#, php, batch, bash). I am also very good at finding a way to code what I need when I don't know upfront how to do it. I have some code samples for all these languages that I have used to solve problems at work. How do I incorporate this experience into my resume to be a more viable candidate for an entry level position?
34577
Best approach to designing multi-client applications
I was wondering how you guys start out if you need to design a multi-client project where multiple clients can interact with a server. In specific how do you go about dealing with different states and message handling, how do you start designing and considering all these cases? For example a video webchat application where it is possible that you call another client, while that client is already in a call, or is stuck in a modal dialog such that the calling dialog does not come through.
144092
The rule of 5 - to use it or not?
The rule of 3 (the rule of 5 in the new c++ standard) states : > If you need to explicitly declare either the destructor, copy constructor or > copy assignment operator yourself, you probably need to explicitly declare > all three of them. But, on the other hand, the Martin's "Clean Code" advises to remove all empty constructors and destructors (page 293, _G12:Clutter_ ) : > Of what use is a default constructor with no implementation? All it serves > to do is clutter up the code with meaningless artifacts. So, how to handle these two opposite opinions? Should empty constructors/destructors really be implemented? * * * Next example demonstrates exactly what I mean : #include <iostream> #include <memory> struct A { A( const int value ) : v( new int( value ) ) {} ~A(){} A( const A & other ) : v( new int( *other.v ) ) {} A& operator=( const A & other ) { v.reset( new int( *other.v ) ); return *this; } std::auto_ptr< int > v; }; int main() { const A a( 55 ); std::cout<< "a value = " << *a.v << std::endl; A b(a); std::cout<< "b value = " << *b.v << std::endl; const A c(11); std::cout<< "c value = " << *c.v << std::endl; b = c; std::cout<< "b new value = " << *b.v << std::endl; } Compiles fine using g++ 4.6.1 with : g++ -std=c++0x -Wall -Wextra -pedantic example.cpp The destructor for `struct A` is empty, and not really needed. So, should it be there, or should it be removed?
72726
Making sure nobody has created an app for something before?
I've an idea for a smartphone game app. I want to make sure nobody has made an app like this before; how can I check that? I don't want to remake something that already exists now.
177528
Does async/await makes simple thing unnecessary complicated?
After exposing to Windows App Store development for a month, I begin to feel that `async` / `await` programming model does more harm than good. **It makes simple thing complicated.** Take an example, folder creation. In Java or Desktop .NET, I can simply do ## Java public Constructor() { new File("c:\\folder").mkdirs(); System.out.println("I am pretty sure c:\\folder is ready now"); } ## Desktop .NET Constructor() { System.IO.Directory.CreateDirectory("c:\\folder"); Console.WriteLine("I am pretty sure c:\\folder is ready now"); } But when comes to ## Windows App Store .NET Constructor() { // Damm it! Another async function? I don't need aysnc! Windows.Storage.ApplicationData.Current.LocalFolder.CreateFolderAsync("c:\\folder", CreationCollisionOption.OpenIfExists); // I am not sure c:\\folder is ready right now! // OK. I know I can use ContinueWith. No no no. I don't want. // Why I have to use ContinueWith with such a simple operation? } So, my question is, do you find the newly introduced `async` / `await` programming model in Windows App Store, * Improve your productivity? * Make programming life easier? **For me, I don't!** Perhaps I have been missing out certain useful techniques. I know, Microsoft says, it helps us to write responsive UI code. But I would say, **No thanks! Hey look, my code is already in non-UI code!** Most of my current operation code is fast enough and doesn't block UI. When my operation code is not fast enough, I am pretty comfortable in making those slow operation code run in separate Thread/ Task. Forcing me to use `async` / `await` which I do not need, only makes my code more complicated. **Message to Microsoft** : May I beg to you, besides async functions, can you provide a same set of non-async functions, please? I already build up my habit of running code in non-UI thread. I promise I will continue make your Windows App perform as smooth as iOS :)
177529
When connecting to a server using the DRDA protocol, is it true that the first Client-To-Server command MUST be EXCSAT chained with ACCSEC?
When connecting to a server using the DRDA protocol, is it true that the first Client-To-Server command MUST be EXCSAT chained with ACCSEC? I found 2 different answers when I googled it. If you look at The Open Group web site (https://collaboration.opengroup.org/dbiop/) it can be understood that the answer is NO. However, if you look at the IBM website (http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=%2Fcom.ibm.ims11.doc.apr%2Fims_ddm_excsat.htm) you can understand the answer is YES. So which is it?
177526
If you have several SCRUM teams working on one backlog, how do you divide story point estimation between those teams?
I'm asking because approach in my company looks as follows: * stories in the backlog are not estimated * team that picks the story estimates it in story points during sprint planning part two
105807
Best Practices for Corporate Sponsorship of Open Source Project
We are preparing to OpenSource our ASP.NET MVC multi-tenancy CMS. We currently use BitBucket.org to host our source repository and we are considering best approaches to repository naming. In terms of the user/host of the repository, We are debating using our company name which is the sponsor of the project versus the project name itself. The company name is JoyaTech Solutions, the project name is JoyaCMS. Do people think that having a company name as the user/owner of an open source project is a turn off or is there value in displaying that relationship?
105805
Storing passwords for usage in scripts
There are few situations that require users to provide their password while automating things during development process. Site deployment is only one of the common situations. Creating dmg files under OS X requires password as well. Most of the command line utilities used in scripts has an ability to receive a password via stdin. Providing password each time the script is run kinda defeats the purpose of "automatic". Storing it plain text in the script defeats the purpose of "password". What is the most optimal approach to providing passwords to scripts that requires them?
50381
What tools or way to start a web project
I am a sandwich training student in a company that has a little informatics service who develop web app Until today, they work with simple php, a little CSS and no version control. So, the code becomes unmaintainable. The project manager would like to use php object, and i am the only one with some knows in it. But i am still a beginner with no experience in web dev, and after some search i am afraid to building a php MVC alone. So my question is : Should i convince the team to start using a framework like symfony ( i'm feeling ok to use it ) with the big change it impose to the team, or simply bring a better work structure with version control and tools like an ORM ? Thanks for your help EDITED : with the hope it's now understandable
224275
Why are there so few comments in C/C++ code?
I'm a web developer primarily, and I've been learning C/C++ and trying to get involved in some open source projects. Something I find very unusual is the lack of comments in C/C++ source code (I've looked at big projects like Linux, Varnish, and HipHopVM). In web development, I'm used to seeing a **lot** of comments in source code, and I tend to comment a lot as well. I assume it's a culture/attitude thing, as I posted some C code for review and a couple people said I had too many comments.
228556
When the ScrumMaster is a technical leader, it's a good or a bad practice?
I know that the ScrumMaster should be a leader, but it's a good practice to have a technical leader as a ScrumMaster. For example: a coordinator.
228557
Entity Translation Should be in the Data Layer or Business Layer
From my understanding I though the data layer should isolate the Data Technology from the rest of the application, for me this also include the schema in this case the data entity. Recently I've been looking at the Silk project from Patterns & Practices http://silk.codeplex.com/, and noticed that data entities are translated in the business layer rather than in the data layer. I think the advantage is that it avoid the data layer to reference an assembly containing the business model. However the fact that it expose data entities publicly is from my understanding a disadvantage because external components may be dependent of the data schema. I would like to understand why they translate data entities in the business layer and what are the advantages? I know that they use code first entity framework, so that the entities doesn't have data technology related dependency, however there responsibility is still to structure the data model not the business model. Thanks
224271
What are the proper terms for desk/user testing?
Is there a common and accepted term for the manual tests done by programmers or users on software in lieu of or in addition to automated testing? For example, in a progression as follows: 1. "Desk Test" for the non-automated testing a programmer does while writing code. 2. "Unit Test" for an automated test for a particular class/method/function. 3. "Integration Test" for an automated test of multiple components working together. 4. "System Test" or "Acceptance Test" for application-wide tests that would be meaningful in conversation with the end user. 5. "User Test", for when we hand it to the user and ask them to find bugs. Are there better terms for #1 ("Desk Test") and #5 ("User Test")? (And I know that TDD would say write #2 before #1... but making that point is exactly why I want to know the right word for #1.)
187188
Do I include third party classes in my UML class diagrams
I'm developing a system which involves 2 Android applications and a Java web application. For my UML class diagrams I have not included third party classes I use e.g. observer type interfaces. Should I include them? If so how can I differentiate between my entities (classes, interfaces, enums etc) and their entities? Thank you.
202983
Can and do compilers convert recursive logic to equivalent non-recursive logic?
I've been learning F# and it's starting to influence how I think when I'm programming C#. To that end, I have been using recursion when I feel the result improves readability and I can't envision it winding out to a stack overflow. This leads me to ask whether or not compilers could automatically convert recursive functions to an equivalent non-recursive form?
219541
Which of these old criticisms of common lisp still apply today?
In _A Critique of Common Lisp_ written by Rodney A. Brooks and Richard P. Gabriel from Stanford in 1984, some design decisions retained by the normalizing committee of Common Lisp are discussed. While most of the discussion remains valid, there are two statements that refer to the technology available at the time and may be false today. These two statements are: > Too many costs of the language were dismissed with the admonition that ‘any > good compiler’ can take care of them. No one has yet written—nor is likely > to without tremendous effort—a compiler that does a fraction of the tricks > expected of it. As I am a Common Lisp novice, or even an apprentice, I am not able to be more specific than the authors are. They seem to state that a great generality and flexibility has been built into several aspects of the language, which makes writing a good compiler quite difficult. > In COMMON LISP a little too much control was placed on floating-point > arithmetic. And certainly, although the correct behavior of a floating- > point-intensive program can be attained, the performance may vary wildly. As far I understand, it seems that writing efficient numerical code in Common Lisp is possible but more challenging than it has to be. This was thirty years ago. How should I regard these statement today if I am willing to write Common Lisp programs for one of the common free software implementations (CLISP, SBCL et al.)?
64171
Which is the best book to learn Facebook App development and Facebook Graph API?
Which is the best book to learn Facebook App development and Facebook Graph API?
144323
Conditional checks against a list
I was wondering how computers do this. The most logical way I can think is that they are iterating trough all elements of the list until they find one that matches the condition :) For example if you call `function_exists()`, PHP should iterate trough all defined functions until it meets the one that matches the name you're looking for. Is this true that this is the only way? If it is, it sounds like it's not very efficient :s
144324
Prolog parallelism
Are there any prolog interpreters that can functionally decompose your 'programs' in order to improve efficiency? I know there's been research on prolog interpreters that reach near-C speeds through parallelism (the kind that a typical C programmer can't "see"). Does anyone know more about this topic?
144326
try-catch in javascript... isn't it a good practice?
There is a provision for **try-catch** block in **javascript**. While in java or any other language it is mandatory to have error handling, I don't see anybody using them in javascript for greater extent. Isn't it a good practice or just we don't need them in javascript?
144327
Synchronous vs. asynchronous for publish subscribe communication between JavaScript objects
I implemented the publish subscribe pattern in a JavaScript module to be used by entirely client-side oriented JavaScript objects. This module has nothing to do with client-server communications in any way, shape or form. My question is whether it's better for the publish method in such a module to be synchronous or asynchronous, and why. As a very simplified example let's say I'm building a custom UI for an HTML5 video player widget: One of my modules is the "video" module that contains the VIDEO element and handles the various features and events associated with that element. This would probably have a namespace something like "widgets.player.video." Another is the "controls" module that has the various buttons - play, pause, volume, scrub, fullscreen, etc. This might have a namespace along the lines of "widgets.player.controls." These two modules are children of a parent "player" module ("widgets.player" ??), and as such would have no inherent knowledge of each other when instantiated as children of the "player" object. The "controls" elements would obviously need to be able to effect some changes on the video (click "Play" and the video should play), and vice versa (video's "timeUpdate" event fires and the visual display of the current time in the controls should update). I could tightly couple these modules and pass references to each other, but I'd rather take a more loosely coupled approach by setting up a pubsub type module that both can subscribe to and publish from. SO (thanks for bearing with me) in this kind of a scenario is there an advantage one way or another for synchronous publication versus asynchronous publication? I've seen some solutions posted online that allow for either/or with a boolean flag whereas others automatically do it asynchronously. I haven't personally seen an implementation that just automatically goes with synchronous publication... is this because there's no advantage to it? I know that I can accomplish this with features provided by jQuery, but it seems that there may be too much overhead involved here. The publish subscribe pattern can be implemented with relatively lightweight code designed specifically for this particular purpose so I'd rather go with that then a more general purpose eventing system like jQuery's (which I'll use for more general eventing needs :-).
6633
How are open-source projects able to sustain themselves?
I always had this question in mind but couldn't find a proper place to ask. There are some really nice and great open source free software available on the net. How do these products sustain themselves financially? It is one thing writing a small utility which does something nice but writing a complicated product with whole lot of features is a totally different ball game. So to repeat myself again, how do they work financially?
189694
Can a programmer renounce ownership of source code?
I came across this license: /** * The author disclaims copyright to this source code. In place of * a legal notice, here is a blessing: * * May you do good and not evil. * May you find forgiveness for yourself and forgive others. * May you share freely, never taking more than you give. */ Would this have the same legal bearing as the WTFPL license?
189691
UML diagrams for small projects
All of a sudden the need for proper formal documentation has become a thing in our organization. A lot of work I do are enhancements and addition to an existing system. Generally a quick fix or a new method, etc. I am just not sure what kind of diagrams I should/could use for small projects. For instance I am adding a new functionality to an existing system that verifies format of a field and they want proper "Component design description with diagrams" for a simple regex that verifies format of one field. In the past we only did pseudocode and that was enough for such projects as the system is somewhat legacy with very little original documentation.
100350
What does Google or Microsoft get by hosting JS files on their Content Delivery Networks (CDN)?
As you know Google, Microsoft and jQuery.com offer JS files on their CDN. To do this, they must need to operate significant servers which must come at a cost to them. Why do they do this and what do they get from it?
92062
.NET CQRS Frameworks nCQRS vs Lokad.CQRS
For the last couple of weeks I've been reading up and watching any resources I can find on CQRS. I really like the concept and am keen to start delving deeper. I have only found 2 major .NET frameworks for CQRS and I am trying to evaluate the differences between them. I am looking to implement CQRS on a noSql db, most likely RavenDB. Lokad seems very focused on windows Azure, not sure if it supports Raven. It has extensive documentation but not a lot of activity in the community. nCQRS has a lot of activety and supports Raven. I was wondering if anyone has any experience working with these two frameworks and what the major differences are between them.
209725
Must OpenCL code be compiled for a specific GPU?
Most OpenCL Tutorials give a nice introduction to OpenCL, yet I have not found information on the question of interoperability of the compilation targets. It seems that I have to compile OpenCL code for the target GPU. Now when making a binary distribution of an application using OpenCL, does one have to make several builds for the vendor-platforms?
209723
Java exception redundancy
To what extent should one make exceptions redundant or atomic to a method. For instance, suppose I have a method `public void authenticate(String username, String password)` that calls `private void invokeServer(String username, String password)`. Both methods require those params to be non-zero length, and as such I would raise a `NullPointerException` if needed. Should I sanity check in `invokeServer` as well as `authenticate` on the basis that it could potentially be used independently at a later date?
100356
Can we develop ASP.NET MVC application with MySQL as the database?
I have mostly seen ASP.NET websites using MSSQL as database. Even I developed one some time ago. Why only MSSQL, when MySQL, a free alternative is available. So, the question is, IS it possible to integrate a MySQL database as easily as MSSQL with ASP.NET application or we need to use some API for doing so ??
108867
How do you decide between putting the code in the database or putting the code in the application?
For the sake of argument: * Let's assume the application we are building is an amortization schedule. * Let's also assume that the database has a table called tblAmortizationPayments that stores the information about each monthly payment in a separate row. * Let's further assume that the database language can support the math calculations needed to perform the calculations. If you were to build this amortization schedule for a 30 year mortgage, how would you decide between placing the code for performing these 360 calculations inside the database (I'm assuming this would be a stored procedure) or inside the application? I'm more interested in your thought process for making this type of decision or any similar scenario that might come along.
209729
Rationale behind C library functions never setting errno to zero
The C standard mandates that no C standard library functions shall set `errno` to zero. Why exactly is this? I could understand it being useful for calling several functions, and only checking `errno` after the last one - for example: errno = 0; double x = strtod(str1, NULL); long y = strtol(str2, NULL); if (errno) // either "strtod" or "strtol" failed else // both succeeded However, is this not considered "bad practice"? Since you're only checking `errno` at the very end, you only know that one of the functions _did_ fail, but not _which_ function failed. Is simply knowing that _something_ failed good enough for most practical programs? I tried looking for various C Rationale documents, but many of them don't have much detail for `<errno.h>`.
130850
Difference between DevOps and Software Configuration Management
What is the difference between Development Operations and Software Configuration Management? For me it seems to be the same as long as both DevOps and Software Configuration Management are focused on: 1. Establishing **development infrastructure** \- being in charge of version _control, build management, deployment management, dependencies management, continuous integration and delivery_ , etc. 2. Using best practices for organizing **developers environment**. 3. **Quality Assurance** of development processes - gathering metrics of development effectiveness, working on eliminating bottlenecks of development process (running unit-tests, evaluating unit-tests coverage, running inspections, etc) 4. **Infrastructure management** \- target platforms and its specifics. 5. **Release management** \- making sure release has been delivered to customer/client in time. Maybe I'm missing something? This link shows that usage of term 'Software Configuration Management' prevails. But still, what word combination would you rather use to describe listed range of activities: **Development Operations** or **Software Configuration Management**?
151544
JQuery / JSON + .Net Service Layer - to WCF or Not to WCF?
I Recently had a discussion with a colleague of mine about the pros / cons of WCF. He mentioned about how much code is generated to support WCF, and also the overhead required. It was mentioned that a simple jQuery /Ajax post to a .aspx page (or a handler for that matter) that returns JSON would work more efficiently and takes much less code to implement. I am also aware of the new WCF Web API and feel that technology may solve the "bloated"-ness required in attaining a proxy etc... by just outputting JSON. So when developing a relational DB (MSSQL) storage model, with a fairly complex Business Layer (C#) and Data Access Layer (EntityFW).. what's a good technology for creating a "service layer" which will spit out View Models represented in JSON, with a CQRS(Command Query..) approach in mind.. The app would use the service layer to support it's required UI, as well as provide an available subset of services (outputting JSON data) for service subscribers.. In other words an admin panel to support the admin UI, and service endpoints that return JSON to access the configurations made from the administration UI. What are some potential technologies to use as the transport / communication layer. I'd like to use a pure RESTful approach, but am not against doing some URL rewriting with IIS. Obviously some of the available technologies are: WCF WCF Web API (should this even be separate?) Straight request / response (query string to .aspx / handler) Would using MVC .Net solve this entire problem? maybe their single page app approach? any suggestions / feedback from developing this type of application? Thanks,
24722
Do you have any techniques to help you get started in the morning?
I'm not a morning person. I got into the habit of working from 10 to 7/8, sometimes 9. Nevertheless, many of the places I've worked for have asked for something more like 8 to 6 or 9 to 6. Honestly, I have a real tough time getting my brain going in the morning and getting into the code. Once I do, I can concentrate for a long time and be quite productive. It's getting into the code and starting to get going with it that I have trouble with. Sometimes I will waste time in the morning just because I can't focus on the problem (yes, I am writing this in the morning). I've put all my busy work in the morning, but as a developer, I don't have a lot of busy work. It kind of becomes a self reinforcing thing; because you don't get things done in the morning, you have to stay later. Because you have to stay later, then its harder to get started the next morning, etc. Do other people have trouble with this? If so, any techniques you've learned? Thanks!
110929
Understanding Cyclomatic Complexity
I've recently come across Cyclomatic Complexity and I'd like to try to understand it better. What are some practical coding examples of the different factors that go into calculating the complexity? Specifically, for the Wikipedia equation of `M = E − N + 2P`, I want to better understand what each of the following terms means: * E = the number of edges of the graph * N = the number of nodes of the graph * P = the number of connected components I suspect that either _E_ or _N_ may be the number of decision points (if, else if, for, foreach, etc) in a block of code, but I'm not quite sure which is which or what the other signifies. I'm also guessing that _P_ refers to function calls and class instantiations, but there isn't a clear definition given that I can see. If someone could shed a little more light with some clear code examples of each, it would help. As a follow-up, does the Cyclomatic Complexity directly correlate to the number of unit tests needed for 100% path coverage? As an example, does a method with a complexity of 4 indicate that 4 unit tests are needed to cover that method? Finally, do regular expressions affect Cyclomatic Complexity, and if so, how?
50651
When using membership provider, do you use the user ID or the username?
I've come across this is in a couple of different applications that I've worked on. They all used the ASP.NET Membership Provider for user accounts and controlling access to certain areas, but when we've gotten down into the code I've noticed that in one we're passing around the string based username, like "Ralph Waters", or we're passing around the Guid based user ID from the membership table. Now both seem to work. You can make methods which get by username, or get by user ID, but both have felt somewhat "funny". When you pass a string like "Ralph Waters" you're passing essentially two separate words that make up a unique identifier. And with a Guid, you're passing around a string/number combination which can be cast and made unique. So my question is this; when using Membership Provider, which do you use, the username or the user ID to get back to the user? Thanks all!
130858
Date as software version number
Software developers don't typically use date as version number, though YYYYMMDD format (or its variances) looks solid enough to use. Is there anything wrong with that scheme? Or does it apply to limited 'types' of software only (like in-house productions)?
187235
Is HTML5 usable for syncing data between devices?
I work for an insurance company. They have a contact database that gets pushed to the field agents by Lotus Notes. We're trying to move away from Lotus Notes, but we first have to remove our dependency on it. It has been suggested that a HTML5 solution could provide offline access to agent contacts and be used to sync changed from the server down and the client up. It is my understanding that the SQL storage capabilities of HTML5 aren't fully implemented (IE and Firefox apparently don't support yet per one site I read.) LocalStorage may not be robust enough for the data we need to sync since the size limit is relatively small. Is HTML5 a feasible solution to this issue or should we track down some kind of syncing solution? (I've been reading about one from the Ubuntu folks and Microsoft's, as well.) Thanks!
50652
Should one avoid or be careful with C99 features in C code?
Some seem to say that one should avoid C99 features in C code as compilers don't really support those features. C99 is a standard from 1999, shouldn't these features be quite widespread now? Should one avoid using C99 features in new code? In legacy code? I happen to use some C99 features quite often, should I stop doing that or be more careful with the use of those features?
221175
problem with High Cohesion - DRY principle across components
In our company we have to follow a rigid cycle of: 1. Requirement Analysis Document(Use Case Document). 2. Design Document (first High level then Low level) 3. Coding according to the document. 4. Unit Testing. 5. QA team then does testing **Abstract:** It all started when we developed a component in the initial lifecycle of project. The component consisted of its own domain layer/business layer, data layer, interfaces ... etc. After say around a month we had to create a new component due to some other given requirements, it also consisted of its own domain layer/business layer, data layer, interfaces ... etc. There is a Common Component in our solution where we keep all common methods/classes in the entire solution. We kept on developing second component as the requirements were coming and we were providing new features in that component, as a result the design also started evolving in this component. The first component was kept untouched, with old design. There were however some classes/interfaces that were mostly similar but duplicated violating DRY. * * * **Question:** Is it ok to just add reference of the business layer, data layer or "other relevant components" of Component2 in Component1, does this approach adhere to any **architecture/ software design best practices**? Or The common classes/methods should be promoted to common component where they could be used by other components (following DRY principle)? * * * With first approach it seems that my component/ solution will be in a danger of Big ball of mud. With second approach it seems that if a class is used in more than one component it should be promoted to Common component. Doesn't this violate High cohesion principle So, long story short **I am asking for any expert advice on the two mentioned approaches or may be another one from software professionals/ architects**. Since this is a common problem which every software product faces, so how to tackle it?
187232
What is this variation of MVC in JavaScript?
I am working on sorting out my **Javascript** code. Currently I have views implemented without any Model or collection. Now I working on separating Model from View. So for this transformation, I am planning as follows: View ---> X <--- | ---> Server < Client side > Assumptions: 1. View will not have any data that is to be loaded form server. 2. X will talk to server and get the required data. Then X will fire event. 3. View will listen to events and update themselves accordingly. 4. X is not an exact replica of some entity on server. X will just take those entities/ data from server and then View can request this data from X. 5. There will be exactly one X for each View. Now question is -- What is X called? Options -- Model, Controller, ViewModel, Presenter, or anything else. Or Is this very crude thing which can not have terminology?
151549
Which class to start TDD of card game application? What's the next 5-7 tests?
I have started to write card game applications. Some model classes: * CardSuit, CardValue, Card * Deck, IDeckCreator, RegularDeckCreator, DoubleDeckCreator * Board * Hand and some game classes: * Turn, TurnHandler * IPlayer, ComputerPlayer, HumanPlayer * IAttackStrategy, SimpleAttachStrategy, IDefenceStrategy, SimpleDefenceStrategy * GameData, Game are already written. My idea is to create engine, where two computer players could play game and then later I could add UI part. Already for some time I'm reading about Test Driven Development (TDD) and I have idea to start writing application from scratch, as currently I have tendency to write not needed code, which seems usable in future. Also code doesn't have any tests and it is hard to add them now. Seems that TDD could improve all these issue - minimum of needed code, good test coverage and also could help to come to right application design. But I have one issue - I can't decide from where to start TDD? Should I start from bottom - Card related classes or somewhere on top - Game, TurnHandler, ... ? **With which class you would start? And what would be the next 5 to 7 tests?** _(use the card game you know the best)_ I would like to start TDD with your help and then continue on my own!
61212
Portfolio Snippets
I just got out of school. And was about to make my portfolio.... but really all my code looks so simple that I wonder what are good enough code snippets to add to a portfolio ??? Or is my view of grandeur so high that I am just over thinking this.... And I say snippets because well no one wants to look at a project right ? and there is also all those nda's which are a pain... Please if you can include examples, would be great, especially portfolio snippet examples as I can get at a look at how they present it. thanks...
181171
Why is using classic for loops as iterators in stl considered bad?
I've read a couple of articles (example) that consider the classic `for (int ...... size() .... i++)` loop bad practice when iterating through for example vectors in stl. Instead the recommended why is to use vector iterators, i.e. `begin, end`, etc. Why is that?
181176
When are RPC-ish approaches more appropriate than REST?
After watching this talk on REST, Reuse and Serendipity by Steve Vinoski, I wonder if there are business cases in _greenfield_ projects for (XML-)RPC-ish setups, that REST could not solve in a better way. A few RPC-Problems he mentions: * Focus on language (fit the distributed system to the language, not the other way around) * "Make it look local" (and cope with failure and latency as exceptions rather than the rule) * intended to be language-independent, but still has "function calls" across languages as main ingredient * IDL boilerplate * Illusion of type safety * and a few more ... * * * Just to dramatize it a bit, some Google Instant result for RPC vs REST: ![RPC](http://i.stack.imgur.com/jkIJ3.png) ![REST](http://i.stack.imgur.com/F9C2z.png)
181177
Are there published guidelines, standards, or references that propose more than 80 chars per line?
Despite increases in screen size and resolution, many sources still suggest that code be limited to 80 characters per line. I realize than there are many different opinions on this subject, but I wonder whether there are any standards bodies or influential firms that use other limits (120 characters is a common alternative). For example, are any standards bodies considering "enlarging" the suggested limit? Are there large scale software projects (e.g. at NASA or ESA) that use larger limits? > Note: This is not yet another question about what individuals do, or about > related opinions, though I'd welcome such information as _comments_. This is > a specific question about whether there is any indication that standard > practice or recommendations (in the form of specific examples) is likely to > change soon.
141313
How do you price your work?
Well, let me explain : This has really been an issue for me, for such a long time. And what is worse - since coding is something I simply _ADORE_ (I would definitely do it, even if there was no payment involved whatsoever..) - is that I always end up feeling somewhat awkward... Anyway... **So, here's the deal :** You start working on a project, you may have something in your mind, and even if you're lucky enough and the client needs no " **cost estimates** " beforehand, sooner or later you'll face the ultimate dilemma of pricing your own work. * * * **So, how do YOU do it?** * By estimating the **time** you put into it? _(obviously, this is not exact, 'coz perhaps a more capable coder will need much less time for the very same thing than a not-so-competent coder + even the very same coder may not "perform" equally at all times)_ * By the **Lines of code** you've written? _(obviously, this is not a measure either : a 10-line script that does exactly the same with a 1000-line script is, at least for me, "better")_ * By taking into account the level of **complexity** of the project and, perhaps, how specialised the subject is? * By taking into account other factors? _(e.g. the **value** of the project for your customer)_
141311
Are developers expected to have skills of business analysts?
Our business analyst has left the team. We are now expected to do the work which was previously done by the business analyst, and the management thinks that a task which is done in three months by a business analyst can be done in one month by a developer. My experience is in programming only, and I'm not familiar to the business intelligence tools. To me this seems like maybe an unfair comparison or expectation, and might even trivialize the role of a business analyst. Has anyone else encountered this situation? How to deal with it?
141317
C++ 'using': Should I use it or should I avoid it?
I realize there are subtly different semantics for some of these, because of ADL. In general, though: Which one should I prefer (if any), and why? (Or does it depend on the situation (e.g. inline header vs. implementation?) Also: should I prefer `::std::` over `std::`? using namespace std; pair<string::const_iterator, string::const_iterator> f(const string &s) { return make_pair(s.begin(), s.end()); } or std::pair<std::string::const_iterator, std::string::const_iterator> f(const std::string &s) { return std::make_pair(s.begin(), s.end()); } or using std::pair; using std::string; pair<string::const_iterator, string::const_iterator> f(const string &s) { return make_pair(s.begin(), s.end()); } or std::pair<std::string::const_iterator, std::string::const_iterator> f(const std::string &s) { using std::make_pair; return make_pair(s.begin(), s.end()); } or std::pair<std::string::const_iterator, std::string::const_iterator> f(const std::string &s) { using namespace std; return make_pair(s.begin(), s.end()); } or something else? (This is assuming I don't have C++11 and `auto`.)
184528
Is using unit tests to tell a story a good idea?
So, I have an authentication module I wrote some time ago. Now I'm seeing the errors of my way and writing unit tests for it. While writing unit tests, I have a hard time coming up with good names and good areas to test. For instance, I have things like * RequiresLogin_should_redirect_when_not_logged_in * RequiresLogin_should_pass_through_when_logged_in * Login_should_work_when_given_proper_credentials Personally, I think it's a bit ugly, even though it seems "proper". I also have trouble differentiating between tests by just scanning over them (I have to read the method name at least twice to know what just failed) So, I thought that maybe instead of writing tests that purely test functionality, maybe write a set of tests that cover scenarios. For instance, this is a test stub I came up with: public class Authentication_Bill { public void Bill_has_no_account() { //assert username "bill" not in UserStore } public void Bill_attempts_to_post_comment_but_is_redirected_to_login() { //Calls RequiredLogin and should redirect to login page } public void Bill_creates_account() { //pretend the login page doubled as registration and he made an account. Add the account here } public void Bill_logs_in_with_new_account() { //Login("bill", "password"). Assert not redirected to login page } public void Bill_can_now_post_comment() { //Calls RequiredLogin, but should not kill request or redirect to login page } } Is this a heard of pattern? I've seen acceptance stories and such, but this is fundamentally different. The big difference is that I'm coming up with scenarios to "force" the tests out. Rather than manually trying to come up with possible interactions that I'll need to test. Also, I know that this encourages unit tests that don't test exactly one method and class. I think this is OK though. Also, I'm aware that this will cause problems for at least some testing frameworks, as they usually assume that tests are independent from each other and order doesn't matter(where it would in this case). Anyway, is this an advisable pattern at all? Or, would this be a perfect fit for integration tests of my API rather than as "unit" tests? This is just in a personal project, so I'm open to experiments that may or may not go well.
22070
Which useful alternative control structures do you know?
Similar question was closed on SO. Sometimes when we're programming, we find that some particular control structure would be very useful to us, but is not directly available in our programming language. **What alternative control structures do you think are a useful way of organizing computation?** The goal here is to get new ways of thinking about structuring code, in order to improve chunking and reasoning. You can create a wishful syntax/semantic not available now or cite a less known control structure on an existent programming language. Answers should give ideas for a new programming language or enhancing an actual language. Think of this as brainstorming, so post something you think is a crazy idea but it can be viable in some scenario. It's about imperative programming.
189347
Which of these OOP examples demonstrate proper OOP concepts?
I'm still trying to wrap my head around OOP. All of the following examples work, of course, but is there one (or possibly another) that best exemplifies OOP concepts? /** * For the following examples the Image class queries an image * and associated info from a database, which is passed on * instantiation via dependency injection. */ $image = new Image(new Db()); **Example 1:** if ($image->setImageId($id, $size)) { header('content-type: ' . $image->content_type); header('content-length: ' . $image->length); echo $image->getBytes(); } **Example 2:** if ($image_info = $image->getImageInfoByIdAndSize($id, $size)) { header('content-type: ' . $image_info->content_type); header('content-length: ' . $image_info->length); echo $image->getImageBytesByIdAndSize($id, $size); } **Example 3:** $image->setImageIdAndSize($id, $size); if ($image_info = $image->getImageInfo()) { header('content-type: ' . $image_info->content_type); header('content-length: ' . $image_info->length); echo $image->getImageBytes(); }
189346
Does map-reduce transmit the data and executable instructions?
When map-reduce divides a task and sends the data to each worker process, does it also transmit the instructions for how to operate on the data? For example, let's say Google has some huge array of computers that use map- reduce to index webpages. If they wanted to temporarily use that same array of systems to do something else, would they have to reconfigure each system manually, or does map-reduce handle transmitting the new executable instructions to the workers?
86974
Company wants to write custom project management tool, rather than use third party product
At the company I work, we are really wanting to get into the agile methodology for developing software. One thing that I'm not excited about is the fact that management wants us to build a custom project management feature inside the company's Intranet. I think this is a total waste of time. There are many great third party tools available (e.g. Axosoft OnTime) that can do everything we need, and more. For how much development time it would cost us to build our own project management module, we could buy numerous licenses for a third party product. One concern is that, whilst we are writing code for a client, and using our custom Intranet project management module, we find bugs in the module that need fixing ASAP. That means having to stop work on the client code to fix the Intranet. That just puts shivers down my spine. Another worry I have is lack of functionality. This custom module is going to be so basic, that it will just feel really crap to use. That might sound a bit snooty, but for goodness sake, many third party tools are so feature rich, that the idea of having to write our own tool makes feel very uneasy. In fact, I can't be bothered. What do you guys think? I'm going to raise this issue with my boss, since I feel it's such an important topic to talk about. EDIT: Thanks for the great responses, much appreciated. To summarize some of them: **Money** Naturally my boss does want to save money, by not forking out a few hundred £'s for licenses. However, for us to write a custom tool, it will take x number of days, multiplied by approx £500, which is our costs. I don't see the business value in this. Management have mentioned that they want to sell the Intranet as a product in the future, but it's so custom to our needs (and downright basic), that in order to give it to another client, I can see us having to fork a version of the code and rebuild the majority of it anyway. So it's not like we're gaining anything there in reuse. **Features** Having our own custom module means not feature bloat - only the functionality we require will be in the product. My issue is that there are plenty of free, open-source project management tools out there with minimal features already. So even if cost is an issue, we could look into open-source. Again it all boils down to the fact that I don't see the point in writing a project management tool in this day and age. It's a bit like writing your own web browser - why?, what's the point? Although management are asking for this tool, just because they are, it does not mean I'm going to please them and do it just because they asked for it. If something does not make sense, then I will raise it as a concern. At the end of the day, it's the developers who write the code, it's the developers who make money for a business. Thus, as far I'm concerned, the devs have a very big role in deciding how a company should manage projects and what tools are used. "I am Spartan, argh!" :) Hmm, I've not been able to make this question a wiki for some reason, thus I'm going to have to pick an answer to accept. Edit: I had a meeting with my boss today. I told about my concerns on us writing a custom tool from scratch. I even showed him OnTime 2010, plus I ran an OnTime SDK example project which showed we could write our own custom code to interact with the data and do whatever we want. I showed all the lists, features, I could think of. But he wasn't convinced. Un-f@king-believable! :( So we will have to write everything from scratch, knowing full well that we could just buy a tool of the shelf to do the job. There's a lot of swear words I could use right now to describe how I'm feeling!
86972
What does a student do at Microsoft Developer Community
I am studying Software Engineering and I am currently in 4th semester. I was asked represent my college as a Microsoft Student Partner. I refused because it was mostly organizing event. Later I was selected by Microsoft to be in Microsoft Developer Community. I know little about my role, if I have any, and do not know what I have to do or learn for this selection. I know that I was selected because of my GPA. I have been told to excel at Microsoft technologies by my professor and nothing much information is yet made available. Also I have been told that Microsoft has my information! I am asking here in advance because I do not want to get caught in a situation where Microsoft comes asking me to compete at a programming event or show up some relevant work and I am still not prepared for such a event. What is the role or expectation from students who are selected in Microsoft's Developer Community. Can I contact Microsoft directly to ask about it, how can I do that. Also do I get an account or some ID from Microsoft to access some website?
165364
How to process large files in NetLogo?
I am running into problems in NetLogo with large *.csv / *.txt files. The documents can consist of about 1 million data sets and I need to read them (to eventually create a diagram based on the data). With the most straightforward source code, my program needs about 2 minutes to process these files. How should I approach reading such large data files faster in NetLogo? Is NetLogo even suitable for such tasks (as it seems to be designed more for teaching and learning)?
234893
Developing a dynamic site with Node.js
I'm trying to get some pointers on what the best methodology to follow for a web application would be. First, some background: I've built two different APIs using Node.js where Node serves the data to clients using a JSON interface. The clients have both been iOS applications, making heavy use of Socket.io and Express. Now, I'm trying to get into the world of website development- I'd like to be able to create a single-page application that is run in the browser, again using Socket.io and Express. However, I'm hung up a bit on what exactly I should do. * Should I host my site out of Nginx/Apache and use Node as simply a "data" server, funneling data through JavaScript on the client to update the site HTML? * Should I host it all through Node, adding routes for files as I go? * Should I attempt to create some form of "send a command via Socket.io to the client JS to build the page dynamically" type of framework? * Should I do something else entirely? Basically, I'm an iOS and API developer unused to web technologies overall, trying to figure out how best to use what I know about Node's data serving methodology and apply it to a client side web app. I've been reading tons of information online and, while helpful, it seems that everything seems to assume that I know a lot about web development already and am just trying to adapt it to Node, whereas instead the opposite is true: I know about Node but not about web development. I've looked into the MEAN stack, for example, and while I love the concept it doesn't appear (at first blush) that Angular is any more suited to Node than, say, jQuery (I'm sure I'm wrong here- there must be some reason 'MEAN' is a thing). Any input is greatly appreciated!
165369
Is script grouping and minification counter-productive?
On a web page I have 1 script tag that contains all my minified JavaScript (I use SquishIt for .NET). However I see that a few people prefer to load their scripts in parallel using something like requirejs or headjs. I was wondering which is better for performance and whether combining and minifying all my JavaScript is worth the effort?
98477
Problem understanding what "Exporting functions means"
I cannot understand what the following means "ISAPI applications can be written using any language which allows the export of standard C functions, for instance C, C++, Delphi." What is "allowing export of C/C++/Delphi functions" ? P.S. I am very very new.
253872
Is there a pattern or best practice for passing a reference type to multiple classes vs a static class?
My .NET application creates HTML files, and as such, the structure looks like variable myData BuildHomePage() variable graph = new BuildGraphPage(myData) variable table = BuildTablePage(myData) BuildGraphPage and BuildTablePage both require access data, the myData object. In the above example, I've passed the myData object to 2 constructors. This is what I'm doing now, in my current project. The myData object, and it's properties are all readonly. The problem is, the number of pages which will require this object has grown. In the real project, there are currently 4, but the new spec is to have about 20. Passing this object to the constructor of each new object and assigning it to a field is a little time consuming, but not a hardship! This poses the question whether it's better practice to continue as I have, or to refactor and create a new static class for myData which can be referenced from any where in my project. I guess my abilities to use Google are poor, because I did try and find an appropriate pattern as I am sure this type of design must be common place but my results returned nothing. Is there a pattern which is suited, or do best practices lean towards one implementation over another.
98471
Managing DLL files, deployment, and ease of use for the end user
I've been thinking recently about being an end-user who wishes to download one of my own projects and use it on a perfectly average machine. Having an equal background in Unix as well as Windows, I know that package management on Unix makes it FAR easier for the programmer to make it easy for the end-user. If a package is required, it's simply required, and all the required libraries are just there. However, it's a different story on Windows. I have a project that I store on GitHub that is basically a C++ GUI application to interface with the Wii Remote. Nothing much. However, early on, I separated some of my initial project into a separate library project, because I could foresee that it would be useful to do so. The end result of all this is that I have the actual application project on GitHub, which requires both some wxWidgets DLL files and the DLL from my separate library project, which in turn requires a boost DLL file (threading) and the wiiuse DLL file, none of which the normal user is going to have on their computer, much less their PATH. I could take ALL those DLL files, zip them up, and put them with the application, but I'd have to remember to replace my separate library DLL file whenever I did work on the library. Anyway, what is the common approach for dealing with this on Windows? Are there installer tools that can help me with the kind of issues described above?
100975
How to deal with OOP design problems in interviews?
This is a question where I seek guidance from fellow/senior developers to get into my dream company - it's a pioneer in OOP and Agile. I've already failed once to clear an interview. One part I feel most challenging is to come up with a proper Object Oriented design(classes, interfaces, methods, interactions etc.) in a very short time for certain situations like Pacman, Game Of Life and so on. As the problems are unprecedented ones - my approach is mostly to try different things and then make decisions - which they feel is not clear and not what they expect from a developer with 5+ years of experience. I've already studied a few books on patterns, OOP - it didn't help me much and I think it'll take a bit more than that. Could some one please guide on what specifically shall I practice so that I can do better at design problems as above. I want to refine my approach and have a better thought process.
100973
ASP.NET vs ASP.NET MVC
I just started learning the ASP.NET MVC framework and it's very different in architecture from regular ASP.NET development. Transitioning from windows forms to WPF was nice, and seemed a way forward in technology. But, while learning ASP.NET MVC, I don't feel the same, I am unable to convince myself that MVC is better than WebForms. It just seems that they made some tweaks to the already available web framework and adopted the MVC architecture from some other language. Is ASP.NET MVC the step ahead in development? Should I learn and develop my future projects based on this platform and architecture? To me, it just seems like Microsoft is throwing a new architecture just along with WPF or copying Ruby on Rails. WPF seems promising and great while ASP.NET MVC just makes you crumb-some _[sic]_. They have removed the controls, thrown a new control system and data-packaging, and it's all together an extreme change to WebForms. I realize that with MVC you have great freedom in the testing aspect, but I don't believe that this makes a lot of difference in small website or projects. If you ignore the value of testing, What are your takes on this?
138706
Why is C++ still "hybrid"
On a related question, it has been clarified why C++ is not compatible with C in many aspects. However C++ is still a "hybrid"* language. And unfortunately, many programmers still consider C++ as a "C with streams and built-in strings". That results in really bad written code, that it's neither C++ nor C. IMHO, it would be better if the language/compiler forced to some extent programmers to write more elegant code. So is there a rationale for keeping modern C++ (for instance C++0x and future versions) hybrid? * By hybrid I mean that it's up to the programmer to decide if he/she will use: standard strings and streams, classes, namespaces other than the default, etc.
249712
PHP Cache Strategy - Genius or Sheer Stupidity?
I have a shared hosting with limited capabilities. Memcache and mod_cache are not available to me. I would like to implement my own PHP caching method to cache the results of load-intensive SQL query. Using summary tables in SQL is not an option because the query takes multiple parameters that can assume thousands of different values (it's a statistical system). My idea is like this function execQuery($parameter) { $query = "SELECT ....... " . $parameter; //query code has been generated $rand = mt_rand(0,10); //no need to check/save expiry dates,generate cache randomly for speed if($rand == 0) { //execute query normally and generate new cache $result = mysql_query($query); $md5 = md5($query); // the name of the cache file equals the md5 of the query $cache_file = fopen("/cache/" . $md5 ."php", "w"); fwrite($cache_file, $result); // the result is written as php code generating a ready for use result array, code has to be modified I think //return the result } else { //cache will be used $md5 = md5($query); if(file_exists("/cache/" . $md5 ."php")) { include("/cache/" . $md5 ."php"); return $result; } else { //no cache exists, run query normally and generate cache } } } What do you think of this and what are the possible pitfalls? What are the implications of using mt_rand, md5? Do you think they will out-perform a load- intensive query? Are the multiple system file writes worth it (only one write for every 10 hits and can be even increased)? Improvements and suggestions are highly welcomed.
183999
Best organisation for a team application
I'm developing an application based on this structure : /Root /--- Index.php /--- /includes/ /--- /modules/ /-------- /Mod1/ /-------- /Mod2/ /-------- /ModN/ In the future, 2 developers will participate in the project. 1. I have to restrict the access for the developers. They shouldn't get access for the "/includes/" folder. It contains the system's Core. They just will have to code modules. 2. I Will use Mercurial. What is the best "organisation" (repository, lock, permissions...) for this kind of project. A need advices. Thank you :)
4647
Does one's native spoken language affect quality of code?
There is a school of thought in linguistics that problem solving is very much tied to the syntax, semantics, grammar, and flexibility of one's own native spoken language. Working with various international development teams, I can clearly see a mental culture (if you will) in the codebase. Programming language aside, the German coding is quite different from my colleagues in India. As well, code is distinctly different in Middle America as it is in Coastal America (actually, IBM noticed this years ago). Do you notice with your international colleagues (from ANY country) that coding style and problem solving are in-line with native tongues?
93333
Tools to support learning a new business domain
Suppose you just accepted a job, writing code in an industry sector that you've never worked in before. To be effective, you want to immerse yourself in the business domain - to understand the vocabulary, issues and people you'll be working with. Obviously the first step is to find good mentors and reading material to begin to get acquainted with the domain. After that, how do you "learn" the business? What tools, techniques and resources do you use? For instance, is a wiki a good way to capture the domain language?
101008
Why applications don't have constraint-based security?
In almost any security system I've ever seen, what is controlled is that **which person has access to which part**. However, in real life, in many situations, security systems also consider **when** and **where** a person is permitted to do something. For example, **you can drive fast in day** , but **you can't drive fast in night** , or **you can marry a homosexual officially in X** , but **you can't marry the same gender in Y**. Does constraint-based security has any meaning in the context of software. For example, a system can prevent you from entering in certain times of the day (after work for example), or another system can let you stay signed in, only if you type fast enough, or another system can let you enter data, only if you are currently located in the USA (Geolocation API), etc. Why computer security systems don't match real life scenarios?
93334
Terminology question: Generalize Heisenbug
Is there some kind of generalization to the effect called Heisenbug? Because I would like to describe in my documentation how instrumenting a program changes the execution no matter what. In The New Hacker's Dictionary it is defined as following: > **heisenbug** /hi:'zen-buhg/ /n./ [from Heisenberg's Uncertainty Principle > in quantum physics] > > **A bug that disappears or alters its behavior when one attempts to probe or > isolate it.** (This usage is not even particularly fanciful; the use of a > debugger sometimes alters a program's operating environment significantly > enough that buggy code, such as that which relies on the values of > uninitialized memory, behaves quite differently.) Antonym of Bohr bug; see > also mandelbug, schroedinbug. In C, nine out of ten heisenbugs result from > uninitialized auto variables, fandango on core phenomena (esp. lossage > related to corruption of the malloc arena) or errors that smash the stack. Actually this is a general problem, when trying to observe the programs state by instrumentatation (tracing, debugging, etc.) the program execution is changed no matter what. But the definition for Heisenbug clearly says, it is a bug which is masked due to debugging and which disappears. What about bugs, which appear due to debugging - there is no word for that. Is there some kind of generalization, like _Heisenbug principle_?
101006
What is the biggest obstacle ASP.NET MVC ever had for you? Why and how it can be fixed?
What aspects of ASP.NET MVC can be considered bad practices of Microsoft or problematic? In ASP.NET web forms, thing like ViewState, Automatically generated Id and names, single form usage and pattern like this are many times problematic. As no claim should be reason-less, so, it's better to mention why that aspect is an obstacle. Also finding any problem intrinsically means that we like to solve it. Therefore, Please also recommend ways to solve that issue.
93339
Is it legal to show thumbnails on my site of photos that aren't mine?
I would like build an web-application that has thumbnails (around 100x100) of photos. These thumbnails will be linked to the original site (the copyright holder). Is this something that is legal to do? E.g this will be similar to Google Image Search.
93338
JavaScript - Why do frameworks bind to $()
Disclaimer: I know there is no strictly correct answer to this, but I've come across something that does not make sense to me, and I'd like to try to understand it better by seeing what other people have to say on the subject. Anyways, I was thinking about how many different JavaScript frameworks all define slightly different variations of a `$()` function (and also things like `$$()`, `$E()`, and so on), and was wondering why they do it. This is basically what I came up with: **Pros** * Typing `$()` is fast. **Cons** * The name `$` does not imply anything semantically meaningful by itself. * `$` is a property in the global namespace, and thus can only be claimed by a single framework at any given time. * Having multiple frameworks competing over the same global name(s) makes them less easily compatible with each other. * Older code that uses the `$()` function defined in one framework can be accidentally broken by simply importing a second framework that provides its own version of `$()`. * With everybody providing a different version of `$()`, code becomes less readable because one cannot make assumptions about what `$()` is doing without knowing what framework is in use. * Sometimes novice developers get the wrong idea from all the dollar signs flying around, and think that they need to prefix all their function declarations with "$". So it seems to me that the cons far outweigh the pros. Which begs the question, if there are so many negatives associated with claiming `$()` as one's own, why do many frameworks do this automatically? Are there some other benefits that I am missing?
209222
C++ Linkage Languages other than C?
The C++ language allows intermixing of both C++ and C in one source file. For example, extern "C" { struct bar { /* ... */ } } Does C++ or has it ever supported any other "linkage languages" other than C? e.g. `extern "Pascal"` or `extern "Haskell"`
170890
Do ASP.Net Web Forms actually produce ADA compliant HTML? Does the ASP/AJAX toolkit undermine the goal of ADA compliance?
I'm trying to convince my employer to let us use the Microsoft ASP/AJAX toolkit since it simplifies the implementation of many controls. However they have rejected the idea on the grounds that it produces "AJAX code" which is not ADA compliant. However the same employer requires webpages to be written in ASP.NET Web Forms which, as far as I can tell from the source, is very very far from ADA compliance. I am new to both web programming and ADA compliance. My questions are: 1. Do ASP.Net Web Forms actually produce ADA compliant HTML? 2. Will the ASP/AJAX toolkit undermine the goal of ADA compliance?
246474
Data Oriented Design - impractical with more than 1-2 structure "members"?
The usual example of Data Oriented Design is with the Ball structure: struct Ball { float Radius; float XYZ[3]; }; and then they make some algorithm that iterates a `std::vector<Ball>` vector. Then they give you the same thing, but implemented in Data Oriented Design: struct Balls { std::vector<float> Radiuses; std::vector<XYZ[3]> XYZs; }; Which is good and all if you're going to iterate trough all radiuses first, then all positions and so on. However, how do you move the balls in the vector? In the original version, if you have a `std::vector<Ball> BallsAll`, you can just move any `BallsAll[x]` to any `BallsAll[y]`. However to do that for the Data Oriented version, you must do the same thing for every property (2 times in the case of Ball - radius and position). But it gets worse if you have a lot more properties. You'll have to keep an index for each "ball" and when you try to move it around, you have to do the move in every vector of properties. Doesn't that kill any performance benefit of Data Oriented Design?
122629
Why don't more companies hire remotely?
I keep hearing about the desperate recruiting efforts of companies in tech hubs such as SF and NYC. However, every time I'm contacted by a startup I'm told the position is on-site and working remotely isn't possible. Let me clarify that these are tech startups. They should be very comfortable with the idea of using technology to get things done and connect teams together. With the housing market the way it is, many of us can't relocate even if we wanted to pay the higher cost of living. Why are so many companies still stuck in the industrial mindset of butts in seats?
157552
Handling fast growing multi-function services
My team has been developing a web business application for more than a year. It started quite small, but now it is growing bigger and bigger. I think it's time for refactoring. Looking at the code, I see the below situation: IUserService * addUser * deleteUser * updateUser * addMember * deleteMember * updateMember * registerMember * deactivateMember .... * getExpiringMember * nominateMember Generally saying, there are about 50 functions for more than 2500 lines of business logic. I once read "Clean code", it states that there should be no more than 200 lines for a normal class. Our code violates this requirement seriously, and I'm beginning to feel the hardship of code management. The simple solution might be spliting this service into many other services, but it is not feasible/reasonable: 1. This service class serves as an API point for mobile client, so that every change on Interface (even renaming) requires change for the client as well. I don't want to spend the precious time of our team if not for good reason. 2. I already split a part of this service into another classes, but that class (RegistrationService) also grow quite fast and reach 500 lines of code recently. 3. More and more business logic request recently, and these services are going to grow even more. I'm afraid that at some point we will lose the tracks if a team member who manage a specified service got retired. Is there any way I can make this service more manageable? Any Design Pattern, Refactoring technique that I can apply? I'm still not experienced enough in this field... any suggestions or directions are welcome.
138429
Good resources for advanced C++ topics?
What are some good resources for advanced C++ topics. I know C++, but have little knowledge of threading, advanced meta-programming and inner-workings of meta-programming and I'd like to get better.
185697
Are chained methods that require only one parameter per method equivalent to currying?
I've been toying around with Ruby lately and I found myself wondering if in pure object oriented languages (and even those that are not pure) making methods that take only one parameter and then get chained together is equivalent to currying in languages with a functional style? If not, why not? I'd appreciate a detailed, even rigorous answer on the subject.
135737
Does programming in general become easier to read, write and understand as you gain experience?
I'm a beginner in programming and I've been reading books, studying, reading articles, and whatnot. I'm getting great results since I've started learning programming, and when I was a beginner I used to think I knew everything about programming, but as I learned more I realized how difficult this field is (In fact all fields are difficult, but that's not the point). Nowadays, I've written functional software and I've learned the BASICS of 3 languages and I'm intermediate in just one language. When I look at advanced things like MYSQL, or OpenGL programming, or even visual studio C++ code it gives me headaches, and even when visualising HTML source code of many websites (Most source codes on websites, seen by google chrome seem very messy and unorganized) it makes me confused to the very limit of my brain. It all seems simple at first, yet when looking at these advanced things it just makes me wonder how can one learn so much. The question, in a nutshell, is if these things become clearer to a programmer as he advances in his career. Do complicated topics as the ones listed above (OpenGL, MySQL, advanced html sites) become easier to read, write and understand as you learn more, or does it just get more complicated as you go by? How can you combat this feeling that you're an ant in the programming world and this stuff is the foot about to squash you?
140950
Is it a good approach to rely on 3rd party software ( not library )?
We have program( written in VB ) using a call to a winzip program or 7zip command line tool to zip some files. Once I accidentally uninstall the winzip on my computer and making one of our program( created by the programmer already left ) crashed. So we cannot uninstall the winzip program. Now we am writing another program with java + windows batch file. And I've come to a point which I need to make a decision between 1) using a call to external tool ( for example 7z ) for gzip in windows batch file, 2) or I make a java program to gzip the file. Obviously a external tool such as 7z is convenient and we can avoid some extra coding with java. On the contrary, if 7z is uninstalled accidentally, our program will crash. What do you think?
135730
When business rules affect presentation in MVC
The MVC design pattern is supposed to led itself to separating business rules from presentation. But sometimes business rules AFFECT presentation. What is the best way to deal with this? Is that when a ViewModel should be used? For example, going back to my non-existent Library application, a librarian is scanning returned books. The system indicates that a book is late, and applies a fine to that patron. Certain employees may have security to override that fine based on certain conditions. The presentation layer of my library application will need to let the employee set the fine to 0, or click a button to override the fine. But employees who do NOT have security to do this should see the fee as either a disabled input or maybe read only. _Note that security may not be the only business rule_. This is just an example. For example, my application may have configuration information set up somewhere that causes a field on a screen to become unnecessary, etc. While the code could just let anyone change the fine and then show a validation message, that's not a good user experience. What is a good practice to accomplish this? The options I can think of (using ASP.NET MVC) are: 1. Have the view itself check the business rule and disable or enable the field. 2. Use a HTMLHelper function that implements the presentation for the fine field, and have that helper function check the business rule. 3. Have the controller check the business rule and use a different view. 4. Have the controller check the business rule and set a property in the ViewBag that indicates whether the field is enabled. 5. Use a ViewModel checks the business rule and set information indicating that the field is enabled. Options 1 & 2 cause the presentation layer to have to do business rule validation, and that muddles things. Option 3 will cause duplication of effort in that now you have two views defined. Option 4 & 5 requires the presentation layer to know that the field COULD be enabled or disabled, but not WHY. I think I like 4 or 5 best. Our there other options I'm not thinking of?
125163
What is the starting point for Ubuntu app development?
I'm thinking of developing software for Ubuntu and other related Linux-based distros (like Linux Mint). But currently am at a loss for where to start. Would learning Python be enough/good? And what are the other things I should know about before starting this kind of developing? And will I be able to publish my apps to a software store like Ubuntu store even if I am from outside USA/UK? If not, what are the options I have to make my apps reach the audience? * * * As a lot of users had asked, I intend to build applications only for Linux (I'm thinking of Gnome) that will be a bit business and enterprise oriented. Currently I am an Oracle certified Java developer in J2SE and J2ME. And I know Python a bit.