Randall Cook

San Francisco Bay Area

Follow me on Twitter @randallecook!

Feb
26
revised How to use code blocks in HTML
expanded answer to mention libraries
Feb
12
comment number of strings, when each character must occur even times
I recommend breaking up the problem into smaller pieces. For a given n (which I am guessing must be itself even for the answer to be nontrivial), compute all the different combinations of the 4 symbols that can comprise a set of n, where each symbol appears an even number of times. For each combination, compute the number of permutations of those symbols, omitting duplicates, presumably. I may be overly optimistic, but neither of these problems seems excessively difficult. Unfortunately I don't have time to work out the algorithms right now. I'm sure someone will before I return to this. :)
Feb
12
answered Does this python program obey functional paradigm?
Feb
12
comment Does this python program obey functional paradigm?
I totally agree. And I was going to suggest returning multiple values (a tuple). +1
Feb
12
revised Making sure loaden (non default) config is valid
added web links
Feb
12
answered Making sure loaden (non default) config is valid
Feb
11
revised Fastest way to store tiny data on the server
added alternative solutions
Feb
11
answered How to implement a function like invokeOnMainThread() in C/C++ linux?
Feb
11
answered Fastest way to store tiny data on the server
Feb
11
comment Jacobi solver going into an infinite loop
Your loop is not reaching the break statement. It's might be the semicolon on the if abs(norm(x) - norm(x0)) < TOL; line, but wouldn't that just force it to hit the break statement on the next line?
Feb
11
awarded Citizen Patrol
Feb
11
comment Jacobi solver going into an infinite loop
How do you know it is infinite? What is the size of A? Matlab is notoriously slow when it comes to iterating through matrices with for loops. Better to vectorize your work instead, if you can.
Feb
11
comment Optimal substitute data structure to improve running time due to huge size of dictionary?
Nice catch, @Gabe!
Feb
11
comment Optimal substitute data structure to improve running time due to huge size of dictionary?
@Gabe is right. You need to get some profiling metrics so you can know where the slow part is. You have a lot of places in your code where there can be hidden loops, allocations, and other things that can get slow when done millions of times. You could use a profiler, but adding some simple code to measure the clock difference around certain subsections is sufficient.
Feb
11
comment Optimal substitute data structure to improve running time due to huge size of dictionary?
Wow. That's terrible performance. 200MB, 4.9M keys, 9.7M lines just isn't that big these days.
Feb
11
answered Why is Java's Math.min so slow in my Android app?
Jan
12
awarded Notable Question
Jan
2
comment send/post xml file using curl command line
The command in this answer didn't work for me. curl -F filedata=@myfile.foo http://127.0.0.1:8080 worked instead.
Dec
13
awarded Famous Question
Nov
30
comment How to access Samba shares in Lubuntu 12.10
If you want to connect as a particular user, use smb://username@smb_server/some_folder. Under Lubuntu 14.10, this brought up a password dialog for me and then connected with the expected ownership and privileges.
1 2 3 4 5