0

Tuning DD-WRT

Posted by admin on Apr 24, 2012 in Uncategorized

echo 0 > /proc/sys/net/ipv4/tcp_westwood (default 1)
echo 1 > /proc/sys/net/ipv4/tcp_vegas_cong_avoid
echo 3 > /proc/sys/net/ipv4/tcp_vegas_alpha
echo 3 > /proc/sys/net/ipv4/tcp_vegas_beta

TCP Vegas tunes the network performance based on packet delay instead of packet loss.

 
0

Microsoft Remote Debounce

Posted by admin on Apr 13, 2012 in HTPC

The MCE remote implements something called “debounce”, which means that with each button press the remote alternates the signal code it sends, I think to limit accidental double button presses. Hence, when you program your universal remote it only has one of the codes, so it will work the first time you press it but wont work again until after you’ve pressed something else.

To disable debounce you need to change a registry key. Find this key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HidIr\Remotes\745a17a0-74d3-11d0-b6fe-00a0c90f57da

and change the value of the EnableDebounce DWORD value on the right hand side from 1 to 0. Reboot for it to take effect.

 
0

replace into

Posted by admin on Apr 10, 2012 in Database

I had been using mysql’s replace into syntax until I read this article http://code.openark.org/blog/mysql/replace-into-think-twice which makes a lot of sense.

I have mostly changed statements to use insert .. on duplicate key instead.
For example


    insert into currentusage (
      userid,
      anytimebytesuploaded,
      anytimebytesdownloaded,
      peakbytesuploaded,
      peakbytesdownloaded,
      offpeakbytesuploaded,
      offpeakbytesdownloaded,
      bytesexcluded)
    select
      userid,
      sum(case when timing = 'ANYTIME' then bytesuploaded end),
      sum(case when timing = 'ANYTIME' then bytesdownloaded end),
      sum(case when timing = 'PEAK'    then bytesuploaded end),
      sum(case when timing = 'PEAK'    then bytesdownloaded end),
      sum(case when timing = 'OFFPEAK' then bytesuploaded end),
      sum(case when timing = 'OFFPEAK' then bytesdownloaded end),
      sum(bytesexcluded)
    from netflowsummary
      where userid = 12350
      and summaryinterval >= '2012-04-04'
    on duplicate key update
      anytimebytesuploaded=values(anytimebytesuploaded),
      anytimebytesdownloaded=values(anytimebytesdownloaded),
      peakbytesuploaded=values(peakbytesuploaded),
      peakbytesdownloaded=values(peakbytesdownloaded),
      offpeakbytesuploaded=values(offpeakbytesuploaded),
      offpeakbytesdownloaded=values(offpeakbytesdownloaded),
      bytesexcluded=values(bytesexcluded)

 
0

Upscaling Xvid using Avisynth

Posted by admin on Mar 16, 2012 in HTPC

I knew that ffdshow could use avisynth for complex scaling and sharpening but only recently had the time to play around with it. I’m pretty happy with the results.

This tutorial was the basis of my experimentation –
http://www.homecinema-hd.com/ffdshow-video-avisynth_en.html

There are a number of software versions of all the associated plugins so these are the ones I used.

Downloaded the standard avisynth 2.6 from SF
googled “avisynth 2.6 MT download” for the Multithreaded version of avisynth –
http://forum.doom9.org/showthread.php?t=148782 and overwrite the avisynth DLL in the windows system directory
googled “LimitedSharpenFaster” for home page -
http://avisynth.org/mediawiki/LimitedSharpen
and downloaded prerequisites masktools-v2.0a48.zip, RemoveGrain.rar and LimitedSharpenFaster.avsi which is in masktools.

Then installed the following script in ffdshow.

SetMemoryMax(512)
SetMTMode(3,4)
ffdshow_source()
SetMTMode(2)
dispWidth = 1920
dispHeight = 1080
mWidth = float(last.width)
mHeight = float(last.height)
ratio = (mWidth/mHeight)
newHeight= round((dispWidth/ratio)/2)*2
newHeight > dispHeight ? Eval("""
newHeight=dispHeight
newWidth=round((newHeight*ratio)/2)*2
""") : Eval("""
newWidth=dispWidth
""")
LimitedSharpenFaster(ss_x=1.0,ss_y=1.0,strength=45)
spline64resize(newWidth,newHeight)
SetMTMode(1)
GetMTMode(false) > 0 ? distributor() : last

Note that LimitedSharpenFaster is placed before the resize because this did not work when placed after it during testing.

The following screen shot shows a comparison with a Kung Fu Panda trailer although its a bit hard to see the difference, the detail is discernable. Kung Fu Panda

A similar improvement can be gained using ffdshow alone by using the built-in resize & aspect filter and resizing to 1920 x 1080. On the settings tab, set the Luma method to spline and the Chroma method to bicubic. Then adjust the Luma and Chroma sharpen settings to around 0.75.

In my opinion, the avisynth sharpening seems slightly warmer and brighter but that’s a subjective personal preference.

This soon to be moot because most dowloaded movies and TV will be in H.264 codec anyway.

 
0

Setting Static IP of NAT network interface in VirtualBox

Posted by admin on Feb 9, 2012 in Unix

In NAT mode, the guest network interface is assigned to the IPv4 range 10.0.x.0/24 by default
where x corresponds to the instance of the NAT interface +2.
So x is 2 when there is only one NAT instance active.
In that case the guest is assigned to the address 10.0.2.15, the gateway is set to 10.0.2.2
and the name server can be found at 10.0.2.3.

This means that for Ubuntu, the /etc/network/interfaces entry for the network card settings are something as below:

