Backquoted symbols, good or bad?

I'm designing a programming language which has three kinds of quoted entities: strings and characters as in C, and symbols (interned strings intended for use as lookup keys and such) which I consider one of the most endearing features of Lisp. Currently I have the following syntax for these:               "*" // String     '*' // Character     `*` // Symbol      which I quite like, but has a couple of potential problems:   1. I'm told that on some keyboard layouts, backquote is a nuisance to type.   2. Backquote and ' are not the most visually distinct of characters, and I have a few times found myself typing ' when I meant backquote. On my setup this is not a problem because I have UltraEdit syntax highlighting set up to show backquoted symbols in green so the mistake is instantly apparent, but of course I can't provide syntax highlighting for most of the editors people use, so at least in the early days most users won't have the benefit of that kind of special coloring. So, given these potential problems, I'd like to get some feedback on which option people consider preferable:   1. Keep the syntax the way I have it now.   2. Swap backquote and ', so that ' is used for symbols and backquote is used for character constants.   3. Use ' for symbols, @"*" for character constants (in e.g. the Linux kernel code, character constants are something like thirty times rarer than string constants, so it's arguably okay to give them slightly more verbose syntax) and backquote for something else, perhaps raw (most escape codes not interpreted) strings.   4. Use ' for symbols, @"*" for character constants and forswear the use of backquote entirely.


Suggest a best practice to create Constants class

There is a debate in between my team members about declaration of Constants class. We are moving the constant variables into separate class as like below               public class Contants     {           public const string StateId = "ST";           public const string CountryId = "CI";     }      few of my team members are suggested to declare the class as sealed to avoid overriding option, and few are suggested to mark it as static to avoid instance creation of constant class.   However I preferred to have it as Sealed with static constructor, since it will help us to initialize the read-only variables in future need. Please advice this..


Name for a tree where nodes hold a reference to their parent as well as their children

I am creating a tree where some nodes have a reference to their parent as well as their children. It feels like a tree version of a doubly linked list. Is there a name for this?


Synonyms for operators

In the case of a newly designed functional language, consider e.g. the _not equals_ operator, spelled `/=` as is common among functional languages. Of course this operator is also known as `!=` in C family languages, and `<>` in SQL et al. It would be easy to make the parser accept these as synonyms, in the hope of cutting down on the number of things for someone not very familiar with the language to trip over. But on balance is this a useful thing to do, or would it just add more confusion than it's worth? Most mainstream languages don't provide synonyms, probably on the basis that they're designed for programmers who are familiar with the syntax. But what if you're designing a scripting language, for scenarios in which many users will not be very familiar with it, and may be specialists in something other than programming? Does that tip the balance in favor of providing synonyms to make things easier for newbies?


Hacking Python "Requests" library.. How to start as an intermediate pythonista?

My question is conceptual, yet extremely vital for me. I'm an intermediate Python developer. I know fair enough about it, and actually use it on a daily basis. Now, I would like to transform my capabilities from a library/API user to "designer" one. I found that "Python Requests" library by **Kenneth Reitz** is an extremely good place to explore Python patterns and idioms. I need to learn to split a big problem into its essential `Modules`, define required classes/functions, and use them to work together. I lack such a discipline, and I'm starving to gain this knowledge. How should I dive into this library? It is **big** , with many modules (with logical names, of course), classes, and methods. I started to read the code, but I don't know where I am and what this portion of code is designed for.


How to assure client that we will complete our project and won't run away with the money

I have decided to work as a freelancer. I have developed a software and have successfully given the presentation demo. The client liked it and has agreed to implement the project in his organisation. But the client has asked me make it sure that I wont run away with the money without completing the project. The cost of project is high and it is not possible to complete it without acquiring the advance from the client. What are the practice that is usually followed ? I myself somehow agree with the client query. I know I will be able to complete the project. I do not intend to cheat. But how to prove it to client? What to do in such situation?


Static variable - Usage and Implications on Threading

I have some confusion regarding the use of static variables/references in a class. It feels like I may not have entirely figured out the implications of keeping something static. When I say a variable is public static, is it one instance of the variable per class or one instance per assembly? For example, I have a user control (say, for a WPF app). This user control has a public static variable that coordinates various things within the control. If there is a form in a client application that uses this user control, with multiple instances of this control per form, how many instances of the public static variable are created? (My guess is only one, and it is modified by every control). Now, I actually need each instance of the control to have one such variable, not one variable across all the instances of the control in that single form. Does using a singleton pattern, with a "lock" keyword solve this issue i.e will it create one variable per instance of the user control? If not, what issue does the singleton pattern solve? What are the options in solving this design problem? (Note: I have resorted to creating an internal non static global variable and passing it around carefully, instead of going the static route and its working fine. I am looking to see if there is another option.) (Please bear with me if the question sounds very naive or unresearched, I did read a bit before posting, but seem stuck on finding an answer that explains it very clearly to me.)


CANopen and CAN Driver

**CAN Driver** means application program that interacts with CAN hardware and helps in initializing setup and communication. **CANopen Stack** provides various APIs to deal with CAN communication. Now this is confusing me so please let me know: **Is CANopen Stack and CAN driver one and the same?**


Is it OK to pass the concrete client to a method on the concrete strategy?

When using the strategy pattern, is it good practice to pass `this` to a method on `this.strategy`? I have a strategy interface with one call, `TakeAction`. The idea is that TakeAction decides which of the several possible actions the Client should perform and then calls the appropriate method on the client. So in a concrete strategy, the `TakeAction` method might look like:               void TakeAction(IAbstractClient client)     {         if (client.IsBlah()) client.UnBlah(this.BlahValue1, this.BlahValue2);         else if (client.CanFoo()) client.Foo(this.FooValue);         else if (this.ShouldTwiddle()) client.Twiddle();     }      And in the client, the call looks like:               this.strategy.TakeAction(this);      Is this good form? Or is there a better way to do this? (Passing back a class with an enum describing the action and the values to pass to it seemed overkill.)


The keyword const and the linker file

If I declare in a header file, for example, `extern unsigned long * Ptr;` and the value of this pointer Ptr in the linker file. Will this adrress be 'constant'? Can I change its value ?


Are sessions secure for captcha on failed login?

I don't like writing open-ended questions but I have a quick security question. I have a PHP login script that shows a CAPTCHA on the third failed login attempts. The way I'm counting failed logins is by using session data. Is this secure? Is there a better way to do this? Maybe store the IP in a database table? I'm not really sure how bots and programs that try to use word list actually work. Thanks


Is it OK to repeat code for unit tests?

I wrote some sorting algorithms for a class assignment and I also wrote a few tests to make sure the algorithms were implemented correctly. My tests are only like 10 lines long and there are 3 of them but only 1 line changes between the 3 so there is a lot of repeated code. Is it better to refactor this code into another method that is then called from each test? Wouldn't I then need to write another test to test the refactoring? Some of the variables can even be moved up to the class level. Should testing classes and methods follow the same rules as regular classes/methods? Here's an example:                   [TestMethod]         public void MergeSortAssertArrayIsSorted()         {             int[] a = new int[1000];             Random rand = new Random(DateTime.Now.Millisecond);             for(int i = 0; i < a.Length; i++)             {                 a[i] = rand.Next(Int16.MaxValue);             }             int[] b = new int[1000];             a.CopyTo(b, 0);             List<int> temp = b.ToList();             temp.Sort();             b = temp.ToArray();                  MergeSort merge = new MergeSort();             merge.mergeSort(a, 0, a.Length - 1);             CollectionAssert.AreEqual(a, b);         }         [TestMethod]         public void InsertionSortAssertArrayIsSorted()         {             int[] a = new int[1000];             Random rand = new Random(DateTime.Now.Millisecond);             for (int i = 0; i < a.Length; i++)             {                 a[i] = rand.Next(Int16.MaxValue);             }             int[] b = new int[1000];             a.CopyTo(b, 0);             List<int> temp = b.ToList();             temp.Sort();             b = temp.ToArray();                  InsertionSort merge = new InsertionSort();             merge.insertionSort(a);             CollectionAssert.AreEqual(a, b);          }


Can you give me an example of your Continuous Integration development process

we are thinking of doing Continuous Integration with Nightly builds here. Some of our sticking points is when to do Code Reviews. Is anyone out there doing Continuous Integration with nightly builds AND doing code reviews? If you can give a brief outline of your process that would be great. For example, here's what we are doing now:   1. Developers attempt to check in code daily or as often as possible. Code does not have to be "done", it merely has to compile. They rebase their code with everyone else's changes at this time. Doing this often prevents us from merging nightmares.   2. Builds come out nightly, but QA only looks at the builds but doesn't write up bugs yet, they merely inform us of what they are seeing.    3. Every few days, we have an official release. Code is Reviewed. We write up a description of what is ready for testing, what isn't.    4. QA writes up what they find in the stuff we say is ready for test. The process starts over. So, what are we doing wrong? One thing I dont like, is that Code is checked in that isn't reviewed. I heard before, that code should only be checked in that's been reviewed, however, I'm not sure how to do that and still have programmers checkin code daily. if you guys can give examples of what your process is, I'd really appreciate it. Thanks.


Can you call any php model class in an MVC from the controller?

I'm creating a **simple MVC** at the moment and am wondering if it's 'correct' to be able to call any model class directly from the controller to get the data to send to the view? I have the following folder structure:               .htaccess     index.php     /controller     /model     /templates      I also have the needed model classes within the `/model folder`, at the moment I've tried playing with a `/model/model.class.php` to try and build all parts of the site but it's already starting to become huge and I think it might be better to completely cut it out. I'm thinking the better approach is to use:               elseif($_GET['type'] == "Profile") {         $profile = new thread($userId);         $comments =  $profile->getComments();         require "templates/profile.php";     }      The above is a brief example but is that how a controller could/should/might look or was the first approach better or am I completely missing the point of the model and controller communication?


Google Docs Scripting

I have about 10 google docs spreadsheets. I would like to add / process rows from each of them and display the summation of this data in a new tab in each spreadsheet. So if somebody adds a row to one of the spreadsheets, the summation tab should be updated in all of them. 2 questions:   1. Is this possible using google docs scripting?   2. What is the best way to share the same script and run it against all the documents?


"Undoing" an integer wraparound

I ran into an interesting theoretical problem a number of years ago. I never found a solution, and it continues to haunt me when I sleep. Suppose you have a (C#) application that holds some number in an int, called x. (The value of x is not fixed). When the program is run, x is multiplied by 33 and then written to a file. Basic source code looks like this:               int x = getSomeInt();     x = x * 33;     file.WriteLine(x); // Writes x to the file in decimal format      Some years later, you discover that you need the original values of X back. Some calculations are simple: Just divide the number in the file by 33. However, in other cases, X is large enough that the multiplication caused an integer overflow. According to the docs, C# will truncate the high-order bits until the number is less than `int.MaxValue`. Is it possible, in this case, to either:   1. Recover X itself or   2. Recover a list of possible values for X? It seems to me (though my logic could certainly be flawed) that one or both should be possible, since the simpler case of addition works (Essentially if you add 10 to X and it wraps, you can subtract 10 and wind up with X again) and multiplication is simply repeated addition. Also helping (I believe) is the fact that X is multiplied by the same value in all cases - a constant 33. This has been dancing around my skull at odd moments for years. It'll occur to me, I'll spend some time trying to think through it, and then I'll forget about it for a few months. I'm tired of chasing this problem! Can anyone offer insight? (Side note: I really don't know how to tag this one. Suggestions welcome.) **Edit:** Let me clarify that if I can get a list of possible values for X, there are other tests I could do to help me narrow it down to the original value.


Is java a good start to learn OOP?

I have good teacher who understands OOP. However, the language which he is expert in is Java and I don't want to learn Java. My question is, do you think if I learn OOP using Java I will waste my time? And do you think it is good to start to learn OOP?


How to detect achievements in gaming?

I mistakenly posted this to stackoverflow and now posting here based on a suggestion in on that site ... This is a very high level conceptual question. Say in a software application I have 4 different actions, for example: Upload, Share, Comment, and like And I want to give achievement badges to users like:   * Rookie - Upload your first 5 files    * Upload Junkie - Upload 20 files in 1 day    * Night Crawler - Upload a file after midnight    * Share-a-holic - Share 10 different files    * Likes-everything - Like 20 different files you get the idea. What is he best way to check and see if a user has achieved a particular achievement without having to compile the logic for achievement into my code? And .. - Retain the ability to Add new achievements post compile (xml or db) - Achievements must track specific actions, number of times, and additional criteria (like time of day) - Detection should be near real-time so the user notified almost instantly when an achievement is completed My biggest questions is, how do I detect these achievements being achieved? Do I: 1) Check after every action to see if ... (Most real time) 2) Have another program check the DB at all times against a set of rules? (Easiest) Is there another paradigm that I'm missing? I feel there definitely is because in many games (like jetpack for iOS for example), I'm notified of the achievement I have unlocked in the instant in which I unlock it which I found pretty impressive. Thank you


