ATI R9 270x (and R9 295X2,R9 290X,R9 290,R9 285,R9 280X,R9 280,R9 270X,R9 270) enable audio over dvi connection

As standard you do not get audio over the DVI port on R9 devices.

I got audio working correctly over DVI using an old DVI to HDMI converter that shipped with one of my previous ATI graphics cards, the HD4850x2.

They are still floating around on ebay, and look like this:
shopping

Just use a standard HDMI lead to your monitor or TV and you get full 5.1 surround sound :)

Have fun watching youtube in 5.1 :)

If this post has helped you please consider clicking on my sponsor ads if they appeal to you :)

LetsEncrypt renew Apache PluginError((‘There has been an error in parsing the file (%s): %s’, u’/etc/apache2/sites-enabled/000-default-le-ssl.conf’, u’Syntax error’),).

Trying to renew a LetsEncrypt SSL certificate in Apache and I got this unhelpful error message:
PluginError((‘There has been an error in parsing the file (%s): %s’, u’/etc/apache2/sites-enabled/000-default-le-ssl.conf’, u’Syntax error’),).

Now I can understand most error messages and figure out the issue but this one had me stumped. There was nowhere near enough information to allow me to determine the nature of the error.

My config file parsed correctly and worked without issue so I knew there was nothing fundamentally wrong with it.

Eventually I pinned it down to one of two problems:
* CaSe NoT MatcHing in <> –
* XML layout incorrect:

<ifModule greg>
	WhiteSpaces must be consistent
This line is incorrect and will break letsencrypt
	This is correct and will parse without issue
	All entries must line up
	<ifModule somethingelse>
		This must be indented correctly too
This line is incorrect and will break letsencrypt
	This line is incorrect and will break letsencrypt
		This is correct and will parse without issue
	</ifModule>
</ifModule>

This version is correct

<ifModule greg>
	WhiteSpaces must be consistent
	This line was incorrect and would have broken letsencrypt
	This is correct and will parse without issue
	All entries must line up
	<ifModule somethingelse>
		This must be indented correctly too
		This line was incorrect and would have broken letsencrypt
		This line was incorrect and would have broken letsencrypt
		This is correct and will parse without issue
	</ifModule>
</ifModule>

If this post helped, please consider clicking one of the ads. It costs you nothing but I get a nominal fee.

Apache wordpress remove index.php 404 not working .htaccess definitive solution

Scenario:
You are running Apache, have installed WordPress and are trying to get pretty permalinks working and it keeps returning a 404 page.

You’ve tried everything – a2enmod rewrite, removed the .htaccess file, reset the permalinks, changed them back to the pretty version, restarted Apache – in short everything people tell you.

The problem is still there isn’t it? The internet sucks, nobody knows anything.

Sit back, have a nice drink and we’ll have it fixed in seconds.

Edit the main Apache config file (/etc/apache2/apache2.conf in my case).

Search for:


       Options Indexes FollowSymLinks
       AllowOverride None
       Require all granted

Change it to:


       Options All
       AllowOverride All
       Require all granted

Restart Apache.

Want to thank me? This server has google ads and I receive a nominal amount per click.

Feel free to comment :)

wordpress permalinks
wordpress permalinks

Phpmyadmin root login not working apache http2

After playing around with http2 for a couple of servers I am commissioning (not this one yet!) I consistently run into issues with root being unable to log into phpmyadmin.

Logging into mysql manually works perfectly, the password is definitely correct.

If you have the same issue, try this as root:

echo "update user set plugin='' where User='root'; flush privileges;" | mysql --defaults-file=/etc/mysql/debian.cnf mysql

Let me know if it works for you. This post is actually mainly here because I never remember to do that line :P

So.. my quadcopter disappeared from view, and my life.

