Are there any scientific studies (and conclusions) about the impact of mastering a new programming language over previously learned programming languages? I'm particularly interested if mastering various languages can decrease average productivity.
...
Hello,
I'm working on a program using a SQL database (I use SQLite). What my program does is the following:
Creates the tables in the database if they don't exist (on startup)
Executes SQL queries (SELECT, UPDATE, DELETE) - decided by the user from the interface
What I saw doing this is that there is a lot of redundancy. I give the ...
const char IsPressed = 1; // 1
const char WasHeldDown = 2; // 10
const char IsFirstPress = 4; // 100
char* keystates[256];
Class::CalculateKeyStates()
{
for(int i = 0; i < 256; ++i)
{
if(this->IsDown(i))
{
keystates[i] |= IsPressed; // turn on
if(keystates[i] & WasHeldDown)
{
...
We just can use function like
public static List<T> New<T>(params T[] items) {
return new List<T>(items);
}
and more important it's better
var list = new List<int> {1,2,3};
var list = List.New(1,2,3);
So, when we really need to use it?
Dictionary
public static Dictionary<T, K> New<T, K>(T key, K value) {
return new Dictio...
i'm trying to test an object by passing a mock owner. Originally PartD would be passed a PartB1 as its owner:
PartD partD = new PartD(partB1);
Now i want to test a feature of PartD by passing it a mock owner:
PartD partD = new PartD(mockPartB1);
This works okay, except there are things PartD does that depends on it knowing some sta...
Given an input sequence, what is the best way to find the longest (not necessarily continuous) non-decreasing subsequence.
0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15 # sequence
1, 9, 13, 15 # non-decreasing subsequence
0, 2, 6, 9, 13, 15 # longest non-deceasing subsequence (not unique)
I'm looking for the best algorithm. I...
Can you have dynamic naming in regex groups? Something like
reg = re.compile(r"(?PText|Or|Something).*(?PTextIWant)")
r = reg.find("TextintermingledwithTextIWant")
r.groupdict()["Text"] == "TextIWant"
So that depending on what the beggining was, group["Text"] == TextIWant
Updated to make the quesetion more clear.
...
Assume I have method that reads customers from a csv file.
When reading the file an exception occurs (e.g. IOException or FormatException). In most cases the method can't do anything about the errors but it can add extra information like file name, line number etc.
The method's class got an IProgressAndErrorReporter dependency that is ...
Hi!
Is it a good practice to catch all exceptions and re-throw them as a specific type -basically to classify all the exceptions thrown from a particular part (or service) of an application?
Something like:
// This class is used to label all the exceptions occured on
// Race Cars Service calls as RaceCarsServiceException
public clas...
Given a set of nodes, how can I construct a tree which links together all the nodes in a way which minimises max(max(degree), max(depth))?
For example, given a set of five nodes, I could connect them like so:
However, this is not minimal, since max(degree) == 4 and max(depth) == 1, a better tree would be:
which has max(degree) == ...
I'm constructing a file sharing system which needs to transmit a single file to many peers. One single root peer has the entire file and needs to transfer it to all other peers. How can I best construct a tree of file transfers such that total waiting time is minimised?
For example:
In this tree, we need to wait 4 times before the tr...
I have following task:
In the program we should draw lines on a bit mapped display. An array of n pairs of reals (ai,bi) defined the n lines yi = ai*x + bi. The lines were ordered in the x-interval [0, 1] in the sense that yi < yi+1 for all values of i between 0 and n-2 and for all values of x in [0, 1]
Less formally, the lines do...
who explain this show with programming theory?. i want to learn this show. Also how to move ball if you vibrate phone or computer? http://apps.facebook.com/sanalvideo/izle.php?id=6776
...
I'm currently researching user authentication protocols for a website I'm developing. I would like to create an authentication cookie so users can stay logged in between pages.
Here is my first bash:
cookie = user_id|expiry_date|HMAC(user_id|expiry_date, k)
Where k is HMAC(user_id|expiry_date, sk) and sk is a 256 bit key only known ...
On on hand:
1. You never get time to do it.
2. "Context switching" is mentally expensive (difficult to leave what you're doing in the middle of it).
3. It usually isn't an easy task.
4. There's always the fear you'll break something that's now working.
On the other:
1. Using that code is error-prone.
2. Over time you might realize that ...
Put simply, what are some good practice applications that anyone who considers him/herself a programmer should write.
...
Have you come across a super programmer? What identifies him or her as such?
Also. how do you deal with a person in your team who believes he is a super programmer? Both in case he actually is or if he isn't?
...
One of my former students sent me a message about this interview question he got while applying for a job as a Junior Developer.
There are two candidates running for president in a mock classroom election. Given the two percentages of voters, find out the least amount of possible voters in the classroom.
Examples:
Input: 50...
I am looking for a language, or package in an existing language, that is good for specifying and drawing geometric diagrams.
For example, I would like to draw a hexagonal grid, with its dual triangular grid superimposed on it. Now, I could sit down, put some elbow grease in to work out the trig by hand and come up with some Postscript o...
What's the most interesting/surprising Software Engineering metric you know? For example, I find that "50% of all projects are considered failures" is quite frightening.
...