Draw a checkerboard in Java

I'm reading through a programming book and am having trouble understanding a few parts of this code. The program draws a checkerboard, and colors the odd squares black.               import acm.graphics.*;     import acm.program.*;          public class CheckerBoard extends GraphicsProgram   {          public void run()   {         double squareSize = (double) getHeight() / numRows;         for(int i = 0; i <= numRows; i++){             for(int j = 0; j <= numColumns; j++)    {                 double x = j * squareSize;                 double y = i * squareSize;                 GRect square = new GRect(x,y,squareSize,squareSize);                 square.setFilled((i + j) % 2 != 0);                 add(square);             }         }     }          private static final int numRows = 8;     private static final int numColumns = 8;      I understand most of the code, but I am still a little confused. My first question is: How exactly does the program go through the for loops? They are nested, so would it create all of the columns (the j for loop) first? Or does it increment both i and j after the block of code finishes? Secondly, why do I set x = j, and y = i? x is horizontal and j is vertical, shouldn't I set x = i and y = j? Both seem to yield the same results. Mostly, I would just like to know how the for loop runs each time around. a basic run or two through the program. Any help would be appreciated, thanks!


Is application written from scratch in programming language has to be license?

There are so many programming language like PHP, Perl, Python, Java, C, C++ and many other. These programming language has some open source license. If i develop application from scratch which is not related the source modification of these languages. Is my application has to be open source license?? There are billions of applications written in these language? All application has be open source? I don't understand that, is there language issue ever existed? I think there should not programming language licensing issue just like spoken language..either i speak in english, french or any other. I can write a book in any language without my book to be open source, is that right???


How do I implement the OpsDB from Release It! by Michael T Nygard

I have recently been reading the Release It! book by Michael T Nygard.In the book he talks about Implementing an OpsDB to manage and record performance statistics of applications. Has anyone implemented any of the concepts in OpsDB? I've been trying to find some examples but am struggling and I really would like to implement something like this. This page gives a little background to the the details http://screamingtiger.blogspot.co.uk/2010/05/release-it-176-standards-de-jure- and-de.html at the Operations database section Looking at the above I am not really sure what a Feature would be - would a client application count. Also, what would be some of the common things to capture for a web application. Any help would be most appreciated


How to minimize merge conflicts when using non-lock VCS like git?

I have been using git for about four months now. While I like most of its features, I find it rather inconvenient that multiple developers can make concurrent changes to the same file and then a need for merging ensues. In fact, I would prefer waiting for a file to get unlocked over tedious and brain hurting merges. I was wondering if there was a team etiquette or workflow to circumvent this terrible predicament. In my ideal world of development, there would never be a need to merge. E.g. is there a combination of hooks, commands, and workflows for git in order to have a remote repository notified when a local repository changes a file so that other developers get a git notification if they themselves try to modify the same file concurrently (e.g. when they run `git status` or something like that)?


Using a texture as an integer array (OpenGL 3.3, shader version 3.3)

I'm trying to have something like an integer array uniform for my fragment shader (I only need read access). Since it's a fairly large chunk of data (not so large that uploading it in every frame would be impossible, but enough to make me want to rather not do it). Essentially I want to just pass it a uniform telling the shader where this "array" is. I believe I can use a 1D texture for this, but I don't know how (actually, I don't know how to do many things because I just can't seem to find a reference for GLSL 3.3, I only ever find references for the C API). This sounds like a rather basic question and I'm sure it's been answered already somewhere, but I keep searching and can't quite find what I'm looking for.


Has anyone used RemObjects' Hydra to mix a large Delphi project with new C# additions?

