Categories
Programming Languages SVG

Color sampling and SVG gradients

More fun with SVG.

I’m rather surprised there isn’t more general ‘design’ work using SVG. True, you really should have your pages as XHTML and not many people are ready to jump on that bandwagon. Still, once you’ve bit the bullet, you can have a lot of fun with your pages and incorporating SVG.

My newest experiment is actually combining PHP image functions with dynamically generated CSS entries, which also control the random photo header. All the SVG elements are dynamically created based on colors sampled in whatever is the current header image. I used the photographer’s ‘rule of thirds’ to pick four outer points and then sampled the middle. I use the sampled colors to generate CSS values used to style 4 small circles in the top of my sidebar and rounded-corner gradient-filled ‘caps’ to my individual comment entries.

I had to make some tweaks to make the gradient comments work. First, the SVG element had to have the display setting set to ‘block’ in CSS; otherwise, the browsers generated space following the object. I’m assuming that the SVG element is treated like the IMG element is in strict XHTML mode: treated as an inline element, and given a ‘text descender’ space. Second, just as with images, fixed widths work best for gradients, and the viewport for each SVG element has to be fixed to work with Safari 3.

The gradients don’t work with Firefox 2.x if you access the page using a page fragment, such as clicking on a specific comment. This is a bug that has been fixed in Firefox 3.x. It does work with the latest Opera and Safari 3. The page degrades nicely for non-SVG browsers.

I’m not sure if I’ll keep the SVG effects, or even take it further with creating entire page color schemes based on color sampling of the image. I may look at embedding additional data directly in the images to control both the CSS and the SVG.

I do want to implement ‘caching’ for the ‘blog pulse’ I created earlier. The best time to cache the pulse would be each time a new comment is saved, probably to a database table I’ll create for other uses. The color sampling, though, may not need caching. The gradient effect can be a little slow, but most of the ‘slowness’ is from the fact that the header image is quite large. Then there’s the random selector for the image–I imagine this can be improved through the use of caching.

Frankly, I don’t load my sidebar with dozens of widgets, hook into that abysmal google syndication service, nor do I embed dozens of YouTube videos in my posts. My little use of SVG is nothing compared to all of this, and, unlike the other services, doesn’t impact on the loading of the page contents.

Still playing. I’ll worry about performance when I’m finished playing.

For your own playing: SVG is in page, PHP dynamic modification code, import into your CSS file using: @import “photographs.php”;

The only drawback to all of these changes is Internet Explorer. None of this is going to work with IE. None of what I’m doing, though, impacts on the page layout, or the text or even the generated CSS style settings. The IE users won’t get some of the effects, but they’ll get the weblog content. I’m not going to try and use Silverlight or VML or a plug-in to work around these issues, either. I figured if the Microsoft people don’t care that their users are missing out on the fun pieces of the web that’s Microsoft’s problem, not mine. That browser has killed too much of my fun over the years–enough is enough.

Categories
Programming Languages

Perfect example

Recovered from the Wayback Machine.

Here’s a perfect example of how the computer field is broken:

In a post at Coding Horror, based on earlier posts at Imran on Tech and Raganwald, the author parrots what the others state, that programmers can’t program. With lots of exclamation points.

Why make such a breathtakingly grandiose claim? Because of what happens in interviews. It would seem that the originator of this newest fooflah created a series a tests given during the interview process and found:

After a fair bit of trial and error I’ve discovered that people who struggle to code don’t just struggle on big problems, or even smallish problems (i.e. write a implementation of a linked list). They struggle with tiny problems.

So I set out to develop questions that can identify this kind of developer and came up with a class of questions I call “FizzBuzz Questions” named after a game children often play (or are made to play) in schools in the UK. An example of a Fizz-Buzz question is the following:

Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

Most good programmers should be able to write out on paper a program which does this in a under a couple of minutes. Want to know something scary? The majority of comp sci graduates can’t. I’ve also seen self-proclaimed senior programmers take more than 10-15 minutes to write a solution.

