I have been programming on a Windows machine my entire career, and have always noticed that PHP takes a rather long time to run on my local machine versus a dedicated server. I never paid much attention to it, thinking that there wasn’t much that I could do to solve the problem.
Lately, I’ve been working with Magento at my new job, and have noticed that it takes an excruciatingly long time to render a page. Due in part to my use of Xdebug, and also due in part to the large and complex nature of Magento.
I finally got sick of the wait as it was reaching a point where I was waiting minutes for a page to render, and I started to look at the processes that were running at the same time as httpd (the web server). One that stood out–because it was taking nearly 12% of my multi-core processor (which is a lot for a multi-core)–was MsMpEng.exe. This little service is the one that runs the Microsoft Security Essentials scanner.
So basically what was happening was that every time I requested a page, Microsoft Security Essentials decided to hop in and make sure that the server was not doing anything malicious. This in turn caused the server process to slow down, and the response from the server to halt while the scanner scanned the response.
I therefore added httpd, php, php-cgi, php-win, mysqld, and mysql to the list of excluded processes, and let me tell you, going from literally minutes to a just few seconds to load a Magento page is a nice improvement.
So if your server is consistently slow, make sure there are no security programs scanning the processes while they run. It may surprise you the difference it makes.
When I first looked at this, I wasn’t quite sure what it did, but as I started to take it apart, it became clear. It’s a very clever little piece of code.
This was part of the return value of the sort function, which, if it returns a 1, sorts ASC, and -1 sorts DESC. This little snippet switches that.
The way it works, is it creates a small two-element array [-1, 1] and then pulls out the n-th element where n is +!!reverse.
It’s the same as writing:
var test = [-1, 1];
var idx = +!!reverse;
The !! part makes sure that reverse is a boolean, and the + converts it to an int.
Very interesting, and I had to look at it for a second to really figure it out.
Original snippet location:
So I’ve decided that I want to keep my personal site and my professional site more separate, as well as give everyone in the family a matching email address and allow for growth within the family website, so I’ve created welkerfam.net.
Anything that is of a personal nature will be found over there, and all of my more professional/programming things will remain here at the iohelix.
Feel free to head on over and check it out. It’s pretty fresh, and I’m still getting things moved over properly, so I’ll keep a copy here as well for about a month or so until everything has been ported over properly, but it’s up and running.
So I’ve been geeking out over a puzzle that I got for Christmas this year. The puzzle is called 36 Cube. If you have this puzzle, and haven’t solved this cube, or would like to in the future, or have any other reservations about reading spoilers,
PLEASE STOP READING.
This is not a hints post, and I do not ease you into a solution slowly. This is a post about how I solved the puzzle and some interesting facts about the puzzle I found out afterwards when I began to dive deeper into the solution set. As well as the programming that went with it.
If you would like some proper hand-holding, please see How to solve the 36 Cube puzzle – hints & solution for hints (and samples of the program that got me started down my path).
AGAIN, IF YOU DON’T WANT SPOILERS, PLEASE STOP READING!
so unless you’ve been living under a rock, you know that we’ve moved to Slovakia. during the move, I was unable and unwilling to pack my computer up to bring with us. it was just too large to be feasible. the next best thing was to backup my digital life onto an external hard drive–which chelsea so conveniently gave me for christmas–and bring that with us instead. one problem with this is that, as with every other time that I had to wipe my hard drive, I would be forced to re-import my entire iTunes library into iTunes, and if you’ve ever tried to import an iTunes library, it’s better than starting from scratch, but it sucks. playlists don’t sync properly, especially if they are based on other playlists. and the add date for all your songs becomes the same date, which I use in many of my playlists (recently added, etc.) but I think I found a solution to my problems…
for everybody who will be celebrating the coming new year, make sure you don’t start (or end) your new year’s countdown early.
the international earth rotation and reference systems service (IERS) has announced that a leap second will be added at the end of 2008, making 2008 one second longer than it should be.
so either start your countdown at 11, or end your countdown at -1, either way…
enjoy the extra long year! (it has both a leap day, and a leap second)
so we got a new camcorder for christmas (mrs. claus was nice enough to bring one by for us), and I broke it out, started using it, got it home, and tried to hook it up to the computer… well, that failed with a cryptic error message, but no big deal, the memory card is easily removed, and the camcorder conveniently came with a USB card reader. so i plugged that in, attached it to the comp, and tried to open the files with my favorite in-a-hurry audio/video player, VLC…
nope. try again.
Microsoft Internet Explorer is about to ruin your day. Read the story for more info:
Now, do yourself a favor and grab one of these:
- You’re good, no worries
- But grab Firefox, just for the heck of it
- You can also grab Opera, if you want
A co-worker of mine pointed me towards this entry in a blog.
It talks about linking to a specific time in a YouTube video. I’ll repeat here in case you don’t want to link offsite.
Have you ever recieved links to videos that say something like “It gets really good around 1:47″, or something similar?
Now you can link to a specific moment in that video by putting the time as follows in your link:
What this does, is when somebody goes to that link, it not only starts at the given time, but it doesn’t buffer all the stuff that comes before it, so you don’t have to wait for the part you’re interested in.
For instance, try the following link:
That’s just awesome.
being a web developer, i try to keep up with what’s going on in the browser realm of the interwebs. today saw the release of the new Google browser: Chrome. a new browser release is nothing new, but the fact that Google has, for quite some time, been the main ‘internet’ company, providing everything from search engine and page cache, to email, web documents, and calendar, all online, makes this browser release something to look at.