_(Hopefully this is deemed suitable for Programmers, not StackOverflow - I could imagine it getting closed at SO because there's no obvious 'right' answer.)_ We have a large Delphi 2007 VCL project that uses things like DBXpress, Report Builder, DevExpress and TMS components (both visual and non-visual) etc. For reasons I won't bore you with, the company would like to start adding new modules to the program using .Net (via C# in particular). Rewriting from scratch isn't an option and given the heavy use of Report Builder and various other bits of Delphi-specific 3rd party code, I suspect that using something like TurnSharp to regenerate a C# project wouldn't work well either. **Ideally we want to keep our Win32 VCL Delphi code but add new modules (plug- ins, sections of contained functionality like wizards etc) via C#.** So we're considering RemObjects' Hydra, and in the next few weeks will probably have a go at evaluating it on a smaller-but-representative project first. I wondered if anyone had experience of doing this kind of thing with Hydra...?


Is imperative style programming (say with Java/C) more error prone than something more declarative

I know programmers tend to get defensive with their paradigms and tools that they use. But in your experience, with the most generic, typical pieces of code that you see with Java or C++ or C, is the code more error prone than a similar piece of code in an declarative or functional programming language. For example, with Java there can be a lot of boilerplate and setup code need to call your target routine. Usually developers may need to look at the implementation details to really understand what happens if they do or do not provide the correct dependencies. Normally the developer never does that so you end up with NullPointerException bugs and other logic errors.


Porting Software

I would like to know what would be needed to study and understand in terms of computing platforms and OS (Linux, Mac OS X and Windows) to become a software porting engineer.


How to test and optimize when you can't reproduce the environment?

In the past, I've worked in a variety of environments. Desktop apps, games, embedded stuff, web services, command line jobs, web sites, database reporting, and so on. All of these environments shared the same trait: no matter their complexity, no matter their size, I could always have a subset or slice of the application on my machine or in a dev environment to test. Today I do not. Today I find myself in an environment whose primary focus is on scalability. Reproducing the environment is prohibitively costly. Taking a slice of the environment, while plausible (some of the pieces would need to be simulated, or used in a single-instance mode that they're not made to do), kinda defeats the purpose since it obscures the concurrency and loading that the real system encounters. Even a small "test" system has its flaws. Things will behave differently when you've got 2 nodes and when you have 64 nodes. My usual approach to optimization (measure, try something, verify correctness, measure differences, repeat) doesn't really work here since I can't effectively do steps 2 and 3 for the parts of the problem that matter (concurrency robustness and performance under load). This scenario doesn't seem unique though. What is the common approach to doing this sort of task in this sort of environment? There are some related questions:   * this question has to do with hardware (like spectrum analyzers) being unavailable, which can be (relatively) easily emulated.    * this question is about tracking down bugs that only exist in production environments, which is helpful - but a different sort of activity.


Are expensive operations for a user bad for other users?

Let's say user A does something expensive (regarding CPU and/or memory), which takes a few seconds. Concurrently, user B needs a very small amount of computing time. In this case, will the computing for user A significantly slow down that of user B (even block maybe?), or are these situations handled in most systems? (I use ASP.NET MVC, but I wouldn't mind a more general answer either)


MySQL Database design - Opinions

Im working on a web Application for our bussiness with my brother. Our application its pretty simple, will be develop with php and mysql.   * Clients and providers ABMs   * Articles Inventory (we do not manage stock, because we resell from our providers)   * Purchases   * Account balance for our clients and providers Im stuck on accounting tables... Here is my model: ![database design](http://i.stack.imgur.com/jvRmR.jpg) Im in doubt with account table, im thinking about use a Trigger when purchases change Status (delivered to client) then I update Account balance but i dont know if this model its good for manage Accounts for my Clients. Im looking for opinions about my mistakes!! Thank you.


Are there alternatives to using an optional type in a multithreaded environment?

I'm making an MPMC queue in C++, and I would like to find out what the best interface for a `try_dequeue` method would be (I'm **not** concerned about its implementation). I'd like to provide a method which does not block if the queue is empty (like my `dequeue()` method does), but somehow notifies this to the caller. While I provide a `bool empty() const` method as well, this unfortunately does no good because for a multithreaded queue doing something along the lines of `if(!queue.empty()) queue.dequeue();` provides no guarantees. What I currently have is `T try_dequeue()`, which throws an exception if the queue is empty. This seems to offer the most intuitive interface, but an empty queue is hardly an exceptional situation, and that seems an awful lot like using exceptions for control flow. Another option would be `bool try_dequeue(T* t)`, which would write to `t` only if the queue was not empty and return if `t` was written to. After using the exception method above, this seems probably least intrusive, but it would require that `T` is both default-constructible (or in some manner trivially constructible, so the caller can do `T t; queue.try_dequeue(&t);`) and assignable. I wouldn't want to force those requirements on `T`, though, so perhaps a Java- like approach such as `optional<T> try_dequeue()` is in order. One of the minor issues with this is that I'd have to implement my own (can't use boost). Perhaps more importantly, it makes the interface seem bloated, in the sense that now I'm now dragging another type in where it would (hopefully) be avoidable, and, much like the situation with STL's `set::insert` requires us to copy a pair, then "unfold" its arguments, it forces the user into clumsy, long ritual that has to be repeated every time he or she uses the function. Perhaps I'm worrying too much about `optional<T>`'s usability, given that it doesn't have any of the more serious problems that the other two approaches do, but I'm wondering, what would be the best approach here? Is it the `optional` one? _Edit_ : It occurred to me that there's also a bit of an outlandish `bool try_dequeue(std::function<void(T&)>)` option which actually seems pretty nice (in fact this one will actually have the most minimal interface you can have, where there's no need for any external logic setting a local `T` to the returned value). Unfortunately I'd prefer to avoid the overhead incurred by calling an actual `std::function`, and using a template function `template<class F> bool try_deque(const F&)` isn't an option either since this is a derived class (from a generic `queue` interface).


If you should only have one assertion per test; how to test multiple inputs?

I'm trying to build up some test cases, and have read that you should try and limit the number of assertions per test case. So my question is, what is the best way to go about testing a function w/ multiple inputs. For example, I have a function that parses a string from the user and returns the number of minutes. The string can be in the form `"5w6h2d1m"`, where `w, h, d, m` correspond to the number of weeks, hours, days, and minutes. If I wanted to follow the '1 assertion per test rule' I'd have to make multiple tests for each variation of input? That seems silly so instead I just have something like:               self.assertEqual(parse_date('5m'), 5)     self.assertEqual(parse_date('5h'), 300)     self.assertEqual(parse_date('5d') ,7200)     self.assertEqual(parse_date('1d4h20m'), 1700)      In the one test case. Is there a better way?


Keeping a domain model consistent with actual data

Recently domain driven design got my attention, and while thinking about how this approach could help us I came across the following problem. In DDD the common approach is to retrieve entities (or better, aggregate roots) from a repository which acts as a in-memory collection of these entities. After these entities have been retrieved, they can be updated or deleted by the user, however after retrieval they are essentially disconnected from the data source and one must actively inform the repository to update the data source and make is consistent again with our in-memory representation. What is the DDD approach to retrieving entities that should remain connected to the data source? For example, in our situation we retrieve a series of sensors that have a specific measurement during retrieval. Over time, these measurement values may change and our business logic in the domain model should respond to these changes properly. E.g., domain events may be raised if a sensor value exceeds a predefined threshold. However, using the repository approach, these sensor values are just snapshots, and are disconnected from the data source. Does any of you have an idea on how to solve this following the DDD approach?


Is there a math theory or a model behind programming languages design

I'm trying to understand if a programming languages design is built on some a theoretical model.   I came across few links that was describing Programming Language Theory, Lambda Calculus, Formal Languages and Turing machine. I got lost in all that theory, what I understood from all that is that (any ..?) programming language is built on lambda calculus, that boils down to few language constructs.   1. is my understanding correct?   2. are there any models other than lambda calculus?   3. if the languages shares the same model, can we use that to convert a source code from one language to the other?


How do I properly design a many-to-many (charges/payments) accounting system?

This is just as much a db/programming question as an accounting/math question, so I'm actually posting to all relevant boards. I appreciate your patience in advance. Basically I'm having trouble wrapping my head around a payments ledger. My system has three tables: CHARGES, PAYMENTS and a PAYMENTS_TO_CHARGES. The issue is that part of the system requirement calls for both the ability to directly associate a payment with a CHARGE as well as allow members to post overpayments (or credits) to their account. So there's the need to track credits then apply them as needed to future CHARGES. Perhaps I'm thinking about things from the wrong standpoint, but I'm picturing CHARGES as a DEBIT and PAYMENTS as a CREDIT. However, it would appear that they can both have DEBIT/CREDIT depending on your accounting approach. So, my question -- officially -- is what is the best way to go about tracking/reconciling payments, and charges, while still allowing for overpayments, etc. I'm trying to work out the DB tables and business logic but every time I solve one problem, a reverse (or converse) item presents itself. Do I allow the many-to-many relationship to track positive and negative numbers per transaction? Do I create a fake universal charge that all credits apply to? Do I create a completely separate CREDITS table? As you can tell, I'm likely overthinking this, but I'm certainly befuddled. If all transactions were guaranteed 1-to-1, it would obviously be much simpler. Unfortunately they're not Best.


Linear probing hashing collision resolution

So I have a quick question about the linear probing method of collision resolution in hash tables. So by definition a linear probing method would look like:               while (hashTable[hash] != null)         hash = (hash(key) + step) % tableSize;      But in my case I know exactly what the table size will be, I know all the keys, so I'm wondering if this is a valid alternative implementation:               while (hashTable[hash] != null) {         if (++hash == hashTable.length)             hash = 0;     }      I'm sorry if I made it too confusing, but I'm a little confused myself... If you can't get what I'm asking, a simple explanation of how linear probing would be implemented would be very helpful, and ps: I'm working in java. Thanks alot


What do you use macros in your editor for?

My editor of choice is Notepad++. It has macro capabilities, but as much as I think, I don't see how can I use it for anything. Do you use macros in your editor that have made your work easier? (for general use I mean)


Programming Language? - To create a application (eLearning course) that will work on PC, Mac, iPhone, iPad, Touch etc?

Currently at work I'm helping put together and create eLearning courses within Flash. Our senior programmers have knowledge of how to do this, Although - I would like to know how you could go from converting a eLearning course from Flash into a application for Mac and PC, looking similar to Garageband's music lessons?   * What programming language was used to create Garageband on Mac?     * What is the best way to create a application that will work on PC, Mac, iPhone, iPad, Touch etc, Rather then using flash and Actionscript to create online based applications, that will only work in a browser on Mac and PC?   * Any further tips? Thanks Josh


