« first day (307 days earlier)      last day (4656 days later) » 

7:20 AM
morning all
 
^ View from my apartment :)
 
7:53 AM
Hi
@StackedCrooked Did you try it ?
 
@StackedCrooked wow, seems quite high up
 
I was wondering somethig, I have some codes of mine that I wish to improve, etc. Should I use codereview.stackexchange.com ? I have posted in there once but it took a very very long time to get a single reply or should I post it on stackoverflow ?
 
Well, codereview is not a big community.
I think if you post code on Stack Overflow asking for review, your Q will just be migrated to cr :)
 
I would not mind to have it moved if there was a bigger amount of users or perhaps the same community as so in there as I am seeking for lots people to look at it and give me inputs, opnions examples etc
that is why i would not like to post it in there in first place
would you think that is there any work around ;) ?
 
There are definitively fewer people on codereview.
 
8:01 AM
yeah :( the ideia is great but the amount of people makes it not as good
 
Well, if you post it on SO, you will have people from SO looking at it, then it will be migrated, then people from CR will look at it :)
 
that is mainly the problem consider they looked at then it got moved and they didnt had any chance to reply to it and they dont frequent cr and cr people never replied to it so it would be left to dust
 
In fact the Q will be closed and there will be a link to the Q on CR. So there will be basically two entry points.
But I think there is bigger communities of code review on the internets. Don't know where they are though.
 
I was actually thinking of that but i dont know of any either
the codes are in c# tought :P
 
8:31 AM
Hey, I have a MT question. Anyone ?
 
What's MT?
 
Multi-Threading
 
Well, is the question on another thread? Badum-ching!
 
8:47 AM
@Potatoswatter lol
Now that I have your attention :
I have a "config" class which will be accessed by several threads, where properties are written or read from different threads. What is the best design for it ?
 
Threadsafe.
:P
 
I was thinking of using mutexes and RAII locks for each method, but it seems a little bit overkill.
 
If the configuration doesn't change often, or there are no performance considerations, use the simplest design. One global lock.
 
Stale data is not acceptable, right?
How many readers? How many writers?
 
Also, maybe I should declare a mutex for each property instead of only one for the whole object ?
@RMartinhoFernandes What is stale data ?
@RMartinhoFernandes Probably one writer and 3 readers max.
 
8:50 AM
@kbok Data that was changed by another thread, but the changes are not yet visible on this thread.
 
@kbok Start with the simplest design. One mutex for the whole system. Is there a reason that might cause a problem?
 
@RMartinhoFernandes Ok.
 
But hear @Potatoswatter. Just throw one lock for the whole thing and see if it suffices.
 
You might want to consider shared locks (rw locks).
 
@Potatoswatter Ok, and Lock at the beginning of each get/set method ?
@wilx I'll have a look at it
 
8:52 AM
@kbok Right. Or each group of get/sets that need to comprise a single transaction.
 
@kbok RW lock are designed for single writer/many readers scenarios, which sounds like yours.
 
Ok.
I was wondering if there was such thing as a template to make assignments/copies atomic.
 
There's std::atomic in the new standard.
 
Like atomic_stuff<std::string> ?
Does it fit my case ?
 
Is the set of config properties fixed at start?
 
8:55 AM
Yes.
 
Hmm, atomic might be enough.
 
Ok.
 
I'm not sure if it guarantees visibility, though.
 
What do you mean ?
 
The stale data issue I mentioned. I don't know if std::atomic guarantees the data will be immediately visible to other threads.
Other threads could have local cached values.
I haven't read much about the new threading facilities.
 
9:02 AM
I think it would not too atomic, if it did not guarantee that...or would it?
 
Ok. In this case, when is the data made visible to other threads ? Does one needs to call a "flush" method, or does it just updates at some undetermined time ?
 
Hmmm, without much checking, seems like you can guarantee that with an ordering of memory_order_acquire, memory_order_acq_rel, or memory_order_seq_cst.
And memory_order_seq_cst is the default.
 
@wilx Atomic just means that an intermediate state will not be read. That is subtly different, but keeping a locally cached value is definitely a path to wrongness unless it is always updated completely and atomically.
 
Ok.
 
> All modifications to a particular atomic object M occur in some particular total order, called the modification order of M.
Atomic only requires modifications to be ordered.
That is, unless you use a memory order that is stronger, like I mentioned above.
And the justification for these low requirements, is the usual:
> Except in the specified cases, reading a later value does not necessarily ensure visibility as described below. Such a requirement would sometimes interfere with efficient implementation.
Performance.
 
9:14 AM
I see.
 
Hey hey, I have an anal pedantic question!
0
Q: Does a namespace-scope constructor definition require a class-qualified identifier?

