This page is a NO-INDEX summary of comments posted in this blog.
Total 849 Comments (29/34 Pages) - Newer Comments - Older Comments
701. 2015-12-24 09:11:58 ACMer Comments on C++ Range Sum Query on Immutable Array via Prefix Sum:
Thanks, will try that ๐
702. 2015-12-24 09:11:19 slyy2048 Comments on C++ Range Sum Query on Immutable Array via Prefix Sum:
Using 2x less memory. Probably faster too, if tested on non-busy server.
class NumArray {
int* const m_piSums;
public:
NumArray(vector& n) : m_piSums(&n[0]) {
int s = n.size();
for (int i = 1; i < s; i++) {
m_piSums[i] += m_piSums[i-1];
}
}
int sumRange(const int i, const int j) { return m_piSums[j] - (i ? m_piSums[i - 1] : 0); }
};
703. 2015-12-23 15:09:04 twofei Comments on Case Study: use PHPQuery to Crawl 3000 images from Tumblr:
It seems that WP has removed the tag I mentioned in my comment above.
There are many html documents use <br> to represent as a soft break๏ผnot the slash one: <br/>. And <p>๏ผ in H5, it is valid.
So they are not strict, well-formed XML. Many DOM parsers cannot handle them well.
704. 2015-12-23 14:17:20 ACMer Comments on Case Study: use PHPQuery to Crawl 3000 images from Tumblr:
doesn't matter, the PHPQuery recognizes self-closing tag.
unclosed tag is not a valid HTML, which produces unexpected (unstable) results.
705. 2015-12-23 13:23:19 twofei Comments on Case Study: use PHPQuery to Crawl 3000 images from Tumblr:
what about self-closing tag and the unclosed ๏ผ
706. 2015-12-09 01:22:32 Jacques Leroy Comments on C/C++ Function to Compute the Combination Number:
I keep claiming it's full of bugs !
1) ans[] MUST be initialized, or random values will poison the algorithm
2) the iteration on j
for (j = 1; j <= n; j ++)
{
ans[j] = ans[j] + ans[j - 1];
}
screws ans[] content - loop MUST be done backwards !
Just check my version against yours and see by yourself !
707. 2015-12-09 01:13:12 Jacques Leroy Comments on C/C++ Function to Compute the Combination Number:
I'm afraid it is a bug:
_ ans[] is not initialized, introducing potential bugs due to random values
_ the loop
for (j = 1; j <= n; j ++)
{
ans[j] = ans[j] + ans[j - 1];
}
screws ans[] content
proof: like this: ans[j] is always greater than ans[j-1], inacceptable for a line of Pascal's triangle
ultimate proof: test my version against yours and see by yourself...
708. 2015-12-09 01:05:25 Jacques Leroy Comments on C/C++ Function to Compute the Combination Number:
Please ignore my previous post (a -j should be a --j)
The code for int pascal(int m, int n) is full of bugs !
Hereโs a correct version:
int pascal(int m, int n)
{
int ans[MAX];
int i, j;
if (n > m) return 0;
if (n + n > m)
{
n = m โ n; // pascal(m, n) == pascal(m, m-n) โ choose min(n, m-n)
}
if (n == 0) return 1; // n == m case now impossible
ans[0] = 1;
for (i = 1; i <= n; i++)
{
ans[i] = 0; //ans[] array MUST be initialized !
}
for (i = 1; i <= m; i++)
{
for (j = n; 0 < j; --j) // j loop must be done backwards !
{
ans[j] += ans[j โ 1];
}
}
return ans[n];
}
709. 2015-12-09 01:00:33 ACMer Comments on C/C++ Function to Compute the Combination Number:
It is not a bug. Just a recursion to illustrate the idea. Recursion can be optimised by iteration.
710. 2015-12-09 00:58:14 Jacques Leroy Comments on C/C++ Function to Compute the Combination Number:
The code for int pascal(int m, int n) is full of bugs !
Here's a correct version:
int pascal(int m, int n)
{
int ans[MAX];
int i, j;
if (n > m) return 0;
if (n + n > m)
{
n = m - n; // pascal(m, n) == pascal(m, m-n) - choose min(n, m-n)
}
if (n == 0) return 1; // n == m case now impossible
ans[0] = 1;
for (i = 1; i <= n; i++)
{
ans[i] = 0; //ans[] array MUST be initialized !
}
for (i = 1; i <= m; i++)
{
for (j = n; 0 < j; --j) // j loop must be done backwards !
{
ans[j] += ans[j - 1];
}
}
return ans[n];
}
711. 2015-12-02 10:48:50 ACMer Comments on Test SD Card Speed on Raspberry PI:
(y)
712. 2015-12-01 20:05:36 lev tor Comments on Test SD Card Speed on Raspberry PI:
16gb sd card+16gb usb flash disk Raid 0 Raspberry Pi 2
root@raspberry:~# hdparm -t /dev/md127
/dev/md127:
Timing buffered disk reads: 114 MB in 3.03 seconds = 37.68 MB/sec
root@raspberry:~# hdparm -I /dev/md127 | more
root@raspberry:~# hdparm -T /dev/md127
/dev/md127:
Timing cached reads: 670 MB in 2.00 seconds = 334.32 MB/sec
root@raspberry:~# hdparm -T /dev/md127
/dev/md127:
Timing cached reads: 664 MB in 2.00 seconds = 331.41 MB/sec
root@raspberry:~#
713. 2015-12-01 11:36:43 ACMer Comments on Simple Touch Implementation in Windows Batch Programming:
thanks, good to know this trick!
714. 2015-12-01 11:33:20 movsb Comments on Simple Touch Implementation in Windows Batch Programming:
I prefer using "cd. > file".
715. 2015-11-25 19:42:25 ACMer Comments on Using Imagify Wordpress Plugin to Reduce size of Images:
Thanks. I agree but in general i find the 'Bulk Optimisation' a useful tool.
716. 2015-11-25 17:33:31 Martin Bolt Comments on Using Imagify Wordpress Plugin to Reduce size of Images:
Imagify seems a bit late to the game, there are so many image compression tools around. But very curious to see if it could beat the competition so gave it a try. It certainly looks very promising, but image compression doesn't seem intelligent enough. Some of the images I tried were compressed too much and others could easily be compressed much, much more.
717. 2015-11-19 01:04:20 ACMer Comments on Simple C/C++ Rocket Animation:
Yes, it would be much more complex animation from left to right or right to left
718. 2015-11-19 00:13:35 ACMer Comments on why C++ - another case study?:
Yes, you are right.
719. 2015-11-18 22:45:34 ACMer Comments on WP-Rocket Plugin - A Must Have for Wordpress Users!:
It may not be compatible (some image not showing with Lazy Load on) with the CloudFlare Rocket Loader.
720. 2015-11-05 19:04:58 ACMer Comments on Tutorial 8 โ C Programming in 6502 โ Sprites:
my pleasure.
721. 2015-11-05 18:22:32 John Comments on Tutorial 8 โ C Programming in 6502 โ Sprites:
Thank you very much for all these tutorials. This was very interesting and help me get my feet wet in nes programming.
722. 2015-10-28 14:19:42 hellman Comments on Compute PowerMod a^b%n:
> The python console almost hangs.. So it is obvious a hidden power-mod rule applies.
You are wrong 2**99999 % 50 is computed as simple exponentiation and then taking modulo, python does not do any optimization here. However if you write pow(2, 99999, 50) - you will get indeed the optimized version.
Why then 2**99999 % 50 is immediate, while 2**99999 hangs? You should have written x = 2**99999 then the time will be the same (and even less). If you write simply 2*99999 in the console, python has to convert the number from the internal representation into decimal to print it, that's why it hangs.
723. 2015-10-24 05:34:07 ACMer Comments on Review - HPZ800 Server WorkStation HP Z800 Workstation Desktop PC Tower Computer POWERHOUSE (2x Intel Xeon X5650 - 48GB DDR3 Memory - 2TB HDD - 1GB Nvidia Quadro):
HDD is lagging behind...
724. 2015-10-23 23:53:13 Tom Comments on Review - HPZ800 Server WorkStation HP Z800 Workstation Desktop PC Tower Computer POWERHOUSE (2x Intel Xeon X5650 - 48GB DDR3 Memory - 2TB HDD - 1GB Nvidia Quadro):
this is still 5.9.... windows are you @#$% kidding me?
725. 2015-10-10 15:28:22 disketto Comments on why C++ - another case study?:
sorry, i meant *value = randomizingFoo() ๐
Newer Comments - Older Comments
–EOF (The Ultimate Computing & Technology Blog) — 46 words