For quite some time I have been considering getting into the world of (or should that be the air of?) remote control flying machines such as quadcopters and the bigger brothers hexacopters and octocopters.
Recently while enjoying a nice day out shopping with my wife (we’ve all been there haven’t we) and I saw a shop that appealed to all my basic masculine needs. It was a boy toy shop for grown ups. Quicker than ‘er indoors could say “does my backside look big in this” I was detouring from the tent – er clothes – shop and meandering my way across the mall (hi Tiffany if you’re reading this – how about your comeback tour getting over to the UK? We have Europe’s largest shopping centre right on my doorstep) to Menkind.

Think for a second about that. A shop called Menkind. In this day and age of rampant feminism a shop that dares sell stuff to males.. Just a heads up ladies – there are no woman seats, unlike shoe shops which have male seats with popcorn while women fight to the death over the last pair of Jimmy Chews (alright already, I don’t want to sound like I take an interest in girly things. I know it’s Choo. Just wait until you get home and I cover them in ham slices and let the dog in. Tell me I am wrong then).
There’s another thing. Go into any shop that sells gadgets or pluggy in things and you get bombarded by extended warranty offers. Why not on a pair of shoes that cost a month’s wages and still break before the sticker comes off the bottom?

Where was I? Ah yes. I was drifting across towards the shop that glowed and I swear it had heavenly music coming from somewhere. Gold gates, masses of scantily clad angel girls all beckoning me into it.

Sorry about that, back to normal after a cold shower.

So I walked into this.. masterpiece full of Batman Neon lights and fold up tools for removing the headlight cover from a 1940s car. This shop had everything. It even had a car driving up and down on the window. On the actual window. Like something out of Mission Impossible. It must have been done with mirrors or something. What an age we live in.

Along one wall was a row of quadcopters. After spending the obligatory 5 minutes drooling a very knowledgeable member of staff (a girl no less) leapfrogged over the shambling wrecks of other men trying to get the stickers back on a Rubik’s Cube and somersaulted in front of me. Cue another heavenly fanfare.

“So, you are looking at quadcopters” she stated. I even heard the comma.
“I am indeed good man. Can you tell me the flight characteristics, expected flight time, lift capacity and control distance of each model please?” was what I wanted to say.
What actually came out was “want want want want want want want”.
“Ah, a tough customer. This is the one for you” she stated. She’d make a good statesman.

So off I skip – er manly stomp – to the checkout to pay for my pretty.

————–
Wordpress rant at this point:
I hate WordPress.com’s new editor. Whenever I get to the bottom of the page while typing my text disappears and I have to stop, scroll down and begin typing again, totally losing my train of thought.
There it did it again when I pressed Enter. Scroll up automatically WHEN I press Enter, not when I start typing. It is most disconcerting.
————–

 

Where was I? Ah yes. I was paying for my new quadcopter before She Who Must Be Obeyed got out of the changing room with two new canoes bungee strapped to her feet. Why God only knows, we live at the top of a hill. Flooding affects the poor people at the bottom of the village. It’s called Flood Plain Avenue for a reason and why we live at Flood Plain View.

So I manage to pay before my flexible friend shatters under the weight of her new Jimmy Cruise (ships), solve the Rubik’s Cube and put it back on the shelf to the sound of acolytes chanting my name. Truly I am Emperor of this new land.

I float on a cloud back across the heads of shoppers and land back in my front row seat to watch the end of the fight. The bloke in the dress won, but only because he outran the woman with the sharpened walking stick.

Someone had stolen my popcorn. Expletive deleted!

I nestle the quadcopter box under the pile of canvas sheets, tarpaulins and tents and await the return of my dainty little princess.

After 154 hours she returns (something about the fire brigade being called to get her out of the cowshed she was jammed into to try on her arks), takes one look at the lorry containing her underwear sails and asks me what the box is.

Being a brave man I tried to tough it out. When I woke up she was towering above me holding a quadcopter box, a petrol can and a lighter. Where the hell did she hide that?

“Want to try that again?” she asked in the dulcid tones she normally reserves for firemen and cake sellers.

I told her everything and she glanced over to where I was frantically pointing at a derelict store.

I willingly gave my bank card to the love of my life and she went to the nearest jewellery shop to buy herself a couple of anchors for her ears to go with her submarines.

I managed to get home. The bank, and my back, were both broke from the exertion.

