ATI Radeon: Screen blanks out but computer continues to operate

I've noticed this happen a few times on Windows XP, even after I bought a bigger power supply of 600W (which has stopped my random reboots!), but my computer was still suffering from the random black screens.

Normally associated with playing Starcraft 2, but it also happens with other games or when performing other tasks such as messing with stuff on Photoshop (with 3D acceleration enabled).

Being a ridiculously vague topic to search for online, theres alot of solutions.

Symptoms

The screen blanks out, as if the video card decided to go on strike and stop sending out data to the monitor.

The music continues to play and the computer continues to run like usual, still responding to mouse and keyboard commands also.

Fixes

Of course, you've probably tried the usual things already.

  • Update your graphic drivers
  • Reboot your computer (and hope that this freak accident never happens again but it does)
  • Update the software which causes the problem

If you haven't tried those yet, give it a shot.

Shutdown

If you can find yourself a way to shut down and you're willing to lose some data, go for it. I normally (on Windows XP with classic menu) press on the keyboard in the following order:

  • Windows button
  • U
  • U

Then wait for the computer to shut stuff down.

If it stops for a while and there is no harddrive activity, press E. This is to close the "End Task" dialog that halts the shutdown process.

I've never tried to hibernate, so you might want to give that a shot. Let me know how it works out.

Remote Desktop

If you're lucky enough to have a spare computer with network access, then simply remote desktop into the machine. When you log out, it'll give the video card a kick-start.

Excel: Macro security error when opening XLS spreadsheets

It sucks when you try to open a spreadsheet and it whinges about macro security.

Honestly, you can't inspect that shit unless you open it, but you can't open it unless you let it run the macro which you're uncertain about.

Ahh the wonderful catch 22 in the realm of security warnings.

Anyway, if you get this error:

This workbook cannot be opened under High Security Level because it contains a type of macro (Microsoft Excel 4.0 macro) that cannot be disabled or signed.

To open this worbook, click Macro on the Tools menu, then click Security. In the Security dialog box, click Medium.

image
Thats one long ass error message.

Well, thats pretty much it. Do as it says and you'll be able to open it.

image In the Tools menu:

  • Go to Macro
  • and select Security

image

  • Select "Medium"
  • click OK
  • You should now be able to open the file

jQuery: Ajax post calls error handler even when proper response given

When using an AJAX post with the dataType JSON, be careful when returning a valid HTTP response (200) with an empty string as the content.

If the JSON fails to validate, it will call the error handler.

This was encountered when using jQuery v1.2.6, so I updated to v1.4.2 and it worked again.

Otherwise, you can add a check in the error handler to validate the error's status (so if its 200 then ignore) or check the response HTML if its an empty string.

Download certain files from ZIP/RAR/etc archive files

If you're after a particular file from a big archive but don't want to download the whole thing, you can still download it as long as you get some special software.

I've found 2 ways of doing it but I don't see myself using it very often.

LoudScout

First is to use LoadScout. It is a standalone program that lets you paste in the URL of the archive and it'll display its contents.

Select the files you want to download and let it work its magic.

image
LoadScout 3.0 interface

The interface is a bit old but it still works well.
I didn't particularly like the sorting it used for the file list nor the way it displayed the download progress.

ArchView

My preferred choice was the Archview addon for Firefox.

It had a slightly nicer user interface, but I didn't like the way it automatically assumed I wanted to explore every archive I clicked on.

image
ArchView addon for Firefox

I tried ArchView in a separate installation of Firefox, so it didn't affect the way I normally download archive files.

If you've got a better method, I'm happy to try it out!

Starcraft II: Access North America battle.net servers from South-East Asia

First off, let me say that Blizzard's region locking is fucking gay. I have a few mates in the states and not being able to play the SAME GAME against them sucks.

Since patch 1.1 of Starcraft 2, Blizzard was "kind enough" to allow Aussie (and Asian) SC2 players to play against the fat North Americans.

To enable it, you must first log into http://www.battle.net with your SEA account. Under "Your Game Accounts", click on "StarCraft II: Wings of Liberty [SCII-1] North America (NA)" to add the game to your profile.

Now start up the game.

Before you log in, click on the region button on the left side of the screen. Select a region and then log in as per usual.

image

Let's all hope this sort of region locking gayness won't ruin the experience of Diablo III!

