He Shiming

Shanghai, China

kaoya.com

Age: 33

Creator of Bizble, 雅思听力宝, 考鸭, Toppin'Wiper, MediaMan and Goals.io.

Independent developer of desktop, web, and mobile platforms.

UI designer.

Jul
25
awarded Autobiographer
Jul
16
comment pthread_cond_wait sometimes will not receive the signal
Thank you! I did realize it's possible the log is out of order but I didn't figure out how to keep them in sequence.
Jul
16
accepted pthread_cond_wait sometimes will not receive the signal
Jul
14
comment pthread_cond_wait sometimes will not receive the signal
Well, the mutex is locked prior to conditional waiting (as illustrated in td initialization). I managed to dump the return variable to the log, pthread_cond_wait always returns zero.
Jul
13
comment pthread_cond_wait sometimes will not receive the signal
Thanks but I believe I got all those points correctly. 1), if you check my initialization code of td, the mutex is locked. 2), I can't do while(flag) and condition waiting at the same time. They are separate problems aren't they? My current situation is that the waiting won't return. 3), I've got separate cond and mutex for each thread. 4), the thread is waiting on cond as thread_worker illustrated.
Jul
13
comment pthread_cond_wait sometimes will not receive the signal
@pilcrow, thanks but could you elaborate? The documentation of pthread_cond_wait clearly says that the mutex has to be locked before calling. What's an associated predicate? I understand I'm not checking the return variable, but it's not the problem I'm facing, I mean, it didn't return and kept on waiting.
Jul
13
asked pthread_cond_wait sometimes will not receive the signal
Jul
10
awarded Popular Question
Jun
25
awarded Citizen Patrol
May
22
comment Class imbalance problem - Random under sampling
From what I understand, the recall for the 0.5% class will be bad, unless feature selection is obviously distinct. I've worked with 7 to 1, or 8 to 1 classification situations. What I learned is that because of statistical nature of models (such as logistic regression), a model will definitely be benefit from a balanced statistical distribution. You may have to artificially inject 0.5% class samples, until an optimal recall is reached.
May
20
comment Python, optimizing a list comprehension for string concatenation
Thank you all, I'll definitely do some research together on serialization to see if anything can be done there.
May
20
accepted Python, optimizing a list comprehension for string concatenation
May
20
comment Python, optimizing a list comprehension for string concatenation
Well, serialization is not the culprit at the moment. I've already used the best possible solution: '\t'.join(strings), and it's much faster than anything else.
May
20
comment Python, optimizing a list comprehension for string concatenation
Thank you for the pointers. I have implemented pre-calculation, though still with str concatenation instead of formatting (which is slower). It's faster but I wish I could do something to the list comprehension itself.
May
20
comment Python, optimizing a list comprehension for string concatenation
Unfortunately, yes because eventually this list has to be serialized and sent to another module.
May
20
reviewed Approve suggested edit on Python, optimizing a list comprehension for string concatenation
May
20
comment Python, optimizing a list comprehension for string concatenation
Yes, it's similar to my original solution.
May
20
comment Python, optimizing a list comprehension for string concatenation
s is a string with length in range 4 to 32
May
20
asked Python, optimizing a list comprehension for string concatenation
May
18
awarded Yearling
1 2 3 4 5