Monday, July 26, 2010

Win7/Vista: Disable password expiration

One day, I got an annoying message saying "Your password has expired". Wtf?

Anyway, to disable the password expiry feature:

  • open a command prompt in Administrator mode.
  • Then type "lusrmgr.msc" to load up the "Local Users and Groups" management console.
  • Go into "Users" and edit the profile that has expired.
  • Select "Password never expires" and apply.

If you get "Access is denied", that means you didn't run the console with administrative rights (step #1).

While you're at it, you might want to take the time to disable the Guest account as well.

Thursday, July 22, 2010

Left 4 Dead 2: Uncensored Australian Hack

Censorship sucks, no matter in what form. Hide reality long enough and we'll end up with a nation of fucking sissies that'll cry if a dog leaves a turd on grass.

In the pansie Australian version of Left 4 Dead 2:

  • Zombie bodies will fade straight away
  • Body parts will not be sliced. The whole zombie dies intact no matter how you kill it.
  • No blood on your screen.
  • Zombies will not burn when hit with molotovs or incendiary ammo)

Well fuck you "Office of Film and Literature Classification" (OFLC)! We still don't have an R18+ rating because according to them, Australia doesn't have anyone that is mentally older than that.

So to get these features back, you'll have to first understand there are some side effects.

  • It works best on single player and offline play.
  • You cannot play online with your friends (even if they have patched it). There are some places that mention an "sv_pure 0" setting but I've never looked too much into it.
  • This works on the Steam version, but its easier to just buy it from the UK store.
  • You cannot start the game through Steam, but you need it to be running to play.

Editing

  • Upon up your Steam folder
  • Go to "steamapps\common\left 4 dead 2"
  • Open "steam_appid.txt"
  • Change 550 to 510
  • Save the file and close it
  • Now right click "steam_appid.txt" and click "Properties"
  • Make it "read only" and save
  • Now create a shortcut to "left4dead2.exe" on your desktop (or where ever you want that is convenient)
  • From the current folder you're in, go into "left4dead2"
  • Open "gameinfo.txt" and change "SteamAppId" from 550 to 510
  • Now make that file read only

The reason we created a desktop is that you cannot start the game via Steam. Otherwise it'll just quit when the gameplay starts.

You also cant start the game without Steam running in the background. Quite annoying.

Now you can enjoy L4D2 while burning and cutting up zombies, the way that nature intended.

[ Source ]

(The source seems to be a bit outdated, but the majority of the instructions still work)

Sunday, July 18, 2010

Facebook: Post RSS feeds to your Page wall (not personal wall)

I haven't had much luck with finding information about this, but somehow I stumbled upon a little site called TwitterFeed.

Surprisingly, the site wasn't just about Twitter (ugh) and it provided a very simple yet helpful service; read off an RSS feed and post it to various social networks such as Twitter, Facebook, Statusnet, Ping.fm and Hellotxt.

Whats better is that it actually supports posting to your business/organisation page, rather than just your personal page.

Unfortunately there is no "about us" page of some sort on TwitterFeed, so I had to sign up to see what it was all about.

Very simple to use

  • Create a new feed (enter in name and URL)
  • You can configure how often it updates and how many posts to make from each update, post suffix/prefix and also filter out keywords.
  • Each feed is configured independantly, so you can choose which social network that a feed is directed to.
  • (Facebook) Upon entering your account details, you can then selected which page it displays on, but only if you have admin rights on the page.

That's all!

Friday, July 16, 2010

WordPress: Custom query builder to list posts in a certain category or tag

I wanted to a page which displayed posts in a specific category, on a given date and didn't want to write some custom SQL query for it.

Luckily, the WordPress API makes it easy to modify the query even while in the template.

A global variable called $wp_query is available during most parts of the code.

This snippet below lets you list:

  • All posts (no paging)
  • In chronological order
  • and listed in the 'Links' category
$wp_query->set('nopaging', true);
$wp_query->set('order', 'ASC');
$wp_query->set('category_name', 'Links');

$wp_query->query($wp_query->query_vars);

get_template_part('loop');

Now you've got a snippet that does just that, in a few lines of code without having to write up any SQL at all!

The "loop" and argument in get_template_part() can be any template name you want.

You can also filter by tags and categories (or exclude), limit the number of posts shown, restrict by date range, author or paging options.

See the documentation for many more options.

[ Documentation ]

Thursday, July 15, 2010

mIRC: stop /var from evaluating mathematical expressions

I can't see why this is a useful feature, since $eval() and $calc() already exist.

So I've finally gotten around to fixing a bug in my script that's been haunting me for the good part of 4 years.

It was in the script I've been using to highlight URLs which I paste in a blue underlined format.

on *:input:#: {
if ($left($1,1) != /) {
var %input $1-

.echo -q $regsub(%input, /((?:telnet:\/\/|ftp:\/\/|https?:\/\/|www2?\.)[^<>\.\s]+(?:\.[^<>\.\s]+)+(?:\/[^<>\.\s]+)*)/g, 12\1, %input)
.echo -q $regsub(%input, /(irc:\/\/[^<>\.\s]+(?:\.[^/<>\.\s]+)+(?:\/[^/<>\.\s]*)?\/?(?![^\s\x2c\.]))/g, 12\1, %input)
.echo -q $regsub(%input, /(aim:goim\?screenname=[^\s&]+(?:&message=[^\s&=]+)?)/g, 12\1, %input)

if (%input != $null) {
msg $active %input
haltdef
}
}
}