Jeff Atwood of Coding Horror also goes on to quote others who run into the same problems: interviewees can’t seem to do even the simplest coding tasks during interviews. These gentlemen completely ignore the environment and focus on the grossest of generalities:

Programmers can’t program.

Here’s a clue for you: I don’t do well in programming tasks during interviews, and I’ve love someone to come into my comments and tell me I can’t program based on this event. No, I’ve only faked it while working for Nike, Intel, Boeing, John Hancock, Lawrence Livermore, and through 14 or so books–not to mention 6 years of online tech weblogging.

In fact, you’ll find a lot of people who don’t necessarily do well when it comes to programming tasks or other complex testing during job interviews. Why? Because the part of your brain that manages complex problem solving tasks is the first that’s more or less scrambled in high stress situations. The more stress, the more scrambled. The more stressed we are, the more our natural defensive mechanisms take over, and the less energy focused into higher cognitive processes.

Why do you think that NASA, the military, and other organizations training people for high risks jobs spend so much time in simulation? Because they want the tasks to be so ingrained that in a stress situation, the people’s responses are almost automatic.

If you add the potential for embarrassment on to the strong desire to do well, the need to get the job, toss in a panel of arrogant twats sitting around a table looking directly at you while you do your little tests, and you have the makings of an environment that almost guarantees the elimination of many fine candidates.

Who does well in these kinds of testing situations? Good testers, the supremely self-confident and equally, typically arrogant, and the people who don’t care: none of which is necessarily the best candidate.

The whole purpose of tests such as these are not to determine if a person has programming capability–how can one stupid test determine this? What these tests do, though, is add to the self-consequence of the person doing the interview.

“I can do this, but all these people can’t. Therefore, I’m so much better.”

It’s also a lazy interview technique, which shows that HR associated with the company doesn’t give a crap about the IT department.

Some justify such tests with, “We need people who can do well in stress situations.” Bilge water.

The stress one goes through when one is an outsider faced with a bank of insiders, is completely different than the stress an individual goes through when they’re part of a team trying to fix a problem or roll out a product. Comparing the two is ludicrous, and nothing more than a demonstration of completely two-dimensional thinking: one form of stress is completely the same as another. My god, no wonder we’ve had few tech innovations lately if this is demonstrative of leadership in IT.

Having candidates bring in samples of code and having the interviewer and interview team review such, and question why decisions were or weren’t made is an excellent way of getting insight into the person’s problem solving skills, without the trained dog and pony show. Asking a person what approach they would use in a situation is superior to doing a random memory test on keywords. Providing applications and having the person provide their own critique is an amazingly effective way of getting insight, not only into their problem solving skills, but also into their personality. If they point out errors but do so in a thoughtful manner, it’s a heck better than doing so in as scathing a manner as possible.

Looking at past applications or effort is another effective approach. New programmers with no job experience can provide pointers to open source applications; experienced people who have worked in an NDA situation can provide pointers for discussions and work online: heck, Google the person’s name–that will tell the interviewer much more about the person than a silly programming test.

That primitive techniques such as the abysmally stupid “FizzBuzz” approach are used shows that companies are still missing out on good people because they have idiots doing most of the interviews.

And making the leap between how people do on interviews into such grand claims that programmers can’t program demonstrates that idiocy travels up the food chain.

You know what’s especially humorous? All the people who solve the test questions in the comments. What possible reason would a person have to do such a thing? It’s completely irrelevant to the environment in which these so-called tests are given. This no more shows that these people can program, then it shows that the other people can’t.

The lack of logic in this whole thread is amazing.

What’s less funny, though, is the slavish adherence to Joel Spolky’s elitist crap. Joel runs a smallish computer company with limited products: what the hell makes him the definitive answer on these topics? Perhaps the people should spend less time making pronouncements, and more time developing independent thinking skills.

Many of the comments in the Coding Horror post do mention these concerns, and provide other effective approaches to interview. If the people who create these tests will actually read these responses, some good will have come from the discussion.

I have found, though, that people who write these kinds of tests aren’t always willing to considering other options. The other approaches just aren’t ‘clever’.

Categories
Programming Languages

