Sunday, April 24, 2016

Media Center on Windows 10 Fixes (DVB-T, Scheduled Recording and ehrecvr.exe Fix)

Gday again.

Well the time has hit to use pleb TV again in Australia (thanks Masterchef) so I thought I'd get good old Media Center going on Windows 10.

As it turns out, Media Center is no longer part of Win10 by default.

Luckily, you can still manually install it.
Head to the http://lifehacker.com/get-windows-media-center-running-on-windows-10-with-a-f-1729919907 for more details.

Once installed, you'll hit a few small issues.
Below is a list of these issues and how to resolve them.


Live TV Doesn't Work (Codec Issue)
By default Windows 10 doesn't have the necessary codecs to decode a DVB-T stream.

This is easily fixed by downloading and installing the LAV filters pack available at:
https://github.com/Nevcairiel/LAVFilters/releases

Recordings Don't Start (Permissions Issue)
It appears Media Center uses task scheduler to manage recordings.
Win 10 uses different privileges for different users and it appears the standard account doesn't have rights to create scheduled tasks.

This is easily fixed by changing the program shortcut settings under the compatibility tab to make sure that the program is always run as an administrator.

Machine Unresponsive (CPU gets hammered by recording service)
It appears the gem that has plagued media center from day one still exists.

Anyone who has used MediaCenter has probably experienced the issue where you get 100% CPU usage on all cores by a little bastard process called ehrecvr.exe.
As an added bonus, it also sets it's priority to above normal, which makes it even more prone to CPU chomping.

This is the service used by Media Center to record shows, so  it's sort of important.
It's clearly a bug that has never been resolved by MS.

Luckily, there's absolutely no need for this service to require that much CPU so we can limit how many cores it can use (one) and set its priority to normal (instead of all).

Note - through my testing, you have to have ehrecvr bound to core 1.
You can give it more than one core, but one of the cores must be core 1.
If you don't, recordings won't start.

To bring this sucker under control, first you need the ehrecvr service to start.
The only way to do this without confusing Media Center is to let Media Center be the reason it starts.

I put a shortcut to Media Center (set to run as administrator) in my Startup folder to make sure it kicks off at boot.

Next, create a batch file with the following lines and save it somewhere:

wmic process where name="ehrecvr.exe" CALL setpriority "normal"
PowerShell "$Process = Get-Process ehrecvr.exe; $Process.ProcessorAffinity=1"

Note - the processor affinity value indicates which cores to use.
For this exercise, one core is fine but if you want you can give it two cores.

Values are as follows:
Core 1 Only: 1
Core 1 and 2: 3
Core 1 and 3: 5
Core 1 and 4: 9

Next, create a scheduled task with the following settings.

General Tab: 
Run whether user is logged on or not: Checked
Run with highest privileges: Checked

Triggers:
Begin the Task: At Startup
Delay Task For: 1 Minute

Actions:
Point it to your batch file.

And that's it :)

You should now have a full functioning install of Windows Media Center on Windows 10 that doesn't cause weird performance issues.

Enjoy :)









Friday, April 15, 2016

Asus UX305CA Windows 10 Touch Screen Sleep Resume (Wake) Fix Using DevManView

Got a touchscreen laptop like the Asus UX305CA that has the pain in the hole problem where the touchscreen stops working on wake from sleep (Windows 10)?

Tried the hibernate fix and no joy?

Tried the change lockscreen type from Spotlight to Picture and still no solution?

Well - this is for you :)

As an overview, what we'll be doing is using a third party program to force the touchscreen driver to stop and start when you unlock your laptop using a batch file and a scheduled task.

This implies that you will be using a password to lock your laptop.
You password protect your laptop right?
It might work without a password but I haven't personally tried this.

PLEASE NOTE: As Windows / driver writers are a bit daft, both the touchpad and the touchscreen device have the same name (I2C HID Device).

When the script runs, your touchpad will momentarily be disabled and then re-enabled while the script runs (which takes all of 3 seconds).

It's honestly a non-issue and given the fact that this fix is a reliable way to get your touchscreen working EVERY time after resuming from sleep, it's worth the tradeoff in my opinion.

First off, grab yourself a copy of DevManView.

