instruction stringlengths 34 19.9k |
|---|
List.ForEach(Console.WriteLine);
List.ForEach(s => Console.WriteLine(s));
To me, the difference is purely cosmetic, but are there any subtle reasons why one might be preferred over the other?
|
Earlier I asked a question about "Entity Framework and layer seperation" and found out that some people use a ViewModel to show their data in the UI.
For example if we got a "Person" table and an "Address" table and I want to show a combination of the two tables. I would then create a ViewModel, lets call it PersonAddr... |
I am quite a beginner in code testing, and was an assert whore before. One thing worrying me in unit testing is that is often requires you to make public (or at least internal) fields that would have been private otherwise, to un-readonly them, make private methods protected virtual instead, etc...
I recently discovere... |
As far as I know, the terminology comes from how the inheritance hierarchy is traditionally displayed, with the extending types at the bottom, and the parent types at the top.
This is a bit pointless, unless you feel like calling the following leftcasting and rightcasting.
I am not looking for opinions why the termino... |
I am looking to teach myself some web programming, but I am not sure how I can experiment with an actual website. Are there sites that host platforms for these purposes?
|
I am just starting a new position and using svn rather than git (my favorite).
With svn if there are any conflicts will I see them after an svn update or after an (attempt) to svn commit?
In other words will an svn update merge remote changes into my current (uncommited) working copy?
I want to be sure not to mess up... |
From the accepted answer to "Why is Lisp useful?":
Wartiness. The real world is messy. Pragmatic coding winds up having to either use or invent messy constructs. Common Lisp has sufficient wartiness that it can get stuff done.
This thought has occurred to me, too. I'm currently developing an application whose backe... |
Assuming a comment won't fit (or can't go) on the line it applies to, should one write the comment before the code or after?
Well, wherever future readers will best understand the comment's scope. In other words, wherever most programmers/scripters put such comments.
So where do most programmers/scripters put a comment... |
I'm on a team that is currently using Scrum, and we're considering adding pair programming to help improve the cross-functional skills of the team, as well as help reduce defects with a "two heads are better than one" philosophy.
On our team, each team member typically signs up for a full workload during sprint plannin... |
I write business applications for a living. Often, for whatever reason, an interviewer asks me to write up a program to solve some kind of game like problem. I find this to be an inappropriate question for two main reasons:
Games often deal with constructs that are rarely used in business dev. E.G. Multi-dimensiona... |
After writing my billionth null check in Java code, I started wondering why the ability to null check method arguments wasn't already built in to Java. For example, for some methods, I want to throw an IllegalArgumentException if some (or all) of the arguments are null. It would be great if I could mark up the code, a... |
For the project my team and me are working on we often find that we need large pieces of scaffolding code. Creating domain objects with correct values, setting up mocks for repositories, dealing with the cache,... are all things that occur commonly throughout the tests. A lof of times we're working with the same basic ... |
Sometimes, when I plan to create a program using this architectural pattern, I've got a lot of difficulties when I'm in the View Model phase.
I'm using WAF Framework to develop this architectural pattern. I'm a still a newbie.
Before you start, do you create all the UML design or do you use another tool to help you? H... |
We develop a Windows client application that locally caches a user's credentials for connecting to our server application using the Windows Credential Management API.
Our caching logic works in the following way:
The user opens the application and selects a server in the UI. It then queries the server for authentic... |
Should the expected results of a unit test be hardcoded, or can they be dependant on initialised variables? Do hardcoded or calculated results increase the risk of introducing errors in the unit test? Are there other factors I haven't considered?
For instance, which of these two is a more reliable format?
[TestMethod... |
Given Google's shift towards a stronger focus on page markup data, how do the data formats used in Schema.org work alongside those for Microformats? How do these (and other specs) compliment each other and which should be used in preference in different situations?
Edit:
It seems from established content on the subject... |
What are the pros and cons of generating dynamic pages with javascript vs doing it in PHP?
As an example, I want to display certain records from some database in a table and I'm considering the following approaches:
Use Javascript to get some response in JSON from some PHP page, then dynamically build the table in Jav... |
So many times on this site I see people trying to do things like this :
<script type="text/javascript">
$(document).ready(function(){
$('<?php echo $divID ?>').click(funtion(){
alert('do something');
});
});
</script>
I don't think that this is some sort of pattern that people naturally fall int... |
I'm really new to this sort of stuff; my background is in C# mainly. Could anyone point me in the right direction?
I need to set a script to automatically parse some JSON into an SQL database whenever the data has been updated on the server.
I look at this file first which returns the file location for the data and the... |
Currently, I've learned the following in Java SE:
Logical Operations
Loops
Inheritance
Polymorphism
Abstract Classes
Interface
I'm currently learning Strings, Characters and Regular Expressions. What are things that I should learn before proceeding to Java EE?
|
Back in the day, there were a lot of academic programming languages (okay, maybe not a lot, but it seems like there were more than today). I distinctly remember spending time in both high school and college learning languages like Basic, Ada, Pascal, Prolog, Haskell, Scheme, and Turing. While it's unfair to call all th... |
I am trying to build a system for my company which wants to check for unusual/abusive pattern of users (mainly web scrapers).
Currently the logic I have implemented parses the http access logs and takes into account the following parameters to calculate the potential of a user being a scraper or bot:
It checks v/s HTT... |
I'm about to start writing a library to support machine learning algorithms (decision trees, ANNs, Bayes nets, etc.), and I'm planning on making this a very general library. By this, I mean I want to be able to plug this module into as many languages as possible.
To clarify, here's why I've started writing it in C++ (... |
I need some help with a correct design.
I have a class called BufferManager. The push() method of this class reads data from a source and pushes it to a buffer repeatedly until there is no more data left in the source.
There are also consumer threads that read data from this buffer, as soon as new data arrives.
There i... |
What are the best tools / frameworks / libraries available to implement and run algorithms on graphs?
In particular I need a tool that can load a set of nodes, edges and values assigned to these edges and then allows me to perform operations on them.
I already found R but I'm wondering if there is a more "programmer fr... |
My coworkers tell me there should be as little logic as possible in getters and setters.
Yet, I am convinced that a lot of stuff can be hidden in getters and setters to shield users/programmers from implementation details.
An example of what I do:
public List<Stuff> getStuff()
{
if (stuff == null || cacheInvalid())... |
So, I'm trying to teach my much younger cousin a little bit about programming. My initial thought was something like Scratch or Alice, but there were a few downsides to that.
Everyone seems to be really in to game programming and developing video games (because everyone loves playing video games, and as far as pla... |
I have some software application managed using Git. I just released a new version 2.x which I plan to maintain on the long term (bug fixes mostly). In the meantime, I would like to start working on version 3.x. What is the recommended way to manage this? Should I create a branch for version 2.x and have the 3.x develop... |
My programming environment / language (gamemaker) gives the source files as "XML-files". Each resource has its own XML file. Where the properties (code is a property) are stored inside xml tags.
Is there a source control which can handle these? With subversion collisions don't seem to be handled correctly: when a colli... |
Following is the Url for my website, http://www.price-tag.org . If you visit any category link, you will see it performing very slow. For example, if you visit http://www.price-tag.org/Store/Section/Computers , you will see a lag before the sub categories are loaded.
This is just the very first phase and i have just a... |
I'm still a relative novice with OOP, so I am still trying to understand some of the best practices for how to design "good" objects. I know this question is probably a rather subjective, which is why I am here rather than on stackoverflow.
I am designing an object that will have 20 separate string properties, none of... |
We have a unique situation (at least for me, first time seeing this).
We have a web form where accountants can fill in requests and that part is taken care of. But after their login we redirect them to a third-party website where we need more information from them. The process is crazy right now since we have to give ... |
In my current project, we have an ongoing discussion about whether or not it's a good idea to include an artifact representing a web page in an UML sequence diagram for a web application, making explicit which page starts a business interaction.
I think it's a bad idea to include a web page, for me a sequence diagram s... |
I've just started my first IT job in a team with two developers (junior and senior), a project leader and an architect. My role is not yet completely defined and I said I'd be ok with both programming or testing. For now they put me on use case analysis since the PL says that it would leverage my analytical skills (I'm... |
I've dipped my toes in C++ programming but I haven't actually delved into it. I want to know if I actually need to learn it or any other languages before I go to college for Computer Engineering or am I just going to learn it at school anyway?
|
I understand this is a very broad question, but I have worked with various aspects of this problem individually and am struggling to bring all the concepts and technologies together.
I'd like to specify that answers should include these technologies:
C#
MVC 3 w/ Razor
Javascript w/jQuery
Anything above and beyond ... |
So my friend's boss brought in four junior candidates with some work experience, she is one of them. Her manager wants them to be experts on the subject matter of tomcat in a matter of two months in order to justify them as billable to other clients as a technical trainer.
My biggest concern is this, they only have a y... |
I am considering investing time to learn Hadoop and it's related technologies. The problem is that my current day job will not be using Hadoop any time soon and even if I learn from books, blogs personal projects I will not have much to backup when I actually need to show that I have Hadoop experience.
So while contin... |
I'm doing the same. When there is something "to-do" in my code, I write //TODO .... But I'm curious to know when this started and if there is a reason for writing "to-dos" in all capital letters?
|
Prior to actual question, let me summarize what I'm trying to do. I plan to implement a small, JIT-enabled, register-based VM runtime. Instead of making a proper compiler (which is hard IMO) for a super-fancy home-brew language, I decided to implement a binary translator from a appropriate bytecode (much like Dalvik VM... |
I have a graph with an Eulerian cycle and no Hamiltonian cycles. I would like to divide this graph into simple cycles.
Edges may not be repeated in simple cycles.
How can this be done?
|
I've been hearing about using the dependency injection over Singleton for my colleague. I still can't make out if it they are two orthogonal patterns which can be replaced with one another? Or is DI a method to make the Singleton pattern testable?
Please take a look at the following code snippet.
IMathFace obj = Si... |
I have 3 years experience in ASP.NET with C# and now I am learning Silverlight with Beginning Silverlight 4 in C# book.
As I have completed my first 4 chapters, I am getting the feeling that Silverlight is just about creating RIA which can also be done with Flash.
What is a scope of Silverlight for a C# programmer?
|
I would like to know how I can use a switch statement with enum values for the following scenarios:
I am making a small program for a flight reservation system. The program is meant to enter certain details about the passenger. The program also restricts the user to choose destinations other than the following 3 destin... |
If you have a single property that is relevant across a full project, but you should logically have only a single representation of, how would you represent this? In my case, I am developing a simple drawing app where the user can select a colour. This colour should then be available to all the pen/shape classes in th... |
I have been looking for Time Series models over in SO, but I figured this place was the best site to actually ask the question.
I am wondering what is the "best" way to handle Time Series in .Net.
First, I would define a Time Series as a mapping of different DateTime with a single value of type T.
The value can possib... |
In the current semester at the university we are working on OOP with C++.
I would like to understand the difference between a pointer and a reference operator.
The differences that I understand are:
1. Cannot change the object that the reference variable is binded to
2. we can use the reference variables to refer to ... |
In Knuth's Fascicle 1 on MMIX, the "Memory and Registers" section on page 4 states:
"thus if x is any octabyte, M[x] is a byte of memory."
and
"thus if x is any byte, $x is an octabyte."
How can x be an octabyte (64 bits) and M[x] be a byte (8 bits)? Conversely, how can x be a byte and $x be an octabyte?
|
Ok, already up front, I'm going to tell you, that this is a bonus task for Data structure course I'm taking. That should take care of all the questions whether or not this is for a homework.
Route creator
I have a task, where a company has to create a route for a given data set. The data set can be input for every ope... |
For studying advanced topics, what's the better and nearer to complete approach? Can books cover what's in research papers, journals or those ACM transactions, or Springer's LNCS? Or reading research papers is indispensable for getting advanced? If we can't depend on books for information, how can a learner know of wha... |
I'm starting to tinker with process forking, just to get a feel for it. I thought I'd write an example where work is distributed among child processes and the results handed back to the parent; this way, it could be run in parallel on several processors.
In my first attempt, I'm forking in a loop, which means that each... |
It seems less common with newer websites, but many websites I need an account on (like for paying bills, etc.) prevent me from creating a password with spaces in it. This only makes things more difficult to remember, and I am aware of no database or programming restrictions on spaces in passwords, encrypted or (heaven... |
I have a series of arrays which represent file system paths, so each next value is actually a directory deeper, for example:
var a1 = ["Desktop", "Pictures", "Summer 2011"];
is the equivalent of
Desktop
|-Pictures
|-Summer 2011
I'm trying to find an elegant way to:
Flatten/merge all the different arrays I have to... |
What are some good practices in debugging multiprocessing programs in Python?
|
I have documents that contain an arbitrary amount of key/value fields. The value can be a primitive or a list.
Completed documents all have an associated state (such as passed, failed, halted, etc.).
Using completed documents as training data in a machine learning algorithm, my goal is to pass the system an incomplete ... |
Periodically, I wonder about this:
The short-circuit OR would always return the same value that the unshort-circuited OR operator would?
I expect that the short-circuit OR would always evaluate more quickly. So, was the unshort-circuited OR operator included in the C# language for consistency?
What have I missed?
|
When I first started learning Android, I found a fantastic series of YouTube videos by Marakana that stepped through building a Twitter clone. It walked me through all the steps and thus explained to me the basics, common libraries, best practices, resources, etc. Looking over an expert's shoulder while building a prac... |
What visualization method would you recommend for event driven programs? Are there industry standard diagrams, such as flowcharts?
|
Some languages (mostly ones made in the last 2 decades or so) can now not only run (after some compilation step or directly) on several platforms, but also can be compiled to run on several virtual machines.
For example, take Scala. Pure Scala code can be either interpreted , compiled to run on the JVM (Java Virtual Ma... |
Using C#, I have been doing multithreaded development for about 5 years, and consider myself quite proficient (I wrote my own lock-free queue and task parallel framework before Microsoft made TPF).
However, I find it incredibly difficult to find information on practical multithreaded system design patterns anywhere. Th... |
I'm a bit of a neat freak and tend to keep my projects by cleaning references and usings in each class to keep only what's actually used.
What other argument could I make (besides calming my OCD nerve) of keeping to the essentials? I'm thinking mostly system references, any reference to custom work will bring its lot o... |
I am seeking some ideas for how to build and install software with some parameters. These including target OS, target platform CPU details, debugging variant, etc.
Some parts of the install are shared, such as documentation and many platform independent files, others are not, such as 64 and 32 bit libraries when these ... |
EDITED FOR CLARIFICATION
In the past, I have seen a whole manner of resolutions and fudges. Some really stand out. One particular resolution that I initially thought of as a fudge possibly deserves a category of its own.
It could be considered a hack or a pattern, as a design pattern is just a piece of reusable code. ... |
I was reading another thread where a guy asked about C++ books for beginners, and one of the programmers answering wrote this:
Some warnings: avoid all books that present an "hello world" stating with
#include <iostream.h>
I opened my C++ book and sure enough it included the iostream header like the example above.
... |
In a previous question, I asked about finding a route (or path if you will) in a city. That is all dandy. The solution I chose was with the A* algorithm, which really seems to suit my needs. What I find puzzling is heuristic. How do I find one in an environment without constant distance between 2 nodes? Meaning, not ev... |
Warning 1 The field 'MCS_SPS_School.Fees.DiscountAmt.rtvalue' is assigned but its value is never used G:\Jagadeeswaran\Nov 17\MCS-SPS School\MCS-SPS School\Fees\DiscountAmt.cs
Warning 2 The field 'MCS_SPS_School.Fees.DiscountAmt.dt' is never used G:\Jagadeeswaran\Nov 17\MCS-SPS School\MCS-SPS School\Fees\Discou... |
I have been recently working on Objective C and came across use of Delegate pattern.
I had seen most of the common patterns theoretically in Java, thanks to the Head First book.
But at times looking at differences in Dynamic and scripting languages I get confused about need of certain design patterns.
For example lets ... |
I whipped up a demo on Friday before the holiday weekend of using the Model-View-Presenter pattern (the "Passive View" version, I believe) that I want to show to my co-workers this week as an example of how to architect our WebForms application moving forward and get maintainable, clean code. We currently keep almost ... |
I run some basic performance tests in C# on simple methods, but there are also legacy monolithic pieces written in C# as well as other languages. So, when testing, I often end up working with a black box that takes a number of parameters. I can write code to get a bunch of sample data out, but making sense of it (e.g. ... |
I need to come up with a custom recursive object locking mechanism\pattern for a distributed system in C#. Essentially, I have a multi-node system. Each node has exclusive write permissions over n-number pieces of state. The same state is also available in read-only form on at least one other node. Some writes/updates... |
As anyone who has used Smalltalk knows, one of the main benefits (other than a late-bound language that discourages many poor practices), is that the system is totally transparent and reflective, which makes understanding APIs and existing code easy, and locating functionality pretty easy.
Is there anything that create... |
Let's say I have a page, accessible by several people concurrently, that lists information that must be processed in some way by the user, after which it is either marked as "completed" and effectively disappears, or is left unprocessed and thus left in the list to be tried again later. What is the best way to ensure t... |
I am a contractor to a big company. Currently, there are three developers on the project, myself included.
The problem is the other 2 developers don't really get it. By "it" i mean the following:
They don't understand the best practices for the technology we are using. After 6 months of me and others giving them ... |
I am currently working on a solution written in JavaScript. I plan to release two versions:
For free: the lite one with base options, which is plug and play (it just works when loaded in the page)
For a subscription fee: the full version that has more options and requires support
I am wondering which license(s) would... |
I am a graduate student in aerospace engineering. A lot of my Master's thesis has been on developing an OOP software architecture in MATLAB to facilitate control of Arduino-based vehicles (blimps, cars, quadrotors, etc).
All my code is heavily documented, but my thesis itself needs to be more than a reference of every... |
What is the suggested way (specifically in the open-source world) for the package name when porting a library.
Say I am porting someone else's library where they have used a reverse domain name stucture for there package name, so there library package name was some thing like com.therename.thelib. What should I do if I... |
One of the most popular questions on stackoverflow.com is this one:
https://stackoverflow.com/questions/4025768/what-do-people-find-difficult-about-c-pointers
Many of the answers seem to gravitate toward the fact that students often don't get a good understanding of what is physically going on when code executes... the... |
I'm going to be developing an Intranet site for my specific plant, and our company standard for web-development is IIS + ASP.Net + VB.Net + Microsoft SQL Server (note that we have about 10+ plants). The Intranet site will only be used by my plant, and I'm the only one who will support it. I'm much more proficient with ... |
We are going to start using Git (not using it yet), and I want to define the workflow.
We have 4 teams at 4 different global locations, developing together the same product. Each team owns a part of the product's code, but sometimes they also have to make changes in the code owned by other teams.
Is there a recommendat... |
I am staying in an environment, where people believe:
Java generics are the feature exclusively used for library writing
and not for the real coding.
C++ is an OO programming language; template is an optional and
avoidable feature
Though, these people rely highly on the libraries written using generic programming (e.... |
This question was inspired by this one. While that other question was deemed localized, I believe the underlying problem is something that is extremely common in our industry. I know there are some developers, who will read this and think I'm making this stuff up and then they might reply how everyone cares about their... |
Is it a good rule of thumb to always write code for the intent of re-using it somewhere down the road? Or, depending on the size of the component you are writing, is it better practice to design it for re-use when it makes sense with regards to time spent on it. What is a good rule of thumb for spending extra time on... |
Possible Duplicate:
Elegant ways to handle if(if else) else
In a function where there are multiple returns, what is the best style to use?
This style, where there is no 'else' because it is frivolous and you think it is more concise?
f() {
if (condition) {
return value;
}
return other_value;
}
... |
Possible Duplicate:
How do you manage extensibility in your multi-tenant systems?
I asked this on StackOverflow, but I thought it might be more appropriate for Programmers.
I've got a few big web based multi-tenant products now, and very soon I can see that there will be a lot of customizations that are tenant spec... |
I would like to launch an in-house user group/forum for the developers in my company, but I'm not sure how to get started.
We have several teams of developers spanning many technologies and levels of experience. I envision this as an opportunity for all of us to come together and share techniques, best practices, less... |
I'm looking for an algorithm to either use or as a jump point for load balancing.
Environment:
We have ~7 job types that can be scheduled at any time by our users. Some jobs are fast, others are slow (lot of data processing). We have a single instance of a "job processor" that will discover jobs that have been schedul... |
Just browsing the google maps source code. In their header, they have 2 divs with id="search" one contains the other, and also has jstrack="1" attribute. There is a form separating them like so:
<div id="search" jstrack="1">
<form action="/maps" id="...rest isn't important">
...
<div id="search">...... |
I am looking for examples of general purpose algorithms (meaning non-graphics related) that have been proven to run an order of magnitude faster on a GPU than on a CPU. I will use these examples to think creatively about other algorithms that I could implement on a GPU.
|
I'm doing some high-level sketching of a system that will require users to register, when they do they get an account and can invite others to that account.
To be clear, an account would be similar to a private workspace, and the users will belong to that account and cannot exist outside of that account. The users will... |
I was checking out what version of Firefox I'm using and it was telling me that I'm on the 'release update channel'. So I googles "Update Channel" and I finds this seemingly antiquated MSDN article which has a confusing bit of ASP.NET pre-processed into the article to give you the sense that you both should not use th... |
I've got a few big web based multi-tenant products now, and very soon I can see that there will be a lot of customizations that are tenant specific.
An extra field here or there, maybe an extra page or some extra logic in the middle of a workflow - that sort of thing.
Some of these customizations can be rolled into th... |
I'm looking for software to organize and maintain projects internal documentation, specification, requirements, etc. Currently we store all documentation as lots of MS Word DOC files in a source control repository, which gives us version control, and that's nice. But you can't search this information, create links betw... |
What do I mean by high-level plan? The kind of plan that outlines product's functionality that needs to be developed but not going into too many details that are done afterwards. This kind of plan helps deciding functionality development order (priority) or even eliminating non-necessary ones. A great high level plan i... |
I am using curl_multi_exec to process over 100K requests. I do 100 requests at a time because curl_multi_exec can only handle 100 requests at a time to eventually get to 100K requests. We have added multiple servers to this system to spread the load [we are using load balancing]. What is the best way to have curl handl... |
I'm new to PHP and MySQL and I've only seen posts related to this on Zend and ASP so I'm looking for some advice to point me in the right direction for a LAMP project.
I'm putting together a webform for a project of mine that logged in users will access to upload a submission. Each user will reuse previously uploaded f... |
I'm interested in machine learning in relations to the stock market (predicting future values of stocks etc).
What topics would I need to learn - e.g. what branch of AI to look into etc?
and what libraries/tools do I need?
|
I wrote the following a while back, but I've come to review it recently, and now don't think it's good design.
The design is for a kind of modular database layer using Entity Framework 4. There is a single database object which loads (lazily) entity framework contexts from external libraries in a specified location, an... |
Let's say that I want to show a form that represents 10 different objects on a combobox. For example, I want the user to pick one hamburguer from 10 different ones that contain tomatoes.
Since I want to separate UI and logic, I'd have to pass the form a string representation of the hamburguers in order to display them ... |
I was developing a WindowsForm application in C#, with 2 forms. Regardless of what they both did specifically I needed to access values in form2 and send them to form1 and vice versa. For this to happen I found someone talking about constructor overload and it worked for me as I explain in the code.
Form1:
namespace mi... |
I am programming in Windows Forms and MySQL.
If I declare this in the program, I can use the connection and command objects in the whole .cs page:
MySqlConnection connection = null;
MySqlCommand command = null;
MySqlDataReader Reader;
But if I write the code below, connection and command objects are declared twice:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.