Yes, I still play CoD4.

Yes, I still play CoD4.

I recently upgraded my PC from Windows Vista to Windows 7. I got Vista when it came out, and I sometimes feel like I’m the only person in the world who doesn’t hate Vista. Yes, I like it. Never had a beef with it. I even stood up for it when people were so quick to put it down. Anyway, enough of that, this article is about Windows Vista Service Pack 3 7.
I must admit that I was a bit underwhelmed by the new features over Vista. Of course, anyone migrating from XP to 7 will notice a couple more improvements. The most obvious new addition when logged in is the revamped taskbar. Merging the functionality of the quick launch and the taskbar program buttons is a great idea, which I understand started out in Linux. Aero-peak, which is called by hovering over the show desktop button is kinda cool, but not really that useful. Aero Shake is a little more handy though, grab a window and shake it to minimize all other windows.
A really useful feature is Aero Snap, something that seems so obvious it feels like it should have been in Windows 98. Drag a window to the left or right side of the screen, and it fills the entire half of the screen – makes transferring files between two locations much, much simpler. Drag a window to the top to maximise it, but I prefer the good ol’ double-click the title bar option.
So those are the main aesthetic changes, another big improvement is performance. Starting up and shutting down is ridiculously fast. As in “wait, did that shut down properly?” fast. It’s awesome, and it’s the way technology should be going. The UAC prompt that pops up when there’s a potential security vulnerability also appears much quicker, and I’ve noticed appears less often than it did with Vista – so that’ll cheer a few people up.
There are many other improvements, but I reckon these are the main points. Since I’ve been using Vista for so long, I’ve felt it improve over time, and moving to Windows 7 isn’t much of a leap at all. The speed improvement is always welcome, and the new features are handy to have, too. But if Vista annoyed you, I can’t see Windows 7 being any better. My advice is to grin and bear it, Windows 7 is not a bad OS by any means.

 

I’ve just done a little experimenting with CSS3, and I’ve come up with a design that I’m extremely pleased with. It wouldn’t work the same without rounded corners and shadows, and I think I’ve come up with the style I’ve been looking for.
At the moment it’s just on a test HTML page, but it’ll be easy enough to port to the main website. You can find it by clicking here here!
As it’s just a test HTML page, it’ll be changing a bit as I experiment s’more, but I’m really, really pleased with this design and want to start using it immediately!

 

I had a little bit of trouble with this recently, and thought I’d might as well post the solution. I have two computers, both using a wireless connection. One runs Linux Mint, the other runs Windows Vista. I wanted to use Synergy on both machines so that I only had to use one mouse and one keyboard. I got that working easily enough, but over wireless it was a bit choppy, sometimes a little unresponsive.
“I know what to do,” I said. “I’ll fix it with a good ol’ crossover cable” (I didn’t really, I just used a regular cable, network cards are smarter than they used to be). As simple as that it was not! Mint wanted to use the wired connection for all traffic. When I had the cable plugged in, I could not access the internet. Sure, I could have shared the network through Windows, but I wanted a more elegant solution… Here is what I did to get it all working.

  • Give the wired network adapters manual IP addresses in a different subnet to the wireless connection – in my case, the wireless connection was a class C subnet (see this Wikipedia article for more information on subnets), so I opted for a class B subnet for the wired interface. Looking at the Wikipedia article, that would give them a subnet mask of 255.255.0.0. I gave the interfaces IPs of 128.0.0.1 and 128.0.0.2. Default gateways and DNS servers do not matter here.
  • This is the bit I had trouble with. In the Mint Connection Manager, select the wired connection and go to IPv4 Settings, and click the Routes button.
  • Add an entry and enter the address that the wireless adapter has, and use the router address as the Gateway

Sorted! Mint will now use the wired connection for Synergy, and wireless for internet/network stuff.

 