PotatoswatterHere's something we all learned on Day 1 of C++, which we take for granted but doesn't clearly follow from the wording of the Standard. Given struct S { S(); }; we define the constructor as S::S() { … }. But the Standard seems to allow S() { … } just as well. Qualifying the name of a class with ...

 
Is a constructor a member function ?
 
@kbok Yes, a "special member function"
 
Is it explicit in the standard ?
 
He quoted from a chapter titled "Special Member Functions".
 
9:22 AM
@kbok Far as I can tell, the only relevant parts of the standard are the ones I quoted.
 
Ok.
 
I think §9.3/5 still applies.
You just can't define a constructor according to it.
But you can with the special syntax described §12.1/1.
Which leads exactly to the same, I'm just being stupid, mainly.
 
Heh. I played around a bit and tried various weird declarations before coming to the conclusion that the compilers are being too restrictive…
Also, is the unqualified style the way constructors are done in D?
 
@Potatoswatter I think you should add a code sample to show exactly what you're getting at. I had some trouble understanding it at first. You mean this: S() {}, but outside of class scope, right?
 
9:30 AM
Right.
 
Will compilers accept S::S::S::S(){}?
Ah, GCC does. Just not S(){}.
 
Made the examples clearer. You can also typedef S T; and use T::T::T::S() {}, or ((T::S::T::S))() {} because parentheses are ignored.
 
0
Q: Is the "Objects First" apporach a good idea?

FredOverflowDo you think programming novices should learn objects from day 1, as seen in the book "Objects First With Java: A Practical Introduction Using BlueJ" by David Barnes? Or do you think this is a bad idea?

 
I didn't want to confuse the question with such examples, but there are a lot of ways to do it… and the requirement of at least one :: is arbitrary.
@FredOverflow s/apporach/approach/
 
AppRoach. He's a fried on the AppMoth.
 
9:38 AM
@Potatoswatter thx
@RMartinhoFernandes What's a "fried"? A mixture of "friend" and "fred"? Or do you literally mean "fried" as in "fried potatoes"? :)
 
LOL someone downvoted the question
 
Ugh.
Hmm, the commenter makes a good point.
 
I think the N took a walk over to on, and there's a missing F.
 
Haha, you wall-of-texted @DeadMG.
 
@RMartinhoFernandes He was asking for it ;)
 
9:52 AM
0
Q: std::getline for an ifstream but using a char* instead of a string

PilpelI want to use the getline function with a char*. I just don't want to include the string library.

lol, what ?
 
"I want to use the getline function in a way that is utterly broken and unsafe. I just don't want to include the library that works safely."
 
Gah, why does SO still Capcha me? Isn't 25K rep worth anything?
 
It regular thinks I'm a robot too. No I have embraced that.
 
If I get good enough at compiling C++ in my head, will I start to fail Turing tests?
 
Damn, I'm making typos every other message.
And not noticing it until it's too late.
 
10:20 AM
> I have a function that takes char* as parameters and writes to them and I don't want to write a whole new one just for strings. – Pilpel 9 mins ago
Hmm, on Stack Overflow cats work on our problemz, but on Programmers it's dogs.
> The application hung, crashed and generally failed in so many creative ways that the developers had actually gone so far as to add a "Force Exit" option to the main menu. Unfortunately, when push comes to shove, it didn't actually work unless the "Matters" window was still open. Any attempt to "Force Exit" without that window open caused the application to stop responding. - in Might as well JUMP
 
10:38 AM
Hehe, malfunctions like that come from project management problems. So that likely does belong on Programmers.
I worked with a very large custom app at a very high-tech company that had "features" like that… it wouldn't work unless you set an environment variable that told it to ignore memory traps.
 
10:51 AM
If I checkout two subversion repositories simultaneously will it result in a less efficient hard-disk layout then if I checked out one at a time?
 
That's implementation-defined :)
 
@StackedCrooked Probably. If the difference is measurable, just copy the files and they should be straightened out again.
 
Well.
I think it really was too harsh to close the question so quick: stackoverflow.com/questions/7119854/…
 
11:06 AM
I'm open to vote for reopen if it is edited to include more information.
 
I do think he's asking for the wrong reasons, but the question is stated in such a simple and direct manner that the easiest thing to do is just answer it.
 
My opinion is that it is not straightforward. It mentions a mysterious requirement I'd rather know before I guess an answer. I've seen similar questions get "wrong" answers because the mysterious requirement also invalidated them.
 
I think as well that he is asking for the wrong reasons. And I still think that he should be steered towards std::getline(). But after some deliberation, I think it was too harsh to close.
Less zealotism, please.
 
The right thing is probably to refactor the program to use string instead of char*. But we don't know how much work that is, or if char* really is being used incorrectly, or if there was a genuine performance concern to justify its use. Using one more char*-oriented function won't break things further, so send him on his merry, probably inefficient, way.
 