Once the aircraft carriers and marquees were ensconced in the walk in cupboard (ok it is a hole smashed into the castle next door) she gave me the box containing the quadcopter.

Faster than you can say “these things have a 2 hour charging time” I was waiting 4 hours for the quadcopter battery (which was the size of a grain of sand) to charge.

Fast forward a few days. I can press a button and make the quadcopter flip. King of the world, baby!

Now to learn turning and coming back to me.

As I watched my quadcopter sail into the distance at the speed of light I tried to get it to return. Out of range of the controller the brave little quadcopter gallantly flew on towards the great unknown. It was last seen heading towards the sea and Norway.

So I am now looking forward to convincing RentATent that I need a new quadcopter, only this time bigger with more features.

One of the first features I will be adding will be a device that I have called a LinkIt One which is a wonderful little board with built in wi-fi, GPS and can send and receive SMS text messages.
Just imagine: “GPS my quadcopter”
“I am at x, y and 470 feet above sea level, come and get me please.”

I can write the code to make the aforementioned LinkIt One do that.

I just need to generate the funds to purchase a quadcopter strong enough to carry the LinkIt One with a decent flight time, and keep the funds away from Shoe Shop Annie who will blow it on ropes for her boots or something.

Wish me luck, and feel free to comment with any suggestions.

Tiffany, I was serious about the comeback tour visiting the malls of the UK. I’d even sacrifice some of my quadcopter funds to buy tickets.

Menkind is online at http://menkind.co.uk
LinkIt One is a product made by MediaTek http://labs.mediatek.com/site/global/developer_tools/mediatek_linkit/hdk_intro/index.gsp

This post is not an advertisement for either of the two companies listed above.

Lissajous Patterns on an Oscilloscope using Silego GreenPAK4 Development Kit and SLG46620V

lissajous 2 to 5 ratioIntroduction
What are Lissajous Patterns?
Lissajous Patterns are the result of two sine waves controlling the X and Y axes of an oscilloscope.
Lots of science fiction movies will show Lissajous Patterns on oscilloscopes as it is a very impressive thing to display.
https://en.wikipedia.org/wiki/Lissajous_curve
What is an Oscilloscope?
An oscilloscope is an electronic device used for viewing waveforms or electronic signals on a screen.
https://en.wikipedia.org/wiki/Oscilloscope
What is a Silego GreenPAK4?
GreenPAK4 is a highly versatile NVM Programmable Mixed-signal Matrix designed to easily implement differentiating features and functions into already highly integrated designs while minimizing component count, board space, and power consumption. GreenPAK4 comprises the best analog and digital resources from previous generations with expanded functionality and a few new additions, such as the hardware reset pin and Digital to Analog Converter (DAC), all in a tiny package.

Prerequisites
Oscilloscope and test probes
I use a Philips PM3217 which has served me well for many years
Silego GreenPAK4 Development Kit and SLG46620V
STQFN-20 (2.0 x 3.0 mm) GreenPAK4 Dual Supply Socket Adapter
Silego GreenPAK4 Designer
http://www.silego.com/products/greenpak4.html
Tweezers with antistatic coating and needle tips

Warning
As with most electronic parts the Silego GreenPAK4 Development Kit and SLG46620V are sensitive to static electricity. Ensure all static precautions are taken while using the board to prevent damage.

Setting up the board
Rather than permanently programming the SLG46620V we will be using the emulator function in the GreenPAK4 Designer software. Although the software calls itself an emulator it will actually be running on the IC. Using the emulator means that we will be able to program the IC (or use it in the emulator) again in the future, and more importantly for this tutorial we can change figures on the fly to generate different patterns and not have to burn a single use IC in the process.

I suggest working in a clean, uncluttered area with a sheet of blank white paper to put the board on while you are doing the initial set up. The IC we will be using is tiny, measuring 2 millimetres by 3 millimetres and will easily get lost forever should it drop onto a dark surface.

boardRemove all connections from the development board (including USB and the socket adapter).

