Monday, 20 October 2014

Upgrade Crunchbang from wheezy/waldorf to janice/jessie (stable to testing) simplified


Following jschueths's post Updating Crunchbang to the Next Release I decided to use SED to make everything easier, instead of making the changes one-by-one by hand.

We should probably make backups of the files we are modifying first:
$ sudo cp /etc/apt/sources.list /etc/apt/sources.list.waldrof
$ sudo cp /etc/apt/preferences /etc/apt/preferences.waldrof
Then one command to make all the modifications:
$ sudo sed -i 's/waldorf/janice/g;s/wheezy/jessie/g' /etc/apt/sources.list /etc/apt/preferences
Then as jschurths said:
$ sudo apt-get update
$ sudo apt-get --no-install-recommends dist-upgrade

Sunday, 19 October 2014

Block incoming WAN (Internet) connections for SAMBA using iptables


 This is my idea on how one might keep WAN connections from hitting a SAMBA server:
iptables -m multiport -m comments -A INPUT -s 192.168.0.0/24 -p tcp --dports 137:139,445,43270,43273 -j ACCEPT --comment "Allow local connections to SAMBA - TCP"
iptables -m multiport -m comments -A INPUT -s 192.168.0.0/24 -p udp --dports 137:139,445,43270,43273 -j ACCEPT --comment "Allow local connections to SAMBA - UDP"


iptables -m multiport -m comments -A INPUT -p tcp --dports 137:139,445,43270,43273 -j DROP --comment "Block WAN connections to SAMBA - TCP"
iptables -m multiport -m comments -A INPUT -p udp --dports 137:139,445,43270,43273 -j DROP--comment "Block WAN connections to SAMBA - UDP"
 The ports *should* be right for SAMBA. The network address and range (192.168.0.0/24) might have to be changed to reflect you LAN (internal network)

Tuesday, 28 January 2014

Unity 4 - Third Person Controller and Camera useage hints and tips

1.) First thing first, when applying the components "Third Person Controller" and even more importantly "Third Person Camera" BOTH scripts should be applied to your player object. "Third Person Camera" is not meant to be applied to a camera, as much as the name might suggest it.

If you attached the "Third Person Camera" script to a camera you probably got a message like the following:

Please assign a target to the camera that has a ThirdPersonController script attached.
UnityEngine.Debug:Log(Object)
ThirdPersonCamera:Awake() (at Assets/Standard Assets/Character Controllers/Sources/Scripts/ThirdPersonCamera.js:58)

2.) If you can't find "Third Person" Controller or Camera look under Components > Scripts.

3.) If you leave the "Camera Transform" attribute under "Third Person Camera" blank the script will try to use the Main Camera automatically. If you have no main camera (for whatever reason) and don't assign a camera transform to it there will be issues.... With an error probably like the following:

MissingComponentException: There is no 'Camera' attached to the "something" game object, but a script is trying to access it.
You probably need to add a Camera to the game object "something". Or your script needs to check if the component is attached before using it.

4.) If you get the following error:
InvalidCastException: Cannot cast from source type to destination type.
ThirdPersonCamera.Awake () (at Assets/Standard Assets/Character Controllers/Sources/Scripts/ThirdPersonCamera.js:52)
...it is probably because there is a collider on your player object. Take off the collider. Something ("Character Controller" I assume) is adding automagically.

5.) If you get weird jumpiness when turning, make sure all the above it straightened out. Then make sure the Camera isn't a child object of the player... Who knows, maybe it got there when you were experimenting with the scripts initially? :p

Tuesday, 19 November 2013

Convert .vhd to VMWare image (.vmdk) on Mac OSX

In order to convert a Microsoft Virtual PC hard drive image (type .vhd) to a VMWare Fusion image (type .vmdk) on OSX you can use Qemu. While other articles mention using the Mac port of qemu called simply "Q", using Macports you can use Qemu directly.

Using Macports:
sudo ports install qemu
Then using the qemu-img command:
qemu-img convert -f vpc -O vmdk Win7_IE8.vhd win7-ie8.vmdk

...for example will output the desired image!

Friday, 6 September 2013

Using Grunt-phonegap-build: depricating grunt-zipstream and buiding on other platforms

If you use Grunt and want to automate builds in build.phonegap.com you may have noticed the Grunt-Phonegap-Build plugin. However the documentation is a little bit outdated. For one, Grunt-zipstream doesn't work with newer versions of Node.js (as of the writing here), so we will substitute in Grunt-contrib-compress. Then there is the fact that iOS uses certs now, and there is a key/password example in the documentation? It turns out that you can simply omit this line and build with iOS no problem! Finally there are the missing examples for Blackberry and Windows Phones builds. Yes, you can do them, and I will show you how:

Replacing Grunt-zipstream

We will use Grunt-contrib-compress instead with the following configuration:
var compressConfig = {
        main: {
            options: {
                archive: 'app.zip'
            },
            expand: true,
            src: ['*.html', 'styles/**/*.css', 'srcipts/**/*.js', 'favicon.ico', 'images/**/*'],
        }
    };