Download links are down the bottom of the page and make sure you grab the x64 version (unless you're a weirdo and for some reason are running 32-BIT win10).

For the purposes of this guide, download the zip file and extract it to a folder on C drive called DevManView.

Now, in the same folder (C:\DevManView), create a file called fixtouch.bat and add the following to the file:

C:\DevManView\DevManView.exe /disable "I2C HID Device"
timeout 3
C:\DevManView\DevManView.exe /enable "I2C HID Device"

Now, go to PC Settings and search for control panel (or just get to Control Panel however you normally would).

In Control Panel click on Administrative Tools and then double-click on Task Scheduler.

In Task Scheduler, on the right-hand side of the screen click Create Task.

You are now going to create a new task that runs the batch file we made above on unlock (obviously following a wake event).

General Tab:
Name: Touchscreen Fix
Run whether user is logged on or not: Selected
Run with highest privileges: Selected
Configure For: Windows 10

Note - you may get prompted to enter your password when you select the next tab - enter your password when prompted.

Triggers Tab:
Click New
Begin The Task: On workstation unlock
Any User: Selected
Enabled: Selected

Actions Tab:
Click New
Action: Start a Program
Program/script: Browse to C:\DevManView and select fixtouch.bat

Conditions Tab:
Start the task only if the computer is on AC power: Unselected
Stop if the computer switches to battery power: Unselected


Click OK.

The script will now run whenever you login to your laptop after entering your password from wake.

If you screw up the instructions above, you risk disabling your touchpad driver.
If you manage to do this, just get yourself into device manger using the keyboard and re-enable both devices named I2C HID Device.

Now go use that touchscreen :)



Ahhh the (MegaDrive) memories.

Time to get nostalgic.

If you're a 90's child you'll remember the Sega MegaDrive and most likely a magazine called MegaZone.




Well, some legend out there on the internet has actually used their scanner and broadband connection for something useful and posted 2 PDF's with a shedload of issues.

Get them at:
http://www.oldgamemags.com/megazone/

If you don't know what I'm talking about, do yourself a favour and grab some Genesis (same diff) games off steam or if you're cheeky an emulator and some ROMs.

Make sure you get your hands on the following titles as no self respecting gamer can claim this title without having played:
  • Blackthorne
  • Mega Bomberman
  • Moonwalker
  • Mortal Kombat Series
  • NBA Jam Tournament Edition
  • Raiden Triad
  • Road Rash 2
  • Rock n Roll Racing
  • Sonic series
  • Street Fighter 2 Special Champion 
  • Streets of Rage Series
  • Zombies Ate My Neighbours
To complete the experience, grab yourself a RetroLink Saturn (yes, it's not MegaDrive, but better!) controller off EBay and away you go!




Monday, April 11, 2016

RackTables Install and Fix Guide



If you've ever had to document a data centre rack layout, you would be aware how challenging this task can be.

Trying to attach information such as cable details, serial numbers, asset details, neighbouring devices and ports.

The list goes on!

Luckily, RackTables comes to the rescue.

Racktables is a PHP / MySQL (with a bit of javascript) platform for easier data centre physical documentation.

Install Guide 

This guide is written for CentOS 7 (my go to Linux distro these days).

Firstly, install the good old LAMP stack.



The guide I use most often for this is located at (although my steps below cover this as well):
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-centos-7

In case this link ever dies, here's a PDF version

yum install httpd
systemctl start httpd.service
systemctl disable firewalld
systemctl stop firewalld
systemctl enable httpd.service

yum install mariadb-server mariadb
sudo systemctl start mariadb
sudo mysql_secure_installation

enter blank for root pass
yes for create pass
set new pass
enter for everything else

systemctl enable mariadb.service
systemctl restart httpd.service


yum install php-mbstring php-bcmath php-snmp php-gd php-ldap

wget wget --no-check-certificate https://downloads.sourceforge.net/project/racktables/RackTables-0.19.6.tar.gz


Note - get the link to the latest stable version that you can paste straight into the shell by using the "get direct link" option when downloading RackTables from SourceForge.




tar -xvzf RackTables-0.19.6.tar.gz
cp -r RackTables-0.19.6/wwwroot /var/www/html/racktables

mysql -uroot -p

create database racktables;
grant all on racktables.* to root;
grant all on racktables.* to root@localhost;
grant all on racktables.* to rackuser;
grant all on racktables.* to rackuser@localhost;
set password for rackuser@localhost=password('rackpw');
exit

setenforce 0

*** Used to find Apache process owner and group ***

sudo egrep -iw --color=auto 'user|group' /etc/httpd/conf/httpd.conf

Note - you will need to change the permissions as per below on secret.php as prompted during the installer.




cd /var/www/html/racktables/inc/
sudo chown apache:apache secret.php
sudo chmod 400 secret.php
 

Fixes

Awesome.

So you've got RackTables up and running.
W00t!

Now, if you happen to have long hostnames for the infrastructure devices in your environment, you will immediately notice the text fields in RackTables are too short in the device link and reserve port areas of the interface.

To fix:


nano /var/www/html/racktables/css/pi.css

append to end of file.

#remote_port {
        width: 800px;
}



nano /var/www/html/racktables/inc/interface-lib.php

function stringForOption ($string, $maxlen = 50)

nano /var/www/html/racktables/js/inplace-edit.js

 if (width < 150)
                width = 400;
        span.hide();