socket openPlace the STQFN-20 (2.0 x 3.0 mm) GreenPAK4 Dual Supply Socket Adapter on your work area and open the top by pulling the tab slightly away from the socket adapter which releases the top panel revealing a tiny hole to carefully place the IC.

If you examine the IC you will see that one side has silver pads and the other has text. The side with the text is the top and has a small dot on one corner. This dot is the orientation point.

If you examine the socket adapter with the top panel open you will see a dot. This dot is also an orientation point.

Using your tweezers, pick up the IC, taking note of the orientation point. Place it carefully into the hole in the socket adapter ensuring the two orientation points are together and the text is still on top. Be extremely careful not to damage the pins inside the socket adapter or it will be permanently damaged and require replacement.

Once the IC is aligned and seated correctly open the tweezers and remove them before reclosing the top panel on the socket adapter.

board and socketNow connect the socket adapter to the larger board using the pins in the centre of the board, paying particular attention to the pin alignment.

Finally insert the USB cable into the USB port.

Installing the software
The software can be downloaded from http://www.silego.com/products/greenpak4.html. There are versions for Windows, Mac and Linux. I will be using the Linux version. Please follow the instructions for your particular system.

set chip revision windowOnce installed, run the software. A window will open asking you to select your GreenPAK4 chip revision. We will be working with the SLG46620V so select that one.

When the software has finished loading click on the Emulator button or press F9 on your keyboard.
emulator 1A new (rather curvy) window should open with the message “Please connect device to USB port”. Follow the instructions and plug in the USB cable. Sometimes I get an error message “The critical error message detected…” but I ignore it and click OK.
If you look at the bottom right corner of the window it says Chip P/N SLG46620V. This message means the computer can see the IC and all is well with the board.

emulator Signal Generator menuUse the secondary (right) mouse button to click on the box labelled TP3 and a new context menu will open. Select “Signal Generator”. Repeat this step for the box labelled TP6.

Setting up the oscilloscope
Each oscilloscope is different but basically we will be taking two probes and connecting them to the first and second ports of the oscilloscope and having one probe control the X axis and the other control the Y axis.

We will be using pins 3 and 6 of the GreenPAK4 board. I have arbitrarily selected those pins to allow clearance for the oscilloscope probes. The only requirement is that the pin is not VDD or GND and that it can be configured as “Signal Generator”.

Your test probes should come with crocodile clips that connect to GND. Connect those to one of the two rows of 6 pins sticking out of the board. Both sets of pins are marked GND.

TP3 TP6Take the probe connected to the X axis of the oscilloscope and connect it to the white connector on the board marked TP3. Take the other probe and connect it to TP6. You should now have 4 connections from the oscilloscope – 2 probes connected to TP3 and TP6 and 2 crocodile clips connected to GND.

Creating the Lissajous patterns
Signal Wizard windowWe will generate two separate sine waves, one on each pin TP3 and TP6. When they are displayed on an oscilloscope screen they interfere with each other in interesting ways.

Using the main mouse button double click on the box labelled TP3 at which point a new window will open. This is the Signal Wizard window.
The Signal Wizard window can be divided into two parts:
The signal generator settings on the left and the signal display on the right.

If you look to the right (the signal display) you will see three graphs. The top is VDD and should not be altered under any circumstances. The middle graph is TP3 and the bottom graph is TP6.

Signal Wizard window smallClick on the middle graph (TP3) and make the following changes to the Signal Generator settings:
Type: Change from “Const. Voltage” to “Sine”
Amplitude: Change from “2750.6 mV” to “1650 mV”
Zero offset: Change from “2750.6 mV” to “1650 mV”
Period: Change from “1000 ms” to “30ms”
Double check all the settings and click “Apply”

Click on the bottom graph (TP6) and make the following changes to the Signal Generator settings:
Phase: Change from “0” to “3Pi/2”
Type: Change from “Const. Voltage” to “Sine”
Amplitude: Change from “2750.6 mV” to “1650 mV”
Zero offset: Change from “2750.6 mV” to “1650 mV”
Period: Change from “1000 ms” to “45ms”
Double check all the settings and click “Apply”

