Category: Uncategorised
November 9, 2023
Trouble setting up wireguard-ui in docker
[ Edit: fixed by adding UID, GID, and PEER env vars to the wireguard service: https://github.com/ngoduykhanh/wireguard-ui/issues/473#issuecomment-1793604986 ]
Following a guide to set-up wireguard and wireguard-ui: https://linuxiac.com/how-to-set-up-wireguard-vpn-with-docker/
Server created on DigitalOcean with IPv4 and IPv6 addresses by default.
Configured iptables as per the set-up guide (server also runs another docker based service that opens ports 80, 433, and 9993):
sysops@master-control:~/wireguard$ sudo iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy DROP) target prot opt source destination DOCKER-USER all -- anywhere anywhere DOCKER-ISOLATION-STAGE-1 all -- anywhere anywhere ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED DOCKER all -- anywhere anywhere ACCEPT all -- anywhere anywhere ACCEPT all -- anywhere anywhere ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED DOCKER all -- anywhere anywhere ACCEPT all -- anywhere anywhere ACCEPT all -- anywhere anywhere ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED DOCKER all -- anywhere anywhere ACCEPT all -- anywhere anywhere ACCEPT all -- anywhere anywhere ACCEPT all -- anywhere anywhere Chain OUTPUT (policy ACCEPT) target prot opt source destination Chain DOCKER (3 references) target prot opt source destination ACCEPT udp -- anywhere 172.
read more
February 3, 2023
Use Canon EOS 90D as a webcam for Google Meet / Skype / Zoom / etc on Linux Ubuntu 22.04 with nVidia hardware acceleration
Quick and dirty post that pulls together a couple of sources. I might improve the post at some point. I might not…
Initial set-up:
Source https://www.youtube.com/watch?v=TsuY4o2zLVQ
Additional code to specify which video device to create.
sudo apt update && sudo apt install gphoto2 v4l2loopback-utils ffmpeg echo 'dslr-webcam' | sudo tee -a /etc/modules echo <<EOT | sudo tee -a /etc/modprobe.d/dslr-webcam.conf alias dslr-webcam v4l2loopback options v4l2loopback exclusive_caps=1 max_buffers=2 video_nr=69 EOT Hardware acceleration set-up:
read more
October 15, 2021
New hardware, who dis?
New laptop provided by work. Time to install everything that makes me productive as a PHP developer.
Using Kubuntu 21.10 as my base OS.
General utilities:
sudo apt install \ openssh-server \ net-tools \ htop \ curl \ whois \ ack \ mysql-client \ httpie \ php-cli \ freerdp2-x11 \ meld \ kcachegrind \ vokoscreen-ng \ autokey-qt \ parlatype \ thunderbird-locale-en-gb \ libreoffice-calc \ libreoffice-writer \ libreoffice-draw \ cherrytree Snaps:
read more
October 6, 2021
old and busted: mysqldump, new hotness: mydumper
I’m late to the mydumper party - https://github.com/maxbube/mydumper
Multi-threaded, lightning quick, exports to files per table structure and data.
In the Ubuntu world (and likely Debian too) it’s available as a precompiled package: sudo apt update && sudo apt install mydumper
Backup everything in a database:
mydumper \ --triggers \ --routines \ --events \ --database name_of_source_database It’ll create a date stamped directory with two files for each table. One for the schema, the other with the data.
read more
April 23, 2021
How to call a static method in PHP when you have the class name in a variable
Wrap the variable (that holds the class name) in brackets:
<?php class A { public static function foo($arg) { return 'Argument was "' . $arg . '"' . PHP_EOL; } } $result = A::foo('triggered via named class'); echo $result; $className = A::class; $result = ($className)::foo('trigged via variable'); echo $result; The output of the above code:
$ php a.php Argument was "triggered via named class" Argument was "trigged via variable"
read more
December 18, 2020
I got locked out of a google compute instance due to ssh packets being dropped
Silly thing to happen really.
Some system on the instance detected too many connections in a short amount of time - likely due to some automated tasks driven by ansible.
That resulted in iptables dropping all connections to port 22 š
Thankfully, with google compute, one can access the serial console via the web UI.
Unfortunately, all of my users have no passwords - this is to ensure that ssh logins are via keypairs only.
read more
December 4, 2019
KDE Plasma likes, dislikes, and would be nice to haves
With each new release of Ubuntu, I’ve stuck with the default desktop environment. These have worked well for me over the years, but thought I should see what else there is.
The only way for me to do it justice is to run KDE Plasma as my only desktop environment for a minimum of 2 weeks. So both my work station and my personal laptop are use KDE Plasma installed alongside Gnome 3 Shell on Ubuntu 19.
read more
March 29, 2019
Embiggen .desktop loaded applications on Ubuntu
I keep forgetting the steps required for this, so thought I should write them up in one easy to remember blog post for myself.
My desktop set-up consists of 2 x 1080 and 1 x 4k display. Making sure that applications are readable is a bit of a farce.
But as long as I ensure that certain applications only ever appear on the correct monitor, means that I can alter the launcher to set the correct DPI scaling.
read more
June 4, 2018
Most amusing spam received to date
Good morning…
Do not consider on my English, I am from Iran.I installed the virus on your system.After that I pilfered all confidential info from your OS. Furthermore I received some more compromising evidence.The most interesting evidence which I thieftend- its a record with your self-abusing.I adjusted malicious software on a porn web site and after you installed it. As soon as you picked the video and pressed play, my software immediately set up on your OS.
read more
August 16, 2017
Upgrading Jenkins war file the quick and dirty way
jenkins-update.sh:
#!/bin/bash set -e if [ $# -eq 0 ]; then echo "New Jenkins version number missing" exit 1 fi VERSION=${1} set -x cd /usr/share/jenkins/ wget http://updates.jenkins-ci.org/download/war/${VERSION}/jenkins.war -O jenkins.war-${VERSION} rm jenkins.war && ln -s jenkins.war-${VERSION} jenkins.war service jenkins restart The above bash script will download a given version of the jenkins.war file and symlink it into place before restarting the jenkins service.
Assumptions made:
The jenkins.war file is installed to /usr/share/jenkins The server is using upstart for running services User input is sane - there is no validation or sanitisation Comments Matthew Morton says: 27th October 2017 at 10:24 pm
read more
Category: Programming
July 12, 2022
SQLSTATE[HY000]: General error: 1366 Incorrect string value: ā\xE2\x80\x8B\xE2\x80\x8Bā¦ā for column
If you get this (or similar) when trying to insert/update in a MySQL database, you table is not able to cope with the extended version of the UTF8 character set.
You will need to convert your table to use the utf8mb4 character set, and utf8mb4_unicode_ci collation.
An example to do so:
ALTER TABLE `your_table_here` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
read more
February 23, 2018
Unable to install sass gem on CentOS 6.9 with Ruby 2.4
Something changed recently, preventing a VM from fully provisioning. Tracking it down was a bit of a PiTA.
OS: CentOS 6.9
Ruby: 2.4 - installed from source with the gearlingguy.ruby ansible role
Gems to be installed: sass
Output of attempting to install the sass ruby gem:
$ sudo gem install sass
Fetching: rb-fsevent-0.10.2.gem (100%)
Successfully installed rb-fsevent-0.10.2
Fetching: ffi-1.9.21.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing sass:
ERROR: Failed to build gem native extension.
read more
February 6, 2013
Symfony2 pagination
Using Symfony2, DQL and knplabs/knp-paginator-bundle - how to get around “Cannot count query which selects two FROM components, cannot make distinction”
Fails:
Works:
read more
February 4, 2013
Making an entity repository container aware in Symfony2.1
I had a need to add ACL rules to entities at the repository level.
My biggest struggle was getting dependancy injection working.
This is what I finally came up with after a fresh mind and an instant coffee:
Comments KingCrunch says: 16th February 2013 at 11:30 am
If your EntityRepository needs to know about the DIC, you made it wrongā¦
Wessel says: 13th June 2013 at 12:03 pm
Mmm nice trick.
read more
June 24, 2012
Updating a WordPress database with new domain details
Further to my original quick db update queries, I found the need for a more in-depth approach.
A WordPress site my father works on has weekly backups, but he wanted to see that they actually worked.
To do so, I set up a subdomain vhost on my bytemark server and set about getting the back to work with it.
One of the most annoying/lazy/strange things about WordPress is that it uses serialised arrays within database fields.
read more
February 2, 2012
Symfony 1.4 Doctrine 1.2 MS SQL Server
Web server: Linux (Ubuntu on my dev setup), Apache, PHP 5.3, Symfony 1.4, Doctrine 1.2.
Database server: Microsoft Windows 2008 Server, MS SQL Server
Trying to get Symfony to talk to the database server has been a painful experience for the last few days. But perseverance has paid off.
Lots of Googling with trial & error has resulted in actually achieving a development setup that will mirror the eventual production setup.
read more
August 4, 2011
Fixing odd characters
One of the biggest complaints that webĀ developersĀ have is their lack of control over end users.
When will we be able to tell them a) not to paste Micosoft Word or b) if you must, paste it into something that doesn’t do formatting 1st.
It has a nasty habit of converting quotes into “smart” quotes as well as messing up characters such as the euro symbol ā¬.
This is the fix I came up with that allows end users to continue to paste from such programs and bring their weird charset issues with them:
read more
July 19, 2011
Downloading SoundCloud Playlists
[Update 21st Aug 2013
Post code replaced with a Github GIST.
Please fork and help improve this script š
[Updated 7th Feb 2012
Changes:
file names are now as they would be if you downloaded via web browser Playlist is now in reverse date uploaded order] I like to have music while I’m coding. It breaks the silence while working alone at home.
When I have music playing, it’s best if I don’t have to think about setting up playlists, which is why I used to listen to the radio.
read more
March 21, 2011
wp-block as a shortcode
In my last post I raved about the excellent plugin wp-blocks by Keir Whitaker and then went on to extend it a little.
Time to extend it a little further, this time by adding a shortcode.
Shortcodes are the handy square bracketed code snippets which conjure up more content and functionality direct from a page or post content.
The wp-blocks plugin is currently intended to work with the theme template files in PHP.
read more
March 18, 2011
Getting a random wp-block by regex
If you’re used to developing with a CMS such as CMS Made Simple, you would be quite used to having blocks of content separate from the main content system. These blocks can be re-used through-out existing content and within the theme templates.
One might even consider this a core function for a CMS. Sadly it’s missing from WordPress. Keir Whitaker has been working on this missing option and gives us wp-blocks.
read more
March 7, 2011
Mimicking wordpress.comās image resize URIs
To follow up from last night’s entry [Resize images on the fly without messing with image URLs]](/2011/03/07/resize-images-on-the-fly-without-messing-with-image-urls/), I was determined to remove the intermediary step of my_resize_script.php.
I’ve acheived this goal in the mod_rewrite rule, file name and query string now get passed on to timthumb.php.
Updated rules:
RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{REQUEST_URI} .(gif|png|jpg|jpeg) RewriteCond %{QUERY_STRING} (w|h)=(.*)$ RewriteRule (.*) /full/path/to/timthumb.php?src=$1&%1=%2&%3=%4 [L] This will pass both width and height variables into timthumb if they are declared.
read more
March 7, 2011
Resize images on the fly without messing with image URLs
[EDIT: I’ve made this simpler with a follow up post: Mimicking wordpress.comās image resize URIs]
Exporting a wordpress.com site for use on a standalone wordpress.org install is a joy to set up. The export and import system are simple to use and give little or no issues.
What is a problem is the automatic resizing of images that wordpress.com offers.
One can insert an image in the normal way and then append the image URI with some variables such as width (w) and height (h).
read more
March 3, 2011
Updating WordPress site URLs for different hosts
Why oh why does WordPress insist on storing the site URLs within the database?
Every other project I can think of either keeps it in a config file or doesn’t bother with one and just works with whatever URL it finds itself on.
This is most irritating when you have:
more than one developer working on the same project more than one system for hosting the project (dev, test, live, etc) One way to cope with this irritation is to have a collection of .
read more
October 17, 2010
How to get sfFormExtraPlugin working in Symfony 1.4 using Doctrine
I’m talking about this plugin: http://www.symfony-project.org/plugins/sfFormExtraPlugin
For some reason, getting the plugin to work took a lot of Googling and some trial and error.
So here is how I got it working. Hopefully I did this in the ‘correct’ way…
cd plugins wget "http://plugins.symfony-project.org/get/sfFormExtraPlugin/sfFormExtraPlugin-1.1.3.tgz" tar zxvf sfFormExtraPlugin-1.1.3.tgz mv sfFormExtraPlugin-1.1.3 sfFormExtraPlugin cd .. ./symfony plugin:publish-assets cd web/js wget "http://code.jquery.com/jquery-1.4.3.min.js" wget "http://jqueryui.com/download/jquery-ui-1.8.5.custom.zip" mkdir jquery-ui cd jquery-ui unzip ../jquery-ui-1.8.5.custom.zip mv jquery-ui/css/smoothness ../css</pre> Edit config/ProjectConfiguration.
read more
July 15, 2010
Which Windows applications are used by this web developer?
This list is partly to remind myself what essential apps need to be reinstalled after a system wipe.
But it does have me thinking, what do other web developers use on a daily basis?
Web browsers:
Google Chrome FireFox IE Opera Safari FireFox addons:
Adblock Plus British English Dictionary ColorZilla Dummy Lipsum Firebug Html Validator Web Developer Xmarks Code editing:
PhpEd Eclipse PDT TextPad vim Code tools:
SQLyog WinMerge System tools:
read more
July 4, 2010
Magento: pre filter by multiple option custom attributes
Requirement: pre-filter products by customer group name to product attribute.
I was looking for the “proper” way of filtering items by multiple custom attribute settings, but couldn’t find out how.
So, the following is a brief explanation of how I’ve got this running in Magento 1.4.1.
There are two ways of editing core code in Magento.
Wrong: edit files directly in app/code/core/Mage Right: extend modules and keep them in app/code/local/MyDevCompany If you’re in a hurry, you might edit core files directly and then later copy the altered code out into correctly extended module files.
read more
June 24, 2010
White space trim for JavaScript
I originally blogged about this on my other site lazygnome.net but that was simply a quick place to record it.
I present to you a very quick and handy way of replicating PHP’s trim() function in JS:
function ws_trim(value) { return value.replace(/(^s+|s+$)/g, ''); } There it is, simple and usable.
I don’t claim to be original with this code. I’m sure that others have done exactly the same themselves. But it surprises me that JS doesn’t come with such a text manipulation method by default.
read more
March 17, 2010
writeAttribute() example
The documentation on http://prototypejs.org/api/element/writeAttribute is a wee bit scarce. So here’s a quick one on usage.
To add an attribute:
$('foo').writeAttribute('title', 'bar'); To remove an attribute:
$('foo').writeAttribute('title', null); To enable all disabled form elements (in a form with the id ‘container’):
$('container').select('[disabled="disabled"]').each(function(e) { $(e).writeAttribute('disabled', null); });
read more
October 23, 2009
Please, somebody standadise the order of function variables
Finding a needle in a haystack is a wonderful bit of symbolism and I welcome its use in many situations.
It’s just the implementation of that symbolism that needs to be standardised. For forgetting the order in which a function expects variables to be passed in is tedious.
In PHP, for example, there are some very useful functions: in_array() and str_pos() to name but two.
Usage is in_array($needle, $haystack) and makes sense as you want to check that the needle is in the haystack.
read more
Category: Linux
November 30, 2021
Making my laptop screen less bright and reduce eye strain
Running Kubuntu on my 2018 DELL XPS 15 laptop is a joy, when I can reduce the brightness down to its minimum.
During daylight hours, the minimum is bright enough and saves on battery usage.
But during the evening, when I’m tired from staring at monitors all day long, I found that my eyes were begging me to stop using the laptop.
Using the brightness controls on the laptop’s keyboard causes the brightness to step up and down by distinct levels.
read more
May 14, 2020
Skype forgetting login details on Ubuntu
TLDR; Install gnome-keyring
If you are not using the default install of Ubuntu, you might not be using Gnome. This is the case for flavours such as: Kubuntu (KDE Plsama), Lubuntu (LXQt), Xubuntu (XFCE), and so on.
And if you have installed Skype using snap, then you will likely find that it will always ask you to login upon loading, even if you have it configured to automatically run at login.
read more
March 29, 2019
Embiggen .desktop loaded applications on Ubuntu
I keep forgetting the steps required for this, so thought I should write them up in one easy to remember blog post for myself.
My desktop set-up consists of 2 x 1080 and 1 x 4k display. Making sure that applications are readable is a bit of a farce.
But as long as I ensure that certain applications only ever appear on the correct monitor, means that I can alter the launcher to set the correct DPI scaling.
read more
June 12, 2018
apt-upgrade
I used to use a 2 command 1 liner to update my system:
sudo apt-get update && sudo apt-get dist-upgrade That was easy enough to type out now and then. But over time it grew to include removing and cleaning downloaded packages as well.
Then there’s the matter of knowing if an update requires a system restart.
The lazy me put it all into one bash script and made it globally accessible and executable:
read more
February 23, 2018
Unable to install sass gem on CentOS 6.9 with Ruby 2.4
Something changed recently, preventing a VM from fully provisioning. Tracking it down was a bit of a PiTA.
OS: CentOS 6.9
Ruby: 2.4 - installed from source with the gearlingguy.ruby ansible role
Gems to be installed: sass
Output of attempting to install the sass ruby gem:
$ sudo gem install sass
Fetching: rb-fsevent-0.10.2.gem (100%)
Successfully installed rb-fsevent-0.10.2
Fetching: ffi-1.9.21.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing sass:
ERROR: Failed to build gem native extension.
read more
November 25, 2017
Setting up an On-Premise instance of Amon
NewRelic no longer offers server monitoring for free accounts, so what are the alternatives when you’re on a skin-flint budget?
There are lots, but I’m not going to review any of them. Instead, I’ve been tasked with getting Amon running on a DigitalOcean droplet so that it might be appraised.
Amon can either be used as a SAAS, hosted by Amon themselves. Or it can be run “On-Premise” by cloning the git repo to your own server.
read more
May 7, 2016
Vagrant: sudo access and the hostsupdater plugin
Bringing up a vagrant machine is as easy as vagrant up.
If you’re a web developer, it would be nice if it were to add the private network IP address to /etc/hosts of the host machine. Thus giving you instant access to http://my-awesome-site.dev/
This doesn’t happen by default, but it is possible with the use of a plugin. The one I like to use is vagrant-hostsupdater.
Install thus:
vagrant plugin install vagrant-hostsupdater When you bring up the vagrant machine, it will now automatically add the VM’s name to /etc/hosts.
read more
February 17, 2013
Multi-screen with Ubuntu Unity
This tweet has to have been the most popular thing I have ever said. At time of posting it has gained 80 retweets, 25 favouritesĀ and many replies/questions.
Work recently bought me a new workstation, so the 1st thing I always do is to dual boot with Ubuntu.
Some might consider me an edge case user. Though as a developer, I like a ratherĀ particularĀ set-up. That is, 3 wide screen monitors with the central one rotated 90 degrees for my IDE.
read more
February 5, 2013
Chroot SFTP home dir
Example user ‘iain’
sudo mkdir -p /chroot/iain/home/iain sudo useradd -M -d /home/iain iain sudo passwd iain sudo chwon iain: /chroot/iain/home/iain sudo nano -w /etc/ssh/sshd_config # At the end of the file, add: Match User paypoint ChrootDirectory /chroot/iain AllowTCPForwarding no X11Forwarding no ForceCommand internal-sftp sudo /etc/init.d/ssh restart
read more
June 26, 2012
Ubuntu 12.04 LTS on Bytemark VM
If, like me, you can’t wait for Ubuntu 12.04.1 to be released, you can force an upgrade of your favourite OS OS.
sudo apt-get update; sudo do-release-upgrade -d If you are going from the previous LTS 10.04, then the -d is important. Otherwise there would be no upgrade to offer.
The upgrade process should go smoothly enough. Except for when it comes to the kernel.
Bytemark VM’s make use of kernels that sit outside of the VM itself.
read more
March 29, 2012
PPTP tunnels and if-up.d
Current project requires a couple of VPN tunnels to be set up. An IPsec and a PPTP.
The IPsec will wait for another day, the PPTP is set up and ready to go.
One thing that wasn’t quite right with the tunnel though, is the static route created by PPTP missed out a large chunk of the server’s network.
Starting the tunnel sets up the routing rule of 192.168.100.111 to be sent to the tunnel.
read more
February 2, 2012
Symfony 1.4 Doctrine 1.2 MS SQL Server
Web server: Linux (Ubuntu on my dev setup), Apache, PHP 5.3, Symfony 1.4, Doctrine 1.2.
Database server: Microsoft Windows 2008 Server, MS SQL Server
Trying to get Symfony to talk to the database server has been a painful experience for the last few days. But perseverance has paid off.
Lots of Googling with trial & error has resulted in actually achieving a development setup that will mirror the eventual production setup.
read more
November 18, 2011
Google calendar in Mozilla Thunderbird on Ubuntu 11.10
Via the Ubuntu Software Centre:
Search for thunderbird Click on the search result “Thunderbird Email” and then on the “More Info” button Enable at least the “Calendar Extension for Thunderbird - Google Calendar support (xul-ext-gdata-provider)” Install the add-ons Open your Google Calendar in your web browser In the left-hand column, under “My calendars”, hover over the calendar of choice and click the down arrow that appears after the calendar name Select “Calendar settings” Close to the bottom of the page will be the “Calendar ID” (in my case it is my full email address.
read more
July 27, 2011
Moving from Windows to Ubuntu
It’s finally happened.
I’ve become so fed up of Windows 7 freezing while I’m working that my workstation now runs Ubuntu 11.04.
I would have done it a long time ago, except the lack of hardware compatibility kept putting me off.
That said, there are 2 final hardware items that I need to cater for.
DisplayLink USB graphics adaptor for my 3rd monitor. Skype ATA device so I can use my desk phone with the Skype Out number.
read more
May 21, 2010
upstart failing to manage mysqld on Ubuntu 10.04
Installed Ubuntu 10.04 from ISO onto a blank virtual box machine.
All worked well for a while, until I recently did an aptitude safe-upgrade.
The next time I booted the system, mysql failed to start and refused to do so when I issued: sudo service mysql start
It would just hang there.
Tracked the issue down to this bug. How I maged to get it to work:
In a terminal:
read more
Category: Computers
June 12, 2018
apt-upgrade
I used to use a 2 command 1 liner to update my system:
sudo apt-get update && sudo apt-get dist-upgrade That was easy enough to type out now and then. But over time it grew to include removing and cleaning downloaded packages as well.
Then there’s the matter of knowing if an update requires a system restart.
The lazy me put it all into one bash script and made it globally accessible and executable:
read more
February 23, 2018
Unable to install sass gem on CentOS 6.9 with Ruby 2.4
Something changed recently, preventing a VM from fully provisioning. Tracking it down was a bit of a PiTA.
OS: CentOS 6.9
Ruby: 2.4 - installed from source with the gearlingguy.ruby ansible role
Gems to be installed: sass
Output of attempting to install the sass ruby gem:
$ sudo gem install sass
Fetching: rb-fsevent-0.10.2.gem (100%)
Successfully installed rb-fsevent-0.10.2
Fetching: ffi-1.9.21.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing sass:
ERROR: Failed to build gem native extension.
read more
February 17, 2013
Multi-screen with Ubuntu Unity
This tweet has to have been the most popular thing I have ever said. At time of posting it has gained 80 retweets, 25 favouritesĀ and many replies/questions.
Work recently bought me a new workstation, so the 1st thing I always do is to dual boot with Ubuntu.
Some might consider me an edge case user. Though as a developer, I like a ratherĀ particularĀ set-up. That is, 3 wide screen monitors with the central one rotated 90 degrees for my IDE.
read more
February 5, 2013
Chroot SFTP home dir
Example user ‘iain’
sudo mkdir -p /chroot/iain/home/iain sudo useradd -M -d /home/iain iain sudo passwd iain sudo chwon iain: /chroot/iain/home/iain sudo nano -w /etc/ssh/sshd_config # At the end of the file, add: Match User paypoint ChrootDirectory /chroot/iain AllowTCPForwarding no X11Forwarding no ForceCommand internal-sftp sudo /etc/init.d/ssh restart
read more
June 26, 2012
Ubuntu 12.04 LTS on Bytemark VM
If, like me, you can’t wait for Ubuntu 12.04.1 to be released, you can force an upgrade of your favourite OS OS.
sudo apt-get update; sudo do-release-upgrade -d If you are going from the previous LTS 10.04, then the -d is important. Otherwise there would be no upgrade to offer.
The upgrade process should go smoothly enough. Except for when it comes to the kernel.
Bytemark VM’s make use of kernels that sit outside of the VM itself.
read more
June 24, 2012
Updating a WordPress database with new domain details
Further to my original quick db update queries, I found the need for a more in-depth approach.
A WordPress site my father works on has weekly backups, but he wanted to see that they actually worked.
To do so, I set up a subdomain vhost on my bytemark server and set about getting the back to work with it.
One of the most annoying/lazy/strange things about WordPress is that it uses serialised arrays within database fields.
read more
March 29, 2012
PPTP tunnels and if-up.d
Current project requires a couple of VPN tunnels to be set up. An IPsec and a PPTP.
The IPsec will wait for another day, the PPTP is set up and ready to go.
One thing that wasn’t quite right with the tunnel though, is the static route created by PPTP missed out a large chunk of the server’s network.
Starting the tunnel sets up the routing rule of 192.168.100.111 to be sent to the tunnel.
read more
February 2, 2012
Symfony 1.4 Doctrine 1.2 MS SQL Server
Web server: Linux (Ubuntu on my dev setup), Apache, PHP 5.3, Symfony 1.4, Doctrine 1.2.
Database server: Microsoft Windows 2008 Server, MS SQL Server
Trying to get Symfony to talk to the database server has been a painful experience for the last few days. But perseverance has paid off.
Lots of Googling with trial & error has resulted in actually achieving a development setup that will mirror the eventual production setup.
read more
November 18, 2011
Google calendar in Mozilla Thunderbird on Ubuntu 11.10
Via the Ubuntu Software Centre:
Search for thunderbird Click on the search result “Thunderbird Email” and then on the “More Info” button Enable at least the “Calendar Extension for Thunderbird - Google Calendar support (xul-ext-gdata-provider)” Install the add-ons Open your Google Calendar in your web browser In the left-hand column, under “My calendars”, hover over the calendar of choice and click the down arrow that appears after the calendar name Select “Calendar settings” Close to the bottom of the page will be the “Calendar ID” (in my case it is my full email address.
read more
July 15, 2010
Which Windows applications are used by this web developer?
This list is partly to remind myself what essential apps need to be reinstalled after a system wipe.
But it does have me thinking, what do other web developers use on a daily basis?
Web browsers:
Google Chrome FireFox IE Opera Safari FireFox addons:
Adblock Plus British English Dictionary ColorZilla Dummy Lipsum Firebug Html Validator Web Developer Xmarks Code editing:
PhpEd Eclipse PDT TextPad vim Code tools:
SQLyog WinMerge System tools:
read more
May 21, 2010
upstart failing to manage mysqld on Ubuntu 10.04
Installed Ubuntu 10.04 from ISO onto a blank virtual box machine.
All worked well for a while, until I recently did an aptitude safe-upgrade.
The next time I booted the system, mysql failed to start and refused to do so when I issued: sudo service mysql start
It would just hang there.
Tracked the issue down to this bug. How I maged to get it to work:
In a terminal:
read more
March 25, 2010
Sharing Nexus One internet connection with Ubuntu
Just a quicky…
Using the guide from here, I’ve managed to use the ’net connection of my Nexus One with my Eee PC running Ubuntu Netbook Remix.
Speed tests… Nexus One using Wi-Fi and home cable:
Nexus One using 3G in the Telford & Wrekin region:
read more
February 12, 2010
When MySQL servers go weird
The MySQL PASSWORD() function has started giving a different value on a client’s live server compared to local development servers.
This has resulted in end users not being able to log in when PASSWORD()` is used to compare the stored and entered passwords.
Why this has happened I have no idea. Any thoughts?
dev mysql> SELECT PASSWORD('foobar'); +-------------------------------------------+ | PASSWORD('foobar') | +-------------------------------------------+ | *9B500343BC52E2911172EB52AE5CF4847604C6E5 | +-------------------------------------------+ 1 row in set (0.
read more
November 11, 2009
Installing Boxee on Ubuntu 9.10 on Acer Aspire Revo R3600
This is on myrant.net rather than my other blog on lazygnome.net as it wasn’t as quick and easy as I’d have liked to set up. So, in a way, a very tiny rant with a lot of helpful content (I hope).
Inspiration for this article came from following Popey’s setup instructions with Ubuntu 9.10 alpha.
Download Ubuntu 9.10 32bit desktop ISO: http://www.ubuntu.com/getubuntu/download a) if you have an external CD drive, burn the ISO to a CD.
read more
October 1, 2009
Give me back my focus!
Applications which steal input focus are pure scum.
The only times that a new window should take focus are:
application launched by the user. alert box instigated by the application currently with focus. Whilst I’m coding in an editor, I do NOT want the virus scanner to pop up to say its finished running and expect me to care at that time.
read more
Category: Uncategorized
June 6, 2015
Basic set-up of a 3com 4500 managed network switch
I’m a PHP developer by trade with a strong Linux background. One thing that has been lacking from my skill set is how networking really works.
In an effort to rectify this, I bought myself a 2nd hand managed network switch from ebay. A 26 port (24 x 10/100mb + 2 x 1gb) “3com SuperStack 3 Switch 4500”.
Flashing lights and noisy fans, I feel like I’m headed in the right direction.
read more
April 27, 2015
Vagrant hostsupdater plugin without having to enter your sudo password
Vagrant - Great
Hosts Updater plugin - very handy
Having to enter your sudo password when the plugin edits your hosts file - really annoying.
I finally got around to addressing this on my dev system. Looking at the plugin source there are two sudo commands that we need to cater for. One to add hosts and one to remove.
Adding the following to my sudoers file worked a treat:
read more
November 23, 2009
Getting your news when it has become olds
When something really note worthy happens, I usually don’t go longer than a few days without knowing.
But, for some reason, I just learnt about something that happened 19 March 2008.
Only by reading this comic in this book did I learn of Arther C. Clarke’s passing. This is particularly shocking as Arthur C. Clarke was the main author of the books I read in my childhood.
You’d have thought that it would have been bigger news.
read more
November 9, 2009
Fireworks ā fun or explosives for all?
[this is a bit of a random rant, excuse me whilst I ramble]
Every year, the sale of fireworks seems to come earlier and earlier.
In the UK, we used to use them on the 5th November (or the closest weekend). Now they seem to be in use from the 30th October to mid November. And then over the whole Christmas period.
When in the right hands, they can be great fun.
read more
Category: Symfony
February 6, 2013
Symfony2 pagination
Using Symfony2, DQL and knplabs/knp-paginator-bundle - how to get around “Cannot count query which selects two FROM components, cannot make distinction”
Fails:
Works:
read more
February 4, 2013
Making an entity repository container aware in Symfony2.1
I had a need to add ACL rules to entities at the repository level.
My biggest struggle was getting dependancy injection working.
This is what I finally came up with after a fresh mind and an instant coffee:
Comments KingCrunch says: 16th February 2013 at 11:30 am
If your EntityRepository needs to know about the DIC, you made it wrongā¦
Wessel says: 13th June 2013 at 12:03 pm
Mmm nice trick.
read more
October 3, 2012
Adding extra fields to FOSUserBundle / SonataUserBundle
Sadly, this isn’t really documented (at time of writing).
Adding new protected variables to your User.php entity will not actually create database entries when you try to do a doctrine:schema:update.
While one still needs to have the protected variables in this entity class, along with getters and setters, the actual creation work is within UserBundle/Resources/config/doctrine/User.orm.xml
Here is an example for adding a foreign key:
<?xml version="1.0" encoding="UTF-8"?> <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.
read more
February 2, 2012
Symfony 1.4 Doctrine 1.2 MS SQL Server
Web server: Linux (Ubuntu on my dev setup), Apache, PHP 5.3, Symfony 1.4, Doctrine 1.2.
Database server: Microsoft Windows 2008 Server, MS SQL Server
Trying to get Symfony to talk to the database server has been a painful experience for the last few days. But perseverance has paid off.
Lots of Googling with trial & error has resulted in actually achieving a development setup that will mirror the eventual production setup.
read more
October 17, 2010
How to get sfFormExtraPlugin working in Symfony 1.4 using Doctrine
I’m talking about this plugin: http://www.symfony-project.org/plugins/sfFormExtraPlugin
For some reason, getting the plugin to work took a lot of Googling and some trial and error.
So here is how I got it working. Hopefully I did this in the ‘correct’ way…
cd plugins wget "http://plugins.symfony-project.org/get/sfFormExtraPlugin/sfFormExtraPlugin-1.1.3.tgz" tar zxvf sfFormExtraPlugin-1.1.3.tgz mv sfFormExtraPlugin-1.1.3 sfFormExtraPlugin cd .. ./symfony plugin:publish-assets cd web/js wget "http://code.jquery.com/jquery-1.4.3.min.js" wget "http://jqueryui.com/download/jquery-ui-1.8.5.custom.zip" mkdir jquery-ui cd jquery-ui unzip ../jquery-ui-1.8.5.custom.zip mv jquery-ui/css/smoothness ../css</pre> Edit config/ProjectConfiguration.
read more
Category: WordPress
June 24, 2012
Updating a WordPress database with new domain details
Further to my original quick db update queries, I found the need for a more in-depth approach.
A WordPress site my father works on has weekly backups, but he wanted to see that they actually worked.
To do so, I set up a subdomain vhost on my bytemark server and set about getting the back to work with it.
One of the most annoying/lazy/strange things about WordPress is that it uses serialised arrays within database fields.
read more
March 21, 2011
wp-block as a shortcode
In my last post I raved about the excellent plugin wp-blocks by Keir Whitaker and then went on to extend it a little.
Time to extend it a little further, this time by adding a shortcode.
Shortcodes are the handy square bracketed code snippets which conjure up more content and functionality direct from a page or post content.
The wp-blocks plugin is currently intended to work with the theme template files in PHP.
read more
March 18, 2011
Getting a random wp-block by regex
If you’re used to developing with a CMS such as CMS Made Simple, you would be quite used to having blocks of content separate from the main content system. These blocks can be re-used through-out existing content and within the theme templates.
One might even consider this a core function for a CMS. Sadly it’s missing from WordPress. Keir Whitaker has been working on this missing option and gives us wp-blocks.
read more
March 7, 2011
Mimicking wordpress.comās image resize URIs
To follow up from last night’s entry [Resize images on the fly without messing with image URLs]](/2011/03/07/resize-images-on-the-fly-without-messing-with-image-urls/), I was determined to remove the intermediary step of my_resize_script.php.
I’ve acheived this goal in the mod_rewrite rule, file name and query string now get passed on to timthumb.php.
Updated rules:
RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{REQUEST_URI} .(gif|png|jpg|jpeg) RewriteCond %{QUERY_STRING} (w|h)=(.*)$ RewriteRule (.*) /full/path/to/timthumb.php?src=$1&%1=%2&%3=%4 [L] This will pass both width and height variables into timthumb if they are declared.
read more
March 7, 2011
Resize images on the fly without messing with image URLs
[EDIT: I’ve made this simpler with a follow up post: Mimicking wordpress.comās image resize URIs]
Exporting a wordpress.com site for use on a standalone wordpress.org install is a joy to set up. The export and import system are simple to use and give little or no issues.
What is a problem is the automatic resizing of images that wordpress.com offers.
One can insert an image in the normal way and then append the image URI with some variables such as width (w) and height (h).
read more
March 3, 2011
Updating WordPress site URLs for different hosts
Why oh why does WordPress insist on storing the site URLs within the database?
Every other project I can think of either keeps it in a config file or doesn’t bother with one and just works with whatever URL it finds itself on.
This is most irritating when you have:
more than one developer working on the same project more than one system for hosting the project (dev, test, live, etc) One way to cope with this irritation is to have a collection of .
read more
Category: Magento
July 4, 2010
Magento: pre filter by multiple option custom attributes
Requirement: pre-filter products by customer group name to product attribute.
I was looking for the “proper” way of filtering items by multiple custom attribute settings, but couldn’t find out how.
So, the following is a brief explanation of how I’ve got this running in Magento 1.4.1.
There are two ways of editing core code in Magento.
Wrong: edit files directly in app/code/core/Mage Right: extend modules and keep them in app/code/local/MyDevCompany If you’re in a hurry, you might edit core files directly and then later copy the altered code out into correctly extended module files.
read more
Category: Television
November 11, 2009
Installing Boxee on Ubuntu 9.10 on Acer Aspire Revo R3600
This is on myrant.net rather than my other blog on lazygnome.net as it wasn’t as quick and easy as I’d have liked to set up. So, in a way, a very tiny rant with a lot of helpful content (I hope).
Inspiration for this article came from following Popey’s setup instructions with Ubuntu 9.10 alpha.
Download Ubuntu 9.10 32bit desktop ISO: http://www.ubuntu.com/getubuntu/download a) if you have an external CD drive, burn the ISO to a CD.
read more
October 10, 2009
Why am I enjoying this?
Strictly Come Dancing has never been the sort of programme to hold my attention.
But whilst I’m keeping my darling girlfriend company, I seem to be distracted from my laptop by the show.
The audience annoys me with their reaction to the judges. Bruce annoys me for having lost it years ago. But everybody else annoys me for humouring the old fool.
Yes, I’m getting old.
read more