Hello guys
 
11:19 AM
@croisharp What, are you implying we've scared all the women away?
 
oh sry, guys and girls :)
 
I don't think changing a function that writes to a char* to write to a std::string instead should be too much work, but maybe I'm not thinking it all very well.
Anyway, I edited the question to include a little bit of information the OP provided in a comment.
 
it is hard to find a job as a c++ programmer, that are programming in Linux environment?
 
user53670
I find one@croisharp
 
Anyway, the solutions presented don't solve the problem at hand, but a similar one.
 
11:22 AM
@Kim what experience you had?
You have a competent salary compared to java, .NET guys?
 
user53670
@croisharp C++ about 2years, and C for haf a year.
 
@croisharp It depends. I've got a C++ job at a place where the focus is on Linux, and I think the salary is ok
 
can i ask you on what type of projects are you working now?
 
user53670
@croisharp I write c++ code for 2 years in windows, and C for half a year on Linux,
 
and C for half a year on Linux,


kernel programming?
 
11:26 AM
@croisharp Well, the company works with medical imaging. I started 2 weeks ago, so I'm not too deeply into all the details yet ;)
 
user53670
@croisharp not kernel programming, write application for mobile.
 
@jalf oh it's interesting, but is hard i think...
 
@croisharp well, if you just want maximum money for a minimum of effort, you should definitely get a job stacking design patterns on top of each others for some enterprise thing in Java
4
 
user53670
@croisharp Now I'm maitaining a component of an os in unix env. written in c++.
 
Personally, I like a challenge ;)
 
11:29 AM
@jalf no you didn't understood me, i am working as a .NET developer, CRM/ERP.. I am satisfied of sallary, but i want to try something new..
 
@croisharp well, there are jobs in C++ and in Linux, and some of them pay well, some of them don't. :)
 
@jalf that was my question..
 
@croisharp some of it is pretty complicated, probably. But there are plenty of simpler tasks as well. it covers a surprisingly broad range of subjects and technologies :)
 
and i have other one , what are programming languages that requires companies, like IBM, Intel, Google, RedHat.
@jalf Oh yeah, i am sure, c++ have a broad range of tasks in which he are the leader
 
@croisharp oh, I didn't mean specifically C++, but rather the application we're working on here. After I started here, Ive been repeatedly surprised at just how much interesting stuff goes into it
 
user53670
11:32 AM
@croisharp Is RedHat famous in America?
 
@Kim I don't know, i am from Moldova, Europe..
 
anything from GPU/shader programming to do the (pretty complex) rendering, to network protocols connecting to a backend cluster, to security and privacy concerns, and lots and lots of concurrency and high performance requirements. Lots of fun :)
 
@jalf Yeah, fun is what is missing in .NET
 
user53670
@croisharp I find writing C code is much easier than C++
 
@croisharp what d you mean?
I didn't mean that any of that was unique to C++. I was just talking about the stuff we do where I work (and where we just so happen to use C++)
but I also find C++ to be a more interesting and, well, fun, language than C#/.NET
but that's subjective, and plenty of people would disagree :)
 
11:36 AM
I'm starting to regret having learned C++ right now.
 
@jalf I mean that i am bored, for developing GUI applications, which you have to develop, other users to know that this is export button, add button, how to do that and that... I want something interesting.. more to system..
 
Now C++ is all I want to do.
 
user53670
@RMartinhoFernandes Why
 
@croisharp ah yeah, I know the feeling. :)
 
But I disagree that .NET is intrinsically not fun.
 
11:37 AM
@RMartinhoFernandes why?
 
@Kim I got a .NET job, and then I started learning C++. Now I love it.
 
@RMartinhoFernandes oh when you do things like wcf security, is of course interesting, but bored winForms..
 
And I don't feel as happy with my .NET job.
 
@RMartinhoFernandes windows environment
?
 
user53670
@RMartinhoFernandes, I'm maitaining a compotent , someone told me that it contains 1million lines of code
 
user53670
11:40 AM
@RMartinhoFernandes I don't believe him , I will write some code to count the number tonight.
 
C++ jobs seem a bit difficult to find around here.
Especially if you don't have a masters' or experience.
 
user53670
How long does it take to get a master degree in your country?
 
I need two more years.
And money.
 
user53670
@RMartinhoFernandes In us are there some one year software engineer program?
 
user53670
11:45 AM
I 've seen one on CMU's website.
 
I doubt you will find anything like that in Europe.
 
Carnegie-Mellon University? One-year program? For what kind of degree???
 
If you want a masters you need at least five years.
 
user53670
@Potatoswatter Master.
 
It may be possible to get a Bachelor's from CMU one year, and a Master's the next.
That does not equate to an "outsider" obtaining a Master's degree in one year.
 
