List sychronizedList = Collections.synchronizedList(new ArrayList()); //is this ok?
try {
ExecutorService executor = Executors.newFixedThreadPool(10);
for (final Object item : fromCollection) {
executor.submit(new ARunnableClass(sychronizedList));
}
executor.shutdown(); //do i need this
...
I'm checking the results from the static code analysis tool Klocwork.
It complains about the following code:
293 for( my_vector_typedef::iterator it( start_pos ); it != end_pos ; ++it ){
294 delete *it;
295 }
With the following message:
Object 'it._M_current' is used after it was freed. Object 'it._M_current' was used at line 293 ...
The following python module is meant to be a basis for "constant" handling in python. The use case is the following:
one groups some constants (basically "names") that belong together with their values into a dictionary
with that dictionary bound to class variable a class is created and instantinated run-time
the attributes of this cla...
I'm using Eclipse and I'm wondering what the best Eclipse/Java/Flexbuilder code review tool is. If it matters we're using SVN as our SCM.
Here are the following I've come across:
Jupiter - seems like it's been around for awhile it looks like there is only a single developer on the project and the documentation mentions rather old vers...
I have a relatively large solution that I compile to DLL. I would like to print out or list all the fields in every class in this project.
I'm looking for a Visual Studio feature, Visual Studio add-on, external tool, script, or code snippet (something involving reflection, perhaps?) that will allow me to simply print out all these fie...
Hi,
The organization I work with, a large Indian outsourcing company, enforces documentation of code review comments. The rationale is that this gives the team insight into the quality of code development and also understanding of the patterns of the problems encountered. This is checked during the regular project audits that we have.
...
Hey,
So I asked a question earlier that was closed because it wasn't specific enough. I am working on a small open source project that I am going to use on my blog for learning/discussion.
Heres my question for fellow stackoverflowers..
Where do you go on the internet to post projects or find people to review your code?
My blog is ...
I'm writing a script in php which updates my database with certain xml information every 30 seconds. (I'm not allowed any other scripting language, and I find php an easy language to work with anyway)
However, because this php script can run for several minutes my mysql database tends to fall away. A lot.
So I started to use link ident...
most of the time i will use exception to check for condition in my code, i wonder when is appropriate time to use assertion
for instance,
Group group=null;
try{
group = service().getGroup("abc");
}catch(Exception e){
//i dont log error because i know whenever error occur mean group not found
}
if(group !=null)
{
//do something
}
...
I have recently started reading "Programming Challenges" book by S. Skiena and believe or not I am kind of stuck in the very first problem.
Here's a link to the problem: 3n+1 problem
Here's my code:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
unsigned long calc(unsigned long n);
int main()
{
...
I have had some problems with authentication in ASP.NET. I'm not used most of the built in authentication in .NET.
I gotten some complaints from users using Internet Explorer (any version - may affect other browsers as well) that the login process proceeds but when redirected they aren't authenticated and are bounced back to loginpage ...
Anyone have a code review checklist/guidelines for a Java web application? A review checklist for each layer would be great.
If there is no such source on the internet, do you know of any good books? I found some useful tips in "Expert One-On-One..." by Rod Johnson. Any other good books you recommend?
...
I'm very new to iPhone development, and I'm trying to write a function which will accept one parameter, and return the current date/month and store it in a variable.
But I'm getting a (null) value with NSLog.
Method:
-(NSString *) getNowDateMonth:(NSString *)type {
NSDate *now = [[NSDate alloc] init];
if (type==@"month") {
...
Trying to find a "simple to use" safe_bool idiom/implementation, I've ended up with my own.
Q: Is this implementation correct?
template <typename T>
class safe_bool
{
protected:
typedef void (safe_bool::*bool_type)() const;
bool_type to_bool_type(bool b) const
{ return b ? &safe_bool<T>::safe_bool_true : 0; }
private:
...
could somebody explain the code below for me? Only the lines where is #??? I asked and got an answer It does 100% what I asked for. Now I need to add some code and I do not know where. I tried and it did not work. I used custom class in ruby twice so far otherwise I used to use arrays.
Is it actually custom class used below? :-)
I nee...
I asked my question and got two answers one is piece of code and the other one is to use a library/module.
I am wondering what is better to use. Does it actually matter? Is there any difference in speed, code update or in any other way?
in my case the code is only a loop with 2 lines... My questions is more in general from somebody who...
Does a website exist that would allow you to post source code for public review? I haven't been able to find one - at least one that has any significant amount of traffic.
I'm starting some work on a very small open source project. I'd like to be able to get eyes on my code, but the best option I have now is to post code on the forum's ...
How to improve one's code review capability? Any suggestion from personal experience will help.
What are the common pitfalls or mistakes done by each one of you? How to ensure issues don't get leaked from code review?
...
This is a question regarding coding design, so please forgive the long code listings: I could not resume these ideas and the potential pitfalls without showing the actual code.
I am writing a ConcurrentReferenceCounted class and would appreciate some feedback on my implementation. Sub-classes from this class will receive "release" inste...
I have a hash of hashes (@post) and I want to save it into csv. Strange for me is that my approach works for the header but not for the rows. If I display the rows using
csv << (@post_csv_order.each {|element| puts single_post[element]})
I can see the right strings on the screen but the csv files contains values of the hash key not t...