However, whenever I would enter in text like "1 / 2" or "1 + 1", the script would evaluate it into "0.5" and "2" respectively.

Baffled, I had no idea behind to why this was happening. Tonight, I had enough of it and looked for an answer. Thankfully, "Sigh" wrote up a little blurb about /var that solved my problems.

All I had to do was change /var to /set -n and it would stop it from evaluating. Simple as that!

set -n %input $1-

The reason is that both commands evaluate mathematical expressions, but /set actually has a switch to treat the value as plain text.

[ Source ]

Firefox: Bring back old session windows with TabMixPlus

After upgrading to a very gay Firefox v3.6, I was annoyed that it disabled many of my working extensions.

To add to my annoyance, it didn't restore my window sessions correctly. I had heaps of windows opened over a period of many weeks and many of the pages were ridiculously difficult to find.

Luckily, I had the TabMixPlus extension installed. It automatically saves your sessions. I know, I know, Firefox does this automatically already. But Firefox only saves one or two sessions.

TMP saves up to a week by default. So it doesn't really matter how many times you open and close your windows, you can be sure its protected in case of a stupid update.

If you need to restore the sessions:

  • Close your Firefox session (and make sure nothing important is opened). You may want to copy these instructions somewhere first.
  • Find your profile folder
  • Go into "sessionbackups"
  • Find the latest "tabmix_sessions-***.rdf" file and copy it
  • Go up a folder, delete/move/rename "session.rdf"
  • Paste the file into "sessionbackups"
  • Rename it to "session.rdf"
  • Your sessions should be restored the next time you open Firefox

[ Source ]

Firefox: Re-enable the "enable" button on extensions that are "not compatible with Firefox"

Sometimes these version checks are just plain annoying. Well, as of Firefox v3.6 they just got MORE annoying!

Anything before the gay persona 3.6, use this trick.

As of v3.6 and onwards, they decided to modify that key use a more stupid convention and append the version to the string.

WHY THE HELL? The very reason that key exists is to disable those fucking stupid version checks!

So, to enable extensions that aren't compatible, do the following:

  • Type "about:config" into the browser
  • Right click on the main area and click "New" > "Boolean"
  • Call it "extensions.checkCompatibility.<version>" where <version> is the version of your Firefox.
  • Set it to False.

image
The old and the new way of doing it. How fucking annoying.

For me, I'm using Firefox 3.6.6, so you can call it "extensions.checkCompatibility.3.6" and it'll work.

The other reason I'm so annoyed at upgrading Firefox is because it cleared the windows I had open. I've fixed it and posted the method here.

[ Source ]

WordPress: Insert a post via code

To insert a post programatically, you'll need to make a simple call to wp_insert_post().

$data = array(
'post_status' => 'draft',
'post_type' => 'post',
'post_author' => $user_ID,
'ping_status' => get_option('default_ping_status'),
'post_parent' => 0,
'menu_order' => 0,
'to_ping' => '',
'pinged' => '',
'post_password' => '',
'guid' => '',
'post_content_filtered' => '',
'post_excerpt' => '',
'import_id' => 0,
'post_content' => '',
'post_category' => array(),
'post_title' => ''
);

$post_id = wp_insert_post($data);

add_post_meta($post_id, 'some-field-name', 'this was added programmatically');

Anything in that $data array can be removed because those are the default values.

The trickiest bit is to get the categories working. The post_category bit requires the category ID, which you can get using get_cat_ID('Category Name').

add_post_meta() is optional, in case you needed to append some meta fields to your post.

And thats all there is to it!

Wednesday, July 14, 2010

WordPress: Get current user's username or ID

There is a global variable called "$current_user".

global $current_user;

And in there is a field called "user_login".

$current_user->user_login;

You can also use "$current_user->id" to get the user id.

Tuesday, July 13, 2010

Wordpress: Make cForms II pass named fields instead of field_X

When capturing the form data in my_cforms_filter() you may have noticed that the posted data does not use proper field names.

Array(
[field_1] => title
[field_2] => name
[field_3] => state
[field_4] => content
[id] =>
)



When setting up your cform, make sure you click "Use custom input field NAMES & ID's" under "Core Form Admin / Email Options".



You should note that this only applies to non-ajax forms, so you'll also have to untick the "Ajax enabled" option next to the form name.



Now you should see some named indexes which are a bit more relevant.




Array(
[Title] => title
[Name] => name
[State] => state
[Letter] => content
[cf_working] => One%20moment%20please...
[cf_failure] => Please%20fill%20in%20all%20the%20required%20fields.
[cf_codeerr] => Please%20double-check%20your%20verification%20code.
[cf_customerr] => yyy
[cf_popup] => nn
[sendbutton] => Submit
)



Lastly, if you want to name these fields, you'll have to set the label in a certain format.



Changing the "Title" label to "Title [id:my-title-field]" would now give you:




Array(
[my-title-field] => title
[Name] => name
...
)



Note: I've had problems using the ID "name", which causes the form to display a 404.