11:48 AM
Two years?
 
That kind of thing depends on a lot of details… what credits/subjects they recognize from your previous education.
 
user53670
The program can be completed in several ways: 12-month/3 semester full-time study on campus; a flexible, part-time plan of study over several years; full or part-time via distance education.
 
But it requires an undergraduate degree and one year of work experience.
 
Ah. 12 months/3-semester = 1.5 years in the usual chronology.
 
11:52 AM
That will total about four years of college education + one year of work experience, which is in line with what I was talking about above.
I was confusing it all.
"Scale able like Java"
Hmm.
 
"Scala able like Java"
 
Are these sites connected to the stackexchange network and jeff atwood ?
Or is this basically a copy ?
 
okay guys and girls, thanks for your opinion, i think i should learn c++ :)
 
Oh, nevermind.
 
according to their faq, it's a separate system
or at least, that's how I interpret it
 
user53670
12:05 PM
I've used a software named "team work", the supporting website is also like stackexchange.@Kbok
 
Ok.
 
answers.unity3d.com/page/faq.html - see halfway down about the "QATO backend"
Basically Atwood & Co went halfway down the open-source path before changing their minds and focusing on StackExchange instead. The previous generation of sites were left out in the cold, and cloned the old software to continue operating.
 
Ah, ok
I'm reading the wikipedia page about minecraft
> By April 2011, Persson estimated that Minecraft had made €23 million (US$33 million) in revenue
Nice.
 
I thought it was more, actually
but 23m euro is pretty good too :)
 
I would not be unhappy to have that in my bank account.
 
12:17 PM
true
it is not a small number
 
With no overhead, and divided among how many people? $33M sounds like enough to last me a while.
 
Anyway, I was not able to find a technical reason as to why Persson used Java for his games.
 
Well, don't assume there is one.
Or should I?
 
But it's highly probable that the only reason is that he only knows Java.
 
user53670
@kbok A indian game company?
 
12:22 PM
@Kim He worked for King.com. Don't know if it's indian.
 
@Potatoswatter he made the game alone. So divided by one, I guess
He's hired a few people after making all that money, of course
@kbok I can't imagine any other reason. There's nothing that prevents the game from being made in any other language
 
@jalf A hand masseur?
 
@jalf <pedantry>Actually no, he hired more developers in 2010, and the $23M are the revenue as in 2011</pedantry>
@jalf I can see why he didn't chose INTERCAL though.
It's obviously because there's no OpenGL API for INTERCAL.
 
@kbok I think the first 10m can be considered to qualify as "all that money" too
 
@jalf Sure
Apparently the sales started to raise after one week of development.
So, who's in for some indie game dev ? Come on, you all want to be rich.
 
12:32 PM
Sure, but without the work!
 
@wilx Try gambling
 
That does not work either :(
 
@kbok Sure, if you can arrange for some extra hours in the day
 
I'd rather try trading shares than gambling :)
 
24 just doesn't cut it
 
12:38 PM
@kbok Do you have candy?
 
I want to gamble and do indie game dev. who is with me?
 
@CatPlusPlus Yes.
 
Wow.
And now I'm hungry.
 
@kbok Throw me some gummy bears.
 
 
12:41 PM
Mmmmmm. Gummy bears. Thank @kbok.
 
@Collecter That's 50¢.
 
Too bad for you I am broke! dashes away
 
WTF, Firefox 6? Are they just accelerating the "major release" increments until they catch up with IE? Do they really intend to challenge MS to a pissing match?
 
Well, that was not my store anyway :)
 
I have FF 7 beta installed already :)
 
12:45 PM
@wilx What's new in it ?
 
Nothing that I can see :)
I have not noticed anything new since like 4.0 :)
Nearly.
 
@Potatoswatter They're adopting Chrome release scheme.
They're planning to hide version number altogether, and just stick to deployment channels.
 
Why don't they simply use <year>.<month> versioning.
Once they reach version 100 the increments won't seem as impressive anymore.
 
I guess there's no point in worrying about naming, aside from keeping the development cycle turning.
 
well technically FF has surpassed MSFT long ago since it is a derivative of Netscape :)
 
12:58 PM
Yes, FF 1.0 was quite an impressive product as 1.0's go ;v)
 
@wilx ff5 had a few minor UI changes, but 6.0 is pretty much internal stuff only
 
Netscape 8 on the other hand was the burned-out wreckage of last year's train crash
 
7.0 is supposed to cut memory usage by 30% or more
 
I wouldn't call the UI change minor
 
6.0 has newer WebSockets implemented and enabled by default.
 
12:59 PM
@CodeMonkey The big changes were in 4.0. 5.0 wasn't very noticeable
 
WebSockets?
 

« first day (307 days earlier)      last day (4656 days later) »