After several months working on a pretty complicated css framewok for our new theme, things have started getting really slow in Netbeans. Like, 20-30 seconds sometimes. Part of how I set up concrete5 themes lately is to keep a separate typography.css file explicitly for the tinymce editor, but not include that in the main theme. This way it's easier to tweak things without having to keep them both using the same file and potentially having issues with inheritance and overriding things cleanly. With dozens of smaller files to compile, every time I hit save somewhere for a minor tweak, it would have to compile both of those, reading all of the intermediate pieces.
It was really getting unworkable, and making it almost impossible to get anything done.
Turns out this is a known issue. Thankfully, I'm already doing a lot of the best practices, using Bourbon and Neat rather than Compass and Susy. So the transition wouldnt' be that difficult. Realistically, you wouldn't think that a few seconds is that big of a deal, but it is. Not just in the amount of productivity lost waiting, but the potential to derail the chain of thought.
SASSC to the Rescue
Ask anyone who knows much about programming, and they'll agree that an interpreted language like node.js or ruby is going to be slower than a compiled language like C. And that's the whole problem here. I could finish switching over to my ssd, but really don't have the time and throwing hardware at a problem isn't a good solution.
Unfortunately, the guides to install it are all a bit technical. OK, really technical. And sparse. I guess that the thinking is "If they know enough to be forking these repos because they have a sass project that is complex enough to slow down like this, they probably already know what they are doing." This guide had most of the steps that were needed. I only had a few things to note.
- I used the updated versions of the libraries. 3.2.4 instead of 3.2.1. I had to look at the releases tab on each repo to find out what was the most recent. It's a bit unnerving to see names like "Patchwork Quilt" "Patch Adams" or "Reassurance Elbow Suite" but as long as what you clone is consistent for each, you should be good.
- I got a lot of errors along the lines of "Makefile:131: *** SASS_LIBSASS_PATH must be defined. Stop." At first I thought it was because of not supplying the -E flag when using sudo. That was partly true, but it wasn't the whole thing. Another part was that the libsass wasn't actually compiled so I used autotools to fix that. On top of that, I ended up removing the quotes around the path when echoing into /etc/environment.
- Instead of going into /usr/local/bin/ and then using a relative path, I put it in as a full path from the root.
What about IDE integration?
Even after it was all working, I still had to make sure that it works with Netbeans. Apparently, two arguments are passed from java that aren't actually in the specifications. Once you've changed to the c compiler from the ruby or node wrapper, stuff like that matters. Hoping that it doesn't pop up somewhere elese in the code later, but it could. Willing to bet that other IDEs could have similar issues.
The workaround shown here almost had it, but not completely. The reason was that there was another argument that was getting sent. That was because I had 'send debug output' included. I didn't need that, so unchecked it in the IDE options dialog. If I did need it, then I could have just adjusted the number used for the argument.
I did need the source maps so I can see where styles are actually coming from when inspecting in the browser. That was happening automatically with the ruby version (think that's what I was using) but not with sassc. Thankfully, using the proxy lets me add those arguments if I need them.
That gives me a minimized css output file with a source map. It could be adjusted to have any extra arguments you need pretty easily. I'll have to dig into that more later. I do like just getting automatically minified files like that every time that I hit save, though I'm not sure how well it will work in a team environment. That's going to be one of the big things that I need to figure out - how to get anyone else on the team that needs to be able to use this stuff up to speed with everything installed. That goes doubly if I try to find a vendor that can handle it.
Honestly, without any tweaks, it's pretty close to what already is generated, so maybe they'll just be the ones dealing with frustrating slow compile times. ;)
Yikes. It's apparently been forever since I last wrote something. I've since one full time at Planned Parenthood Federation of America. It was part time and temporary for the last year and a half or so, but now it's legit. Benefits and everything.
We're doing some pretty amazing stuff with phase two of the site. There's a little bit of a preview you can check out here. I'm really happy with the markup and the editing, and there's a ton that I've learned putting it together that I could talk about.
So, trying to get myself back in the habit of blogging to share some of this stuff. Starting off with something kind of simple that I've been working on the last couple of days; using an inline svg file as a play / pause icon for a video.
Picked up two of these tonight, one for my Macbook Air and one for my Dell XPS-15.
Think they're going to be pretty great for hauling my computers around on bicycles. Totally waterproof, pretty good impact protection, and actually a design I kind of like. Not a lot of 'cruft' - it's still not just a bit of thick cloth. Most of the other cases you'll find are more like briefcases with a sleeve for a laptop, or a backpack. Way too much bulk for tossing in and out of messenger bags or other large backpacks where you are already carrying a bunch of stuff.
I've never really had a chance to travel much, which makes this year pretty unusual. Believe it or not, I had only ever flown once in my life! I've done vacations travelling on bike, or crashing on friend's couches, but those were a lot different. This whole world of hotel rooms and real luggage is completely new.
For my current gig, we have several scripts that need to run that take forever to finish. I'm talking hours. Obviously, doing them through the browser would be impossible, so we use command line php scripts to make sure they can finish completely. Last Friday, I was having issues with one of these, but didn't know why it was erroring out. I could have done a bunch of var_dumps and whatever to try and figure it out, but I wanted to be able to just put a breakpoint in the script and figure out exactly where it was happening in a lot less time.
Thankfully, the answer was pretty simple and easy to find over on Stack Overflow. The one that I ended up going with was actually the second answer. Here it is if you don't want to bother clicking through:
- Start the debugger in the IDE. Take note of the session name in the URL. For me, it was "netbeans-xdebug"
- On the command line, enter this:
- Run your PHP file, it will trigger breakpoints in NetBeans just like running from the browser.
That's it. Super simple, but if you're using command line scripts, it's really useful.
If you want to turn it off again, just enter this. The CLI instance of PHP will stop debugging, but your browser will still be going like normal until you stop that session:
Hope this helps people! Enjoy!
I spent most of the summer hanging out in Montana, visiting family and going to my 20th high school reunion. That was, um, interesting. Certainly the subject of another, longer blog post. I often go quite awhile between posts, but nearly four months is a bit much.
Really, I should be trying to write shorter posts more often. It's just so much easier to publish something short on a social network instead of logging in here and writing something super long. It's kind of an ongoing issue, there are actually four or five posts that I've started and not finished in my drafts.
Another issue is that I can't really just quickly share content across multiple networks. I don't use twitter hardly at all, since I don't really have the focus to try and filter through the 1000s of posts every hour in my stream. I share a lot on Facebook, but don't typically take the time to open up a tab for Twitter to post it there, too.
Don't even get me started on LinkedIn. Does anyone really use that? I've gotten some good job leads from it, though, and if I had quality tech content posted there regularly that would probably increase a lot.
How do we get all of these social networks working together?
There's an old joke about how the barber has the worst haircut and the mechanic's car barely runs. It's true for me. I keep telling myself that I'd work on it and never really seem to find the time. But I'm working on doing some upgrades to the Greaserag site and help them make it easier for them to share content across several different social networks.
Did a lot of digging tonight, and I think that I've found a really great service that is mostly free (some features cost money) that totally fills the need. It's called dlvr.it and it lets you set up queues for your content, subscribe to RSS feeds, use a browser plugin to share scheduled content, control what content is included in the post... You can publish to multiple accounts, and to facebook pages, groups, or profiles. It can auto parse out hashtags, which would be really handy to a lot of people. You can control the scheduling for individual posts, or the frequency of data from an RSS feed, the number of posts per day...
Really, a ton of features.
I just signed up for it tonight, so this is really the first post trying to use it. I'm hoping that the few minutes I spent setting everything up worked well, and that it will show up properly.
Once I've used it for a week or two, I'll try and remember to write a followup.