Load in and Animate content with JQuery

I found out how to load and animate content using this excellent tutorial from tutsplus.com. But I wanted to take it one step further and also show the currently active link highlighted in the menu bar which took a bit of effort.

The full working sample can be downloaded from here.

Here’s the final version of the javascript:

$(document).ready(function(){

var hash = window.location.hash.substr(1);
var href = $(‘#nav li a’).each(function(){
var href = $(this).attr(‘href’);
if(hash==href.substr(0,href.length-5)){
var toLoad = hash+’.html #content’;
$(‘#content’).load(toLoad)
}
});

$(“.nav li a”).click(function(e){

var toLoad = $(this).attr(‘href’)+’ #content’;

var clickedMenuItem = $(this);//Store whatever you clicked over here

var currentMenuItem = $(this);//This is where you’ll store whatever is currently selected (in the next step)

$(“.nav li a”).each(function(){
if($(this).hasClass(“active”)){
currentMenuItem = $(this);//If it is active then set that to the currentMenuItem
return false;//Break out of the each() loop (http://gavinroy.com/jquery-tip-how-to-break-out-of-each)
}
return true;//Just to get rid of the warning “Function doesn’t always return a value”
});
e.preventDefault();
//Change animations to slideUp and slideDown to get the sliding animation
$(“#content”).fadeOut(‘slow’,function(){
$(“#content”).load(toLoad, function(){
$(“#content”).fadeIn(‘slow’);
});
});

window.location.hash = $(this).attr(‘href’).substr(0,$(this).attr(‘href’).length-5);
currentMenuItem.removeClass(“active”);//First remove and then add in case the same link is clicked
clickedMenuItem.addClass(“active”);

});

});

Hard to find svn commands

Some tips for SVN that I’d like to note here rather than google for every single time. Will keep adding them as I get more of them.

Revert all recursively:

svn revert -R <targetdir>

Source

Remove .svn directories in all folder / Clean up entire project from svn

svn export /path/to/old/working/copy /path/to/plain/code

Source

How to set properties for files and directories

svn ps svn:ignore <file pattern> <target directory>

Ex: svn ps svn:ignore ‘database.php’ ‘./config’

Source

Zoundry Raven

Testing Zoundry Raven. Looks pretty decent. Also supports tags and that’s what I was looking for in a blogging tool. Here’s a test image:

Desert.jpg

Images inserted and resized with ease. Blogger interface very much like a word editor which makes it very convenient:

Not bad!

Setting up personal folders on Outlook 2007

My school uses outlook exchange and only allows for 200MB of storage space on the server which sucks big time. So, instead of using their space, I chose to download all my mail directly onto my PC.

The way to do this to create a personal folders (.pst) file under Tools -> account settings. Once you do that, set it as the default folder. You will get a pop-up window saying “… it’s not recommended to download… yada yada yada … “. Just accept it and restart outlook. From now onwards, any message you get will be downloaded directly to your PC. The screenie below shows how your account settings should look like:

outlook personal folders

GTA 4 on Acer 5742G – Torturous setup!

Getting GTA 4 to run on brand new Acer 5742G has been nightmarish to say the least. I bought a legal copy of the game, I have a laptop that can play the damn thing in reasonably good settings, but the damn game devs decided to create a bunch of hoops, light fire to them and make me jump through each of them. Thankfully, someone or the other had already gone through the pain and found a workaround for all the issues I faced when getting it to work. Still, the ordeal took quite a few hours of searching on the net. And GTA 4 is not an easy to game to start and stop. I have to start Rockstar Social Club, wait for the starting music to go through and wait for a lengthy loading time before I could even see if the game is working. This post is just to record my entire suffering so that I don’t have to go through it again (Btw, I did complete the game once before on my desktop, two years ago, using an 8600GT – wasn’t this much of a problem though. So much for future proofing the game clowns!)

Let’s begin. Installing the game takes quite some time and I didn’t have any issues with that. After installing the game, I found out that I couldn’t login to Rockstar Games Social Club (RGSC) because it doesn’t work behind my campus proxy. Thankfully, that is required only if I want to play multiplayer and I wasn’t too interested in that. So onward! I start the game only to see that I cannot make any changes to the graphics options. It’s stuck at an impossible 800×600 with everything else set to absolute minimum. The available video memory shows up as 126MB or something. Now, my laptop has optimus and it has an nvidia 420M card with dedicated 1GB RAM, along with Intel integrated graphics. For some reason the game refused to understand that the nvidia card was running it. So I start searching the web and come across a post on gtaforums.com about removing restrictions. The method that worked for me was:

  1. Create a text file called ‘commandline.txt’ in the same folder as launchgtaiv.exe
  2. Add ‘-norestrictions’ in the first line without the quotes.
  3. Start the game