It’s pretty well documented how to allow the user to edit the properties of a WebPart in SharePoint. What’s less obvious is how to persist data in a similar manner using just code. It turns out it’s not actually all that tricky once you know what’s involved.
First, my scenario. A WebPart is required that builds a list of strings in an ArrayList. The user can add one item at a time using a series of drop-down menus and an Add button. Items can be removed using an ‘X’ icon next to the item name in the list. In Shared View, the same list must appear across all users.
Persisting the array on a shared and personalized basis is the problem here. Here’s how to do it:

  1. In your WebPart class, add a private variable for the object you wish to use.
    private ArrayList listOfItems;
  2. Add an accessor property for the variable, and give it the Personalizable attribute. Setting the PersonalizationScope to User allows changes to be stored on personal pages, and on shared pages. Personal settings will be stored for that user only, but shared settings will apply to everyone’s shared view.
    [Personalizable(PersonalizationScope.User)]
    public ArrayList ItemList
    {
      get { return listOfItems; }
      set { listOfItems = value; }
    }
  3. In the constructor, check to see if the variable has been defined or not. If it is null, initialize it here.
    if (listOfItems == null) listOfItems = new ArrayList();
  4. Finally, the most important part, the part that took me a week to figure out – use the WebPart’s SaveProperty property to, well, save. Set it to true if there are things to save, and it will do so after rendering. If this is not present, it seems as thought it just does not commit any changes. So I put this code in the onPreRender() method.
    if (listOfItems.Count > 0) SaveProperties = true;

That’s the basics, but it doesn’t end there. You don’t want users changing values willy nilly. Users should only be allowed to change properties on personalized views. Only administrators should be allowed to modify the shared views. There are three things to check:

  • Find out if the user has permissions to create and edit pages on the site (like an administrator):
    SPContext.Current.Web.DoesUserHavePermissions(SPBasePermissions.AddAndCustomizePages)
  • Find out if the user can customize their own pages:
    SPContext.Current.Web.DoesUserHavePermissions(SPBasePermissions.AddDelPrivateWebParts)
  • Find out if the page is currently in Shared mode or Personalized mode:
    this.WebPartManager.Personalization.Scope == PersonalizationScope.Shared

I combined these three states to tell whether or not the user should be allowed to edit an object. If the Web Part Page is in Shared mode AND the user is an administrator, allow editing. If the page is NOT Shared, and the user can personalize, or is an administrator, allow editing. Otherwise, do not allow editing. I put the following code in onPreRender():

bool shared = WebPartManager.Personalization.Scope == PersonalizationScope.Shared;
bool admin =
    SPContext.Current.Web.DoesUserHavePermissions(SPBasePermissions.AddAndCustomizePages);
bool personalizable = 
    SPContext.Current.Web.DoesUserHavePermissions(SPBasePermissions.AddDelPrivateWebParts);
bool editable = (shared && admin) || (!shared && (personalizable || admin));
 
if(editable)
{
  // Assert this value just in case
  SaveProperties = false;
  // Hide or disable any editing controls here
}
else
{
  // Set the property to save
  if (listOfItems.Count > 0)
    SaveProperties = true;
  // Show or enable any editing controls here
}

And that’s it. You might need to add more logic to prevent users from removing items from the list and so on, but now the basics are in place, it should be much more straight-forward.
I must admit, I get the feeling that this process is a little flaky, but it works, and I’ve not found a better solution. If you know better, I’d like to know too!

 

A very dark mint

My new Mint setup

I’m afraid not all is well in the world of Linux. Too many issues with my laptop have caused me to half-revert to Windows. I kinda missed running Eve on it. Anyway, I had most of a tutorial written up on how to repartition your hard disk so you can run Linux and Windows on the same drive, as well as having a shared data partition. But it turns out that the Linux Mint installer can do all that for you! If only I’d known that when I did it, I wouldn’t have wasted time writing up a tutorial :P
Ah well, there you go.
Just so this post isn’t a total loss, I’ll say that Linux handles NTFS perfectly these days, so you’d do good to make your shared drive NTFS if you plan to have one.
And I’ll RTFM next time.

