So I’ve been working with SASS a lot lately, and was looking into replacing all the instances of scale-color($color, $lightness: 20%) with lighten($color, 20%), as it’s a more compact syntax and seems like it should do the same thing. But as I was doing that, I noticed that the colors that were being generated were not quite the same, and in some cases, wildly different. So I’m going to explain the differences between lighten and darken vs scale-color .
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:
UPDATE: After playing with this code, and really looking at it, I’ve decided that this piece of code, while clever, is poor programming.
The reason I think this is for one, it’s not clear what it does at first glance, and secondly, it can be re-written to be both more readable, and less prone to errors.
I rewrote the code to look like this:
(reverse ? -1 : 1)
This small difference was enough for me to decide that this bit of code was too fragile and needed to go.
If you’ll also notice, in the original code, reverse was actually set when the sort order was normal (returning 1), and unset when the sort order was reversed (returning -1). I also fixed this, making the name of the variable match it’s function, thereby making the code even more clear.
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.
my site went down about a week and a bit ago, so i tried to contact my hosting company and find out what was going on.
I went to the website, no notices there, went to the forum which has been removed, tried to submit a service ticket which i couldn’t do due to lack of a password for the system, and finally tried to call the 800 number which was blocked from my area code. all this took about 2-3 days, all of which saw no return of my website.
i finally found a regular number that i called and got in touch with an actual person and found out that 16 of the servers that this company owned got hacked and had all the data erased. no backups, no data, no nothing.
they finally got in touch with us (4 days later) and let us know what had happened.
i finally got a password for the support ticket system and submitted a support ticket for my website to be reinstated.
i must admit it was a very prompt reply, but the information they had given me was completely wrong, it was for another user and another site. I let them know they had messed up and they never replied. i told them again… nothing. i finally wrote them a nasty little note and they promptly responded in kind.
i finally got my corrected information and got my site uploaded, but whenever i tried ta access it it would redirect to another website totally unrelated to my own.
it is still having issues, but my site is back up (thanks to backups i had made a week before the attack), my mail is finally working, but there are still some small issues with the site.
so… long story short… don’t host your site through webhostplus. their service sucks.
so i got a new job working for a local independent graphic designer / printer and its pretty nice. i get to work when i want, at my own pace, from home, doing what i love, and get paid for it. the only thing about it that really sucks is that i’m doing web design and as any semi-serious web designer that works for clients will tell you, coding for cross-browser compatibility SUCKS !!
i mean, why can’t all the browsers stop the damn browser wars and come to an agreement on what will and will not be supported? it seems that the w3c has been doing a good job with stating what should be standard and what should not be standard, and most browsers do a pretty god job following those standards.
except one. microsoft’s internet explorer, the number one used browser on the planet. it works the way it wants to work, and getting your site to look the way you want it to in internet explorer is like trying to teach a four year old how to fly a plane. they may get some things right, but most of the time, they budge things up so bad, you have no idea what they are trying to do. and then all of a sudden, they don’t want to do anything anymore. it is the most annoying thing on the planet, because fixing one thing breaks another and when you get it all looking good in internet explorer and then go back and open up the same page in firefox (my personal favorite and most likely the favorite browser of any self-respecting web designer / aficionado) it looks totally whacked and nothing is where it is supposed to be.
and that’s not even considering the dinosaurs out there, who just absolutely have to have thier netscape communicator 4.75, which has almost no current standards support and what it does support (obsolete and completely annoying things like ‘blink’) it supports badly or is no longer a web standard.
but that’s okay, i figure anybody using web browsers older than the wheel are probably used to things looking all messed up, or they are too computer illiterate to care.
i eagerly await the release of internet explorer 7 (which has taken several years, because microsoft, in all thier wisdom, thought, “we have the monopoly on web browsers, why fuck with it?”. that is, until firefox started taking thier precious users and microsoft just HAS to have the monopoly) because that will mean (hopefully) that interent explorer will finally have decent web standards and png support and i won’t have to keep writing several versions of the same page just to get it to look right everywhere. (but hopefully it will still be subject to the same css hacks, so in case it does mess something up, i wont have to rewrite everything to fix it.)
now all we need is to kill off the dinosaurs and we’ll be all set.
i’m currently working on the new corporate intranet and public site for EGI, which is pretty dang huge for a guy who only designs websites as a hobby. the site uses ColdFusion, which is a server side script not unlike php and perl. although it does have its pros and cons. pro is its simplicity, there’s no distinguising between the code and the html while coding, the code merely consists of specific html ‘tags’ (for instance <cfif> </cfif>), but because of it’s simplicity, it’s also a little harder to do complex things without a superfluous amount of code.
i also designed a site for a friend of mine (soon to be brother-in-law through two marriages) at
www.photmillard.com. i really like the way the site turned out for him, i’m actually quite proud of it. it’s simple, but the backend is custom coded in php to select a different random picture from each of the various photo albums and display it as a rollover on the main page every time it is refreshed. i also re-skinned the photo album that he uses (the same php script as mine), and created all new graphics, edited css, and code.
anywho… it’s been a while, sorry to keep everybody in the dark about what’s going on, but i been busy.
p.s.- you may also notice (if you frequent my blog) that the look (and script) has changed, i was forced to do this by some weinie that kept comment spamming my blog. why do people feel they have to be dickheads? what happened to respect?
i don’t know why, but i am so excited today… it could be the airsoft game we’re playing tomorrow, or the party tomorrow night, or the sense of achievement i have at moddin the crap out of my board today… i dunno, but it’s there.
i kinda like moddin my board, it’s fun, except when it doesn’t work. then it sucks, but today… it worked, so it’s good.
have a great day! mine’s goin pretty dang good.
plur, peace-love-unity-respect (www.plur.com)
every time i get just about done upgrading my board with various mods, images, goodies, etc. the peeps over at invision services come out with a new update to the codes, so i have to go through and re-install just about everything on the board. kind of annoying, and i know i don’t have to do it, but i’ve always gotta have the best stuff for my friends to use. so right now, i’m currently workin on gettin my forums workin the way they were before this update, and also gettin all of my links on the whole site updated to reflect the addition of my new photo gallery area which can be found here:
i still can’t decide what template to use on the photos page, but oh well, i guess that’s life, and i have more important things to worry about, such as finals coming up, a take home test i should be doing, registering for the U which starts in like 20 days (3 weeks), and trying to keep my money problems under control.
but its nice to get away from all of that stuff for a while and just get immersed into the computer and workin on stuff that gives me a real sense of accomplishment, so… gonna go get myself a sense of accomplishment! =)