instruction stringlengths 34 36.1k |
|---|
Whenever you want to return a value from a method, but whatever you return depends on some other value, you typically use branching:
int calculateSomething() {
if (a == b) {
return x;
} else {
return y;
}
}
Another way to write this is:
int calculateSomething() {
if (a == b) {
return x;
}
retur... |
Where the code is:
function A()
{
lock()
doSomething()
unlock()
}
We can call A safely from multiple threads, but it never be executed in parallel . For parallel execution, we have to evade all of this code.
But the problem is we never know the A is getting lock or not. If we have source code (maybe lucky ... |
I've heard many times about the aspect-oriented programming, mostly that it is the "next generation" technology in programming and is going to 'kill' OOP.
Is it right? Is OOP going to die or what can be reason for that?
|
Are there developpers out there, who (ab)use the CaptureScreenshot() function
of their automated gui-tests to also create uptodate-screenshots for the userdocumentation?
Background: Whithin the lifetime of an application, its gui-elements are constantly changing.
It makes a lot of work to keep the userdocumentation up... |
I want to improve my programming skills by studying famous open source projects, but I find it is easy to get lost by just jumping into their source code.
So I decided to read their documentation about their design or architecture (such as UML diagrams) to get a general idea about their code's organization first. To my... |
We're going to meet a potential new client today and between ourselves started discussing the need for a non-disclosure agreement (NDA) and whether we need one at this juncture.
In this case we don't think we'll be talking about technical specifics as it's an initial meeting about who we are.
Is there any precedent on... |
We are developing a product which can be used for developing predictive models and the slicing and dicing of the data in order to provide BI.
We are having two kind of data access requirements.
For predictive modeling, we need to read data on daily basis and do it row by row. In this the normal SQL Server database is s... |
I'm new to object-oriented programming, and one concept that has been taking me a while to grasp is immutability. I think the light bulb went off last night but I want to verify:
When I come across statements that an immutable object cannot be changed, I'm puzzled because I can, for instance, do the following:
NSStrin... |
We have a need to FTP files that are generated by our system, so we're trying to decide whether we should spend the time to build something that meets our criteria (relatively easy, .NET has FTP functionality built in, among other more advanced libs from 3rd parties). Or if we should buy something off the shelf.
Our re... |
We're a small team of web developers currently using subversion but soon we're making a switch to github.
I'm looking at different types of github workflows, and we're not sure if the whole forking concept in github for each developer is such a good idea for us.
If we use forks, I understand each developer will have h... |
I been contacted to do some work remote controlling LEDs displays over TCP/IP, but my experience and preparation is mostly about high-level programming language. I said that to the person who contact me about the work and he told me that:
"if you call yourself a programmer you
should know all these things"
Should a... |
Let's say there are two similar open source projects A and B, both licensed under the Apache Software License 2.0.
I would like to contribute an improvement to both projects (because I don't know which one is administered better, and I would like to see my improvement show up in both).
Is there a way I can contribute t... |
I've just come across (for the 47 millionth time) some code that looks like this:
except IOError, e:
print "Problems reading file: %s." % filename
sys.exit( 1 )
My first reaction is very visceral: the person who coded this is a complete idiot. How hard is it to print error messages to stderr and to include the s... |
I'm currently toying with the idea of embarking on a project that far exceeds my current programming ability in a language I have very little real world experience in (C). Would it be valuable to prototype in a higher level language that I'm more familiar with (like Perl/Python/Ruby/C#) just so I can get the overall de... |
I am a little experienced developer having approximately 5 years experience in PHP and somewhat less in Java, C# and trying to learn some Python nowadays. Since the start of my career as a programmer I have been told every now and then by fellow programmers that programming is suitable for a few early years of a career... |
preamble>
It seems to me that computer programmers are one of a select few groups of people who actually take pleasure from sitting in front of computers for long periods of time. Most people in other professions actively dislike their time at computers, and do their best to avoid it (so, I assume, they don't have prob... |
I'm tutoring someone who can be described as a rank newcomer in C. Understandably, she does not know much about coding conventions generally practiced, and hence all her programs tend to use single letter vars, mismatched spacing/indentation and the like, making it very difficult to read/debug her endeavors.
My questio... |
I am tired of hearing people recommend that you should use only one thread per processor, while many programs use up to 100 per process!
take for example some common programs
vb.net ide uses about 25 thread when not debugging
System uses about 100
chrome uses about 19
Avira uses more than about 50
Any time I post a th... |
I am working on this project, which will soon contain loads of packages, projects etc. (Java). So, from the start I need to keep track of the high level package and class structure, monitor which class is being called where, so that I don't make it over complicated after 6 months.
What is the right way to go about it? ... |
Does anyone know or have information about which Software Development Life Cycle methodologies are used by Google?
|
I would like to learn how to write a software product definition. Therefore I am looking for online materials or books which would help me to learn more about this topic. I would like to learn, for starters:
what must be included in such a document
what must not to be included in such a document
how to make a product ... |
The company I work for recently purchased some third party libraries from a very well-known, established vendor. There is some fear among management that the possibility exists that our license to use the software could be revoked somehow. The example I'm hearing is of something like a patent issue; i.e. the company ... |
As an independent, individual programmer:
How do I let people very quickly know that I have not abandoned the software I've written and given away for free? That I am putting in the effort required to maintain and support my software to a professional level?
When software written by one or two developers is available f... |
I've been teaching myself a little LINQ and an exercise I thought would be useful was to take my existing Project Euler C# code, which I built using Test Driven Development and gradually convert it to LINQ. I realise that LINQ is not always the best solution for all of the Project Euler problems, but I don't want to ge... |
I've just recently been on a project and during the release, we realized that it didn't work in Production. It works in all other environments but because we have a separate release team, and we cannot set up the servers and environments ourselves, we have no visibility of the configuration on them.
We suspect that Pro... |
I'm looking at the Creative Commons Attribution-NonCommercial 3.0 Unported (CC BY-NC 3.0) license.
It says that I can use it for "non-commercial purposes".
What does that mean? I see in Stack Exchange, under Network Profile there is that graph that tracks your points across your Stack Exchange accounts. It uses a contr... |
So I've been working at this job for a couple of months. I'm a little frustrated because I do my best work from 2 to 7. In previous jobs, I've come in at 9:30-10:00 and leave at 7. Some companies have been okay with this, others have not.
But my current company insists on my being there at 8:30. Any deviation from ... |
I had planned to study and apply unit testing to my code, but after talking with my colleagues, some of them suggested to me that it's not necessary and it has a very little benefit. They also claim that only a few companies actually do unit testing with production software.
I am curious how people have applied unit te... |
Is is an absolute must when following the Scrum methodology to practice collective code ownership, instead of for example weak code ownership?
|
What will happen to the portions of the Boost library that are incorporated into the new C++ standard?
Will they continue to evolve and any changes be reincorporated into the standard which follows C++0x?
|
This is a more specific question (or actually two, but they are related) coming from the comments of OOP technology death where someone stated that OOP is not the right paradigm for GUI programming.
Reading the comments there and here I still have the feeling there are things to learn: which programming paradigms are ... |
C#'s lambda expression also has closures but is rarely discussed by the C# communities or books. I see far more JavaScript people and books talk about its closures than they do in the C# world. Why is that?
|
From Wikipedia
Extensible Markup Language (XML) is a set of rules for encoding documents in machine-readable form. It is defined in the XML 1.0 Specification[4] produced by the W3C, and several other related specifications, all gratis open standards.[5]
What are the historical reasons for calling the shorthand XML ra... |
I always hear that involving with open source projects is good for career and the more (good) open source you release, the closer you will be to getting your dream job before you've even had an interview.I am expert in Java and I am trying to become fluent in Scala. I always think about getting involved in open source ... |
Possible Duplicate:
How do I comply with the EU Cookie Directive?
Under this new EU law we are not allowed to use any cookies without asking first,
I for one need to use a cookie to register the user logged on, as if not with a cookie they can log on more than once and breach the license terms of the software.
so ... |
One problem I have with compiler optimization is, that I actually never know what the compiler (or in this particular case the Jit) does with my code. So is there any possibility for me to know whether a particular compiler optimization took place or not? I just want to be sure about that some objects (math vectors) ar... |
In DDD i struggle to understand whether or not my domain is split correctly into aggregate roots and then those aggregate roots are grouped correctly into bounded contexts. is there a way - like a set of rules/guidance i can use to decide whether or not i am placing things in the right AR/BC
|
I always wonder this, and perhaps I need a good history lesson on programming languages.
But since most compilers nowadays are made in C, how were the very first compilers made (AKA before C) or were all the languages just interpreted?
With that being said, I still don't understand how even the first assembly language ... |
I had a small project that I was doing on the side. It was basically a couple of forms linked to a DB. Access was out, because it was a specifically meant to be a web application. Being a small project I used ASP.NET Dynamic Data, but, for various reasons, the project ended before deployment. I met the client recently,... |
I have seen some developers use hosted scripts to link their libraries.
cdn.jquerytools.org is one example.
I have also seen people complain that a hosted script link has been hijacked.
How safe is using hosted scripts in reality? Are the scripts automatically updated? For example, if jQuery 5 goes to 6 do I automatic... |
I work with someone who, every time they call a function they put the arguments on a new line e.g.
aFunction(
byte1,
short1,
int1,
int2,
int3,
int4,
int5
) ;
I find this very annoying as it means the code isn't very compact, so I have to scan up and down more to actually make any sense of ... |
I am in the process of finally rolling Mercurial as our version control system at work. This is a huge deal for everyone as, shockingly, they have never used a VCS. After months of putting the bug in management's ears, they finally saw the light and now realise how much better it is than working with a network of share... |
I would like to switch from a 5 day week to a 4 day, but maintain a 40 hour working week.
Would the 10 hour days affect your ability to be productive? I hate our public transit system so if I could reduce my transportation by 20% I would be happy.
If other developers who work 10 hours shifts could be clear as the their... |
I have a interface in our code base that I would like to be able to mock out for unit testing. I am writing a test implementation to allow the individual tests to be able to override the specific methods they are concerned with rather than implementing every method.
I've run into a quandary over how the test implementa... |
I have a Linux application I've developed, and I have created a standalone VMWare Image that people can download to try out the application without needing to install and configure a Linux Server. I created this VMWare Image by starting with a base Debian system, installing a bunch of packages and then configuring all ... |
I am working on an app which I would dearly love to transition from a fairly traditional layered architecture to CQRS, for a number of reasons, not least fo which is that having a robust event log will make adding a couple of feature requests I can see barrelling towards me trivial to accomodate.
Now, I have a conceptu... |
I'm learning C++ and I'm using g++ on Linux for practicing.
I want to know if people working as programmers use g++ -pedantic flag and also its importance in real world.
What about other compilers, do they also allow this? Has this become some de-facto standard?
I'm interested because I'm reading C++ Primer where th... |
SO I'm about to put together a new site and I'd like to go about it by making a web application that parses /#!/ url's and requests content accordingly via AJAX calls to a JSON API that is already put together.
My questions are...
What are the best practices concerning #! url's
Are there any good JavaScript libraries ... |
I used to work on a really small outsourcing company (4 programmers and the boss), then when the stress and the frequent long shifts made the situation unbearable I made the switch to a better paid job with a more relaxed schedule that allows me some more free time.
The problem, however, is that for the most part, ever... |
Is it possible to take a binary compiled for ARMv7 architecture and convert it to ARMv6 ?
Are there any tools that can do this?
|
I think I am at a point where I can truly contribute to a Ruby open source project, can you suggest one or more that would be open to having a true beginner contribute. This would be my first group project where I would like to be 'mentored' or something similar by a more experienced coder. I would be able to work in m... |
When releasing a software update, how detailed should the notes be? Specifically, how detailed should bug fixes be?
|
I want to say that my program is capable of splitting some work across multiple CPU cores on a single system. What is the simple term for this? It's not multi-threaded, because that doesn't automatically imply that the threads run in parallel. It's not multi-process, because multiprocessing seems to be a property of a ... |
Looking at most (if not all) dynamic languages (e.g. Python, PHP, Perl and Ruby), they are all interpreted. Correct me if I'm wrong. Is there any example of dynamic language that goes through compilation phase? Is dynamic language identical with interpreted language?
|
As far as I know and have understood in my experience with Qt, it's a very good and easy to learn library. It has a very well designed API and is cross-platform, and these are just two of the many features that make it attractive. I'm interested to know why more programmers don't use Qt. Is there a deficiency which spe... |
Jeff Atwood recently wrote a blog post about Netflix's implementation of a "Chaos Monkey". It is a very high level article. I am curious if anyone has actually implemented this technique for testing a system.
I guess what Im really trying to ask is: What strategies do you implement to ensure your architecture can surv... |
I've been having a discussion about licensing and open source software. Basically - the other guy is saying that licensing is easy, if you're going to build a product you can use an (any) open source project and make money by selling that code.
My issue is that say I create a website or app with a project that uses a G... |
I am an MCA fresher and will be working on dot Net for next few months (almost 10-12 months). After that I want to switch over to Java.
How is the possibility that I can switch over to it? What type of preparation I am supposed to do? I am also planning to appear for SCJP but don't have any knowledge how to get registe... |
Consider a complex and extensive software component; for example a multi-language text rendering engine, an IPC framework, a scheduler that can handle multiple time zones, a module full of complexities caused by the need to stay backwards compatible, etc... It requires a lot of knowledge of the details to maintain and ... |
We have been working with BDD for sometime now and one issue that keeps cropping up is related to the scope of our scenarios. Particularly when it come to making a change to existing functionality.
As a developer I see the scenarios as being akin to a spec, ie. this is the change that is required. However often they se... |
I started programming in C++ at uni and loved it. In the next term we changed to VB6 and I hated it.
I could not tell what was going on, you drag a button to a form and the ide writes the code for you.
While I hated the way VB functioned I cannot argue that it was faster and easier than doing the same thing in C++ s... |
So I just got a copy of ArgoUML. I originally thought I'd be able to just play around with it to learn it, but it's turning out to be extremely difficult. I searched online for tutorials and videos but came up with nothing useful.
The help file for ArgoUML is very incomplete as well.
Does anybody know of any online r... |
You can often hear that programmers should learn many different languages to improve themselves. I still go to school and don't have big programming experience (a little more than year). But what was noble intention to improve programming skills turned into some kind of OCD: I feel that I won't calm down until I learn ... |
I have a project that uses GNU autotools to build itself. I am trying to modify so that autotools generates all the non-versioned control files in a separate directory so that I can keep the source tree clean of temporary files. Anyone has any ideas how to do this ?
|
I am torn between learning myself some Powershell or just leveraging my existing Ruby knowledge for the various Windows scripting things that I do from time to time.
Powershell does look incredibly powerful, but from initial impressions the syntax is fairly ugly.
Is there anything that Powershell can do that I couldn't... |
At a recent UI/UX MeetUp that I attended, I gave some feedback on a website that used Javascript (jQuery) for its interaction and UI - it was fairly simple animations and manipulation, but the performance on a decent computer was horrific.
It actually reminded me of a lot of sites/programs that I've seen with the same ... |
I'm very tempted to use it purely because of its neat Binding APIs, and now that you're able to use it in conjunction with Swing it feels like a natural progression.
The only thing that I can seem its lacking off the bat is a GUI builder (But then according to who you speak to, this isn't necessarily a bad thing!)
Does... |
I manage a team of coders (5 people) that maintain a few modules in a large project.
On top of doing coding, we also do production operational tasks (like doing server housekeeping, batch backlog tracking).
These tasks are done daily, done by one person, and is rotated weekly.
The problem is this:
These tasks are routi... |
I'm looking to get started with objects in my unit tests. It seems there are tons of good mocking frameworks out there.
Do the different frameworks have different target audiences?
What factors should I consider when choosing which framework is right for my situation?
|
Laugh if you want, but I used to develop substantial line-of-business applications in VB6, long before the .NET framework came along. Why, when I was your age, we used to walk two miles in the snow, uphill. Both ways...
Love it or hate it, VB6 had a REPL-like feel, and a very rapid development cycle. I would like to... |
I have been programming for many years now, primarily in PHP and the like and would consider myself an intermediate programmer. Some of my online projects have now gone global and very widely used, i am now in deep thought about scalability etc.
All of my systems so far are written in PHP, no known database structure s... |
As a learning C++ programmer, I am trying to select a GUI framework or library for my own projects.
I have some experience with Qt: it's very straightforward, it has a very good documentation, and provides a lot of tools, but it seems to duplicate a lot of the standard library.
Are all C++ GUI libraries like this? What... |
In the Handling my antiquated coworker question, various people discussed strategies for dealing with coworkers who are unwilling to integrate their workflow with the team's.
I'd like, if possible, to learn some strategies for "teaching" a coworker who is merely ignorant of modern techniques and tools, and possibly a l... |
Have a tree of variable depth, and width. What is the best algorithm to find the next occurence of the node in that tree.
Next = Search to the right side of the tree ( as in breadth first search )
The selection criteria for the next occurrence of the tree is changeable in different situations.
For example, at one plac... |
For example:
We're running a two community sites on two domains (call them example.com and example.net).
We want to be able to expand that to more domains later.
We want to allow multiple types of login (OpenID, Facebook, Twitter, standard username/password).
We want someone who's logged into one site to automatically... |
I have been reading about various Flex frame works, Robot Legs, Swiz, Cairgnom (spelling error) and a few others. What I am missing is how they actually work with Flex / Flash Builder. Are they simply libraries that you can use with the Flash Builder IDE? Why should I learn to use one of them instead of just using the ... |
I need to design a class hierarchy for my C# project. Basically, class' functionalities are similar to WinForms classes so let's take WinForms toolkit as an example. (However, I can't use WinForms or WPF.)
There are some core properties and functionalities that every class needs to provide. Dimensions, position, color... |
Lately I've used this technique a few times, and I'm trying to figure out if it has a name, if it's one of the patterns, etc.
In complicated situations where I might normally have a number of giant select case statements, I've been experimenting with a more plugin-style approach.
I create an interface, let's called it... |
I am using Ruby on Rails 3.0.7 and I would like to learn to write "advanced" plugins for the current versione of the framework. In order to do that I would like to buy some books but what I have seen on the Amazon website are two or three year old...
Do you know and\or advice some books for this matter?
P.S.: Also link... |
I work on several git repositories though on most not more than 2 people work. Mostly me and my boss. Very often when we work in parallel it happens that "git log" doesn't look so nice because of the merge commits. My boss always complains about that. I really hate that fact because this makes me effectively serialize ... |
I'm a professional .NET -C#- developer who's interested in doing development for Android. I'd like to know if it's really necessary for me to first read a book or two on Java (like Java For Programmers 2nd), or if I should just be able to pick up an Android book (like Pro Android 3) and be able to -mostly- work my way ... |
In a financial services environment - is it realistic to ask your team of ten programmers to take on a 100% automated unit and integration test coverage goal as a stretch task for a legacy java system (>1.5M SLOC)? [as a two year goal in increments]
|
The title says it all but here's some explanation of what I want to know: Let's suppose a programmer has around 5 years of experience in multiple, mainstream languages. Also suppose that the programmer has worked in different positions from junior developer to senior s/w engineer to a team lead. How would he know this ... |
I am an iOS developer.
I have read about unit testing and how it is used to test specific pieces of your code.
A very quick example has to do with processing JSON data onto a database.
The unit test reads a file from the project bundle and executes the method that is in charge of processing JSON data.
But I dont get ho... |
I am refactoring a PHP OOP legacy website.
I am so tempted to start using 'final' on classes to "make it explicit that the class is currently not extended by anything". This might save lots of time if I come to a class and I am wondering if I can rename/delete/modify a protected property or method. If I really want t... |
There is a module in our telecoms equipment which is written in C. I think the code in this module has a bad smell because it has a number of symptoms:
When new features are added to this module, some original features go wrong. And some weird problems were finally orientated to the buffer overflow of this module.
It ... |
I am developing an OS reporting system for PHP, it's main emphasis is right now on the server side of things.
I am trying to look for examples of good UIs for reporting systems. The problem: there are dozens of reports, each linked to the other, how do you navigate between them? How do you know the path you took to get... |
I have a good breadth of experience now (over a dozen) primarily as a dba,developer, BI admin, data analyst. I started my career in a couple of startups and now for a big internet company. The culture has always been interesting, fast-paced and just constantly moving.
Recently, a family member of mine asked if I would ... |
in school we are taught how we can balance an AVL tree upon an insertion or deleting.
How is this type of knowledge actually going to be useful in the real world?
Can someone give an example on when this type of knowledge would actually be useful?
From what I have seen, in the workplace such details hardly ever come u... |
I'd like to begin my question by saying that I understand that SCRUM or some derivative of it is probably a good way to go for managing software development. It seems all the big companies and my managers use it or have used it, and I can't really argue with all that experience. However I'm struggling to understand t... |
At our company we have a team working on 3 different projects at the same time, where typically only one or two people are involved in each project. Project work often involves mastering new technologies and or solving bugs, both leading to tasks which are very hard to estimate. In this situation, the management still ... |
It seems that conventional wisdom suggests that good programmers are also good at math. Or that the two are somehow intrinsically linked. Many programming books I have read provide many examples that are solutions to math problems, or are somehow related to math as if these examples are what make sense to most people.
... |
As one of my summer projects I'd like to build an AJAX program on my own. Not too big. I'm new to the whole matter, however I have general knowledge in programming and a good understanding of the Web workflow.
As for W3C standards, is it wrong sticking to them as if they were a platform?
Is it a good idea to code havin... |
I'm often asked at some point during the interview process to compare myself to my peers. For example, one of my first after-graduation jobs asked me to compare myself to my classmates. A job I recently interviewed for asked me to compare myself to my coworkers.
I always play this down quite a bit. I'm always worrie... |
OO programming literature is full of design patterns. Most books on object oriented programming dedicate a chapter or two to design patterns like factories and decorators. So what are the equivalent patterns in functional languages and why hasn't anyone written a book about them yet? Is there something special about fu... |
I am about to release a piece of software that will be licensed with the GPLv3 (the project itself is "for fun" and has no commercial dimension in it).
The software is intended to help designing digital clocks and I know the core functionality works as - beside having unit tests - I used it for designing a couple of cl... |
So, I'm expending this email submission form script for a client and saw something rather strange to my experience. As you can see below, the original programmer has sanitised the user input. Is this a good practice or does this makes sense at all?
// Build Message Body from Web Form Input
foreach ($_POST as $Field=>$... |
I come from a PHP background so I'm used to everything being in one place. I want to install a python program (Zine)so that I can hack on it. The instructions I've found install it to the system in multiple folders. I do not want to edit files that are installed in Linux system directories.
What is the python way to la... |
I have estimated the cost of a product by COCOMO, then I estimated it by FP too. the results were so different from each other! The cost estimated by FP was about two times more than the estimated cost by Cocomo. which one is more reliable as this product belongs to a large project. shoud I skip the FP result?
|
When I try to design an OO solution ,I generally use the CRC modelling wherein I list the class names (nouns), what they do(verbs) and how they collaborate with other classes.
This blog has the below thing to say about this noun-verb approach
...This approach, which I will call “noun and verb,” is so limited
I’l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.