What is the Ken Thompson Hack?

I read some stuff like cm bell labs but i couldn't get it all. How does it work really? What is the logic in that?


How should I describe the process of learning someone else's code? (In an invoicing situation.)

**Edit:** Justin Cave made a good point that this sort of communication should be up front in my quoting / estimations. Is this case, I'm still interested to know what sort of language people use to describe the 'existing code learning' activities. Especially to a company who haven't dealt with software contractors before. **End edit** I have a contract to upgrade some in-house software for a large company. The company has requested multiple feature additions and a few bug fixes. This is my first freelance style job. First, I needed to become familiar with how the application worked - I learnt it as if I was a user. Next, I had to learn how the software worked. I started with broad concepts, and then narrowed down into necessary detail before working on each bug fix and feature. At least at the start of the project, it took me a lot longer to learn the existing code than it did to write the additional features. How can I describe the process of learning the existing code on the invoice? (This part of the company usually does things in-house, so doesn't have much experience dealing with software contractors like me, and I fear they may not understand the overhead of learning someone else's code). I don't want to just tack the learning time onto the actual feature upgrade, because in some cases this would make a 'simple task' look like it took me way too long. I want break the invoice into relevant steps, and communicate that I'm charging for the large overhead of learning someone else's code before being able to add my own to it. Is there a standard way of describing this sort of activity when billing for a job?


In python, is it considered better to define a module with functions or a module with a class that contains functions?

In my code either of the above two options would work equally well but I am interested in finding out the pros and cons of both approaches.


In a web application, is it ok to group multiple pages in one view class or one class per page?

If you are building a web application, and you have a user management component, is it recommended to do:               class UserAdminView extends View {          }      or               class UserAdminUpdateView extends View {          }      What about controllers? Thoughts?


Programming "everything" using HTML5?