–Edit
Y’know what? I’ll post it anyway! Manual partition resizing a-go-go! This tutorial assumes that Windows is already installed. The Linux Mint Live CD will be used as I know it has GParted on it.
This tutorial is aimed at beginners, and doesn’t explore using multiple partitions for the Linux install. At the least, you may want to put the /home directory on its own partition, but there are plenty of sources of information out there that can advise you on a good Linux partition setup.

  1. Considering Partitions Sizes
  2. This should be the first thing you do. Start with the essentials – the shared data partition, for storing documents for use between operating systems. I set mine to 5Gb, I doubt I’ll need more than that at any one time. I can always chuck files onto a network drive, but you may need more if you’re storing music or something. The second essential, and this one’s easier to figure out, is the Linux swap partition. It should be the equivalent of double your computer’s RAM. So for my 2Gb RAM, I gave it 4Gb. Simples! Now the tricky part – how much to allocate to Windows and Linux? Well, you should know how much you have left now. Depending on what you plan to do with your installations, this is up to you. Windows generally needs a lot more room than Linux, and I like to play games on Windows on my laptop, which takes up a heck of a lot more space. So I rationed out 50Gb to Windows and 15Gb to Linux – and yes, Windows still uses a far greater percentage of the space than Linux does. But like I say, it’s up to you to figure out how much you’ll think you’ll need. It’s very easy to resize partitions later using GParted anyway. Just remember that your hard disk’s capacity will always be a little less than what’s stated on the label! On to the resizing!

  3. Resize the Partitions
    • The first thing you should do is to run a defrag in Windows. Tedious, I know, but it’ll reduce the risk of anything going wrong when you resize the Windows partition. That said, I didn’t bother, but I wasn’t overly fussed about goosing the Windows installation. Surprisingly, it actually turned out alright! But still, defrag, and backup what you need. Saves tears later.
    • Boot into the Mint LiveCD – using the LiveCD ensures that none of the partitions are locked by an operating system on the disk.
    • Go to Menu->All applications->Administration and select Partition Editor. GParted will open, and will show the current partition layout on one of your hard drives. Use the drop-down menu at the top right to select the physical disk to partition. Also, see that Apply button? Any modifications you make now will not be committed until you click that button.
    • Resize the Windows partition to a desired size. Make sure it is still to the left-hand side of the disk (position is important if you need to resize later).
    • If the Windows partition is contained within an Extended partition, great! Otherwise, some planning may be required. Disks should only have up to four primary partitions. A primary partition is one that is not inside an extended partition (extended partitions are also primary partitions). Any more than four could cause problems. Extended partitions contain logical partitions, and you can have loads of them within one extended partitions. It’s just the number of primary partitions that is the limitation. Anyway, you should add an extended partition to the rest of the free space, assuming you do not already have four primary partitions. If you do, you’ll have to figure that one out yourself I’m afraid!
    • We’re going to add the Linux Swap partition. Inside the extended partition, click the New button. Specify the size of the swap, and change the File System to linux-swap. Make sure the partition is moved to the far right-hand side of the available space. Label it appropriately (‘Swap’?), and click the Add button.
    • Now to add the shared partition. I used NTFS, because Linux can handle NTFS very well these days, and of course, so can Windows. As with the previous step, click the New button, specify the size, and this time set the File System to ntfs (or fat32, if you’d prefer for whatever reason). Again, drag it to the far right-hand side, label it, and click the Add button.
    • The remaining space will be used for Linux. It will sit between the Windows partition, and the ‘fixed’ partitions. The reason for this is that if you decide that Windows could do with more space, the Linux partition can be shrunk, or vice versa. Add another partition in the empty space by selecting the extended partition, and clicking the New button. Use all the space. Why not? That’s what it’s there for. Set the File System to ext3 (or if you’re feeling brave/know that your Linux will support it, go for ext4 – it should be worth it!), label it, and click the Add button.
    • The main screen will now show how your disk will be arranged. If you’re happy with it, click the Apply button, make a cup of tea, and watch some Stargate. Otherwise, make the changes as appropriate.
  4. …Oops, not finished this article. I’ll come back to it!
 

I have this nasty habit of redesigning my site on a regular basis. I’ll come up with a great idea, implement it, and then have another, better idea. So this time I’m going to do it properly.
I’ve been raking around the net for inspiration, finding pictures of things with styles I like – everything from the Atari ST GEM desktop environment, to Wipeout’s ship logos. I know that sounds like a horrible mashup, but I think I can pull something together.

This layout is a huge inspiration

This layout is a big inspiration

