I was reviewing this morning a piece of code written by a beginner, when I found these lines:
If
...
ElseIf
...
ElseIf
...
Endif
I told him "Please, Do Not Use This". And the other guy sitting aside (more experimented) said: "Oh no DoN't Use This!". I think there are many reasons explaining this reaction:
a bad experience when we f...
I'm trying to write a tennis reservation system and I got stucked with this problem.
Let's say you have players with their prefs regarding court number, day and hour.
Also every player is ranked so if there is day/hour slot and there are several players
with preferences for this slot the one with top priority should be chosen.
I'm thinki...
Often a quick UI evaluation needs to be done without actual users’ involvement. What approach is to take?
Is there a framework one could stick to (i.e. principles to look out for, steps to take as part of the evaluation) or is it all haphazard, art based on experience rather than rigid process?
...
I've recently come across this piece of JavaScript code:
if (",>=,<=,<>,".indexOf("," + sCompOp + ",") != -1)
I was intrigued, because to write this test I would have done:
if (/(>=|<=|<>)/.test(sCompOp))
Is this just a stylistic difference, or does the author of the other code know something about optimization that I don't? Or per...
Is there a good website, textbook, or other reference for coding practices which can help minimise errors? (No, I couldn't find an answer to this on stackoverflow, or through google searches)
I'm talking about ways to structure the code, rather than things like code reviews/unit testing/etc.
Example: Structuring an if test to place the...
When using threads I sometimes visualise them as weaving together 3 or more dimensional interconnections between Objects in a Spatial context. This isn't a general use case scenario, but for what I do it is a useful way to think about it.
Are there any APIs which you use which aid threading?
Have you used threads in a manner which doe...
There is a standard two-pass algorithm mentioned in RFC 1942: http://www.ietf.org/rfc/rfc1942.txt however I haven't seen any good real-world implementations. Anyone know of any? I haven't been able to find anything useful in the Mozilla or WebKit code bases, but I am not entirely sure where to look.
I guess this might actually be a deep...
I always wondered what different methods Google Desktop Search is using so that it uses least CPU and memory while indexing a computer containing more 100,000 files on an average.
In just few hours it has indexed the whole system and I did not see it eating up my CPU, memory etc.
If any of you have done some research, please do share.
...
An initial draft of requirements specification has been completed and now it is time to take stock of requirements, review the specification. Part of this process is to make sure that there are no sizeable gaps in the specification. Needless to say that the gaps lead to highly inaccurate estimates, inevitable scope creep later in the pro...
I'm looking for a way to sequentially number rows in a result set (not a table). In essence, I'm starting with a query like the following:
SELECT id, name FROM people WHERE name = 'Spiewak'
The ids are obviously not a true sequence (e.g. 1, 2, 3, 4). What I need is another column in the result set which contains these auto-numbering...
Why are inline closures so rarely used in Actionscript? They are very powerful and I think quite readable. I hardly ever see anyone using them so maybe I'm just looking at the wrong code. Google uses them in their Google Maps API for Flash samples, but I think thats the only place I've seen them.
I favor them because you have access to ...
I would be interested to learn about large scale development in Python and especially in how do you maintain a large code base?
When you make incompatibility changes to the signature of a method, how do you find all the places where that method is being called. In C++/Java the compiler will find it for you, how do you do it in Python?
...
A pearl is an elegant, instructive and fun example of programming, which teaches important techniques and fundamental design principles.
For example, I really enjoyed the programming pearl Automata via Macros. It shows how to build a construct for finite state machines using Scheme macros, while touching upon the importance of tail-cal...
How do i parse a text file in c#?
...
I've been testing out the performance and memory profiler AQTime to see if it's worthwhile spending those big $$$ for it for my Delphi application.
What amazes me is how it can give you source line level performance tracing (which includes the number of times each line was executed and the amount of time that line took) without modifyi...
In my thirty years of programming experience, it seems to me that the vast majority of the source code that I have read, and the vast majority of the programmers that I have encountered, tend to write all their code at the lowest possible level of abstraction.
Allow me please to provide an example. I answered a post earlier today in wh...
I have an application that is database intensive. Most of the applications methods are updating data in a database. Some calls are wrappers to stored procedures while others perform database updates in-code using 3rd party APIs.
What should I be testing in my unit tests? Should I...
Test that each method completes without throwin...
A few years ago I worked on a system where a numeric primary key was stored in a [SQL Server] varchar column, so I quickly came unstuck when querying with a BETWEEN operator:
SELECT ID FROM MyTable WHERE ID BETWEEN 100 AND 110;
Results:
100
102
103
109
110
11
This was simply bad design. However, I'm working on an 3rd-party ERP syst...
I have an Array of Objects that need the duplicates removed/filtered.
I was going to just override equals & hachCode on the Object elements, and then stick them in a Set... but I figured I should at least poll stackoverflow to see if there was another way, perhaps some clever method of some other API?
...
Certainly there are valuable programming techniques yet to be discovered, or that have been discovered but are not well-known.
I'm interested in hearing about techniques that may be counterintuitive or seem strange, but have real benefit.
Edit: It was suggested that I give an example.
Just to show what I mean, my personal favorite i...