Posted: January 22nd, 2008 | Author: Andy | Filed under: observation | No Comments »
Its rare for a developer to talk about their weaknesses on the internet. It can damage their next job opportunity. However, fuck that, here is what I need to improve upon as I suck in these areas.
-
Regular expressions
Its a fucking travesty that I don’t know regex inside out. I get by, but I’m no super hero.
-
Python
Never dabbled with it. I have moved from java to php and now Ruby (with a spattering of others in between). Python is one of those languages that looks awesome and enjoyable to arse around with.
-
SQL advancement
Many people boast that they know SQL. I could state that I do. However I feel that I should know more advanced SQL, looking at streamlining my code much more.
-
C
I, for my sins never learned C at university. I did history instead. *puffs on an invisible pipe*
-
Some Microsoft pap
I have never learned VB, nor Basic nor ASP. I don’t know the suited “certified” world of Microsoft. This is wrong, I should at least try and use it, it can’t all be bad.
-
CSS
I sodding hate IE 6. I should learn some CSS techniques that prevent me from foaming at the mouth and swearing at Bill Gates.
-
Java web systems
A mystery to me, although I understand its awesome power and “enterprise” deployment worth.
-
Flash
Flash is awesome at some things. Notably video delivery. I should play more with that.
-
Growing hair
Unix == Beard
Flash == Ponytail
Fortran == Sideburns
Ada == That weird hair that comes out of your ears when you are old
-
Realise that you shouldn’t do all of this list and specialise a little ….
Posted: January 17th, 2008 | Author: Andy | Filed under: accessibility, ajax | No Comments »
I can chat about accessibility for an age, its become a bit of a passion. This passion was fanned just before Christmas when I met up with a web accessibility tester who was blind. This was a by chance meeting over a drink at an induction type thing in london. It was fascinating chatting to a person who experiences every day the problems that I knew existed, but could never imagine how they coped. From this brief chat it became clear that some people are still too fascinated by javascript without knowing how people with disabilities suffer as a result.
I admit, in the past, I built apps which were over reliant on javascript. If you used a screen reader or god forbid disabled javascript you were doomed. I have changed, learned more and realise the error of my javascript ways. As a result here are the rules I live by when making an app which might involve ajax.
- Never build an app were javascript is required to do most tasks
- If you can’t build your app without resorting to javascript. Read more as you are probably wrong.
- Ajax can be awesome, if you do use it, use it unobtrusively
- Only use ajaxy wizzy effects to give real feedback to the user. Not because it looks pretty
- Never ever try and excuse yourself by saying “well netvibes.com doesn’t work without javascript”
- If you can get stuff accessibility tested, as you Andy don’t have a disability and don’t know what its like
- Remember, flash fades and wizzy effects have to be accessible. Lets not make the new blink tag
Posted: January 16th, 2008 | Author: Andy | Filed under: observation | No Comments »
client: “Yeah, thats great. How about we move that sink over here? That shouldn’t take you long”
plumber: *massive sigh*
plumber: “I have to rejig the water confrabulater H20 washers inductions to do that.”
client: *stares blankly*
client: “So you can do it then?”
plumber: “errr.. yeah.”
client: “OK. So how much will it cost me?”
plumber: “err … err … 6 days at a guess”
plumber: “thats a guess though”
client: “can you do it in 4?”
Posted: January 12th, 2008 | Author: Andy | Filed under: host, rails | No Comments »
This blog and iplayerlist (which I will go into more detail in a later post) are hosted at Slicehost. I think its wise just to go through how everything is set up over here.
This is on the cheapo slice with 256mb of memory. Thats enough for me.
I used deprec to set up everything over here. It didn’t work straight off the bat and required a little tweaking but the resulting server setup is pretty much ideal for my needs.
- Ubuntu Gutsy
- Ruby on Rails 2.0
- Mysql
- Apache2 with mod_proxy
- mongrel cluster application servers. (one for the blog and 2 for iplayerlist)
- subversion source management
- capistrano deployment (this end)
- mephisto blogging system
I went with slicehost after I finally got annoyed at dreamhost. Now dreamhost is awesome and very cheap but for Rails apps it really doesn’t cut the mustard. Its FastCGI was slow and rails apps were a pain to set up. Slicehost offered a blank canvas which I could install what I wanted and can only blame myself if something goes horribly wrong, hurray! :)
Posted: January 12th, 2008 | Author: Andy | Filed under: jquery, rails | No Comments »
I’m having loads of fun with jQuery of late. Its small size and increasing collection of plugins has made me want to throw it in any app that has a need for javascript and ajax controls. So I thought I would just put down the basics for anybody wanting to give it a bash.
In this example I will be avoiding RJS and helper methods, sticking to writing pure Javascript. Plus as jQuery and jQuery UI is, in my opinion, rather cleaner and easier to read than Prototype and script.acul.us, RJS and helper methods would just gets in the way.
First thing is first, load up your javascripts including jQuery in your layout.
<%= javascript_include_tag 'jquery-1.2.1.min.js' %>
<%= javascript_include_tag 'application.js' %>
Lets make a standard link in a view that we are going to attach our jQuery magic to.
<%= link_to 'What do little foxes like to eat?',
{ :controller => 'foods', :action => 'fox' },
{ :class => 'ajaxLink' }
%>
In our application.js we are going to convert this regular joe soap html link into an ajax one unobtrusively. Here is a good place to start having a read through the jQuery docs.
$(function() {
$(".ajaxLink").click( function() {
$.ajax({
url: this.href,
dataType: "script",
beforeSend: function(xhr) {xhr.setRequestHeader("Accept", "text/javascript");}
});
return false;
});
});
Create our action in our foods controller that will spit out the food that foxes love to eat.
def fox
@food = 'foxes love chunky Bacon'
respond_to do |format|
format.js {} format.html { render :text => @food }
end
end
This method will respond to an Ajax request by rendering fox.js.erb, however, if the user‚Äôs browser doesn’t have javascript enabled we will just render the food string, this could easily be fox.html.erb.
Create our javascript ‚view‚ called fox.js.erb. We will just have an alert box for now, but this could easily be any other javascript method.
alert('<%= @food %>');
As you can see this is a fairly trivial example, but works rather well. Now if I wanted to Ajaxify any link, all I need do is give it the class .ajaxLink in the html. Much much cleaner than the onclick links the link_to_remote produced.