Or pretty much any Ubuntu version really. This is aimed at desktop installations, not servers.
Ubuntu has a fancy little property called swappiness. Swappiness basically tells Ubuntu how often to move processes out of memory and onto the hard drive. Things that are in memory are faster. Just like remembering something is faster than wondering off to google and looking it up. So in general, on your average Ubuntu desktop, you want to tell the operating system to keep processes in memory for longer. Enter swappinesss.
To find out your swappiness open up a terminal and try this:
It will probably report back "60". Now, for desktops, the recomended value of swappiness is 10. So let's change the swappiness factor - open up /etc/sysctl.conf in your favourite text editor (you get extra imaginary points if you use vim instead of gedit). Again, at the terminal type: <code class="bash"> sudo gedit /etc/sysctl.conf
Search for (or add if it isn't there) "vm.swappiness" and change it to:
Save, reboot and hey presto off you go. For the curious, read more about swap than you could ever want to know.
I have no idea why Ubuntu doesn't set this by default on desktop installs really, it's one of the things that is standing in the way of it really taking off for the average computer user. Not swappiness per se, but just the fact that you have to get your hands a little dirty when you run Ubuntu, when the average person just wants to install and then play Internet, Facebook, Twitter, type a few documents and check their bank balance. Still, now you can do all that. Only faster.
This lovely piece of code from Ryan Dahl's JSConf presentation in 2009 illustrates so beautifully the nature of node.js:
var sys = require("sys");
[caption id="attachment_221" align="alignnone" width="600" caption="Job's evil dream "][/caption]
At some point during the last few hours of riffling through CVs, my initial scorn for people who have obviously just applied for any old job they could turned to sympathy.....or maybe compassion....I don't know. The role my organisation is hiring for is a developer role, with specific requirements for a Microsoft skill set. It is pretty clear from a lot of the CVs that we have received though, that people either do not understand what the role is, or they are just applying to every.single.job that they come across. Getting through a bunch of CVs is tough....and some very smart people have written about the process time and time again.
We had a few jokes initially, as you do, about the lawyer and accountant who submitted their applications.....but then suddenly, I was on page 4 of a very well written resume when my heart just melted. Something in the wording just made me sad. Sad that someone so completely unqualified for the job submitted such a good CV.
Is it the economic climate? Is it pure desperation? Is it simply a desire to move into a new career that prompts someone who does not code to apply? I have no idea. But sometimes I wish I could bring people in for an interview, just to chat. And if, you know, they fit, train them up. Because I'm pretty sure anyone can code, at least I'm pretty sure this one can.
Sometimes on a corporate network, you'll be stuck behind a proxy and working away on a Windows box. Trying to install or update gems like Ruby on Rails with commands like
gem install rails
can give you strange errors. You'll see various things at various points of bashing your head against the wall. Things like
<code class="bash">ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
bad response Forbidden 403 (http://rubygems.org/latest_specs.4.8.gz)
<code class="bash">ERROR: Could not find a valid gem 'rails' () = 0) in any repository
ERROR: While exectung gem ... (Gem::RemoteFetcher::FetchError)
bad response Forbidden 403 (http://rubygems.org/latest_specs.4.8.gz)
O hell. How do I fix this? You think.
Personally, I tried calling the inhouse IT department to get whatever was being blocked unblocked (I know very little about networking so don't ask me specifics here). They couldn't really help me out for some reason. So instead I grabbed a copy of ntlmaps which basically allows you to create and run a proxy on your local machine that will grab all requests and re-package them as if they were coming from IE, thus allowing the communication to go ahead.
ntlmaps is a neat little python utility so you'll need to get that on your 'puter. Then pop the ntlmaps into a nice easy to find directory and read the Install.txt and readme.txt to get a little background and basic info. I went ahead and changed my server.cfg file filling in the following bits:
Now I've got a nice little local proxy ready to run - give it the old <em>runserver.bat</em> at the command line - and wait for it to fire up. You should get something like <code class="bash">NTLM authorization Proxy Server v...blahblahblah Now listening at COMPUTERNAME on port 5865 </code> obviously, COMPUTERNAME is going to be your computer name. Now, fire up a new command shell and type in <code class="bash">SET HTTP_PROXY=http://COMPUTERNAME:5865 </code> You'll get no response from that command but don't worry. If you want to verify the setting of the HTTP_PROXY variable, simply type <code class="bash">SET HTTP_PROXY
At last, you can try updating the gem again:
gem update rails
And you should be good to go
Very cool - sort algorithms expressed as dance:
I find it interesting that some web applications have matured to the point that they basically become frameworks in and of themselves. Take WordPress as an example. Originally written as a blogging tool, it has evolved into a framework of its own through its various hooks and actions that, if you were feeling adventurous, allow you to do pretty much whatever you want, from creating new tables to creating entirely new functionality.
Playing with a system that's evolved into a framework is very different to playing with a system that was written as a framework first and foremost. I've been developing a plugin for vanillaforums to allow classified listings on a forum site, and it's interesting to look at the architecture. On some levels, vanillaforums feels over-complicated for just a forum. But then you look a bit deeper and find a whole MVC framework coded up, with the forum module essentially just an application written on top of the framework. I do wonder sometimes why someone would go to the trouble of re-inventing their own framework when there are so many available ones out there. But I can, at the same time appreciate the desire to create a framework that follows your own opinions rather than falling in line with someone else's.
I wonder at what point we could consider an application to be a framework? Because any well designed system is or should be easy to extend. I think what makes an application into a framework is documentation. Good documentation that allows moderately skilled developers to jump in and be productive immediately turns a simple app into a framework in it's own right. That and a .org domain name :)
The gist is that 5 year olds can come up with a "program" to create a circle, whereas 15 year olds cannot. Now there is a trick to it, which is so obvious that you kind of hit your head when you get it, but more than the trick, it shows that very often we follow a train of thought without really first sketching out a few alternatives. Sometimes it is good to stop and really examine what we are trying to achieve and really develop our solution based on that.
Another story in what it's really like to develop software. These are the kinds of hacky bodges you will end up making in any system that is more than a few months old and is in production. :( These hacks do not make me happy. Especially when they are hacked because of pre-built components that are meant to save you time!
The Telerik Radgrid is both a blessing and a curse at the same time. How can a grid, that seems designed to have a dropdown column in it and comes with default filtering, not take into account the fact that you are going to have foreign keys in a grid that you want to filter on?
This is an ongoing rant of mine. Getting good foreign key support on large enterprise applications seems like an uphill struggle every single time. I wrote about how I like to see books on programming jump right in and show me how to get my foreign key drop downs hooked up almost right off the bat, since it is almost entirely unavoidable in any application that has any sort of usefulness in my opinion.
My goodness getting the RadGrid to do your bidding can be an infuriating ride. Personally, I think components should just work out of the box. I know the RadGrid is extremely complex and there are layers upon layers of documentation and examples on the Telerik site, but to me, I shouldn't have to find out about how difficult it is to filter on ListTextField after I've knocked up a prototyped to a client. Heck the documentation should have a large caveat at the top telling you the limitation of the software. Really, I shouldn't need to read that far into the documentation just to use the component in my opinion. I want something quick and easy to take the pain out of grid based data admin, not a whole new bloody thing that I have to learn inside out.
As per Telerik's website:
he built-in GridDropDownColumn will be filtered by its ListValueField when the default filtering feature of the control is used. Filtering by ListTextField is not attainable in the present version of Telerik RadGridGreat. Thanks! This is burried in the How To section. Okay, not too obtuse, but still, all the basic examples show filtering on example datasets that are things like Customer listings (with Customer, Contact Name, Company). Heck, it is reasonable to assume that Company was being looked up using the GridDropDownColumn column. Isn't it?
So, Telerik provide a solution - have a hidden field that is the text description. Capture the ItemCommand on the grid and then if it is a filter command, pop the filter text into the hidden field's filter text box and run the filter based on that criteria. The problem is, out of the box this breaks user experience because the filter text they typed in disappears.
Now you have to hack around to find a way to keep the filter text there. Come on Telerik, get this one together. Not pleasant. I gave up, because I didn't have time to delve that deeply into the RadGrid. I needed something quicker. Option 2 given by Telerik - implement a custom drop down in the actual filter area of the grid. The example code was long and I didn't feel like going through it - again time constraints. I just couldn't spend time exploring all of this because I have deadlines. Why couldn't they just build this into the grid? If they have solutions, it shouldn't be that difficult to put it into the base functionality.
One more thing - putting a drop down in that is based on an id field (and let's be honest it probably is if it's a lookup into another table) means you get the default "number" filtering options. This means that the filtering options out of the box are things like "greater than", "less than" etc etc. These don't make sense for a user who is filtering based on text. This is another fault with their default solution outlined above of using the hidden field and substituting values in. I know you can overide this and put your own filtering menu in, but say it with me.....deadlines. :(
By now, I'm not a happy bunny. What did I do in the end? I amended my stored proc to bring back a complete result set with description fields (making things slower for me because now I have table joins). Then I hid the drop down list field until the user wanted to edit the row or add a new row in. Then I hid the description fields and showed the drop down fields.
What a bodge.
Here's a lovely little one that just took me much to long, probably because I'm tired, or having an off day or something:
See, the error isn't obvious, because the SQL compiles and runs, but the result set just doesn't bring back what you expect.....because [Name] is now aliased as [Surname] - all because of a missing comma.
Hate it when that happens.