Nothing will change on the oscilloscope, this is expected.

Do not close the Signal Display window as we will be making changes shortly.

Emulation Active smallSwitch back to the Emulation window and click on “Emulation” on the right hand side. The “Emulation” and “Test mode” buttons will change colour to orange. Switch back to the Signal Display window and look at the bottom.

Signal Wizard Start Pause StopThere is a radio button marked “All” and three buttons marked “Start”, “Pause” and “Stop” respectively.
Click on “All” so the radio box is filled and then click on “Start”.

Oscilloscope CircleThe oscilloscope screen should now show a circle.
If you see an oval you can use the controls on the oscillator to make it the correct position and size.

On my oscilloscope the settings are:
A/Alt/Chop/Add/B: B
AC/DC/DTB/MTB/X Defl/AC/AUTO/DC: X Defl
A Position: Unused
B Position: Used to control Y (vertical) axis
Delay Time: 0:0
Level/Slope: Unused
X Pos: Used to control X (horizontal) axis
Ampl/Div: 0.5v
Time/Div: Off
Hold off: Unused
Trace Sep: Unused
AC/DC: DC
O: Off
Del’d TB: All off
Main TB: A

Once your oscilloscope is correctly showing a circle in the centre of the display we do not need to change any settings.

Lissajous 1We can now generate some Lissajous patterns.
To do this switch to the Signal Wizard window and click on the TP6 graph.

Lissajous patterns are created when there is a difference between the period of two sine waves. By adjusting the Period setting for TP6 we can generate our first one.
Change Period for TP6 to 15ms and click Apply.
This will give you a shape resembling a curved V. Not very exciting is it?
Let’s see it move then.
Change Period for TP6 to 15.10 ms and click Apply.
The lissajous figure will now be rotating.

By making a slight difference to Period we can control the speed of rotation.

Decent figures for TP6 can be found by using TP3/n where n is a whole number eg 2, 3, 4 et cetera.
For example TP6 = TP3/3 = 30/3 = 10ms gives a 3 pointed Lissajous pattern.
To see it move set TP6 to 10.1

After a while you will doubtless get frustrated with clicking “Apply” after every change. If you click on the box next to “Auto Apply” then changes are made simply by pressing the Enter key.

One of my favourite values for TP6 would be 30.1 ms, which is a slowly rotating circle. Make it faster by changing TP6 to 30.3 ms.

Go ahead and impress the people around you. At work use it to convince management you need a bunch of new tech toys, your wife that your kit is actually useful and your children that you are the cleverest person they know.

Secret Santa PHP script

Today I have knocked together a Secret Santa script in PHP.
It takes a list of names and email addresses and randomly assigns people then emails the Secret Santa with their person to buy for.

Feel free to use the script – and if you want to say thanks to me please click on an ad that interests you :)

Change the recipient list, message and you’re all set.

Permalink to the script: secretsanta.php

Merry Christmas
<?php
$santas = array(
array("Alexander 'Scrooge' User", "A.User@example.com"),
array("Barry 'Baubles' User", "B.User@example.com"),
array("Charles 'Tinsel' User", "C.User@example.com"),
array("Dominic 'Rudolph' User", "D.User@example.com"),
array("Ernest 'Humbug' User", "E.User@example.com"),
array("Ferdinand 'Elfie' User", "F.User@example.com"),
array("Georgina 'Santa's Little Helper' User", "G.User@example.com"),
array("Helena 'Born In A Barn' User", "H.User@example.com")
array("Isla 'Mulled Wine' User", "H.User@example.com")
);
$numsantas = count($santas);

$combos = array_fill(0, $numsantas, -1);

echo “There are $numsantas Secret Santas this year.\n”;

$fp = fopen(“santalist.txt”, “w”);
if($fp)
{
fwrite($fp, “Secret Santa Draw ” . date(“r”) . “\n\n”);
}

