instruction stringlengths 34 19.9k |
|---|
There is C# code, VB.NET code... Can I also say ".NET code" as an umbrella term that covers all the languages you can use with the .NET framework?
I've seen people using it as well as people saying it shouldn't be used...
|
The official tutorial uses the term symbol table in a few places where I would expect the term namespace.
1. Defining functions
The execution of a function introduces a new symbol table used for the
local variables of the function. More precisely, all variable
assignments in a function store the value in the loca... |
I have a MVC architecture, and I have the basic views completed. I now need to add the first user tutorial mode into the project. I don't want to add checks for first user state in all the views that need it, but the only alternative I can think of is to subclass everything and use those subclasses on first open. Is th... |
How do I correctly include copyright statements for included libraries?
I have a program that uses libraries which are licensed under the GPL and MIT (either jointly under both, just only MIT) licences.
How do I specify this at the top of a combined and minified file?
I have this currently:
My Program (GPL)
Copyright ... |
Recently Windows Azure Storage SSL certificate unexpectedly expired and since a lot of dependent services defaulted to "refuse to connect to a site with expired SSL certificate" that became a serious problem.
Now the SSL certificate of any web service can be retrieved by anyone at any time for validation. The picture i... |
In order to sign an application for the Apple App Store, we need to create a certificate by saving a certificate request file from keychain and then upload it to the Apple store.
I was wondering, what does this certificate request file contain?
Does the certificate contain any information (like a finger print) about t... |
My manager has tight deadlines to meet.
The current project I am working on is currently on schedule, but I've noticed a couple of quite significant areas in the code that are really badly written. (Bits of code get called two or three times, when they only need to be called once.)
The problem is, as far as my manager... |
I've often come across the situation when the same mistake is made in many places in an application. For example, in a web application when the user creates an item and clicks the Add button to save it. If they click the button several times, multiple items are added instead of one because UI wasn't blocked and backend... |
I have a private method in my test class that constructs a commonly used Bar object. The Bar constructor calls someMethod() method in my mocked object:
private @Mock Foo mockedObject; // My mocked object
...
private Bar getBar() {
Bar result = new Bar(mockedObject); // this calls mockedObject.someMethod()
}
In some... |
Lately I am seeing quite a few application development job ads asking for experience with this or that Java EE server. I can understand this if it is for a server administrator, however I find it stupid and ridiculous to ask for some one with a specific server implementation experience when the job is Java software dev... |
I am integrating with a Financial Management System (FMS). I have a class that prepares a set of objects (each of these objects is called a TransactionEntity). These are then passed to the FMS.
I give particular importance to correct terminology. What should I name this class that prepares the transactions? I am thinki... |
I have a function evaluate() that parses a String for some variables and replaces them with their corresponding value:
public String evaluate() {
String result = templateText;
for (Entry<String, String> entry : variables.entrySet()) {
String regex = "\\$\\{" + entry.getKey() + "\\}";
result = re... |
I've been reading a bit about Literate Programming recently, and it got me thinking... Well-written tests, especially BDD-style specs can do a better job at explaining what code does than prose does, and have the big advantage of verifying their own accuracy.
I've never seen tests written inline with the code that they... |
Do iterative methods such as are commonly found in modern languages such as C#, JavaScript, and (hopefully) in Java 8 reduce cyclomatic complexity's impact on understandability and supportability of code?
For example in C# we might have the following code:
List<String> filteredList = new List<String>();
foreach (Stri... |
I am working on a user driven cms site. Think of it like stack overflow. The users can write posts, and publish them to the web. I am using a WSGI editor to generate the content.
One of the features I am implementing is the ability for users to comment on particular section of a user post. I am trying to think of a ... |
I'm trying to name a component that will be capable of both reading from an InputStream (file or otherwise), and writing to an OutputStream; thus serving both as a Reader and as Writer.
So far the best I've come up with is:
ReaderWriter
IOStreamManager
StreamManager
Any good ideas?
|
In my current role as a software developer in a Java/Spring/Hibernate/JSF shop, I am sometimes asked to develop large-scale web apps with many interfacing systems and/or large databases as well as small-scale web apps with low traffic and/or simple databases. To accommodate this variation, I would like to have 2 techn... |
I have a tree:
a
/ \
b c
/ \
d f
/ \
g h
And the pattern:
x
/ \
y z
/ \
q p
As output I would like to have:
x: a
y: b
z: c
q: d
p: f
and
x: b
y: f
z: c
q: g
p: h
Is there any algorithm I could look at?
|
I need help understanding what user stories should look like for a web testing framework we are building for our organization's QA department. We are trying to run this project using Scrum.
The product will have 3 layers:
utility classes to make working with underlying web automation tool easier.
a page-object API lay... |
Today I experienced a first in a technical interview. The candidate refused to use the whiteboard to solve an algorithm question, as I requested. There was no sort of disability at play or anything (outside of nervousness). He simply said that he is uncomfortable using a whiteboard for difficult questions.
Oddly enough... |
I came across below style of writing if statements in C#, on msdn code examples. Usually when I write if statements, the conditions I would write `(Customer != null)
I want to know if there is any difference/gain in writing statement like below:
Customer customer;
if (null != customer)
{
// some code
}
Or
if ("" !=... |
I'm building a parser using a parser combinator library. I need to keep track of where AST nodes started and ended in the textual input -- line and column numbers.
How is this problem approached and/or what are strategies for dealing with it?
Clarification: I'm asking about how/when/where the line and column data is... |
Let's say we're designing a video game. We have some sprites on the map and we want to call some method of the particular sprite at some particular position.
We are using one broadly-known C++ framework. It has an GraphicsItem class, and ALL our sprites are derived from it. Now, framework has a method to get a pointer ... |
My boss found out I'm not as smart as he thought.
An example from my experience:
I'm a junior programmer, and I work in a team of two, my boss (senior programmer) and myself.
I was tasked with developing an internal web-application for the company we work at. I wrote the back-end to the front-end (the database design w... |
In general, should I use some sort of convention for structure names which is distinct from other type name? I was thinking about this when my professor started talking about structures.
I had the following discussion with myself, and since I do not want to come to any unreliable conclusions. How would you answer the q... |
As a Lead Programmer my responsibilities include calculating the deadlines of the projects.
To do this I have discussion with related team players and calculate a deadline estimation. Sometimes, I got a scared voice from CTO saying that the estimated deadline is too much. Then I have to shorten the deadline. With a sh... |
We have a client-server application with a thick client (GWT).
There are client-side MVP presenters (MVC controllers) which hold references to some objects viewed in the GUI. Some user actions cause these objects to be updated on the server. After that we can send updated objects back to the client and reassign them to... |
I am working on a website (C#, ASP.Net MVC 3) which reads some RSS feeds from multiple sources and put feed title and summary in a database table(Sql Server).
What I want to do is:
Put an algorithm in place which can relate multiple feeds. For example if each feed is a news item, I would like to relate all news which ... |
As part of my work on a legacy C# application I've come across a novel (to me) use of an interface & concrete implementations. I can't think of any reason why you'd do the following, but I'm pretty thick, so maybe someone else can?
public interface IContract
{
ContractImplementation1 Contract { get; }
bool I... |
I am wondering if there exists a way to half way synchronize javascript functions, where data is requested on the fly. I don't want to make it purely blocking (which I guess is impossible), I just want a nice way to write the overall algorithm in one piece.
Let's take the following example:
function(){
command1;
... |
I've had a bit of experience with unit testing before, in what I call (not pejoratively) the classic software engineering project: an MVC, with a user GUI, a database, business logic in the middle layer, etc. Now I'm writing a scientific computing library in C# (yeah, I know the C# is too slow, use C, don't reinvent th... |
The background
One of the functionality of a product that I am currently working on is to process a set of compressed files ( containing XML files ) that will be made available at a fixed location periodically (local or remote location - doesn't really matter for now) and dump the contents of each XML file in a databas... |
What is the general solutions to allow the client to choose the concrete instance of a method output?
For example, in the Lucene API the search method receives and modifies the collector input parameter, but this is generally regarded as a bad practice:
IndexReader reader = DirectoryReader.open(index);
IndexSearcher se... |
The definition of "C-Style language" can practically be simplified down to "uses curly braces ({})." Why do we use that particular character (and why not something more reasonable, like [], which doesn't require the shift key at least on US keyboards)?
Is there any actual benefit to programmer productivity that comes ... |
When making changes to large systems, I often face the problem that some piece of functionality needs to get some data from another piece, but they're in different parts of a deep and branching call tree, possibly flowing through event listeners, deferred calls, etc. In this way a simple change can balloon quickly.
A r... |
If we assume that it is not desirable for the base class to be a pure interface class, and using the 2 examples from below, which is a better approach, using the abstract or virtual method class definition?
The advantage of "abstract" version is that it is probably looks cleaner and forces the derived class to give a... |
I am new to C# development and wish to create a more responsive UI. In my preliminary research, I have seen two methods for achieving this:
Multi-threading in conjunction with the BackgroundWorker class.
The newer Async/Await modifiers.
Does newer mean better? What's the difference between the two methods? If I wish... |
In our company we have two large systems, basically they are scoring and CRM. Both have large SQL Server databases running on Windows servers on the intranet. These two databases are managed by other department, which we have a direct contact with.
Neither of those systems have any external APIs except for some stored ... |
I want to fork on Github the TestNG java testing framework (Apache 2 license) so I can add/change some minor things to suit my needs.
It's unlikely that all of my changes would be approved in the main project or that other people would use my fork. This would in no way be a competition to the main project.
Now, in term... |
So, I am working on a project with a team and we are using Entity Framework. We basically want to use linq to entities, and not use stored procedures. I use quite a bit of lists and IEnumerables and so does everyone else.
My question is, will converting the dataset produced by a stored procedure to an IEnumerable dram... |
I have a ASP.NET MVC4 project in which I would like to use the SimpleMembership. The application has a Person table that holds relevant information about users in the system.
I would like a link between the currently logged in user and the Person information. So I have made a foreign key in the Person table to the User... |
We're looking into improving our testing process for some of our applications, and the idea that's been put forward it to write unit tests in Groovy and automatically run them with Maven.
The first application to get this treatment is written in Java, but I've been told that some of the classes being tested need to be... |
This is a follow up to this question. There I was asking how to do unit testing when you have a library of scientific algorithms. I have a similar problem now but with a different project.
I'm working on a 3D graphics engine framework abstraction for DirectX, OpenGl, WebGl, Silverlight, WPF, and basically whatever 3D A... |
We are writing software to track Foo Widgets. Each Foo Widget has a serial number. The serial number is an 32-character alphanumeric string. The string is separated into five sets. Each set is separated by a dash (so the s/n is 32-characters NOT including dashes).
So for example: 11111111-1111-1111-1111-111111111111. ... |
We currently have 3 similar, but slightly different applications that use the same data. We load the (same) data into each application that uses it. The applications are similar and use the same technology (Ruby on Rails) but were developed by different programmers.
In consolidating this data, our management seem the... |
I often need to do some operations in a loop and some other operations between the iterations. A simple example would be collecting words from an array into a string, spelled backwards and separated with commas. Is there an idiom or language support for this in any language? (For now i am mostly interested in Ruby.)
I... |
If I am selling software commercially and I offer users free upgrade for 12 months after purchase, can I make them agree to a new licence when they download an upgrade?
What should the original license say in order to stipulate this?
And if I can do this, then wouldn't it be possible to put in the new license that th... |
Right now creating a new service that will integrate into our company's existing platform. The service will be responsible for tracking "points" that a user can generate over time through certain activities.
I am caught between two different methods of approach. I'm not sure whether to choose one of the following struc... |
As a relatively new (self-taught) web developer, I've heard the terms front-end, client-side, back-end, and server-side quite often. To me, front-end and back-end were always synonymous with client-side and server-side, respectively.
However, as I've begun working with MVC frameworks like CodeIgniter, I've come across... |
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 (cli... |
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... |
I'm building a proprietary file format for an application I wrote in C# .NET to store save information and perhaps down the line project assets. Is there a standard on how to do this in any way? I was simply going to Serialize my objects into binary and create a header that would tell me how to parse the file. Is this ... |
I'm implementing a Java app that includes an Undo/Redo stack. I've noticed that some apps (such as TextEdit on Mac OS X) let you choose "Undo Typing" from the Edit Menu after typing some text. I'd like to implement that sort of thing into my app as well, but I'm having a really hard time finding guidelines about how it... |
In my current job, I've been tasked with cleaning up old code a few times. Often the code is a labyrinth and the data behind it is even more tangled. I find myself combing out things into nice, neat, modular methods. Each method does one thing and does it well. That's when things start to go south...
Invariably, I ... |
I have a GWT website that displays some data onto the client in a tabular form. Some of the fields are editable, when any change is made the save button becomes active.
There are multiple properties that may have changed, how would I go about updating them on the server? Additionally I'd like to provide an undo button ... |
I'm looking for a simple definition of the concept of “client-server”
I'd like something similar to this definition of state.
... That "thing/information" that you need to remember is called "state".
Edit - This isn't a homework question (nor am I a student). My goal is to come up with a compact way of explaining RES... |
Below is Java code.
I need to cover the below function. I searched for many websites, but I still have no ideas. Is there any methods to cover the override anonymous classes?
public static void addEnterListener(Text text, final String methodName, final Object callee) {
text.addKeyListener(new KeyListener() {
... |
I wrote the following function to validate emails for a web app I'm working on:
function validate_email($email) {
$valid = true;
if(!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$valid = false;
}
$email_parts = explode("@", $email);
if(count($email_parts) < 2) {
$valid = false;
... |
I don't like singletons, but I have to compromise now (but only as temporary measure).
However I don't want to go completely singleton. I'd rather want to use this pattern:
interface NameThisInterface {
//Returns the currently centralized object.
static function current();
//Centralizes the instance.
function... |
I am reimplementing some component and noticed that the original version has a Liskov Substitution violation. It's not all that critical, though I'd like to get rid of it in the new implementation . It is however not clear to me how to do this.
I have a component defining very simple value classes used by the system. T... |
How should my web application handle common errors such as incorrect password, session timeout, etc.?
I have a class called Hotmail that contains various method such as login, logout etc.
To illustrate the confusion, I have a login method that logs the user into Hotmail via my software. The login method returns a HttpW... |
I was recently discussing with some friends which of the following 2 methods is best to stub return results or calls to methods inside same class from methods inside same class.
This is a very simplified example. In reality the functions are much more complex.
Example:
public class MyClass
{
public bool FunctionA(... |
Some time ago I read a kind of "rule of thumb" about the concreteness of method parameter types, return types and property types, but I just do not remember it.
It said something about keep your return types as concrete as possible and your parameter types as abstract as possible... or vice versa.
I don't know if it wa... |
I have a web application which I want to make RESTful.
Here is the structure of the app:
Top level has a bunch of search screens, they are basically tabs which search different parts of database with different parameters.
After the search is done we display search results in a new tab, inside this tab is a table with ... |
I am starting a new project, and I want to follow the separation of concerns pattern, and I have been reading on the topic, and now I am in doubt of how I should go about this.
Here is how I thought I should go about it:
Application/Presentation Layer uses the Business Layer. Works with the entity interfaces.
The Bus... |
For example I have class ItemDownloader which has method downloadItem. This method creates instance of another class - Download to perform actual downloading.
Question is: I want to test ItemDownloader in isolation, so I will probably mock up Download. How should I do it?
P.S.: Question is more about design than implem... |
I am migrating to using the new Storage Client Library for my Azure Table Storage.
Querying with the previous Storage Client Library 1.7 namespace:
var orders = serviceContext
.CreateQuery<Order>(tableName)
.AsTableServiceQuery<Order>()
.Where(e => e.PartitionKey == pa... |
There are a lot of very smart and experienced people, who claim that if you don't write unit tests then your code will be buggy and God will kill all kittens. On other hand, another bunch of smart people will say that unittesting is counterproductive. So if you will write unittest then kittens will be damned too.
Also,... |
On my last large project, I used dependency injection really heavily. I started out using constructor injection but even two or three dependencies resulted in really ugly code.
public MyClass(
IDependency1 dependency1,
IDependency2 dependency2
IDependency3 dependency3)
I am not a fan of property injection... |
I just started building an iOS app and wanted to get some feedback regarding views.
I've got specs for
Activity Page
Activity Recording
Activity Create
Activity Save
Each of the specs show a different function, but would each of these be a brand new view in my iOS app?
|
In my iOS app, things are mostly driven by events.
The user presses a button
The app listens for an external device to be connected to the iOS device
Once the device is detected (is connected), an asynchronous call is made to a web service (to check for user authenticity)
The web service returns the user's authenticit... |
I recently came across an algorithm design problem that I'd like some help with:
Given some letters, for example a,e,o,g,z,k,l,j,w,n and a dictionary of words. Find a word in the dictionary that has most letters.
My first attempt:
Let us assume that the dictionary is in a tree. Start by finding the permutations of th... |
I have read numerous times that programming languages when making games or large software often use multiple languages / scripts together. I'm wondering how that works. How do they compile it? How does it work together?
Also, how does this work with web design also, i.e. How does one combine their HTML/CSS with their ... |
I would like to have a menu like this in surfdome. I don't mean the UI but the flexibility of this menu.
I will try to explain it.
I have some products. I want to match these products with some categories and have multiple type of menus based on these categories.
e.g. (in [] are the categories and in () are the prod... |
I am programming in PHP and I have an include file that I have to, well, include, as part of my script. The include file is 400 MB, and it contains an array of objects which are nothing more than configuration settings for a larger project. Here is an example of the contents:
$obj = new obj();
$obj->name = "myname... |
I've joined as a fresher (trainee) a software company developing for Windows Store. I don't know much about C#. My company has started Windows Store development recently. They didn't do .Net development before, that's why my company got an Senior .Net employee to complete the project.
Whenever he completes the project... |
There are plenty of questions around regarding random number generation, but I couldn't find anything that exactly matched my question. Apologies if I missed one.
Most random number generators in software tend to have flat distribution - in the given range, any number is as likely to come next as any other (more or les... |
I have a question as to the proper best practices revolving forking code.
I've taken code base licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 and brought significant changes to it to suit my needs. I feel as though my version could benefit others and wish to redistribute it.
I'm unsure what ... |
I'm working on a large project at the moment and I'm trying to document the communication protocol that sits on top of a message queue middleware.
The documentation is intended for another organisation that is going to be implementing a new back end to the client.
The messages format uses protocol buffers, so I'm less... |
Frequently, in my programming experience, I need to make a decision whether I should use float or double for my real numbers. Sometimes I go for float, sometimes I go for double, but really this feels more subjective. If I would be confronted to defend my decision, I would probably not give sound reasons.
When do you u... |
I have the following Azure Storage Table.
PositionData table:
PartitionKey: ClientID + VehicleID
RowKey: GUID
Properties: ClientID, VehicleID, DriverID, Date, GPSPosition
Each vehicle will log up to 1,000,000 entities per year per client. Each client could have thousands of vehicles. So, I decided to partition by... |
Quite recently, I thought about the use of as, is and direct cast in C#.
Logically, is it a better idea to use :
var castedValue = value as type;
if (null != castedValue)
{
// Use castedValue.
}
than :
if (value is type)
{
var castedValue = (type)value;
// Use castedValue.
}
But I still have issues ... |
I'm in the process of rewriting a small application from console mode to a GUI mode.
The input is a file with log data from a measuring device:
...
00029;00044;00076;00044;00021
00309;00032;00037;00000;65535
00013;00016;00008;00007;00005
...
Each row of data represents 5 counters which summarize the range in which the... |
I have read a few of the articles related to the Language Oriented Programming paradigm. Therefore, I concluded that LOP paradigm can let programmers be more productive because of it's extensibility.
Are there any programming languages that are already implemented LOP or in development status?
|
Is it considered a good practice to have a remote branch for each individual developer in the project?
We're using Git with the following branches:
master
release
develop
If each developer had their own branch, they could push code into their branches and others could merge these changes into their own branches.
|
I have moved to a new project and as the only 'software guy' I'm welcome, and expected, to suggest design improvements to the existing code (code just got out of prototype phase and needs extended to final releasable version; plus adding functionality)
The code has multiple stand alone components which are suppose to r... |
I need to create a web service using the .NET platform for accepting file uploads. What are the options available for doing this in C#?
What is the best approach to use? Can please you provide me with blogs/code samples/references for further reading?
|
I have some C++ knowledge and know that pointers are commonly used there, but I've started to look at PHP open source code and I never see code using references in methods.
Instead, the code always uses a return value instead of passing the reference to the variable to the method, which then changes that variable's va... |
At our company we have an existing translation ms-sql table wich stores strings like this:
Id | Key | Language | Value
1 | hello-world | nl-BE | Hallo Wereld
2 | hello-world | en-GB | Hello World
There are 3 languages in the system and I expect this to grow to a maximum of about 10 in the future
This ... |
I am in high school at the moment and soon reaching stages where I would have to make choices. To introduce, I love programming. I had started learning programming a year ago and have some experience with ActionScript3 and Java + (the web languages like html CSS JavaScript. But php I have found a bit hard to understand... |
Is it a bad practice to rely on an auto-incrementing primary key to sort rows in a table? A coworker and I were having an argument about this subject. We need to be able to find the last-inserted row in a table, and we have no create/update time columns (which might be considered a bad practice in itself, but that's a ... |
Background
This question stems out of an architectural discussion we had at work.
For the current project we are using Python and an object oriented database. There are input services that we consume, and certain interfaces that we are expected to provide output through.
Someone on our team started designing a data mod... |
I'm working in a software development area in my university, and we've noticed we need some system to track errors and bugs, who and when it is dealt with. I've researched some software management/bug tracking applications, with Redmine being the one that appeals to me the most because of its simple UI (actually I disc... |
The question is pretty self-explanatory. I've had some experience with git-flow, and not much more true experience with plain git before that. (I was using it more as a backup-provider.) I'm confused as to what consensus is, given that I can safely assume that there are a large number of git users who miss 'the good... |
So, I'm designing an MVC framework. In the name of keeping everything statically typed and non-magical, I've come to quite a problem with "automatically" passing models to a controller.
So, traditionally, I usually see no more than one model used at a time in a controller as far as automatic-population.
For instance, t... |
I am trying to develop a Delete command through BDD that will simply delete an user from the database, given user_id as a parameter. What can be some possible behavioral tests that will drive me to write a proper implementation for the command?
|
The often known as likely and unlikely macros help the compiler know whether an if is usually going to be entered or skipped. Using it results in some (rather minor) performance improvements.
I started using them recently, and I'm not sure how often should such hints be used. I currently use it with error checking ifs,... |
I'm working on a simple widget system (single window, fixed size). Each widget gets its parent (i.e. the widget containing it) passed into its constructor - except for the root widget, which I called Screen.
I have some doubts if that approach makes sense. I did it because most of the widget systems I used before do it... |
Static code analyzers like Fortify "complain" when an exception might be thrown inside a finally block, saying that Using a throw statement inside a finally block breaks the logical progression through the try-catch-finally. Normally I agree with this. But recently I've come across this code:
SomeFileWriter writer = nu... |
All over the internet, I see the following advice:
A GET should never change data on the server- use a POST request for that
What is the basis for this idea?
If I make a php service which inserts data in the database, and pass it parameters in the GET query string, why is that wrong? (I am using prepared statements... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.