Dabble

I agree with Sam Ruby: a successful tech is a diversified one. You can’t always depend on a new millennium to justify sticking with one and only one programming language.

This last week I worked with Java, JavaScript, PHP, Python, and Ruby. I had been on a long hiatus from Java after the end of the dot-com era, but now I’m back and plan on sticking it out with the language. Yes, even unto J2EE.

I also agree with Michal Wallace: you are more likely to have an easier time getting work if you focus on .NET than Python. In some ways, I think that the interest in Ruby has slowed the interest in Python. Sure you can work with both languages: but why would you want to?

In St. Louis, the demand is for .NET (VB or C#) or Java. That’s it. I mean, that’s really it. Most of the other work in PHP or Python or Perl is off-shored.

When I move to the northwest, I imagine I’ll either need to get back into .NET or brush up my C++ skills, in addition to the Java. If one has up to date C++ skills, one can usually find work.

As for JavaScript — every web developer should be proficient in JS. Eventually you’re going to want to validate a field before sending it to the server, or have to muck with cookies. There will always be someone somewhere who will say, with breathless excitement, “What about AJAX?” JS is ubiquitous.

PHP is also ubiquitous, but there just isn’t the work for it. Nor Python. Perl’s fading. I have my eye on Ruby, though.

Categories
Programming Languages

More new toys

I still love Locomotive, but I haven’t forgotten my PHP, or my first love, RDF. (Note to self: get out more).

Anyway, I spotted the following at the RAP (RDF API for PHP) site:

RAP 0.93 will be released in January 2006 and will include support for the SPARQL query language and the SPARQL protocol.

I’ve been waiting for this to implement more evil plans. Oh rapturous joy! Oh sublime happiness!

I am dancing a jig. Do you see me?

*dance* *dance*

Happy face.

*dance…GROWORWOOWROWRWR!

(I danced on Zoë’s tail…)

Categories
Programming Languages

Chu chu code

Recovered from the Wayback Machine.

I can’t believe how easy it is to set up Ruby on Rails on the Mac with Locomotive. I went from two downloads to my first application in less than 1/2 hour. Great stuff.

I’m in the process of making vast changes here abouts. The first change is I’m moving my Tinfoil Project domain to a new development server that is upgraded to all the latest, breaking edge PHP, MySQL, Ruby on Rails, and so on. Tinfoil is being re-focused from photos to high-tech, and the new server will provide examples of code how-tos and tutorials I hope to work on this next year.

I’m looking at a virtual private server at A2 Hosting or OCS Solutions at this time, but wouldn’t mind hearing about other hosts–with a few caveats.

I’m looking for a service that goes month to month, since my income is uncertain from month to month. I need enough RAM to run my examples, and enough bandwidth not to have to pay overage. I wouldn’t mind a control panel, and some assistance (paid or otherwise) if things go wonky. I’d also like a system that has some of what I want already installed, so I don’t have to start from scratch. These are things I want. What don’t want is a service that’s heavily connected with weblogging.

You all may jump on the Cluetrain, but I’m finding I’d be just as happy, thank you, in not having a close, intimate connection with vendors. I want to be able to deal at a professional level with companies, and not have Sarah or Sam ‘offended’ by what I write in my weblog.

I want a clear means of communication detailed at the company site; I don’t want representatives in my comments whenever I mention their product. I don’t want to have to use my weblog as a form of extortion to get a company’s attention; or as a backdoor way of doing business.

I don’t care if they see me for who I really am, as long as they see me as ‘customer’ and act accordingly. I don’t want input into the company workings other than “what you’re selling me is working, here’s my money”.

I don’t want to be ‘bad’ or ‘good’ for being critical. I don’t want legions of supporters converging in my space, protecting that nice woman, hip young man, or crusty, but with a heart of gold, legend in his own mind . I don’t want what I say to show up on the tech.meme. I don’t care if what I write shows up on Google — I just want it to work.

I want a service; I’m willing to pay. This is not the beginning of a personal relationship. I don’t want it treated that way. The only train I want to be on around here, is Locomotive.