*edit 31/10/2010*

If you can't see it, you're probably using the "Remember me" option. Click on the little arrow next to your account name to clear it and the "Region" button will appear.

Happy Halloween! =)

image

django: Create a custom admin model filter

For the majority of the time, the built in Django admin filters are sufficient. However, sometimes we need something a bit more customised which will cater to the behaviour of our models.

For example, I needed a filter which filters any active polls. However, the date of which the poll starts and ends depends on the current time and there is (at the time of writing) no filter for that.

I found it quite difficult to find a tutorial on this topic that covers all steps from A to B for a person who is doing this for the first time.

After a few attempts, I managed to get it working.

Firstly, create the filter in "yourapp/filterspecs.py". Because I needed a filter based on the expiry date of a model, it was based off the DateFieldFilterSpec (and Mark Ellul's example in the StackOverflow link)

from django.db import models
from django.contrib.admin.filterspecs import FilterSpec, DateFieldFilterSpec
from django.utils.translation import ugettext as _
from datetime import datetime

class IsActiveFilterSpec(DateFieldFilterSpec):
"""
Adds filtering by future and previous values in the admin
filter sidebar. Set the is_active_filter filter in the model field attribute 'is_active_filter'.

my_model_field.is_active_filter = True
"""

def __init__(self, f, request, params, model, model_admin):
super(IsActiveFilterSpec, self).__init__(f, request, params, model, model_admin)
today = datetime.now()
self.links = (
(_('Any'), {}),
(_('Yes'), {'%s__gte' % self.field.name: str(today), }),
(_('No'), {'%s__lte' % self.field.name: str(today), }),
)

def title(self):
return "Active"

# Register the filter
FilterSpec.filter_specs.insert(0, (lambda f: getattr(f, 'is_active_filter', False), IsActiveFilterSpec)

This creates a filter which will check a field for the "is_active_filter" attribute. If found, it'll be compatible with the new filter.

Now to enable the filter on our field. Edit "yourapp/models.py".

class Poll(models.Model):
start_date = models.DateTimeField('date published')
end_date = models.DateTimeField()
title = models.CharField(max_length = 100, default = 'Weekly Poll')
question = models.CharField(max_length = 200)

# Filter 
end_date.is_active_filter = True

By adding the "is_active_filter" attribute to "end_date", our new filter will see that we want to use it and present itself if needed.

Lastly, the bit I found least information on, you'll need to edit "yourapp/admin.py" to load the filter and display the field on the filters panel.

from polls.filterspecs import IsActiveFilterSpec

class PollAdmin(admin.ModelAdmin):
list_filter = ('end_date', )

For me, the magic line here was the import statement. Prior to this, no other tutorial implicitly mentioned that it needed to be loaded. Without that magic line, the filter would not be registered and would display the normal date filter.

If all is done correctly, the end result is this!

image

Sources

The most useful sites I found on this topic.

jQuery: Stop event bubbling from propagating up the element chain

You may have noticed that sometimes when you click on an element, the click event handler of (one of) the parents are triggered.
Thats because events in Javascript are like bubbles which rise from the lowest element (the one which you clicked) to the top element, the HTML body.
You can prevent the event from rising up the element chain by using jQuery's event.stopPropagation().


$('#some_id').click(function(e) {

do_something();

e.stopPropagation();

});


That's it!


Note: If an element has multiple event handlers, this will only stop the one handler from passing on the event bubble.


[ Source ]

Django: Stop client side caching with @never_cache

Sometimes you want a page to never be cached on the client side.

This could be achieved in other languages/frameworks by sending the certain HTTP headers which instruct the browser "no-cache" and "must-revalidate".

Luckily in Django, there's a nice little view decorator we can use which does just that!

from django.views.decorators.cache import never_cache

@never_cache
def myview(request):
# Your view code here

And that's it! Hard work over.

[ Source ]

Django: Checking for User Permissions

I found it a little difficult finding solid information about implementing user permission checks for Django.

After reading numerous sites and tutorials, I've combined a few methods to make it a bit easier.

Rather than inserting the permissions into the database manually, use the Meta attribute in your models (from Satchmo Project).

class Caption(models.Model):
"""
Example model with permission.
"""
# Your field declarations
title = model.TextField()
description = model.TextField()

class Meta:
permissions = (
("is_caption_moderator", "Caption Moderator"),
)

After setting up the permissions, use ./manage.py syncdb to install these permissions into the database.

Now you can simply check for sufficient permissions as long as you have the user object.

def your_view(request):
if request.user.has_perm('is_caption_moderator') == False:
# Do something here like return HttpResponseNotAllowed()

# The rest of your view here

Lastly, remember to grant specific permissions to users when moving this code live because the admin user automatically has access to everything.

Sources

Add an image to your RSS feed item

It was surprisingly easy to get images into the RSS feed.

All you have to do is add the following attributes and your feeds should be image ready.

  • xmlns:media="http://search.yahoo.com/mrss/" in the XML tag.
  • <media:thumbnail url='http://link' height='x' width='y' /> element in the item.

<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        <title>ThatAwesomeShirt! Latest Shirts</title>
        <link>http://www.thatawesomeshirt.com/</link>
        ...
        <item>
            <title>AWESOMENESS</title>
            <link>http://www.thatawesomeshirt.com/shirt/209/awesomeness</link>
            ...
            <media:thumbnail url='http://www.thatawesomeshirt.com/images/get/252/shirt_thumbnail' height='75' width='75' />
        </item>
        <item>
            <title>Quit Work, Be A Ninja</title>
            <link>http://www.thatawesomeshirt.com/shirt/208/quit_work_be_a_ninja</link>
            ...
            <media:thumbnail url='http://www.thatawesomeshirt.com/images/get/251/shirt_thumbnail' height='75' width='75' />
        </item>
        ...
    </channel>
</rss>

Now, 2 things to make sure of:

  • Make sure you're using RSS 2.0 onwards.
  • The URL for the image must be an absolute URL.

Disable Apple Software Update

I installed Safari onto my computer (by God it's slow on Windows!) and noticed after a while that a software update window kept popping up once in a while.

Another annoying thing is that it suggests updates for software that isn't even installed on my computer!

image

Curious and annoyed, I wanted to figure out how it was running (and disable it). But alas, I could not find it in the conventional places like startup, registry or services.

A quick search online reminded me of another place I forgot to look, the Task Scheduler.

Go to the Task Scheduler by:

  • Start
  • Programs
  • Accessories
  • System Tools
  • Task Scheduler (You need to run as administrator on Vista and 7)
  • Expand to find the group called "Apple" (only for Vista/7)
  • Select "AppleSoftwareUpdate" and disable or delete

image
The Task Manager (Win7/Vista)

Thou shall not annoy.

[ Source ]

Disable "Read More " Browser Clipboard Copy Paste Hijacking

I've noticed a few sites have some sort of copy/paste hijacking.

It happens when I notice something worth pasting to a friend. When I paste it, boom! They get the text I pasted, a few blank lines and then "Read More <url of webpage here>".

Honestly, thats just annoying. I know you have a site and content to protect, but if your content is worth reading then people will ask me for the URL.

Anyway, a quick search will reveal that the company responsible for this is called "Tynt - the copy paste company".

Blocking with AdBlockPlus

I find this rather annoying, so I disabled it using AdBlockPlus.

To do that:

  • Right click on the AdBlockPlus icon in the status tray.
  • Click on "Open blockable items".
    image
  • Type in "tynt" to filter the results.
  • Select any item that matches and press Enter.
  • Select "Custom"
  • Type in "http://*.tynt.com/*"
  • Click "Add filter" to finish

Refresh the page and you should be Tynt-free!

Blocking with host file

Other people have gone a step further and simply blocked everything from Tynt.

If you REALLY dislike them, edit your hosts file and add in this entry.

127.0.0.1   tcr.tynt.com

Obviously, instructions will vary for Windows, Linux and Mac but its not hard to find instructions for doing so.

Sources

Disable Messenger chat in Hotmail/MSN/Windows Live webmail

Jesus christ! When big companies merge all their technologies together it is annoying as fuck!

I'm already on MSN/WLM using the PC client, but when I saw it automatically polluting my webmail in the browser without my consent I was a little irritated.

image
So err, why is it showing me the same shit twice?

Anyway, I'm glad they made it easy to turn it off.

Simply hover your mouse over your profile name in the top right hand corner and select "Sign out of Messenger".

image 

Rage will subside in given time.

 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog