New theme

December 2nd, 2009 No comments

Playing around with a new theme, so several items will probably be missing or otherwise not working, until I have fixed it.

Categories: Blog Tags: ,

Ubuntu and making Windows default boot

December 2nd, 2009 No comments

I recently installed Ubuntu on my Dell Studio 17, dualbooting Windows 7 and I wanted to make windows 7 the default boot. I did this by changing the “default=0″ setting in “/etc/default/grub” to “default=4″, then running “update-grub”. This basically tells GRUB to use menu-entry number 5 (0, 1, 2, 3, 4) as the default boot option. Since Ubuntu by default have 2 Linux kernels (regular and recovery) as well as 2 Memtest, this would select Windows 7.

A little while later I upgraded several applications in Ubuntu as well as the kernel. Updating the kernel added 2 extra menu-entries to GRUB, which t hen meant that menu-entry 5 (“default=4″) would be one of the 2 Memtest entries. This would mean I actually had to update GRUB manually every time I upgraded kernels? Nah, I didn’t want that. The way I did this was rather simple.

First I ensured that the “default” setting in “/etc/grub/default” were set to “0″ (“default=0″) which is first menu-entry. Second I renamed “/etc/grub.d/30_os-loader” to “/etc/grub.d/09_os-loader”. If you notice there are several numbered files in “/etc/grub.d”. These determines the order of selection (or rather order of compilation) when running the “update-grub” command. By putting the “os-loader” entry below the “linux” entry it puts Windows 7 before the Linux entries in the GRUB menu.

Categories: Blog Tags: , , , ,

ArkInventory Rules

First… ArkInventory rules/pwns/is awesome etc. ;) Aah… I just had to get that one out there, now on to the “rules” part :)

ArkInventory is a a bag replacement for World of Warcraft which gives you a massive amount of options to sort and order the contents of your bags and bank. The way ArkInventory does this is by splitting the bags into sections according to the users desire. For example have a section with all your tradeskill items, another for all your trash etc.

ArkInventory is plenty as is for most people just using categories. Using rules makes it even greater. With rules it is possible to specify multiple criteria for how the sections should handle items. Here ar my favorite rules.

Managed Equipment – This rule will create a section where all equipment, which is part of an equipment set (be that Outfitter or Blizzards own Equipment Manager):

outfit()

Soulbound Equipment, unmanaged – This rule keeps track of all the gear that are no part of an equipment set:

equip() and soulbound() and not outfit() and not equip("Tabard")

Idols – I’m a druid so this is to keep all my collected idols nice and orderly:

type("Armor") and subtype("Idols") and not outfit()

Trinkets – This handles your trinkets:

equip("Trinket") and not outfit()

Tabards – With Wrath of the Lich King tabards actually became useful. This rule will give you control of them:

equip("Tabard")

Tradeskill Tools – Keep track of that Pick, Skinning Knife, Enchanting Rod etc.:

pt("Tradeskill.Tool")

Spell Power and MP5 – This keeps track of all the items that have Spell Power or MP5. Similar approach can be used for other stats:

tooltip("Spell Power, mana per 5") and equip() and soulbound()

mirc.php for GeSHi

December 12th, 2007 1 comment

Seems there were a minor issue with the mirc.php file from GeSHi causing all code entries set to be parsed as mIRC scripts to stop with an error. Fixed (or rather made a dirty hack) it so my mIRC scripts once again could be highlighted :)

<?php
/*************************************************************************************
* mirc.php
* -----
* Author: Alberto 'Birckin' de Areba (Birckin@hotmail.com)
* Copyright: (c) 2006 Alberto de Areba
* Release Version: 1.0.7.20
* Date Started: 2006/05/29
*
* mIRC Scripting language file for GeSHi.
*
* CHANGES
* -------
* 2006/05/29 (1.0.0)
*   -  First Release
*
* 2007/12/12 (1.0.1) - Brian Schmidt Pedersen
*   -  Removed the forward slash from all mIRC keywords, since in actual
*       mIRC scripts, they're often written without the slash.
*   -  Entry 6 (timer parsing) under REGEXPS caused GeSHi to halt with an error
*       simple solution was to remove the slash(es)
*
*************************************************************************************
*
*     This file is part of GeSHi.
*
*   GeSHi is free software; you can redistribute it and/or modify
*   it under the terms of the GNU General Public License as published by
*   the Free Software Foundation; either version 2 of the License, or
*   (at your option) any later version.
*
*   GeSHi is distributed in the hope that it will be useful,
*   but WITHOUT ANY WARRANTY; without even the implied warranty of
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*   GNU General Public License for more details.
*
*   You should have received a copy of the GNU General Public License
*   along with GeSHi; if not, write to the Free Software
*   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
************************************************************************************/


$language_data = array (
    'LANG_NAME' => 'mIRC Scripting',
    'COMMENT_SINGLE' => array(
        1 => ';'
    ),
    'COMMENT_MULTI' => array(),
    'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
    'QUOTEMARKS' => array(),
    'ESCAPE_CHAR' => '',
    'KEYWORDS' => array(
        1 => array(
            'alias', 'menu', 'dialog'
        ),
        2 => array(
            'if', 'elseif', 'else', 'while', 'return', 'goto'
        ),
        3 => array(
            'action', 'ajinvite', 'alias', 'aline', 'amsg', 'ame', 'anick',
            'aop','auser', 'avoice', 'auto', 'autojoin', 'away', 'background',
            'ban', 'beep', 'channel', 'clear', 'clearall', 'clipboard',
            'close', 'closemsg', 'color', 'copy', 'creq', 'ctcp', 'ctcpreply',
            'ctcps', 'dcc', 'dde', 'ddeserver', 'debug', 'describe', 'disable',
            'disconnect', 'dlevel', 'dll', 'dns', 'dqwindow', 'ebeeps', 'echo',
            'editbox', 'emailaddr', 'enable', 'events', 'exit', 'filter',
            'findtext', 'finger', 'flash', 'flood', 'flush', 'flushini',
            'font', 'fsend', 'fserve', 'fullname', 'ghide', 'gload', 'gmove',
            'gopts', 'gplay', 'gpoint', 'gqreq', 'groups', 'gshow', 'gsize',
            'gstop', 'gtalk', 'gunload', 'guser', 'halt', 'haltdef', 'help',
            'hop', 'ignore', 'inc', 'invite', 'join', 'kick', 'linesep',
            'links', 'list', 'load', 'loadbuf', 'localinfo', 'log', 'me',
            'mdi', 'mkdir', 'mnick', 'mode', 'msg', 'names', 'nick', 'noop',
            'notice', 'notify', 'omsg', 'onotice', 'part', 'partall', 'pdcc',
            'perform', 'ping', 'play', 'pop', 'protect', 'pvoice', 'qmsg',
            'qme', 'query', 'queryrn', 'quit', 'raw', 'remini', 'remote',
            'remove', 'rename', 'renwin', 'resetidle', 'rlevel', 'rmdir',
            'run', 'ruser', 'save', 'savebuf', 'save', 'saveini', 'say',
            'server', 'set', 'showmirc', 'sline', 'sound', 'speak', 'splay',
            'sreq', 'strip', 'time', 'timers', 'timestamp', 'titlebar',
            'tnick', 'tokenize', 'topic', 'ulist', 'unload', 'updatenl', 'url',
            'uwho', 'var', 'window', 'winhelp', 'write', 'writeini', 'who',
            'whois', 'whowas'
        )
    ),
    'SYMBOLS' => array(
        '(', ')', '{', '}', '[', ']', '|'
    ),
    'CASE_SENSITIVE' => array(
        GESHI_COMMENTS => true,
        1 => false,
        2 => false
    ),
    'STYLES' => array(
        'KEYWORDS' => array(
            1 => 'color: #994444;',
            2 => 'color: #000000; font-weight: bold;',
            3 => 'color: #990000; font-weight: bold;'
        ),
        'COMMENTS' => array(
            1 => 'color: #808080; font-style: italic;'
        ),
        'ESCAPE_CHAR' => array(),
        'BRACKETS' => array(
            0 => 'color: #FF0000;'
        ),
        'STRINGS' => array(),
        'NUMBERS' => array(
            0 => ''
        ),
        'METHODS' => array(),
        'SYMBOLS' => array(
            0 => 'color: #FF0000;'
        ),
        'REGEXPS' => array(
            0 => 'color: #000099;',
            1 => 'color: #990000;',
            2 => 'color: #888800;',
            3 => 'color: #888800;',
            4 => 'color: #000099;',
            5 => 'color: #000099;',
            6 => 'color: #990000; font-weight: bold;'
        ),
        'SCRIPT' => array()
    ),
    'URLS' => array(
        1 => '',
        2 => '',
        3 => '',
        4 => ''
    ),
    'OOLANG' => false,
    'OBJECT_SPLITTERS' => array(),
    'REGEXPS' => array(
        0 => '\$[^$][^ ,\(\)]*',
        1 => '(%|&).+?[^ ,\)]*',
        2 => '(#|@).+?[^ ,\)]*',
        3 => '-[a-z\d]+',
        4 => '(on|ctcp) (!|@|&)?(\d|\*):[a-zA-Z]+:',
        /*
        4 => array(
        GESHI_SEARCH => '((on|ctcp) (!|@|&)?(\d|\*):(Action|Active|Agent|AppActive|Ban|Chat|Close|Connect|Ctcp|CtcpReply|DccServer|DeHelp|DeOp|DeVoice|Dialog|Dns|Error|Exit|FileRcvd|FileSent|GetFail|Help|Hotlink|Input|Invite|Join|KeyDown|KeyUp|Kick|Load|Logon|MidiEnd|Mode|Mp3End|Nick|NoSound|Notice|Notify|Op|Open|Part|Ping|Pong|PlayEnd|Quit|Raw|RawMode|SendFail|Serv|ServerMode|ServerOp|Signal|Snotice|Start|Text|Topic|UnBan|Unload|Unotify|User|Mode|Voice|Wallops|WaveEnd):)',
        GESHI_REPLACE => '\\1',
        GESHI_MODIFIERS => 'i',
        GESHI_BEFORE => '',
        GESHI_AFTER => ''
        ),
        */

        5 => 'raw (\d|\*):',
        6 => 'timer(?!s\b)[0-9a-zA-Z_]+'
    ),
    'STRICT_MODE_APPLIES' => GESHI_NEVER,
    'SCRIPT_DELIMITERS' => array(),
    'HIGHLIGHT_STRICT_BLOCK' => array()
);
?>
Categories: Code, mIRC, PHP Tags: , , , ,

Google Apps e-mail with Google Toolbar

December 12th, 2007 17 comments

So I’ve more or less switched to using only Google Apps‘ Webmail (Gmail with your own domain), making Thunderbird obsolete. To that end I’ve been trying to find a way to make mailto links launch my Google Apps composer window rather than the default Gmail composer window, and also how to make Gmail start by default in https (secure) mode rather than http (plain) mode.

In my search I’ve stumbled upon several resources, most pointing to using GreaseMonkey and a small script that re-writes all mailto links, another resource pointing to Gmail Manager saying it could handle Google Hosted Accounts (aka. Google Apps accounts), as well as some sites that explains how you fix the Gmail button for Google Toolbar to launch Gmail as https by default.

Of the resources pointed out in regards to the mailto handling, I found several GreaseMonkey scripts that did this job very well, although I didn’t really relish the idea of having that addon installed merely because I needed 1 script to handle mailto links, so I decided to try Gmail Manager instead

Gmail Manager was very easy to set up to handle Google Apps accounts in regards to checking e-mails, opening inbox and a few other minor things. All I had to do was type in my e-mail address and my password. Gmail Manager also handles mailto links, at least it opens my inbox when clicking a mailto link, but that isn’t enough for me, I want it to open the actual compose window. I decided it probably just was some hidden configuration option so I decided to muck around a bit in about:config, and behold: There I found “google.toolbar.mailto.providers.Gmail”, which contained the URL that Google Toolbar uses to open the composer window, when clicking mailto links.

So basically, all I had to do from the start was this:

Edit the Gmail button to open the Google Apps account instead of the Gmail account, and in https rather than http

  1. Go into Google Toolbar Options, under the Buttons tab
  2. Mark the Gmail button and click “Edit…”
  3. In the dialog that opens up click the “Use the advanced editor…” link
  4. There are 3 places that needs to be fixed:
    Change:

    http://mail.google.com/mail/?search=query&view=tl&start=0&init=1&fs=1&q={query}&source=navclient

    To:

    https://mail.google.com/a/MYDOMAIN.TLD?search=query&view=tl&start=0&init=1&fs=1&q={query}&source=navclient

    Change:

    http://mail.google.com/?source=navclient

    To:

    https://mail.google.com/a/MYDOMAIN.TLD?source=navclient

    Change:

    http://mail.google.com/mail?atom_browser_auth&source=navclient

    To:

    https://mail.google.com/a/MYDOMAIN.TLD?atom_browser_auth&source=navclient

    (Note: Replace MYDOMAIN.TLD with your own domain)

  5. Click “Save to Google Toolbar…”
  6. When/if asked to replace the Gmail button just click “Replace”.

Thanks to Stefano Savanelli for his comment referring to this following link where you can add a Google Apps e-mail button:
http://code.google.com/p/gtb-gmail-apps-button/

Now the Gmail button is fixed, now to make Google Toolbar send e-mail using the Google Apps account:

  1. Enable “Send with Gmail” in the Google Toolbar Options, under the More tab.
  2. Open about:config and locate “google.toolbar.mailto.providers.Gmail” (filtering by “gmail” makes it easier to find).
  3. Change the value
    From:

    firetool-mail:http://mail.google.com/mail/?view=cm&amp;fs=1@to=to&amp;subject=su&amp;body=body&amp;cc=cc&amp;bcc=bcc&amp;name=Gmail

    To:

    firetool-mail:https://mail.google.com/a/MYDOMAIN.TLD?view=cm&amp;fs=1&amp;tf=1@to=to&amp;subject=su&amp;body=body&amp;cc=cc&amp;bcc=bcc&amp;name=Gmail

    (Note: Replace MYDOMAIN.TLD with your own domain)

By adding the “&tf=1” variable to the URL the composer window will open “full screen”, without the folder list to the left and the search bar at the top.

There.. Now we have made Google Toolbar handle all aspects of our Google Apps account :)

Categories: Blog Tags: , , , ,

Site moved, again

October 27th, 2007 No comments

So I got tired of Servage being slow as hell so I moved back to Surftown, best host for cheap amount of cash I’ve found.

There might still be a few quirks, most likely related to permissions, that I need to find and work out. If you find any, feel free to comment on them in this post :)

Categories: Blog Tags: , , ,

Star Trek: The Next Generation

September 1st, 2007 1 comment

I got the urge the other day to watch some Star Trek: The Next Generation series, unfortunately for me I didn’t have the series around here so I accidentally ordered the entire series. That’s 7 seasons and a total cost of 2332 SEK at www.DVD.se. Now I’m just waiting for them to arrive so I can satisfy my urges ;)

Comment Spam

It’s so bothersome all the comment spam that occurs on blogs all around, a common denominator is that they (almost) always contain links. For this very reason I’m now blocking/blacklisting ALL comments that contain a web address.

Categories: Blog, Rants Tags: ,

Lots of updates

I recently switched host from Surftown.dk to Servage.net, mostly just to check Servage out, but also because I know the owner and one of the admins.

So far I must say I’m a bit disappointed. The administration panel isn’t as intuitive as the one I used at Surftown, but I guess I can live with it, most of the functions I had at Surftown, and lacks here at Servage, were functions I didn’t really use. Servage seems to have problems with responsiveness quite often, can’t pinpoint any specific times, it’s in periods, usually after I’ve done a lot of SQL queries, which makes me think they’re a bit too restrictive on the number of MySQL connections they allow. — Time will tell how well Servage fares, my needs aren’t big so I doubt I’ll have any great concerns.

While moving hosts I also upgrade to the latest WordPress, and made a lot of changes:

Instead of my own gallery page I decided to go with NextGEN Gallery. Has a lot of nice features, however compared to my own gallery it’s very very cumbersome to maintain. My own were just “upload files to a folder”, then the script would handle the rest the next time that folder would be browsed. The pagination, ability to add descriptions and the “effects” that comes with NGG, and also the fact that I rarely upload any pictures, makes it good for me. Made a small change though, had to make NGG add margin-top to every thumbnail, so that it would align properly within its container.

Codebin have been removed, instead I’ll just make a regular blog entry in the Code category, when adding new snippets of code. Again it’s not as easy to administrate as my previous one, but easier to maintain WordPress with updates, backups etc. A thing that bothers me hugely, is that when editing one of these code blogs, the formatting (indentation, special characters etc.) are completely screwed up due to WordPress’ handling of the text-fields, or some such.

Aah, and then I dropped my own theme, mostly because there were some quirks with the CSS that I simply couldn’t figure out, so I decided to drop it entirely. Instead I’m using a pre-made theme, which I’m modifying a bit to suit my taste and needs. Only few changes have been necessary though, mostly to the sidebar.

calc.tcl

#### calc.tcl v1.0.1 ###########################################################
################################################################################
## Written by:                                                                ##
##   KuNgFo0  (http://www.eggfaq.com/).              ##
##                                                                            ##
## Modified by:                                                               ##
##   Brian Schmidt aka. brianMan.                                             ##
################################################################################

#### Readme / Help #############################################################
################################################################################
## This script is ripped from KuNgFoO's ib.tcl v3.19 (infobot) script.        ##
##                                                                            ##
## Script that can calculate just about anything ;)                           ##
##                                                                            ##
## Usage:                                                                     ##
##   To have the .calc[ulate] commands available on a channel you need to set ##
##   the channel flag +calculator from the console/partyline .                ##
##   ``.chanset #channel +calculator´´                                        ##
##                                                                            ##
## Channel Commands (available only if channel is +convert):                  ##
##   .calc[ulate]                                                 ##
## Example:                                                                   ##
##   ``.calc 15*20+3´´                                                        ##
################################################################################

#### Changelog #################################################################
################################################################################
## v1.0.1                                                                     ##
## * Minor code cleanup                                                       ##
##                                                                            ##
## v1.0.0                                                                     ##
## + Initial release.                                                         ##
## * Changed the default trigger ``botname, calc[ulate]´´ to ``.calc[ulate]´´ ##
## + Added the possibility to control which channels could use the commands   ##
##   with the channel flag ``+/-calculator´´                                  ##
################################################################################

bind pub - .calc pub_calc
bind pub - .calculate pub_calc
bind msg - calc msg_calc
bind msg - calculate msg_calc

setudef flag calculator

# You shouldn't change these, however you may add additional variables
# These are used via %varname in the 'calculate' command
# Example: Mybot, calculate %pi / 2
set calc_const(pi) 3.14159265358979323846 ; # PI
set calc_const(e)  2.7182818284590452354  ; # E
set calc_const(n)  6.0221367e23           ; # Avogadro's number [1/mol]
set calc_const(R)  8.314510               ; # Universal gas constant [J/(mol*K)]
set calc_const(k)  1.380658e-23           ; # Boltzmann's constant [J/K]
set calc_const(G)  6.67259e-11            ; # Universal gravitational constant [N*m^2/kg^2]
set calc_const(h)  6.62606891e-34         ; # Planck's constant [J*s]
set calc_const(c)  2.99792458e8           ; # Speed of light [m/s]

# No more editing required

proc xrange {xr xr1 xr2} {
    return [join [lrange [split $xr] $xr1 $xr2]]
}

proc xindex {xr xr1} {
    return [join [lrange [split $xr] $xr1 $xr1]]
}

proc calc_fixdata {arg output} {
    global botnick
    if {[string index $output 0] != "#"} {
        regsub -all -nocase {$output's} $arg "your" arg
    }
    regsub -all -nocase {$botnick'
s} $arg "my" arg
    return $arg
}

proc calc_msg {targets arg} {
    foreach target $targets { puthelp "PRIVMSG $target :[calc_fixdata $arg $target]" }
}

proc calc_fixtopic {arg} {
    regsub -all {[\\\{\}\[\]\"]} $arg {}   arg ; # Bad characters
    regsub -all {(\s)+}          $arg {\1} arg ; # Double whitespace
    regsub -all {^\s*|\s*$}      $arg {}   arg ; # Whitespace at ends
    return $arg
}

# Begin 'calc' code
proc calc_fixexpr {exp} {
    global calc_const
    set exp [calc_fixtopic $exp]
    foreach i [array names calc_const] {
        regsub -all "
\%$i" $exp $calc_const($i) exp
    }
    return $exp
}
# End 'calc' code

# Begin Public binds code
proc msg_calc {nick uhost hand arg} {
    global botnick
    pub_calc $nick $uhost $hand "
" $arg
}

proc pub_calc {nick uhost hand chan arg} {
    global botnick calc_flag
    if {(![isbotnick $nick]) && (![matchattr $hand +b])} {
        if {(![string match "
$chan" ""]) && (![channel get $chan calculator])} {
            return 0 ; # If command comes from a channel, and that channel doesn't have +calculator then ignore
        }
        set isuser [expr {[matchattr $hand - $chan] || [matchattr $hand -]}] ; # Note that $chan might be "
", so we must handle both cases
        if {([validchan $chan]) && ($isuser)} {
            set output1 $chan ; # The bot sends the text to the channel for users
        } else {
            set output1 $nick ; # Non-users get privmsg'd
        }
        if {[set i [string last "
>" $arg]] == -1} {
            set output2 $output1 ; # By default, output2 (~stdout~) goes to output1 (~stderr~)
        } else {
            # Output has been redirected
            if {(!$isuser) || ([set output2 [string trim [string range $arg [expr $i + 1] end] "
"]] == "")} {
                set output2 $output1 ; # Error (User doesn't have access, or output was "
"), so we go back to the default
            }
            set arg [string trim [string range $arg 0 [expr $i - 1]] "
"]
        }
        set remainder [xrange $arg 0 end]

        if {$remainder == "
"} {
            calc_msg $output1 "
error parsing sentence"
        } elseif {[catch {expr [calc_fixexpr $remainder]} output]} {
            calc_msg $output1 "
error calculating '$remainder' ($output)"
        } else {
            calc_msg $output2 "
$remainder = $output"
        }
    }
}
# End Public binds code

# Init stuff
if {[catch {package require Tcl 8.2} error]} {
    putlog "
error TCL v8.2 or higher is required to run this script"
    return 0
}

putlog "
*** LOADED: calc.tcl"
Categories: Code, TCL Tags: , , , ,