$x = -1;
foreach($santas as $name => $email)
{
$x++;
$valid = false;
while(!$valid)
{
$r = rand(0, $numsantas – 1);
if($r != $x && $combos[$r] == -1)
{
$combos[$r] = $x;
echo $santas[$x][0] . ” will be buying for ” . $santas[$r][0] . “\n”;
$to = “\”” . $santas[$x][0] . “\” <” . $santas[$x][1] . “>”;
$subject = “Your Secret Santa”;
$headers = “From: \”Your Name, Secret Santa Organiser\” <youremail@example.com>\r\n” .
“Reply-To: \”Your Name, Secret Santa Organiser\” <youremail@example.com>\r\n” .
“Cc: \”Your Name, Secret Santa Organiser\” <youremail@example.com>\r\n” .
“X-Mailer: PHP/” . phpversion();
$message = “Hello ” . $santas[$x][0] . “\r\n” .
“In the random drawing of Your Organisation’s Secret Santa you have been selected to buy a gift for (insert drumroll sound effect here)\r\n” .
$santas[$r][0] . “\r\n” .
“As the aim of this is to be a Secret Santa please do not tell anyone who you have purchased a gift for.\r\n” .
“Please limit the value of the gift to be £1 maximum, and be creative – there will be a prize for the most appropriate gift for the recipient.\r\n” .
“(The cost of wrapping should not be deducted from the gift value – newspapers are free)\r\n”;
mail($to, $subject, $message, $headers);
if($fp)
{
fwrite($fp, $santas[$x][0] . ” will be buying for ” . $santas[$r][0] . “\n”);
}
$valid = true;
}
}
}
if($fp)
{
fclose($fp);
}
?>

Logitech G510 G510s working under Ubuntu

Hi all
After many years with my Logitech G15 keyboard I had to replace the wire once too many times.

I bit the bullet and bought an upgrade, the Logitech G510.

I run Linux (Ubuntu) and I hoped that the G510 would be as straightforward as the G15 to work under Linux. I was wrong. It’s a pain.

After much searching of the internet I found somewhere that had code for the G510 so I amended it to allow me to alter the backlight colours on the fly.

Enjoy, the zip file is attached.
make; sudo make install;sudo g15daemon
Rather than figure out udev rules I prefer the following line in my crontab:
@reboot while true; do if [ “`pidof g15daemon`” == “” ]; then g15daemon; fi; sleep 1; done

If you create a file /.g15colors and give it 3 lines of content with a number on each line between 0 and 255 it will set the keyboard colour to that colour whenever you send
sudo kill -USR2 `pidof g15daemon`

For example:
sudo echo -e “127\n127\n255” > /.g15color
sudo kill -USR2 `pidof g15daemon`

g15daemonsrc

Pixels Movie Collectable Pixels Cup (cinema promotion) teardown and conversion to MAME arcade emulator

Yesterday I visited the cinema with my children (not to see Pixels oddly enough!).

In the foyer there was a section of the popcorn stand dedicated to the Pixels movie and selling tie in merchandise.

One of the items was a popcorn and drink combo in a collectable cup shaped like an arcade machine.

I purchased 3 of the combos (there were 3 different cup designs) and gave them to the children. One dropped the popcorn immediately all over the cinema floor (cue tears before the film even started) and we sat back to relax and watch the movie. It was Inside Out if you were curious.

At the end of the film I gathered all the cups up and took them home.

Today I had a look at the cups and was extremely surprised to find out that they are very well designed and built out of Polypropylene and are perfectly sized for mounting a small display to and attaching that display to a Raspberry Pi.

I have just done a teardown of one of the cups, it is not as I expected (just a sealed unit that contained drink) but actually a clipped together front and back and an inner drinks container much like a Thermos flask design.

This means that I can give the inner drinks containers to the children and hack away at the outer shell to my heart’s content.

Stay tuned as I progress.

Pixels Cups just waiting to be converted to a Mame arcade machine

Pixels Cups just waiting to be converted to a Mame arcade machine

Pixels Cups just waiting to be converted to a Mame arcade machine

Pixels Cups just waiting to be converted to a Mame arcade machine

Pixels Cups just waiting to be converted to a Mame arcade machine