iface inet static
address (e.g. 10.0.2.7)
netmask 255.255.255.0
network 10.0.2.0
broadcast 10.0.2.255
gateway 10.0.2.2

Also, add the following nameserver entry to /etc/resolv.conf

nameserver 10.0.2.3

 
0

Cyanogenmod on Defy

Posted by admin on Dec 5, 2011 in Android

After a few anxious attempts, I managed to root and upgrade my phone to Cyanogenmod ROM. These are the steps.

1. Rooting the phone.

I tried a few versions of SuperOneClick and had no success but then I found SuperOneClickv2.2-ShortFuse.zip and it ran without problems. The prerequisites are the Motorola USB drivers and MotoConnect. SuperOneClick is a windows program. The phone must first be set to USB debugging under Applications.

2. Installing 2nd Init

http://forum.xda-developers.com/showthread.php?t=1065798

This is required to bypass the locked boot loader. It used to be available as a Market app but now has to be dowloaded from one of many sites. Look for bootmenu 0.6.1.

Prerequistes are Android SDK (installer_r15-windows.exe) from Android Developers http://developer.android.com/sdk

2nd Init also installs ClockworkMod Recovery for backup and recovery. (AKA CWM)

After installing and booting, the phone may end up in the boot menu which is disconcerting. However, selecting the default boot mode as Normal fixes the boot process.

Perform a custom backup (AKA Nandroid Backup) in case something goes wrong. Copy the backup directory to your PC for safety.

3. Installing Titanium Backup Free

This is not required for upgrading the ROM but is in case something goes wrong. Run a Batch backup of everything and then copy the backup directory to your PC for safety.

4. Download RSD Lite and stock (Full) SBF

This is not required for upgrading the ROM but in case something goes wrong and you need to flash a Full ROM. I downloaded JRDNEM_U3_3.4.2_177-003_BLUR_SIGN_SIGNED_USAJRDNEMARAB1B8RTGB03A.0R_PDS03C_USAJRDNFRYORTGB_P019_A010_HWp3_Service1FF.sbf.gz from http://and-developers.com/sbf:defy

5. Download Cyanogenmod ROM from http://www.cyanogenmod.com/

I downloaded update-cm-7.1.0-jordan-signed.zip and renamed it update.zip in the top level directory of the SD Card

6. Download Google Apps if you need GMail, Maps etc

I downloaded gapps-gb-20110828-signed.zip and renamed it gapps.zip in the top level directory of the SD Card.

7. Installing the ROM

I followed this guide http://forum.xda-developers.com/showthread.php?t=1054447 and it ran in about 10 mins with no problems.

8. Adding themes

I downloaded Ice Cream Sandwich CM7 Theme, Black Glass ADW theme and Sense Analog Clock Dark from the market.

Screenshot

 
0

HTPC Specs

Posted by admin on Sep 27, 2011 in HTPC

MediaPortal Version: 1.2.0
MediaPortal Skin: StreamedMP
Windows Version: Windows 7 Home Premium 64bit
CPU Type: i3-2100
Motherboard: ASUS P8H67-I Deluxe
HDD: Samsung 2TB EcoGreen HD204UI
Optical Drive; LG CH10LS20 Blu-Ray Combo Drive
Memory: 4GB DDR3-1333
Video Card: Intel HD Graphics 2000 (Onboard)
Sound Card: Realtek ALC892 (Onboard)
HTPC Case: Silverstone ML03B
Cooling: Thermaltake Slim X3, Arctic F8 Pro
Power Supply: Antec EA-380D
Remote: Windows MCE remote
MPEG2 Video Codec: PDVD11
MPEG2 Audio Codec: ffdshow
h.264 Video Codec: PDVD11
TV: SAMSUNG Plasma PS50B650
TV – HTPC Connection: HDMI

 
0

Reset MySQL root password

Posted by admin on Jul 7, 2011 in Database, Unix

First things first. Log in as root and stop the mysql daemon. Now lets start up the mysql daemon and skip the grant tables which store the passwords.

mysqld_safe –skip-grant-tables

You should see mysqld start up successfully. If not, well you have bigger issues. Now you should be able to connect to mysql without a password.

mysql –user=root mysql
update user set Password=PASSWORD(‘new-password’) where user=’root’;
flush privileges;
exit

 
0

Oracle User Locking

Posted by admin on Jul 4, 2011 in Uncategorized

The DBMS_LOCK package can be used to lock sections of code for concurrency control. Simple usage is as follows;

DECLARE
      lock_handle VARCHAR2(128);
      lock_status number;
BEGIN
DBMS_LOCK.ALLOCATE_UNIQUE (lockname => 'mylockset', lockhandle => lock_handle);
    -- If this is taking a long time to run check if a lock is being held and kill the session
    -- e.g. select osuser,program,sys.v_$lock.type,lmode,request
    --         from sys.v_$lock,v$session
    --         where v$session.sid = sys.v_$lock.sid
    --         and sys.v_$lock.type = 'UL'

lock_status := DBMS_LOCK.REQUEST(lockhandle => lock_handle, lockmode => DBMS_LOCK.X_MODE, timeout => 60, release_on_commit => FALSE);

--- Some protected code ---

lock_status := DBMS_LOCK.RELEASE(lockhandle => lock_handle);

 
0

Add a user to a group in linux

Posted by admin on May 9, 2011 in Unix

Simple things I always forget

Add a user
useradd -p howardb howardb

Add a user to the wheel group
gpasswd -a howardb wheel

Edit sudoers
visudo

Copyright © 2008-2012 Brinsmead Data Services All rights reserved.