This allowed me to make changes to the graphics options. But after making changes, textures stopped showing and I could see Niko walking through air. and vehicles floating in space. Very weird. After searching for quite some time on the forums, I came across another post which talked about specifying the available video memory to the game. It needed adding the option ‘-availablevidmem xx’ to the commandline file where xx is the multiplier for the current memory that the game shows. In my case, since it was showing 126MB, to get to close to 1GB, I had to specify a multiplier of 8.0. So that’s what I did and removed the ‘-norestrictions’ option. Awesome! I could now change the graphics options and textures didn’t disappear. All was well in the world and I played the game for some time.

With Rockstar trying so hard to ruin my gaming experience, Microsoft, true to it’s nature, couldn’t be far too behind. They had to inject their animal called Games For Windows Live (GFWL) into the game to make it even worse. First off, it doesn’t work from behind a proxy as well. And to top that off, you cannot save unless you have an account and are logged in. I tried to find ways to get it to work, but it simply refused. Back to the net and after scouring for quite some time, came across a post which showed that it’s possible to create an offline account. So forget my GFWL account from 2 years ago, I created a new offline profile and was able to save games. Whew!

Then, I realised that Rockstar must have released patches to fix these dumb things. So I downloaded the latest patch (1.0.7.0) from Rockstar and installed it only to find that instead of currently identifying the available video memory, it completely ignored the commandline.txt file now! And to top it off, all my savegames from the previous version were no longer available. I had already played for a few hours and I was horrified to see all of them gone. At my wits end, I uninstalled the entire thing and reinstalled the original thing while going through all the motions as before. I thanked my stars that my offline GFWL profile didn’t disappear and all my savegames were restored.

Played the game for a day and was quite happy with the game performance. However, Rockstar and Microsoft were not be undone yet. The tag team duo had another wrench ready to be thrown into the machinery. 24 hours or so after installing the game, it suddenly started stuttering. I couldn’t understand what went wrong. I checked to see if the wrong graphics card was being picked, but that wasn’t the case. I lowered the graphics settings down to minimum but to no avail. I tried uninstalling and reinstalling the game and it just didn’t help. This was absolutely unprecedented. Never did I ever experience a game with a timebomb built into it just to keep you from enjoying the game. It took me about 3 hours (yes, thanks to the game taking 5 mins to fucking start!) to resolve the damn issue. After a couple of hours of searching on the web with no use and trying to change some setting or the other in the game, I realised that it stuttered only when I pressed ‘A’ or ‘D’ i.e. the left movement key or the right movement key in the WSAD control system. This helped me change the google search term which brought me to another post on gtaforums which said that I should disable Windows Event Logger Service if this happened. Huh?!! WTF has Windows Event Logger have anything to do with me pressing A or D on the keyboard?!! Why did it take a whole 24 hours to start acting up?!! Did the following steps to disable it:

  1. Go to Start->Run (Win + R)
  2. Type ‘services.msc’ without the quotes
  3. Scroll down to the service called ‘Windows Event Log’
  4. Right-click and select ‘Properties’
  5. Disable the service (you may not be able to stop it)
  6. Restart PC

After this, the stuttering disappeared and the game performance actually improved. Been playing the game fine for the last 3 days without any problems. Of course, the DVD in the drive is another nuisance, but for now, I’ll live with it.

This has been a long post, so I’ll just end it here with a note to Rockstar. Thanks for making this the shittiest installation of any game ever. Frankly, if this is how you treat your customers who buy legitimate copies of your game, what incentive are you giving them to continue doing so? Please don’t tell me Rockstar Games Social Club. If I had a pirated copy of this game, perhaps I wouldn’t have minded going through all this trouble to get it running. But I spent money guys! Let me play the game happily and perhaps some good karma will come your way for it.

Switching back from Blender 2.53/2.54 Beta to 2.49b

I love Blender 2.5. I love the improved interface, the ease of use and configurability it allows. It’s a huge step forward from 2.49b.

However, I love using Yafaray and LuxRender. And constant updates to blender 2.5 is keeping the good folks from LuxRender and Yafaray from coming up with a “one-patch-fix-all” solution to the rendering exporters. I have spent countless hours trying to get LuxRender to work with Blender 2.5 beta (Of course it’s easy after you do it the first time!), but then the problem of having some features missing simply takes the fun out of rendering. I also realised I was spending too much time downloading various releases from Graphicall.org and trying them out rather than working on modeling.

So, with that, I’ll be using 2.49b until 2.5 comes out of beta and the exporters are in place.

PS: Any scene modeled in 2.5 might fail to load in 2.49b. I had the problem with a scene in which I had a wind generator. I went around this by exporting it to Collada format (.dae) and then importing it in 2.49b. Of course, I lost some of the settings in terms of textures etc, but it’s still better than not being able to work on it at all in 2.49b.