I’m going to aim for a much cleaner design. Yes, it’s maybe time to get rid of the glowing hexagons already. I want to go for a more flat style – thick lines, bright colours, minimal shinyneess (the internet is too shiny). Maybe some glowing though. I dunno. I’m gonna have to draw up some concept designs and pull all these ideas together into something solid.
The layout’s going to be a good deal different, too. Pictures and interactive things will take centre stage, with descriptions and updates at the side. We’ll see if that reduces clutter, makes the pages more aesthetically pleasing.
Then again, I may just find myself extending WordPress with custom plugins, since it provides a hefty amount of functionality already, and use this as the main site. What is a guy to do…?

 

I’ve given Linux several chances over the years. I’ve always wanted to love it, it’s just been so darn tricky. Microsoft seem to have a pretty good grip on me.
But how long can it last? I decided to pick up an issue of Linux Format a few weeks ago. One of the articles that struck me was on a relatively new Linux distribution – Mint. It started off as a clone of Ubuntu, but with some proprietary drivers/software (will play MP3s out of the box, for example), and less brown. Over time it has grown arms and legs, and has really come into its own.

Linux Mint Gloria Desktop

Linux Mint Gloria Desktop

Since I’d just upgraded my PS3 hard drive, I had a spare for my laptop, on which Mint was promptly installed. Running off a LiveCD is not a bad idea, or a LiveUSB even less so. But I figured if I want to see how it’ll perform properly, I’d have to install it on the laptop’s hard drive.
Installation was very straight-forward, and unlike the OpenSUSE trial before it, the wireless connection worked straight away, without any problems.
Mint has a very fresh feel, too – must be all that green. It’s a refreshing change from Windows Vista (not that I dislike Vista, I’m one of the few who actually stands up for it), and super responsive. The package manager is excellent, too. Finding most programs is a seriously easy process, although some others had to be found using apt-get, which is also greatly simplified in the package manager.
Unfortunately, I’ve been struggling to get 3D acceleration working. My laptop has an ATi X1200, and I’ve quickly learned that ATi’s support for Linux is pretty awful. This has been causing a lot of problems with Compiz (the desktop fancier-upper), Celestia, Blender, and Windows games running on Wine. In that respect, it may be better suited for a machine running an Nvidia card – not an easy upgrade on a laptop, I’m afraid. Still, I may give it a bash on my desktop machine to see how it copes.
Mint Upload makes uploading <em>too</em> easy

Mint Upload makes uploading too easy

Another niggle is that Firefox 3.5 is still referred to by its codename – Shiretoko. This has caused some problems with internet banking, where I’ve had to default to Firefox 3 because my “browser is not supported”. Hrmm.
Despite these shortcomings, I can find no reason not to love Mint. It looks great, worked with most of hardware straight away, and for a Linux distribution is very easy to use. Backed up by a very helpful community, who are also churning out some amazing visuals for the OS, it’s a very appealing alternative to Windows, and I just might stick with it this time.

 

I registered the domain Rakhama.com back in 2003. Rakhama was always to be a showcase site for various computery projects I work on. Since then, it’s gone through several re-imaginings. So why can’t I finish it?
The more I work with programming, the more I learn. The more I learn, the more I realise things can be done better. For example, the first iteration of Rakhama mixed PHP code with HTML code in the same file. This was separated when I learned to build my own template system. More recently, the website has been redesigned to make use of classes. Some might consider this wholly unnecessary, given the linear nature of your average web page. However, not only do I see it as a practical solution for my site, but it’s also good practice for object oriented programming anyway.
A good example of using objects in my site is the Page class. It deals with base functionality – fetching the page title and latest adventure from the database, for example. All pages inherit from this class, but the adventures page overrides the getLatestAdventure() method, and instead picks a random adventure.
Of course, adding all this functionality does make things more complicated – as in, more code. However, it does make it a lot easier to follow, meaning any future modifications should be far less painful than they would if done the old way.
Another recent idea is that all data extracted from the database should go through an XML layer. The reason for this is that sometime in the future, I intend to create a Flash based front-end for the site. Flash can consume XML data, so by adding this additional layer, the data will be readily exposed to the Flash front-end. Furthermore, only one thing needs to be modified to update both versions of the site. And on top of all that, it should make writing an RSS feed much easier.
So all this, plus an administration back-end, plus my work and social time means it could take a fair while to complete! But I am making progress, slowly but surely…

© 2012 Rakhama WP Suffusion theme by Sayontan Sinha