Thanks! This definitely got my going down the right path. I ended up installing a virtual KVM called synergy and using it with multiseat to be able to use one keyboard/mouse with this configuration.
Not entirely. You need a lot of procedural functions to register as callbacks from the wordpress core. It is even worse for Drupal because the module functionality is hooked into the drupal core via each functions name.
You don't always have a choice, for example writing plugins for the most popular CMS's, since the cores of these systems are all based on procedural coding.
One reason for a lot of people being stuck with 5.3 is related to server security; for instance I have a server running Ubuntu server 12.04 LTS, and if you stick with the software updates provided by Ubuntu for this distro, you only get updates on the 5.3 branch for PHP. If you want to upgrade to 5.5 you have to add a new possibly unsecure software source to apt-get or manually update it yourself. Maybe the next 14.04 LTS release will include PHP 5.5.
Not overreacting. This code looks exactly like something I would expect to see from someone who is just starting to learn programming with no prior experience in any language, yet he calls himself an expert level javascript programmer.
Half the code is used to declare hundreds of variables on the global scope
He doesn't understand how to properly use functions or objects, as the other half of the code defines hundreds of functions which accept no arguments nor return any values, they are only used to change the values of the global variables.
Some of the functions consist of nothing but dozens of if statements that could easily be replaced with switch statements
I can see why this file got flagged, it creates a <script> element in the html document and injects another js file called functions.js, which is heavily obfuscated so it is impossible to tell what that file does.
EDIT: got some new information, turns out a copy of userprefs.js was hacked on at least one of their servers, only some people were able to get the hacked copy and most got the good copy, the bad copy contained extra obfuscated code that translated to this:
This isn't actually an animated gif, it's a image sprite set as a background image for each item, and scrolling back and forth with javascript to animate it.. I really don't know why they didn't just go with a gif instead of making it so complicated. Also, I hate gifs, and I think this site belongs in /r/crappydesign.
Upgrade your video card driver. Make sure you have the current flash player drivers for your browser. If you are talking about flash videos viewing inside your browser.
Already installed the latest nvidia driver, updated my xorg.conf, etc.. As for the video issue, I meant actual .avi files with VLC, I can open them, but no video or audio is output. Codec is installed, just doesn't work..
yeah, Probably going to have to do this myself anyways. Although I can now boot back into linux, I'm now stuck using my onboard graphics, as switching to my GTX 670 makes the system hang again on boot, and I can't even play videos anymore for some reason.
Thank you!
Got my system back up and running with your instructions, there were a few minor differences though:
I had to disable my Nvidia GTX 670 graphics card and use my motherboards on-board graphics to even boot into the Ubuntu live CD; Otherwise I would get an error message about not being able to configure the graphics, with an option to boot using low-graphics mode, only selecting that option would still make the system hang.
Once I was able to boot from the CD, all my partitions and HD's were automatically mounted, under the directory /media/ubuntu/
copying the resolv.conf failed because the one in my systems /etc/ folder was a broken symlink, pointing to /run/resolvconf/resolv.conf; only the entire /run/ folder was empty! So I created the /run/resolvconf/ directory and copied the file into it instead.
When I ran apt-get -f install it gave me the message: "dpkg was interrupted you must manually run 'dpkg configure -a' to correct the problem", so I ran dpkg instead and the upgrade took off from where my system crashed before.
Actually you can scratch that last bit about the bug being reintroduced, turns out it's a completely different bug causing another memory leak. I reduced the code to make sure that it was in fact related to gmp_cmp, and it turns out what is actually happening with 5.6.0-dev, is that if you assign a gmp number in a regular for loop and call gc_collect_cycles(); in the same loop, it causes a memory leak. Having either gc_collect_cycles() or assigning a gmp number on its own in a loop does not cause a leak to happen, but for some strange reason having both these things happen in a loop will cause a leak. You can reproduce with the code below:
function calcExp ($gmpC) {
//make sure gc is on
gc_enable();
for ($i=0; $i<2000000000; $i++) {
$gmpTempC = $gmpC;
gc_collect_cycles();
}
return false;
}
$num = gmp_init('1094189891312342345461854');
print "\n";
calcExp($num);
Ok, I did some testing and I have some good news, and some bad news..
The good news is that my most recently discovered bug (reproduceable with the code above your comment) seems to be fixed in the latest 5.6.0-dev build of PHP, since gmp numbers are no longer referenced from a resource ID with an overflowable integer attached. This bug still exists in all other versions of PHP including the latest 5.5 stable release.
The bad news, is really bad. The original memory leak that I first made this post about does exist in 5.6.0-dev, but not only does it exist for literal string values as the second argument of gmp_cmp(), but the memory leaks just as bad using the gmp numbers, so 5.6.0-dev is even more broken in this respect then all other PHP versions.
If this one has been fixed, this same script has caused me to find another bug in gmp, after I fixed the memory leak issue: if you iterate a loop more than 2147483647 times and create a gmp number in each iteration, it causes an integer overflow on the gmp number resource IDs setting the last one to -2147483648, causing a PHP Warning and inability to find the gmp number.
This can be reproduced with the following code:
Wow - I completely missed that one, you are right that is a string literal.. I figured that since it was only "0" that it would have no impact when I put it in. Also, it turns out this WAS the source of the memory leak - I switched it out for a gmp number resource and now there is almost no impact on the system memory from this script - it went from using all 32 GB on the heap to a consistent 2688 KB. Thanks for pointing this out to me.
ok, just added a print statement to the loop to print out the collected cycles and it is consistently 0 for every loop iteration... but the function is still taking up all available memory with this loop.. hmm.
a) the for loop is where the main work is done, it could be iterating trillions+ times depending on the number being worked on.
b) this while loop runs very few times and may not run at all depending on the input number being worked on, basically this loop tests if the number divides evenly (with no remainder) by the for loop iterator, and if so, it loops and continues to test for an even division until the divided number reaches 1 or no longer divides evenly.
It probably is more suited for C, but I am working a lot with PHP lately and wanted to see if it could be done.
I was running it from console on PHP Version 5.3.10-1ubuntu3.6. It eats the memory regardless of the number if it is very large, for testing I was using the gmp number of 109418990000000000000. Maybe I just need to upgrade PHP..
Thanks! This definitely got my going down the right path. I ended up installing a virtual KVM called synergy and using it with multiseat to be able to use one keyboard/mouse with this configuration.
Not entirely. You need a lot of procedural functions to register as callbacks from the wordpress core. It is even worse for Drupal because the module functionality is hooked into the drupal core via each functions name.
You don't always have a choice, for example writing plugins for the most popular CMS's, since the cores of these systems are all based on procedural coding.
nope, just checked and the last version update from Ubuntu was PHP 5.3.10-1ubuntu3.8 on Sept 4, 2013.
One reason for a lot of people being stuck with 5.3 is related to server security; for instance I have a server running Ubuntu server 12.04 LTS, and if you stick with the software updates provided by Ubuntu for this distro, you only get updates on the 5.3 branch for PHP. If you want to upgrade to 5.5 you have to add a new possibly unsecure software source to apt-get or manually update it yourself. Maybe the next 14.04 LTS release will include PHP 5.5.
Not overreacting. This code looks exactly like something I would expect to see from someone who is just starting to learn programming with no prior experience in any language, yet he calls himself an expert level javascript programmer.
If you were to look at his source code, you will quickly see that he is not even close to being an expert in vanilla Javascript.
Great! Thanks for all of your work on PHP.
I can see why this file got flagged, it creates a <script> element in the html document and injects another js file called functions.js, which is heavily obfuscated so it is impossible to tell what that file does.
EDIT: got some new information, turns out a copy of userprefs.js was hacked on at least one of their servers, only some people were able to get the hacked copy and most got the good copy, the bad copy contained extra obfuscated code that translated to this:
The functions.js file also has obfuscated code, but apparently it was originally like that.
Hate it. They took everything that is overused in modern design and mashed it together.
This isn't actually an animated gif, it's a image sprite set as a background image for each item, and scrolling back and forth with javascript to animate it.. I really don't know why they didn't just go with a gif instead of making it so complicated. Also, I hate gifs, and I think this site belongs in /r/crappydesign.
Already installed the latest nvidia driver, updated my xorg.conf, etc.. As for the video issue, I meant actual .avi files with VLC, I can open them, but no video or audio is output. Codec is installed, just doesn't work..
yeah, Probably going to have to do this myself anyways. Although I can now boot back into linux, I'm now stuck using my onboard graphics, as switching to my GTX 670 makes the system hang again on boot, and I can't even play videos anymore for some reason.
Thank you! Got my system back up and running with your instructions, there were a few minor differences though:
I had to disable my Nvidia GTX 670 graphics card and use my motherboards on-board graphics to even boot into the Ubuntu live CD; Otherwise I would get an error message about not being able to configure the graphics, with an option to boot using low-graphics mode, only selecting that option would still make the system hang.
Once I was able to boot from the CD, all my partitions and HD's were automatically mounted, under the directory /media/ubuntu/
copying the resolv.conf failed because the one in my systems /etc/ folder was a broken symlink, pointing to /run/resolvconf/resolv.conf; only the entire /run/ folder was empty! So I created the /run/resolvconf/ directory and copied the file into it instead.
When I ran apt-get -f install it gave me the message: "dpkg was interrupted you must manually run 'dpkg configure -a' to correct the problem", so I ran dpkg instead and the upgrade took off from where my system crashed before.
Actually you can scratch that last bit about the bug being reintroduced, turns out it's a completely different bug causing another memory leak. I reduced the code to make sure that it was in fact related to gmp_cmp, and it turns out what is actually happening with 5.6.0-dev, is that if you assign a gmp number in a regular for loop and call gc_collect_cycles(); in the same loop, it causes a memory leak. Having either gc_collect_cycles() or assigning a gmp number on its own in a loop does not cause a leak to happen, but for some strange reason having both these things happen in a loop will cause a leak. You can reproduce with the code below:
Ok, I did some testing and I have some good news, and some bad news..
The good news is that my most recently discovered bug (reproduceable with the code above your comment) seems to be fixed in the latest 5.6.0-dev build of PHP, since gmp numbers are no longer referenced from a resource ID with an overflowable integer attached. This bug still exists in all other versions of PHP including the latest 5.5 stable release.
The bad news, is really bad. The original memory leak that I first made this post about does exist in 5.6.0-dev, but not only does it exist for literal string values as the second argument of gmp_cmp(), but the memory leaks just as bad using the gmp numbers, so 5.6.0-dev is even more broken in this respect then all other PHP versions.yeah I can do that. I'll report back with my findings.
If this one has been fixed, this same script has caused me to find another bug in gmp, after I fixed the memory leak issue: if you iterate a loop more than 2147483647 times and create a gmp number in each iteration, it causes an integer overflow on the gmp number resource IDs setting the last one to -2147483648, causing a PHP Warning and inability to find the gmp number. This can be reproduced with the following code:
Note that this code took approx. 12 minutes to run on my machine before the overflow occurs.
actually it turned out to be a memory leak originating from gmp_cmp().
Wow - I completely missed that one, you are right that is a string literal.. I figured that since it was only "0" that it would have no impact when I put it in. Also, it turns out this WAS the source of the memory leak - I switched it out for a gmp number resource and now there is almost no impact on the system memory from this script - it went from using all 32 GB on the heap to a consistent 2688 KB. Thanks for pointing this out to me.
yup, I'm aware of that issue, all instances of gmp_cmp() in my code are using gmp number resources for both arguments, so this shouldn't be an issue.
ok, just added a print statement to the loop to print out the collected cycles and it is consistently 0 for every loop iteration... but the function is still taking up all available memory with this loop.. hmm.
a) the for loop is where the main work is done, it could be iterating trillions+ times depending on the number being worked on.
b) this while loop runs very few times and may not run at all depending on the input number being worked on, basically this loop tests if the number divides evenly (with no remainder) by the for loop iterator, and if so, it loops and continues to test for an even division until the divided number reaches 1 or no longer divides evenly.
It probably is more suited for C, but I am working a lot with PHP lately and wanted to see if it could be done.
I was running it from console on PHP Version 5.3.10-1ubuntu3.6. It eats the memory regardless of the number if it is very large, for testing I was using the gmp number of 109418990000000000000. Maybe I just need to upgrade PHP..