and with a sub-directory using a variable for Yeoman
var compressConfig = {
        main: {
            options: {
                archive: 'app.zip'
            },
            expand: true,
            cwd: '<%= yeoman.app %>/',
            src: ['*.html', 'styles/**/*.css', 'srcipts/**/*.js', 'favicon.ico', 'images/**/*'],
        }
    };
 You can replace "zip" with "compress" in the documentation, or make a separate task like I did:
grunt.registerTask('remote_build', [
        'compress',
        'phonegap-build:debug'
    ]);

Blackberry and Windows Phone builds

Wondering how to make Windows Phone Builds with Grunt-phonegap-build? To build out for iOS, Android, Blackberry, and Windows Phone you can do your setup this way:

var phonegapBuildConfig = {
        debug: {
            options: {
                archive: 'app.zip',
                'appId': 'XXXXXX',
                'user': {
                    'email': 'myemail@server.com',
                    'password': 'password1234'
                },
                keys: {
                    //ios: { 'password': password1234' },
                    android: { 'key_pw': 'password1234', 'keystore_pw': 'password1234' },
                    blackberry: { 'password': 'password1234'}
                },
                download: {
                    ios: 'dist/ios.ipa',
                    android: 'dist/android.apk',
                    blackberry: 'dist/blackberry.ota',
                    winphone: 'dist/winphone.xap'
                }
            }
        }

};

No need for the iOS password anymore, see how to specify the key for Blackberry, and the attribute name for Windows Phone is "winphone"!

Here is everything in total:
module.exports = function (grunt) {
    // show elapsed time at the end
    require('time-grunt')(grunt);
    // load all grunt tasks
    require('load-grunt-tasks')(grunt);

    //REMOTE (build.phonegap.com) phonegap (for devices) builds
    grunt.loadNpmTasks('grunt-contrib-compress');
    grunt.loadNpmTasks('grunt-phonegap-build');

    // configurable paths
    var yeomanConfig = {
        app: 'app',
        dist: 'dist'
    };

    var phonegapBuildConfig = {
        debug: {
            options: {
                archive: 'app.zip',
                'appId': 'XXXXXX',
                'user': {
                    'email': 'myemail@server.com',
                    'password': 'password1234'
                },
                keys: {
                    //ios: { 'password': password1234' },
                    android: { 'key_pw': 'password1234', 'keystore_pw': 'password1234' },
                    blackberry: { 'password': 'password1234'}
                },
                download: {
                    ios: 'dist/ios.ipa',
                    android: 'dist/android.apk',
                    blackberry: 'dist/blackberry.ota',
                    winphone: 'dist/winphone.xap'
                }
            }
        };

    var compressConfig = {
        main: {
            options: {
                archive: 'app.zip'
            },
            expand: true,
            cwd: '<%= yeoman.app %>/',
            src: ['*.html', 'styles/**/*.css', 'srcipts/**/*.js', 'favicon.ico', 'images/**/*'],
        }
    };

    grunt.initConfig({
        'phonegap-build': phonegapBuildConfig,
        compress: compressConfig
    });

    grunt.registerTask('remote_build', [
        'compress',
        'phonegap-build:debug'
    ]);
};

Registration (key) pages for various version of Visual Studio Express


If you are looking for the link to a version of Visual Studio Express Registration, here is what I have found so far:

Microsoft® Visual Web Developer® 2008  Express Edition: https://profile.microsoft.com/RegSysProfileCenter/wizard.aspx?fu=http%3a%2f%2fmsdn.microsoft.com%2fen-us%2fvsreg%2fdefault.aspx%3frel%3dvs2008%26h%3dd9eac95a73d80105%26pid%3d91911-152-0000077-60782%26bn%3d030729.01%26r%3dy%26lcid%3d1033&wizid=bbcd9486-83de-4770-9541-708db0f37792&lcid=1033

Microsoft® Visual Web Developer® 2010  Express: https://profile.microsoft.com/RegSysProfileCenter/wizard.aspx?wizid=345281f9-6588-4888-820f-2695af056d4f

Visual Studio Express 2012 for Web: https://profile.microsoft.com/RegSysProfileCenter/wizard.aspx?wizid=C7497E1F-ADA8-4302-9B50-B01855369B2A

Visual Studio Express 2012 for Windows Desktop: https://profile.microsoft.com/RegSysProfileCenter/wizard.aspx?wizid=2525f0ba-d85f-4730-bd75-e1299f83e666&lcid=1033

Hope it helps!

Thursday, 15 August 2013

The TBK Wii-link RF600 PRO 2.4 GHz Wi-Fi Booster.

I've been looking at 2.4 GHz Wi-Fi signal boosters lately, and one (reportedly) powerful (4 Watt) and cost effective (~$100) amplifier is the TBK Wii-link RF600 PRO.

Time for research!

It seems to be manufactured by ShenZhen TBK Electronic Co., Ltd

The most official listing I could find is: http://tbkchina.en.alibaba.com/product/922769231-218833311/2_4G_4W_Waterproof_RF600_Pro_0utdoor_Wi_Fi_Booster.html

As you can see their Alibaba page is: http://tbkchina.en.alibaba.com

Here is the circuit board diagram (Clean version):
And a higher resolution version:





The rest of the images are the highest resolution I could find.

The board, top half:


The bottom half (upside down):



 Close up of the switch:


In the box:


Hey look! Other models (RF600-AP, RF600N, RF600N-AP, RF606):