HTML 5 applications in the browser really seem to be taking off. I've been using src:kit within Google Chrome for a few weeks and love it. I'm an ASP.Net (C#/MVC 3) developer by trade, and in the past did several pieces of WebForms programming. With Windows 8 app development moving into the trade of local HTML5 apps, and the major smartphone browsers supporting HTML5 installation, as well as many platforms supporting it (PhoneGap and Titanium, for example), are we already/will we soon be at the point that I could create an app that would be fully "installable" to run as a _standalone_ on _every_ platform? I do realise that a database (or instert-your-data-store-here) would also be necessary, so adding another language in there for middleware would be necessary. C# on Mac/Linux with Mono is possible, but Mono generally only creates a GTK+ Application, so I would likely need to create another wrapper to house the application... I think. Any suggestions of a better language to use as middleware? I.e. for ease of transportation - I've got far more experience with C# than anything else so would like something from that family if I'll need to do something different. Basically, how far away are we from this? What still needs to change? Most importantly, if it is possible (which I believe, theoretically it is), what is the big jump between where we are now and when we will be there? This will eventually turn into a program, so it is a completely practical problem that I'm working my way through (I'll start development after Christmas). EDIT: To clarify, by 'every' platform, I include at least the following: Windows XP+/Mac OS X/Linux: any distro pretty much in the last 2 years/iOS/Android/Blackberry 5+/Windows Phone 7+


How to create a donation software

I have a requirement to create a donation software for a project. Does anyone know how KickStarter designed theirs? What are the security elements involved? How do I create the credit card transactions-processing part? Is there some common library/service used for that? I am still in research phases for this, so any ideas appreciated!! The site I am trying to do this for is http://www.problemio.com


How do i speedily traverse a file system while extracting/extrapolating various data and provide user feedback?

I'm working on a system file scanner that reveals info about various files (e.g. size, last used, duplicates, etc). Currently I'm traversing the file system once just to get a good measure of the files I'll be processing, I then loop through doing the actual processing (size info, hash info, etc). Obviously that immediately creates an entire layer of "extra" processing, but it allows me to use the previously acquired info to provide the user with some "progress data". I've been looking for a good mechanism to use in order to speed up the process while still showing progress data for end users. I thought about creating separate threads (one for appending files to a stack, and the other for reading from the stack as they became available), but that might get out of hand programmatically quickly. In the interest of speeding up the initial scan, I currently perform a "find path" (or the equivalent depending on what OS is being used) and grab all of the output. This, however, prevents me from negating entire subfolders (if the user desires) as it simply recursively lists everything. Certain OSes do have command line options for negating directories, etc, but I need a cross- platform solution. So, aaaaaaall that said, does anyone have any algorithmic suggestions for being speedy while providing quality progress? I'm not fundamentally tied to any specific language. I'm looking more for a higher level view of what needs to occur. Best.


Optimal way to store 18 billion key, value pairs

I have around 200 million new objects coming in, and a 90 day retention policy, so that leaves me with 18 billion records to be stored in the form of key-value pairs. Key and value both will be a string. It is basically a mapping between a unique identifier for the object in the application to the unique identifier for the object in the actual object storage. There is an application which loads objects into a Web OS. For each object it loads, it creates a 16 character string key, say DataID. The Web OS itself creates a 40 character string key, say ObjectID. So what I'm trying to do is create a mapping between DataID -> ObjectID for 18 billion objects. I'm don't know the mechanism being used to create the IDs. I will have to deal with:               write(key,value)     read(key)     delete(key,value)      I am looking for ideas for an optimal way to implement this. It should be optimized for reads & writes. Space optimization is secondary. I know Hadoop/NoSQL is one way to go, and probably another solution would be distributed Hash tables, but a few more options would help me decide which is the best solution. A relational database is not an option as we don't have an existing RDBMS in the current environment.


Should images be stored in a git repository?

For a distributed team that uses Git and Github as version control, should images also be stored in the git repository? For the most part, the images won't be changed. The folder containing them will only grow in size as images are added. A concern is that the image folder may grow to a large size over time by combination of large images, or just a lot of them. Is this considered a best practice? What other alternatives are there to sharing binary files needed in projects that a distributed team can easily access?


Is COBOL still worth learning?

Does learning COBOL still make sense?


Why JSP over Servlets for view?

Although servlets does the task of sending the HTML code to the client programmers weight JSP over servlets for that. Even a JSP code is compiled into servlet before giving the response to the browser then why is JSP preferred? If servlet is used then a lot of computation work can be saved.


Does iCloud use windows Azure?

I just read this article on iCloud's use of Azure: http://www.zdnet.com/blog/microsoft/is-apple-really-using-windows-azure-to- power-icloud/9687 Anyone know if there is any truth in it?


Library Organization in .NET

I've written a .NET bitwise operations library as part of my projects (stuff ranging from `get MSB set` to some more complicated bitwise transformations) and I mean to release it as free software. I'm a bit confused about a design aspect of the library, though. Many of the methods/transformations in the library come with different endianness. A simple example is a `getBitAt` method that regards index `0` as the least significant bit, or the most significant bit, depending on the version used. In practice, I've found that using separate functions for different endianness results in much more comprehensible and reusable code than assuming all operations are `little-endian` or something. I'm really stumped regarding how best to package the library.   * Should I have methods that have LE and BE versions take an enum parameter in their signature, e.g. `Endianness.Little, Endianness.Big`?   * Should I have different static classes with identically named methods? such as `MSB.GetBit` and `LSB.GetBit` On a much wider note, is there a standard I could use in cases like this? Some guide? Is my design issue trivial? I have a perfectionist bent, and I sometimes get stuck on tricky design issues like this... **Note:** I've sort of realized I'm using `endianness` somewhat colloquially to refer to the order/place value of digital component parts (be they bits, bytes, or words) in a larger whole, in any setting. I'm not talking about machine-level `endianness` or serial transmission endianness. Just about place-value semantics in general. So there isn't a context of targeting different machines/transmission techniques or something.


what is difference in section and subreport, where to use multiple sections?

Please share your knowledge about these Crystal Reports concepts.   1. I want to know what is difference in section and sub report? I know about default sections and we can add new sections into report.   2. What is purpose of a subreport? when should we use a subreport instead of a section?   3. Where should we use multiple detail sections in report?   4. Are sections used to carry a "Can grow" field that will be bringing data dynamically?


Formal definition for term "pure OO language"?

I can't think of a better place among SO siblings to pose such a question. Originally I wanted to ask "Is python a pure OO language?" but considering troubles and some sort of discomfort people experience while trying to define the term I decided to start with obtaining a clear definition for the term itself. It would be rather fair to start with correspondence by Dr. Alan Kay, who has coined the term (note the inspiration in biological analogy to cells or other living objects). There are following ways to approach the task:   1. Give a comparative analysis by listing programming languages that can exhibit (or fail to do so) certain properties unique and sufficient to define the term (although Smalltalk, Scala, ~~Java~~ , and so on - are possible examples but IMO this way seems neither really complete nor fruitful)   2. Give a formal definition (or close to it, e.g. in more academic or mathematical style).   3. Give a philosophical definition that would totally rely on semantical context of concrete language or a priori programming experience (there must be some chance of successful explanation by the community).  My current version: _"If a certain programming (formal) language that can (grammatically) differentiate between operations and operands as well as infer about the type of each operand whether this type is an object (in sense of OOP) or not then we call such a language an OO-language as long as there is at least one type in this language which is an object. Finally, if all types of the language are also objects we define such language to be pure (strong) OO- language."_ Would appreciate any possible improvement of it. As you can see I just made the definition dependent on the term "object" (often fully referenced as class of objects). [EDIT] In addition, I use (luckily well understood) notion of a _type_ as in typed languages. Data type programming or type oriented programing is not only a syntactical interpretation (of the program text, i.e. how to treat certain values of literals and data variables - something that evolves into type safety) but can be attributed to language grammar and studied in formal way (using mathematical logic) as so called type systems. Notice that requiring particular type system to have a so called _universal type_ is one of the ways defining purity of OO language (there are ways to expand this semantically). _NB_ _**how to answer_** :   * it helps if you specify a book or a reference that supports/explains your understanding of terminology and concepts (usually a good definition covers or references all depended concepts except elementary).   * if possible indicate an indented category of your answer/definition if it is not clear otherwise (see above: 1 - by language example, 2 - mathematical logic, 3 - technical description and programming philosophy)   * _classification is important_ (and also because term pure-OO is included into term OO) while answering try to unmix elements of OO paradigm from other well known methodologies (and by no means confuse/overlap them, e.g. typically elements of modular programming can be covered/embodied with OO programming): try to distinguish OOP from (including or being a part of) Functional programming, Logical programming (especially strongly specialized ), Abstarct Data Types (ADT), Modular, Metaprogramming (generics and LISP's macroexpansion-time), Contracts (e.g. Eiffel), Aspect-oriented (AO), (difference between declarative and functional classification as well as _historical_ definitions of Dijkstra's structured are clear) _**on difficulty of giving a formal definition_** : surprisingly enough it is very easy to give a mathematical description of OOP in form of a certain logical (formal) system (most likely type based) and defining one concept after another. One can even try to do something more practical by applying that formalism to type safety checking or new language design aspects than merely abstract entertainment or exercise (also lookup formulation of OOP in Intuitionistic Type Theory, Dependent types, independently, in FOL formalisms as lambda calculus and just by using category theory). A main point here is that _unsurprisingly_ such formulations IMO are strongly biased (flawed) by most likely initially incomplete understanding of OOP (in computer engineering) and end up being almost inaccessible afterwards (thus hardly contributing backwards to programming world - maybe except certain percentage finds applications back from formal world by being integrated into popular languages). So yes, it is difficult to give exactly a "good" definition, not just definition. But I am positive of asking this here because of your experience and direct involvement, guys.


How can I avoid the engineering mistakes of PDT?

As a developer with enough experience to evaluate a tool, I may say that PDT is very huge in size and slow in performance for a PHP IDE. It gets bigger by release and exponentially slower by the size of the projects. Add some extra syntax coloring rules and it literally crawls, code completion works randomly and building workspace takes like forever. Java black magic (-Xmx etc) eases the pain a little but that's it. So my questions are:   1. Why is PDT like this? What design or engineering factors led to its poor performance?    2. How can I avoid making these same mistakes in my own products?


How to break up Yocto layers for continuous integration?

We are building embedded software using a Linux setup based on the Yocto project. We have a couple different configurations that we are building for different purposes (but the same target). I have been struggling with the best way to set up continuous integration for this project. Ideally, I would like to be able to reuse most of the artifacts, so that someone working on a specific layer can get rapid feedback. However, I haven't found any good suggestions on a way to break these builds apart. Is there a way to separate the various layers we are working on into multiple builds with shared artifacts so that it takes a couple hours for developers to get feedback from each build?


Start by Teaching Classes

In every class, and every book I have seen regarding programming, classes are held off. They are thought to be confusing and strange. I certainly had issues with them. But in object orient programing, classes are so important, looking back at my education, it's almost illogical that I was allowed to go so long without knowing objects. I am helping to develop a course to teach python to people who have never coded before. Is it possible to teach programming by starting first and foremost with classes? Is it not possible to say, "This is a class. We will fill it with nouns and verbs so that it can serve our particular/specified needs"?


When to decide to introduce interfaces (pure abstract base classes) in C++?

Assume that you are developing a functionality and are 90% sure that the implementation class will stay alone. If I was in this position in Java I would probably not use the interface right now to keep the things simple. In Java it is easy to refactor the code and extract the interface later. In C++ the refactoring is not always so easy. It may require replacing values with smart pointers (because of the introduction of polymorphism) and other non-trivial tasks. On the other hand I don't much like the idea of introducing virtual calls when I am 90% sure they won't be needed. After all speed is one of the reasons to prefer C++ over simpler languages.


What is the difference between CSDA and CSDP?

This question is in reference to the IEEE's CSDA and CSDP certifications. I've already taken the CSDA course, which covered all of the knowledge areas in the Software Engineering Body of Knowledge (SWEBOK). I'm thinking about doing the CSDP certification as well, but I can't find anywhere that tells me how it differs from the CSDA. I know that it's aimed more at professionals rather than recent graduates, and I'd imagine that it covers the same areas as the CSDA, but in greater detail. Unfortunately I can't find much evidence to back that up. This is making it difficult to justify to my boss that he should spend several hundred pounds of the group's training budget on it. So the question is: **What does the CSDP offer that the CSDA doesn't?**


Drawbacks of code kata

Code kata is a concept that proposes to hone programmer's skill by doing small problems many times trying to improve the code at each iteration. The name comes from an analogy to martial art kata where forms (aka kata) are practices done over and over leading to improvements. From the reaction I got to my last question on the topic, I wish to know what are the draw backs of this approach?


Working with data and meta data that are separated on different servers

While developing a product, I've come across a situation where my group wants to store meta data for data entry forms (questions, layout, etc) in a different database then the database where the collected data is stored. This is mostly for security because we want to be able to have our meta data public facing, while keeping collected data as secure as possible. I was thinking about writing a web service that provides the meta information that the data collection program could access. The only issue I see with this approach is the front end is going to have to match the meta data with the collected data, which would be more efficient as a join on the back end. Currently, this system is slated to run on .NET and MSSQL. I haven't played around with .NET libraries running in SQL, but I'm considering trying to create logic that would pull from the web service, convert the meta data into a table that SQL can join on, and return the combined data and meta data that way. Is this solution the wrong way to approach the problem? Is there a pattern or "industry standard" way of bringing together two datasets that don't live in the same database?


Make a flowchart to demonstrate closure behavior

I saw below test question the other day in which the authors used a flowchart to represent the logic of loops, and I got to thinking it would be interesting to do this with some more complex logic. For example, the closure in this immediately-invoked function expression (IIFE) sort of boggles me:               while (i <= qty_of_gets) {         // needs an IIFE         (function(i) {             promise = promise.then(function(){                 return $.get("queries/html/" + product_id + i + ".php");             });         }(i++));                            }      I wonder if seeing a flowchart representation of what happens in it could be more elucidating. Could such a thing be done? Would it be helpful, or just messy? I haven't the foggiest clue where to start, but thought maybe someone would like to take a stab. Probably all the ajax could go and it could just be a simple return within the IIFE. ![logic test](http://i.stack.imgur.com/qicvE.png)


Is a single config object a bad idea?

In most of my applications, I have a singleton or static "config" object, in charge of reading various settings from disk. Almost all classes use it, for various purposes. Essentially it's just a hash table of name/value pairs. It's read-only, so I haven't been too concerned with the fact that I have so much global state. But now that I'm getting started with unit testing, it's starting to become an issue. One problem is that you don't usually want to test with the same configuration that you run with. There are a couple of solutions to this:   * Give the config object a setter that's ONLY used for testing, so you can pass in different settings.   * Continue using a single config object, but change it from a singleton to an instance that you pass around everywhere it's needed. Then you can construct it once in your application, and once in your tests, with different settings. But either way, you're still left with a second problem: almost any class can use the config object. So in a test, you need to set up the configuration for the class being tested, but also ALL of its dependencies. This can make your testing code ugly. I'm starting to come to the conclusion that this kind of config object is a bad idea. What do you think? What are some alternatives? And how do you start refactoring an application that uses configuration everywhere?


What's the name for a bug that suddenly breaks things but has always been present?

We had a failure in our software today and after investigating discovered that the failure should have been occurring for weeks, but it waited until this morning to rear its ugly head. Is there an accepted name for such a bug that I can use when referring to it with other programmers? The closest I could find was a Schrödinbug, but I'm don't think it applies, since nobody was inspecting any code. The bug was just lying in wait.


What can be done against language inertia?

Often, projects use programming language X, but would use programming language Y if they were started from scratch. For example, big numerical models may be written entirely in Fortran. Whereas this might be a reasonable choice for the components that need to run fast (alternative would be C or C++), it might be a poor choice for components that either do not need to run fast (such as things dealing with human input or simple visualisations), or where runtime is not the limiting factor (such as I/O, particularly when from the network). Another example may be when a project is built using a propriety language (such as Matlab; no, FOSS clones are not good enough) and was started at a time when FOSS alternatives were not viable, but ten years later, they are; and it would be beneficial to migrate. However, due to _language inertia_ , a migration does not happen. Code that works should not be touched, porting code is a time-consuming, expensive process, and programmers are familiar in language X but not necessarily in language Y. Still, in the long term, a migration would likely be beneficial. Can anything be done to mitigate the problems associated with language inertia? Are there any notable examples of big projects that have successfully overcome this problem? Or is a project bound to stick forever with the initial choices?


IOC and stateless services. Short-lived or single-instance?

Given a garbage-collected framework, when using an IOC container to inject purely stateless services, is it generally better to use the container's single-instance lifespan or to recreate the object each time it is used and throw it, and all its dependencies, away as soon as you're done with them?


Writing an application prototype - best practices?

For a project I am working I want to implement a small prototype to try things out, demonstrate some functionality to the client and learn some frameworks used in the project. Do you have any suggestions or do you know of best practices for implementing such a prototype? Some more details:   * The application will be a complex web app   * I have to implement a mechanism where the server pushes data to subscribed clients (the data will be generated by some events)   * I want to write a prototype which implements exactly this behaviour but nothing more


Lone Programmer vs. Everything Else

I guess you could call me a "MicroISV" because it's basically just me doing the work to create a product to be sold commercially. I'm sure there are many out there like me, so here's my question: Besides the programming/coding aspect to get your code out the door, **_do you DIY or vendor-out everything else_**? For example, web site creation, internet marketing, accounting/taxes, company minutes, customer support, setting up ecommerce/banking, server management, procurement, etc. All of those activities seem to be out of the realm of what I'm good at or have the patience/time for, but I don't know if the alternative is too untrustworthy or too expensive to make it worthwhile to try to farm out these tasks to someone else (like a local company, vendors on oDesk, etc.). I can certainly understand wanting to keep all these tasks "in-house" (i.e. me) to protect strategy, plans, code, private things like bank account numbers, but is it really that much of a risk to outsource these tasks? What is your experience?


Executive trying to understand Web 2.0 Development - Which language is best?

I am writing a business plan for developers in the 2.0 environment; my utmost respect is given to the people doing the work, but my ignorance is preventing me from articulating who I will need to complete it. What is the best way to describe the developer needs of a Web 2.0 Social/Gaming company as an open position for hire?


What are your strategies to improve the level of your team in a clever way?

I'm looking for innovatives ways to improve the whole team & raise the global level in every aspects, not just technicals ones. My actual solutions :   * **programming challenge** vith votes, notes etc    * **teaching each others** : each month, a member might present a new api,strategy, whatever that help to build better sofwares. It will end up with votes. If it is approved, the team will commit to use it for a month. Then feedback.Then use it or leave it.    * **annual review to reduce you blind spot** of your Johari window. Personnaly, i really find instructive the _farewell feview_ , done each time i leave definitively a group of people.  Because of social conditioning, they need a warming up. So i really tell them to not filter their words & almost badmouth about me. No matter what they would say i will stay quiet. It works great with women, especially if they can answer with an email and you far away (double safety net) _**And what about yours ?_**


Does it make sense to use tag without version numbers?

In our working group we had a discussion on using git tags in our projects. Some people argumented pro tags and some argumented against using tags. The crux is that we are talking about Magento projects which aren't really using version numbers, hence the tags only consist of `20140624` date references. The pro side was that it is easier to revert to a tag than a normal commit hash and it is part of gitflow, the contra side was that it only creates overhead. What do you think on using git tags only for reverting history?


What's the best way to organize JavaFX 2.0 code?

In every example I have seen yet almost all of the GUI code is written in the `start(Stage stage)` method of the main class. Is this the best approach, or is it OK to subclass the Stage class and make your own thing? If the latter is OK, wouldn't the performance suffer because of lot of Stages?


Why is Perl's smart-match operator considered broken?

I've seen a number of comments across the web Perl's smart-match operator is broken. I know it originally was part of Perl 6, then was implemented in Perl 5.10 off of an old version of the spec, and was then corrected in 5.10.1 to match the current Perl 6 spec. Is the problem fixed in 5.10.1+, or are there other problems with the smart- match operator that make it troublesome in practice? What are the problems? Is there a yet-more-updated version (Perl 6, perhaps) that fixes the problems? **Edit:** To clarify, I'm not asking about bugs, but rather the opinion that the intended behavior of `~~` is bad.


How can I convince cowboy programmers to use source control?

**UPDATE**   I work on a small team of devs, 4 guys. They have all used source control. Most of them can't stand source control and instead choose not to use it. I strongly believe source control is a necessary part of professional development. Several issues make it very difficult to convince them to use source control:   * The team is not used to using TFS. I've had 2 training sessions, but was only allotted 1 hour which is insufficient.   * Team members directly modify code on the server. This keeps code out of sync. Requiring comparison just to be sure you are working with the latest code. And complex merge problems arise   * Time estimates offered by developers exclude time required to fix any of these problems. So, if I say nono it will take 10x longer...I have to constantly explain these issues and risk myself because now management may perceive me as "slow".   * The physical files on the server differ in unknown ways over ~100 files. Merging requires knowledge of the project at hand and, therefore, developer cooperation which I am not able to obtain.   * Other projects are falling out of sync. Developers continue to have a distrust of source control and therefore compound the issue by not using source control.   * Developers argue that using source control is wasteful because merging is error prone and difficult. This is a difficult point to argue, because when source control is being so badly mis-used and source control continually bypassed, it is error prone indeed. Therefore, the evidence "speaks for itself" in their view.   * Developers argue that directly modifying server code, bypassing TFS saves time. This is also difficult to argue. Because the merge required to synchronize the code **to start with** is time consuming. Multiply this by the 10+ projects we manage.    * Permanent files are often stored in the same directory as the web project. So publishing (full publish) erases these files that are not in source control. This also drives distrust for source control. Because "publishing breaks the project". Fixing this (moving stored files out of the solution subfolders) takes a great deal of time and debugging as these locations are not set in web.config and often exist across multiple code points. So, the culture persists itself. Bad practice begets more bad practice. Bad solutions drive new hacks to "fix" much deeper, much more time consuming problems. Servers, hard drive space are extremely difficult to come by. Yet, user expectations are rising. What can be done in this situation?


Method visibility for testing partial mocks

I'm currently writing unit tests to test behavior of a method and would like to partially mock the methods calling injected properties. For example:               public void doSomething() {       int complicatedInt = 1 + 1;       if(getProperty().someBooleanReturn()) {         ... etc. ...        }     }      So obviously I want to mock the `getProperty()` method in order to expect the `someBooleanReturn()`. My question is, since I don't want the getter to be visible to other classes, but visible to unit tests, I've currently been making these methods package-private (default scope). Is there a standard for these types of operations? Thanks!


Copyright on own implementation of Standard C Library

I am busy writing a bare-bones Standard C Library for my hobby OS. I am only including the functions I really need for now but the library is still referenced as 'libc' in my source and I plan to expand it to a fully featured C Library. My OS is going to be released as open-source so I would like to know what kind of copyright notice I should put on the source files for my 'C Library' because the coding is mine but it is still based on the source of other C libraries such as GNU C. I have seen this copyright notice on a C Library implementation for AVR               00001 /* Copyright (c) 2002, Marek Michalkiewicz     00002    Copyright (c) 2004,2007 Joerg Wunsch     00003      00004    Portions of documentation Copyright (c) 1990, 1991, 1993, 1994     00005    The Regents of the University of California.     00006      00007    All rights reserved.     00008      00009    Redistribution and use in source and binary forms, with or without     00010    modification, are permitted provided that the following conditions are met:     00011      00012    * Redistributions of source code must retain the above copyright     00013      notice, this list of conditions and the following disclaimer.     00014      00015    * Redistributions in binary form must reproduce the above copyright     00016      notice, this list of conditions and the following disclaimer in     00017      the documentation and/or other materials provided with the     00018      distribution.     00019      00020    * Neither the name of the copyright holders nor the names of     00021      contributors may be used to endorse or promote products derived     00022      from this software without specific prior written permission.     00023      00024   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"     00025   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE     00026   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE     00027   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE     00028   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR     00029   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF     00030   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS     00031   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN     00032   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)     00033   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE     00034   POSSIBILITY OF SUCH DAMAGE.     00035      00036   $Id: stdlib_8h_source.html,v 1.1.1.4 2012/01/03 16:04:22 joerg_wunsch Exp $     00037 */


Java continuous integration with extras

I am very new to continuous integration, but I decided to give it a shot. Unfortunately I found there to be huge quantities of different tools, and each one is sizable and seems to be difficult (I am new so of course it intimidates me). What I am looking for however is a tool that can   * run my junit tests   * execute my builds   * create the jars   * deploy specific jars to specific remote servers What are the key steps and approaches to filling these requirements?


CSS naming guildlines with elements with multiple classes

Its seems like there are 2 ways someone can handle naming classes for elements that are designed to have multiple classes. One way would be:                     This is something that twitter bootstrap uses. Another possibility I would think would be:                     It seems like the zurb foundation uses this method. Now the benefits of the first that I can see is that there less chance of outside css interfering with styling as the class name btn-success would not be as common as the class name success. The benefit of the second as I can see is that there is less typing and potential better style reuse. Are there any other benefits/disadvantages of either option and is one of them more popular than the other?


What is a good alternative to the name variable for a language that only has immutable references or labels?

For example, in functional languages, **variables** are single assignment and their values are immutable once assigned. So they have two states **unbound** and **bound** , once bound they can't be changed. Is there some mathematical term or other computer science term that is most appropriate for such as thing? Something that **semantically** doesn't imply variance or mutability. If not there doesn't exist such as term and if you were designing a language that had such constructs, what other than the word **variable** would you use to for these? I am **not** really looking to **poll** for ideas, I am trying to figure out if there is already an accepted industry ( any industry ) term for such a thing.


Generic params table design

We have a generic parameter table whose important attributes are :               id number auto increment not null     domain varchar (200) not null     classification varchar (200) not null     param_name varchar (200) not null     value CLOB/text     created_by, created_date, updated etc      Here the id is unique for the table plus at the functional level there is a unique index on domain, classification, param_name The value is text of any length in UTF-8. We want to add BLOB, binary data support. Choices are :   1. add a new column : blob_value BLOB OR    2. add a field 'type' of varchar2 in this table that can be null or 'B', default null. Null or blank means is not - text If B means its a blob. In that case the value will hold an id of a blob table row. The blob table will look like : id number auto increment data BLOB   3. Leave existing table alone and in a new table that references this one: parameter_id number primary key, data blob, with constraint FOREIGN KEY (parameter_id) REFERENCES Parameter(id) (suggestion FrankieTheKneeMan thank you) Advantage of first is that a param can have both a text and a blob or either. Advantage of second - not sure -> do not need to keep null columns? Current table has 30,000 rows and we expect it to grow to 70,000 out of which 10% will need blob data. Question: which of these would you choose and why or do you have an alternate ?


Website for Local Programmers User Group

Looking for suggestions/requirements for a website for a local programmer user group, and the resulting feedback of other commenting on answers. Examples of an existing site would be nice, but not required.


Construct an array from an existing array

> Given an array of integers A[1...n-1] where 'N' is the length of array A[ ]. > Construct an array B such that B[i] = min(A[i], A[i+1], ..., A[i+K-1]), > where K will be given. Array B will have N-K+1 elements. We can solve the problem using min-heaps Construct min-heap for k elements - O(k) For every next element delete the first element and insert the new element and heapify Hence Worst Case Time - O( (n-k+1)*k ) + O(k) Space - O(k) Can we do it better?


Using oAuth as a complement to an existing authentication system?

I am hoping this is the correct stack exchange to be asking this, here goes. I am building a new website whereby it implements its own custom login system. You simply register your username, email password etc. Then you're free to log in with the option of clicking "remember me" to save the hassle of logging in every time. For simplicity, let's call this the **Custom Login System** and an account a **Custom Account**. However, I am very interested in integrating some 3rd party login systems via oAuth that are offered by the likes of Facebook, Google and Twitter. My question is, is it feasible to have a mechanism whereby:   * you log in via Google, for example   * my script confirms the tokens and all that good stuff to ensure you authorised the login   * I then ask you to either link your Google account to:      * an existing **Custom Account** or     * a new **Custom Account** by asking to register one after logging in with Google   * once you've logged in to your **Custom Account** , I treat you like any other user except I assume the "remember me" option was ticked and set a cookie that logs you in from here on as if you were using a normal **Custom Account** the whole time. This could essentially mean that I don't need to constantly query Google's servers, only during login. Then from there on, as long as they have a valid cookie they will stay logged in. Is this possible? Are there any obvious flaws that I am missing out?


Suggested setup for angularJS development in Visual Studio 2013

I am starting with AngularJS. The back end will be Web API (which is new to me as well) and I'd like to use just one IDE, so I'm trying to figure out how to setup a project in Visual Studio 2013 for AngularJS. I'd like to keep it as a separate project, to keep it loosely coupled to the API (or keep the UI decoupled from the Web API). I'm having a hard time figuring out how to get this setup. So....   * What project type is best for a pure AngularJS (pure HTML 5) project?   * Is is suggested to use Grunt? Or is MS Build better to handle build tasks? I thinking here linting, minify, concatenating files into a single distribution file, maybe copying to a web server.   * How do you run tests? Is there a plugin to run Jasmin tests? Do you just run Karma separately?    * Are there any good templates for AngularJS? Any that use ngBoilerplate? Any help would be appreciated.


How are the size of the stack and heap limited by the OS?

**Note** : if you need to consider a specific OS to be able to answer, please consider Linux. Whenever I run a program, it will be given a virtual memory space to run in, with an area for its stack and one for its heap. **Question 1** : do the stack and the heap have a static size limit (e.g., 2 gigabytes each), or is this limit dynamic, changing according to the memory allocations during the execution of the program (i.e., 4 gigabytes total to be used by both, so if a program only uses the stack, it will be able to have a stack with 4 gigabytes)? **Question 2** : How is the limit defined? Is it the total available RAM memory? **Question 3** : What about the text (code) and data sections, how are they limited?


Is using Singleton correct for Jtree & DefaultTreeModel?

Basically I have one Tree view which uses a single DefaultTreeModel. Is it okay to use singleton for Tree extending JTree and another singleton for TreeModel extending DefaultTreeModel? If not, what is the reason to avoid using singleton for each object?


Text Adventure language

I was thinking of creating a text adventure game and after a small google search, I found out that quite a few (simple) text adventure games are created in Prolog. Why is that?


What technology/algorithm should be used to abstract meaning or keywords from a passage of text?

Hi and thanks for looking! ## Background I have a project wherein I need to abstract meaning from a passage of text to determine what the text is seeking and then match that text to a list of search results. Now, I have some context with this and the following scenario is very close, but doesn't violate my NDA with the client: Let's say I have a software developer job description from a posting on Craig's List. I want to somehow parse that description and make a guess as to whether the posting is seeking a C# developer, a DBA, a SDET, a C++ dev, etc. Even better, it would be good to distill certain parameters such as years/level of experience and experience with any particular stacks (.NET, Java, etc). Once I have abstracted the requisition, I then need to reference a database of resumes (CVs) to find a ranked set of matches, probably using the same algorithm or at least a system of tags. ## Question How best do I attain this goal? Should I be looking into building an index of keywords? Natural Language Processing? Evolutionary Algorithms? We have to assume that human interaction will be very minimal. ## Example Job Posting Here is an example Job Posting that I have pulled at random from Craig's List: > We invite you to bring your career to an environment where talent is > rewarded and new ideas are encouraged. At Seattle Children's, the Pacific > Northwest’s premier pediatric care center, we offer more than just state-of- > the-art facilities and open career growth potential. You will also find a > true commitment to our patients and families that reach far beyond the > bounds of clinical expertise. The Applications Development Senior position > in the Center for Developmental Therapeutics will develop, test, standardize > and implement software for high throughput data analysis. This includes > system analysis, design, application support, research into standards, and > customer/vendor relations management in support of production operations. > For example, supporting the integration of different computational > approaches into an end-to-end workflow for high throughput data analysis, > including applications for proteomics and metabolomics. Participate in all > phases of the project lifecycle, including architecture, design, > development, alpha, beta, release and production support. The ideal > candidate will have a Bachelor's degree in the field and a minimum of three > years of experience with software development; working knowledge of JAVA, > Spring, AJAX, JSF, Hibernate, JQuery, and JUnit; and solid experience with > SQL tuning and understanding the execution plan will be key to this role. > Please ensure to complete the job assessment questions right after you > submit your application for this opening. Required: \- Bachelor's Degree in > Computer Science, Math, Business, or related field \- Three (3) years > software development experience \- Working knowledge of JAVA, Spring, AJAX, > JSF, Hibernate, JQuery, and JUnit \- Solid experience with SQL tuning and > understanding the execution plans \- Strong understanding of multi-tiered > web applications and scalability challenges Preferred: \- Five (5) or more > years software development experience \- Experience developing large > software systems \- Experience with web services (HTTP, JSON, SOAP, XML), > Unix/Linux environments, and distributed systems (HADOOP) \- Experience in > software and algorithmic development for molecular biology, biotechnology, > microarrays or proteomics. We offer competitive pay, generous paid time off, > transportation discounts, and employee reward and recognition programs. Thanks! Matt


Use verbs with functions, nouns with classes - what about interfaces?

Ok, I understand the normal conventions of using verbs with functions and nouns with classes. What about interfaces? Is there any methodology when coming up with interface names that may not be that obvious? Just to make it clear, I'm not talking about whether to put an "I" in front of the name or if to use camelCase or PascalCase. I'm wondering about the method of figuring out a clear, semantic name for an interface. **EDIT** I'm obsessing on how to name an interface in the clearest way. I guess it just needs to be a noun too because when I think of naming classes I think of the closest "real" world object it can relate to. I suppose real world interfaces are things like a keyboard, mouse, remote control, ATM screen. Those are all nouns. Anyhow, any additional insight on a good way to formulate interface names would be appreciated.


What issues do I need to consider when setting up a User Support group for a large enterprise system?

I have been tasked with becoming the Administrator for a large enterprise software system that consists of several shrink wrapped applications and some home grown 'glue' and has a couple of hundered users across three continents. What do you think are the aspects / points I need to address? At the moment the best I can come up with is a quote from Kathy Sierra's Creating Passionate Users blog post: > How does this help the users kick ass? which seems helpful as a mantra, but not very concrete.


Which part of the source base should users be testing?

I'm using SVN and I'm wondering about which part of the code base the users should test. The trunk (after the new feature branch has been merged in) or the branch? If using the branch, how do you deal with the scenario where two developers are working on two different feature sets (so two branches), and need to release for testing to the users? We've had a scenario where users are testing the wrong version (branch) and obviously cannot see their fixes. I'd appreciate some experience / advice about dealing with this. Update: Branches are used for new features / bug fixing and eventually merged back into the trunk. Testing involves testing the entire application (for site- effects) but will realistically users will have only tested their feature.


Should we always unit test bugs when correcting them?

When correcting bugs, it is encouraged where I work to first write a test that fails with the given bug, and then to fix the code until the test passes. This follows TDD practices, and is supposed to be good practice, but I noticed it tends to produce cryptic tests that come really close to the implementation. For instance, we had a problem when a job was sent, reached a certain state, was aborted, and retried. To reproduce this bug, a massive test was written with thread synchronization in it, lots of mocking and stuff... It did the job, but now that I am refactoring the code, I find it very tempting to just remove this mammoth, since it would really require a lot of work (again) to fit the new design. And it's just testing one small feature in a single specific case. Hence my question : how do you test for bugs that are tricky to reproduce ? How do you avoid creating things that test the implementation, and hurt refactoring and readability ?


Javascript, Text Annotations and Ideas

I am very curious to hear input from others on a problem I've been contemplating for some time now. Essentially I would like to present a user with a text document and allow him/her to make selections of text and annotate it. Specific to the annotations i aim to achieve the following:   1. Allow users to make a text selection, annotate it, then save the selection and annotation for reference later   2. (UI) Support representing overlapped annotations. For example if the string where: "This is the test sentence for my example test sentence", user1 might have an annotation on "is the test sentence for my example" and user2 might have an annotation on "for my example".   3. Account for a situations where the document's text changes. The annotations would to be updated, if possible. How would you tackle this from a technical perspective? Some ideas I've had are:   * Use javascript ranges and store an annotation as a pair of integers something like: (document_start_char, document_end_char). Save this pair in the db.   * Alternatively, using JS get the text selected and actually save the full text in the db. (not sure how i would then do overlapping annotations)   * Represent overlapped annotations by applying a css style to highlight the text then darken the "stack" of annotations where they overlap. Smallest annotation would always have to be on the top of the "stack". What are your thoughts or areas of improvement? How the _heck_ could I support a document's text being updated without breaking all the annotations?


Closing tag (?>) on PHP files?

Some people swear by closing their PHP files with `?>`, some say it's more optimized to leave it off. I know that it's not essential to have it on there, I'm just wondering what the pros and cons are of doing this, and what best practice is.


Why do people use programming books?

I find that when someone asks what is the best way to learn how to program, people usually provide them with references to a bunch texts written by various authors. However I don't believe many people at all learn to program from books. I find that they are usually faced with a challenge and then use programming as a tool to overcome it. For example I 'got into' programming because I wanted to start a server for a game I was playing, so I googled and read through the support for that particular server and now I am a employed software engineer, using only the skills I developed (and then further developed) by coding C# scripts for a not very popular server package. So my question is, do people generally find it easier to learn from these books? I know I have looked at a few of them and found them far too 'dry' to encourage me to finish it.


Creating a remote management interface

I'm looking for info on creating a remote management interface for our software. This is not anything illicit. Our software is for live TV production and once they go on-air we can't access the PC (usually through LogMeIn). I would like to be able to upload/download files and issue commands to our software. The commands would be software specific like "load this file" or "run this script" or "return this value" etc. A socket connection is preferred but the problem is most of our PCs are behind firewalls and NAT servers. I'm not sure where to start. I think HTTP tunneling is the way to go but am wondering if there are other options or recommendations. Also, assume our clients are not willing to open up ports for security reasons. Thanks.


Development of a bot/web crawler detection system

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:   1. It checks v/s HTTP 'POST/GET' requests ratio for each IP   2. It calculates the ratio of unique URLs and total number of hits (sparsity) by each IP Based on the above two parameters, we try to block any IP showing unusual behaviour, but these two parameters alone have not been sufficient for bot detection. Thus I would like to know:   1. Are there any other parameters which can be included to improve the detection?   2. I found a paper published in ACM library which follows the Bayesian approach to detect a crawler. Has anyone used this? How effective is this?   3. Stack Overflow and other high traffic sites have such kind of systems deployed, what logic do they follow to keep unwanted spammers/crawlers away in real time?


Implications of handles between forms

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 miniDldMngr     {         public partial class Main : Form         {             miniDldMngr.SettingsForm settingsForm; //Instantiate settingsForm                  private void settingsToolStripButton_Click(object sender, EventArgs e)             {                 settingsForm = new miniDldMngr.SettingsForm(this); //Create handle for Form1                 settingsForm.ShowDialog(); //Form properties were changed to act like a dialog             }      Form2:               namespace miniDldMngr     {         public partial class SettingsForm : Form         {             private Main HandleToForm1; //local variable to store handle to Form1                  public SettingsForm()             {                 InitializeComponent();             }                  public SettingsForm(Main frm1Handle) //overloaded constructor with handle to Form1             {                 InitializeComponent();                 HandleToForm1 = frm1Handle;                 txtIni.Text = HandleToForm1.comboLoad.Text; //here's how i access controls on form1 for example, as long as modifiers are public             }      I came across this answer on Stack Overflow and user codesparkle commented: > It's neither scalable nor OOP-like. Which lead me to believe that it might not have been the best choice to solve my initial issue. (S)He further added: > One approach is to create an event in the class that knows the information > which needs to be shown. The form can then register one of its methods as an > event handler. Once the information becomes available, the class notifies > the Form by calling that handler with an argument containing the displayable > information. The beauty of this approach is that the class is decoupled (not > dependent on) the implementation of Form. The MVC and MVVM design patterns > are other robust ways of doing it. Now I'm left with some questions:   1. What are the implications of the procedure I used?   2. Why isn't it an object-oriented approach?   3. What would be the best practice to send information back and forth between classes/forms?   4. How would you go about creating the event mentioned by codesparkle?   5. I don't know anything about MVC or MVVM design patterns, so some links to a structured explanation would be appreciated. Please consider that I'm very new to programming and I won't understand you if you talk like I know what I am doing. Code examples work wonders with me, since I can test them.


How to handle a vendor who asks for the solution of an issue they could not solve

Being a small department of developers, it's not uncommon for us to outsource projects. We have a set of companies that we really like to work with, very reliable and good local people who appreciate the work. This has happened a couple times, most recently today: **We receive a project, set it up in our environment, and notice an issue. Due to them not being able to provide a solution in time, we're forced to find a solve internally. Then the vendor, who we pay very well, will sometimes ask how we solved the problem.** Again, this is a rarity, and we have a great relationship with these guys, but I do have some inkling that I should not be handing out the answers to a resource which we're paying. How should I handle this? Do I set aside my ego and just say "Thanks for doing a great job, here's your $30k and we finished the project for you by doing this one thing your company was unable to do but now can charge us more to do next time"? Is it appropriate to tell them I can't give them "company" code/etc? Would this tarnish our relationship?


Does SCRUM lend itself to multi-project environments?

I will be moving workplace in the near future and I believe they will be very interested in my experience of Scrum and how it may relate to their business. I am trying to understand if it will work in their environment. My current place of work we have a 2 products/2 backlogs/2 separate teams. These backlogs are obviously prioritised based on what the business thinks it most needs for a platform that we develop. The place I will be moving to however has many projects on the go all at the same time with (2/3 individuals working on each), small bits of work come in and are fixed on a daily basis and I imagine all the customer deliverables are roughly equally as important. So I'm wondering if anyone has experience of Scrum in a similar environment, what real examples have you got of things that worked? What didn't work? What considerations need to there for Scrum to work in this situation? There are a few aspects that I'm not sure how would work out well:   1. I believe people in teams will work across projects, and therefore potentially across scrum teams if broken down.   2. How do you go about handling priority on so many moving parts which are probably changing frequently and have their own timescales?   3. If you have a scrum team that works on several projects (some many only require 1 Dev) then how do you understand the context of the stand-up?