Luke,on the topic of  Tools, Web Development
03.26.2010   |   3comment

As Front End Web Devs CSS is our biggest tool. CSS itself keeps getting better and better. We need to keep up on our tool to use it to its fullest. I’d like to talk about a pseudo-selector tool that I have not used much that I would like to embrace in upcoming projects. I find that it will be really valuable to me. I think the Backend Devs will like it to because I won’t have to come bug them as much if I can make proper use of this selector. It is the nth-child selector.

nth-child

Lets say that a client decided they would like the background of every other <li> tag to be darker than the rest. This <li> is created dynamically. In the past I would have to go contact a Back End Dev and have him write some code to put a class on every other <li>. Then I would go style those with the new class. With the use of the nth-child pseudo selector I can do this with the CSS alone. Here’s how:

ul li:nth-child(2n+1) { background:#212121; }

The expression 2n+1 will match the first, third, fifth, seventh, and so on, elements if they exist. 2n+1 isn’t the only expression you can run. Here is a list of a few possibilities:

  • 4n+1 would select the first, fifth, ninth, thirteenth…
  • 4n would select fourth, eighth, twelfth, sixteenth…
  • -n+5 would select fifth, fourth, third, second, first, none

If this isn’t making perfect sense yet just run the math loop in your head and it will. Lets take the first example again. 2n+1

  • 2*0+1=1
  • 2*1+1=3
  • 2*2+1=5
  • 2*3+1=7

Before we go out and use this everywhere I should point out that IE doesn’t support this in any of its versions. The saving point to this though is that jQuery does support all CSS selectors so if you are using jQuery you should be fine. For examples of how the nth-child works with jQuery see this page. Happy Coding.


03.18.2010   |   0comment

I just spent about an hour banging my head on a brick wall with the apparently well known “Unable to create selectable TCP socket” problem, which manifests itself most notably with failing imap_open() calls from PHP. It is related to fd_setsize and a frequent limit of 1024 open files (or at least selectable open files). It is quite well documented that it is some kind of bug/shortcoming in the c-client libraries that underlie a lot of email-related stuff, particularly the UW suite of tools like uw-imap, pine, alpine, etc. as well as the IMAP extension in PHP. I love being able to go Google for answers and find a ton of related content. It is really annoying though when people have been talking about this bug for years, since at least early 2007, with very very few workable solutions posted, or even workarounds.

So, I’m going to do my part: I found a workaround that I think might work very well for a lot of people who run into this problem. It’s biggest advantage is that it is very very easy to try, and has almost no downside, even if it doesn’t work for your particular situation. In my case, I found that Apache did indeed have a lot of files open, including log files for all my VirtualHosts, all the libraries that httpd depends on, files from sites that are hosted there (though it seems to open and close those just fine), and a large buildup of hundreds of entries for /tmp that were open and apparently never got closed properly. In my case, the server in question has an uptime of over 2 years, and while “apachectl restart” runs at least daily for log rotation, it seems that doesn’t really close unused file descriptors. The workaround I discovered was running “apachectl stop” followed by “apachectl start” which fixed the problem completely for me, at least for the next year or two I hope. From over 1600 open files, after restarting Apache fully that way, it only reopened about 325 files. And the imap_open() calls started succeeding as they should.

One last thought before I hop off my soapbox: when you find an answer to a problem, and that answer was hard to find or was not well documented, do your part to remedy that for the next guy or girl to hit that problem, and post your solution somewhere that Google will find it. It makes the internet a better place for all of us, and makes us all more productive. Who knows, maybe down the road you’ll run into the same problem again yourself, and not remember how to solve it until you find your own post from years before, and it will be your own time you’ll save. I fully recognize that a lot of what I accomplish each day is based on work done by others that I have found and emulated, as they say, standing on the shoulders of giants. Each contribution to the body of human knowledge lets us reach that much higher, so when you can, add your bit and as we all do that, it adds up.


03.12.2010   |   0comment

Editors Note: Quintin Smith is the Business Development Manger at White Label SEO and has been kind enough to write a post for Code Greene on his specialty – SEO.

SEO is an interesting process. We here at White Label SEO would like to talk about how important SEO is to your overall success of your website. We would like to thank Code Greene for this opportunity to post a message about SEO to their blog. Thanks Code Greene! One quick word on Code Greene. We have dealt with numerous web developing firms and Code Greene is one of the best. Thanks guys!

So how do you work on optimizing your site. There are a lot of things that need to be done. How is your content? Is your content keyword rich? Are you putting links in the proper places of your site etc? All of this is important, but when it comes to starting a successful campaign you need to know YOUR COMPETITION! At White Label SEO we evaluate your competitors. Why is this? Well, for a few reasons. First, your competition might be large. You may have a lot of competitors that have been doing SEO for awhile so it is important to know who it is and what kind of traffic they are receiving and what keywords they are using. This is all important information to know when it comes to keyword selection and the success of your website. Research your competitors. Once you understand what your competition is doing you can start to build your keyword list that you otherwise may not have chosen if you haven’t looked at your competitors.

Search Engine Optimization is not like PPC. The results are not instant. It takes time and work to get in the top SERP of the engines. Knowing your competitors will help you gauge your success and help you determine your goals. The greatest way to turn an ROI on your site is through organic SEO. So you need to expect to spend a good amount of investment on your own developing your site and creating a web page that people want to link to. This is just a quick start for people that need to gain some insight on SEO. Know who you are up against and build your site and SEO campaign based off that knowledge. We wish you the best of luck in your efforts of climbing to the top of the search engines.

Quintin Smith – White Label SEO
For SEO Services, please contact Quintin and quintin@whitelabelseo.com


Master Sensei,on the topic of  Fun
03.05.2010   |   0comment

Ninja

A friend tipped us off that Abduzeedo had a Friday post on the Awesomeness of Ninjas, mentioning the article probably deserved a spot on the dojo blog. I couldn’t agree more.

From the day I interviewed at Code Greene, Mark (the head sensei here), explained that he was assembling a team of ninjas to do his bidding. Our business has borrowed Japanese philosophy in a number of areas; namely, The Toyota Way, kaizen, and eliminating muda as it applies to workflow and personal improvement. We have 3 actual ninja swords in the office, and we once killed a guy. Well, that’s not entirely true, I can’t actually vouch for the authenticity of the swords.

Anyways, all I really wanted to say is that ninjas are awesome. Go check out the post and relish in their glory.


03.05.2010   |   1comment

This edition of Sharpening the Blades features an article from Mike about using jQuery, CSS and image sprites to create stylish forms, an article from Benjam about Passwords on the web and Mark chimes in with an article about the possibility of HTML5 in Internet Explorer 9.

Mike, Get your form on with Uniformuniform
We’ve all been there. You finish an amazing design using some sweet custom form elements that perfectly match the theme of your design. Then after a few frustrating attempts, you realize that some form elements just can’t be styled. Or if they can, not consistently. So you throw on a border, maybe a background image, and hope for the best as dreams of your custom UI vanish into nothingness. But fear not! Using the clever jQuery script Uniform and some CSS sprites, your form designs can once more be glorious! Works beautifully in all major browsers (degrades gracefully in IE6).

Benjam, The Problem with Passwordspasswords
Being in the Web Development industry for a while now, and having had a few third-party scripts that were on my site hacked, I have become more and more interested in web security.  Passwords are on the front lines to that.  Being a user of Web technologies, I’m also interested in usability and choice, and when it comes to showing or hiding passwords (what? you can do that?) I’m in the boat of give the user the choice.  This article nicely explains a few examples that offer people the choice to show or hide their passwords, both of which are very useful.

Mark, Microsoft to Double Down on HTML5 in Internet Explorer 9internetexplorer
Doubling down seems like the wrong approach to me. If I were the CEO at Microsoft I would instead of thinking of trying to put their foot down harder, they should instead learn to bend in the winds of the market and work on compliance with the other browsers. Though I hate to say it even forced upgrades like Firefox does would be good, to keep people current and reduce the amount of cross browsers compatibility problems Microsoft gives developers. I don’t think Microsoft realizes that by making developers lives bad by trying to be different they are actually building up a mass market of developers who hate them because it is so difficult to make cross compatibility easy and affordable.