Tag: How To

  • Adding products to Woocommerce

    First, log into your website at:

     

    yourwebsiteurl.com/wp-admin/

     

    Enter your username and password and you should be directed to your WordPress dashboard.

     

    First, we’ll upload some images to go with the products you’re adding today. On the left you will see Media:

     

    Screen-Shot-2016-03-04-at-10.02.25-AM

    Hover over it and you should see “Library” and “Add New”:

     

    Screen Shot 2016-03-04 at 10.03.51 AMClick “Add New”.

     

    Screen Shot 2016-03-04 at 10.04.21 AM

    Drag and drop some files in, or click “Select Files” and choose them from your file system. You will see the progress bars for each file below the selection area. Once all of the relevant media files are uploaded, look on the left for “Products” – hover over it and you should see “Add Product”:

     

    Screen Shot 2016-03-04 at 10.06.09 AM

    Click on that, and you’ll unsurprisingly be taken to the “New Product” screen.

     

    Screen Shot 2016-03-04 at 10.06.41 AM

    Here you can add the product name, choose the category it should appear in – you can pick multiple categories – and add the contents for the product page, including additional photos/videos. Add the text in the blank white box on the lower left, and add images/video/etc. with the “Add Media” button. Scrolling down you should see some more info you need to add:

     

    Screen-Shot-2016-03-04-at-10.07.42-AM

    Most of it is self-explanatory – you’ll need to set a product image that appears in the search results and category views, and click on the various tabs in the area with the red rectangle around it to add the various info there.

     

    Once you have done that, head back up to the top and click “Publish” to make the product live!

     

  • Rsync error when connecting to CentOS: rsync error: error in rsync protocol data stream (code 12) at io.c(600) [sender=3.0.6]

     

    We helped rebuild a backup VM which receives data over rsync today; the first rsync attempt failed with the vague error message:

     

    rsync error: error in rsync protocol data stream (code 12) at io.c(600) [sender=3.0.6]

     

    The problem ended up being that the rsync package was not installed. A simple:

     

    yum install rsync -y

     

    …fixed the problem and shortly the backups were back to normal.

  • Krita: Where are the curves?

     

    One of the most common things photographers use when it comes to editing images in Photoshop is the curves function. If you’re trying out Krita for the first time you may be looking for it – it’s in the following menu:

     

    Filter -> Adjust -> Brightness/Contrast curve

     

    The pop-up box should look familiar to those who have used curves in other editing applications:

     

    krita-brightness-and-contrast-curve-popup

     

  • How to install the NFS client packages on Fedora 20 and automatically mount NFS shares

     

    We were asked how to set up a Fedora 20 virtual machine to access folders on an already-set-up Ubuntu Server machine using NFS. A folder has been created on the Fedora VM to mount the NFS share to (/opt/documents in this case). First we install the relevant packages on Fedora:

     

    sudo yum install nfs-utils nfs-utils-lib

     

    Examine the package list, and if nothing looks awry hit Y to install. Now edit your fstab and add this line to the bottom to automount the shares:

     

    [ip.of.nfs.server]:[absolute-path-to-share] [absolute-path-to-fedora-mount-point] nfs auto 0 0

     

    e.g., in this example:

     

    10.1.1.3:/tank/documents /opt/documents nfs auto 0 0

     

    To break this down: the static IP address of the NFS server is 10.1.1.3, the path on the Ubuntu machine to the share is /tank/documents, and the created directory to mount the NFS share to is /opt/documents on the Fedora VM. To mount everything in fstab, run:

     

    mount -a

     

    Then navigate to the /opt/documents directory and check that you can read/write onto the NFS share correctly. Reboot the server to make sure everything works OK and you should be done!

  • How to check the shutter count or actuations of a Canon 5D Mark III (and other DSLRs) using Ubuntu Server

     

    First, we install the required packages:

     

    sudo apt-get install gphoto2 libgphoto2-6

     

    Once that’s done installing, plug in your camera via it’s USB port and check that it is visible to the system:

     

    lsusb

     

    You should see an output along the lines of:

    Bus 002 Device 002: ID 8087:8000 Intel Corp.
    Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 001 Device 002: ID 8087:8008 Intel Corp.
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 003 Device 008: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
    Bus 003 Device 007: ID 046b:ff31 American Megatrends, Inc.
    Bus 003 Device 006: ID 046b:ff40 American Megatrends, Inc.
    Bus 003 Device 005: ID 046b:ff20 American Megatrends, Inc.
    Bus 003 Device 004: ID 046b:ff10 American Megatrends, Inc. Virtual Keyboard and Mouse
    Bus 003 Device 002: ID 046b:ff01 American Megatrends, Inc.
    Bus 003 Device 009: ID 04a9:323a Canon, Inc.
    Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

    You may have less or a lot more, depending on your system and how many USB devices you have connected. Assuming you have no other Canon devices connected, the part you’re looking for will have Canon in the line – here:

     

    Bus 003 Device 009: ID 04a9:323a Canon, Inc.

     

    You can also check using the dmesg command – once you have connected the camera there will be output at the end similar to:

     

    [1798492.201275] usb 3-10: new high-speed USB device number 9 using xhci_hcd
    [1798492.218967] usb 3-10: New USB device found, idVendor=04a9, idProduct=323a
    [1798492.218975] usb 3-10: New USB device strings: Mfr=1, Product=2, SerialNumber=0
    [1798492.218980] usb 3-10: Product: Canon Digital Camera
    [1798492.218984] usb 3-10: Manufacturer: Canon Inc.

    Now we can run the following command:

     

    gphoto2 –get-config /main/status/shuttercounter

     

    You should then see the shutter count:

     

    Label: Shutter Counter
    Type: TEXT
    Current: 31791

     

    For this Canon 5D Mark III, the shutter count is 31,791. Lightly used!

     

    To see a list of supported cameras for this method, see:

     

    http://gphoto.org/proj/libgphoto2/support.php

     

  • How to install additional CentOS packages on XenServer 6.2

     

    While it is unsupported, it can sometimes be quite handy to install additional packages on your XenServer 6.2 system – things like vim, iptraf, perhaps even denyhosts. By default extra packages you wish to install are likely disabled, but using yum we can temporarily allow access to the CentOS packages. Logging in as root and using yum we can:

     

    yum –enablerepo=base –disablerepo=citrix install [packagename]
    As an example, using denyhosts:
    yum –enablerepo=base –disablerepo=citrix install denyhosts
    Doing this is totally unsupported and, depending on the package(s) installed may break the entire XenServer install – so experiment at your own risk!
  • How to delete the rest of a line after the cursor in vim?

     

    Vim has a host of really useful shortcuts; the one we are looking at today allows you to delete the text on the same line after the cursor position. To do this, move the cursor to the desired position and hit:

     

    shift+d

     

    In other words, a capital D. We don’t need a colon in front of it. This will delete the remainder of the line.

  • GIMP: How to save as .jpg and not .xcf?

     

    This is a question we get asked a lot from people who are trying out GIMP as a Photoshop alternative. If you hit Save or Save As, you are only presented with the option to save as a .xcf file. To save the image you are working on as a .jpg we need to export it instead:

     

    File->Export As

     

    You can use the following keyboard shortcut to do this:

     

    Shift+Ctrl+E

     

    Now you can save the image as a .jpg rather than the (usually unfamiliar to people trying it out) .xcf format.

  • XenServer 6.2: How to set up passthrough of a PCI or PCI-Express device

     

    This is done by logging in as the root user to your XenServer system via SSH. To see the PCI devices available to your system, enter the following command:

     

    lspci

     

    Here is an example result:

     

    00:00.0 Host bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890 Northbridge only dual slot (2×16) PCI-e GFX Hydra part (rev 02)
    00:00.2 IOMMU: Advanced Micro Devices, Inc. [AMD/ATI] RD990 I/O Memory Management Unit (IOMMU)
    00:02.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890 PCI to PCI bridge (PCI express gpp port B)
    00:09.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890 PCI to PCI bridge (PCI express gpp port H)
    00:0a.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890 PCI to PCI bridge (external gfx1 port A)
    00:0b.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890 PCI to PCI bridge (NB-SB link)
    00:0c.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890S PCI Express bridge for GPP2 port 1
    00:11.0 SATA controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 SATA Controller [AHCI mode]
    00:12.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
    00:12.1 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0 USB OHCI1 Controller
    00:12.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller
    00:13.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
    00:13.1 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0 USB OHCI1 Controller
    00:13.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller
    00:14.0 SMBus: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 SMBus Controller (rev 3d)
    00:14.1 IDE interface: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 IDE Controller
    00:14.3 ISA bridge: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 LPC host controller
    00:14.4 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 PCI to PCI Bridge
    00:14.5 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI2 Controller
    00:18.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 0
    00:18.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 1
    00:18.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 2
    00:18.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 3
    00:18.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 4
    00:18.5 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 5
    00:19.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 0
    00:19.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 1
    00:19.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 2
    00:19.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 3
    00:19.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 4
    00:19.5 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 5
    00:1a.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 0
    00:1a.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 1
    00:1a.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 2
    00:1a.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 3
    00:1a.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 4
    00:1a.5 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 5
    00:1b.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 0
    00:1b.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 1
    00:1b.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 2
    00:1b.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 3
    00:1b.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 4
    00:1b.5 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 5
    01:01.0 VGA compatible controller: ASPEED Technology, Inc. ASPEED Graphics Family (rev 10)
    01:03.0 Multimedia audio controller: C-Media Electronics Inc CMI8788 [Oxygen HD Audio]
    02:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
    03:00.0 Multimedia controller: Philips Semiconductors SAA7164 (rev 81)
    04:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
    05:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
    06:00.0 InfiniBand: Mellanox Technologies MT26418 [ConnectX VPI PCIe 2.0 5GT/s – IB DDR / 10GigE] (rev b0)

    As you might guess from some of the lines, it’s an AMD server. You’ll notice some USB controllers, likely a SATA controller and any PCI or PCI Express add-in cards (usually at the bottom). In this example we will pass through a digital TV card to a VM so we can record free-to-air TV. The controller here is the fourth-last entry:

     

    03:00.0 Multimedia controller: Philips Semiconductors SAA7164 (rev 81)

     

    It’s a Digital Now PCI-E card – as you can see there’s no mention of the brand in the chipset that the system can see, so you may have to make an educated guess (or do some research as to what’s actually used in the card) to determine which one you want. Making note of the above line, we now edit /boot/extlinux.conf:

     

    vi /boot/extlinux.conf

     

    In our example system it looks like this:

     

    # location mbr
    serial 0 115200
    default xe
    prompt 1
    timeout 50

    label xe
    # XenServer
    kernel mboot.c32
    append /boot/xen.gz mem=1024G dom0_max_vcpus=4 dom0_mem=4096M,max:4096M watchdog_timeout=300 lowmem_emergency_pool=1M crashkernel=64M@32M cpuid_mask_xsave_eax=0 console=vga vga=mode-0x0311 — /boot/vmlinuz-2.6-xen root=LABEL=root-ckwntldj ro xencons=hvc console=hvc0 console=tty0 quiet vga=785 splashi  — /boot/initrd-2.6-xen.img

    label xe-serial
    # XenServer (Serial)
    kernel mboot.c32
    append /boot/xen.gz com1=115200,8n1 console=com1,vga mem=1024G dom0_max_vcpus=4 dom0_mem=4096M,max:4096M watchdog_timeout=300 lowmem_emergency_pool=1M crashkernel=64M@32M cpuid_mask_xsave_eax=0 — /boot/vmlinuz-2.6-xen root=LABEL=root-ckwntldj ro console=tty0 xencons=hvc console=hvc0 — /boot/initrd-2.6-xen.img

    label safe
    # XenServer in Safe Mode
    kernel mboot.c32
    append /boot/xen.gz nosmp noreboot noirqbalance acpi=off noapic mem=1024G dom0_max_vcpus=4 dom0_mem=4096M,max:4096M com1=115200,8n1 console=com1,vga — /boot/vmlinuz-2.6-xen nousb root=LABEL=root-ckwntldj ro console=tty0 xencons=hvc console=hvc0 — /boot/initrd-2.6-xen.img

    label fallback
    # XenServer (Xen 4.1.5 / Linux 2.6.32.43-0.4.1.xs1.8.0.835.170778xen)
    kernel mboot.c32
    append /boot/xen-4.1.5.gz mem=1024G dom0_max_vcpus=4 dom0_mem=4096M,max:4096M watchdog_timeout=300 lowmem_emergency_pool=1M crashkernel=64M@32M cpuid_mask_xsave_eax=0 — /boot/vmlinuz-2.6.32.43-0.4.1.xs1.8.0.835.170778xen root=LABEL=root-ckwntldj ro xencons=hvc console=hvc0 console=tty0 — /boot/initrd-2.6.32.43-0.4.1.xs1.8.0.835.170778xen.img

    label fallback-serial
    # XenServer (Serial, Xen 4.1.5 / Linux 2.6.32.43-0.4.1.xs1.8.0.835.170778xen)
    kernel mboot.c32
    append /boot/xen-4.1.5.gz com1=115200,8n1 console=com1,vga mem=1024G dom0_max_vcpus=4 dom0_mem=4096M,max:4096M watchdog_timeout=300 lowmem_emergency_pool=1M crashkernel=64M@32M cpuid_mask_xsave_eax=0 — /boot/vmlinuz-2.6.32.43-0.4.1.xs1.8.0.835.170778xen root=LABEL=root-ckwntldj ro console=tty0 xencons=hvc console=hvc0 — /boot/initrd-2.6.32.43-0.4.1.xs1.8.0.835.170778xen.img

    Rather an intimidating-looking file if you’re new to *nix config files. Fortunately, we can ignore most of this and just pay attention to the last line in the “label xe” section at the top. The line we want to edit is:

     

    append /boot/xen.gz mem=1024G dom0_max_vcpus=4 dom0_mem=4096M,max:4096M watchdog_timeout=300 lowmem_emergency_pool=1M crashkernel=64M@32M cpuid_mask_xsave_eax=0 console=vga vga=mode-0x0311 — /boot/vmlinuz-2.6-xen root=LABEL=root-ckwntldj ro xencons=hvc console=hvc0 console=tty0 quiet vga=785 splashi  — /boot/initrd-2.6-xen.img

     

    Looking at the line we wanted from lspci above, we want the number at the front – in this case:

     

    03:00.0

     

    Add the following near the end of the config line – inbetween “splashi” and “—“:

     

    pciback.hide=(03:00.0)

     

    The line should now read:

     

      append /boot/xen.gz mem=1024G dom0_max_vcpus=4 dom0_mem=4096M,max:4096M watchdog_timeout=300 lowmem_emergency_pool=1M crashkernel=64M@32M cpuid_mask_xsave_eax=0 console=vga vga=mode-0x0311 — /boot/vmlinuz-2.6-xen root=LABEL=root-ckwntldj ro xencons=hvc console=hvc0 console=tty0 quiet vga=785 splashi pciback.hide=(03:00.0) — /boot/initrd-2.6-xen.img

    Note the space on either side – one between splashi and the new text and one between the hyphens and the new text. Now run:

     

    extlinux -i /boot

     

    Then shut down any VMs and reboot the server:

     

    reboot

     

    Once it is back up, we need to find the UUID of the virtual machine we want to pass the device through to. Run:

     

    xe vm-list

     

    This will return a result for every VM on the system – it might be quite long! If it is a long list you may wish to pipe it to the less command for easier viewing:

     

    xe vm-list | less

     

    If you aren’t familiar with less you can exit with the “q” key. Sort through the list until you find the VM you want to pass through to. In this example it is:

     

    uuid ( RO)           : 6b664553-6822-b445-5a8c-c10d93c41c4c
    name-label ( RW): bacchus
    power-state ( RO): halted

    Now we can add the PCI device to the config of this VM:

     

    xe vm-param-set other-config:pci=0/0000:03:00.0 uuid=6b664553-6822-b445-5a8c-c10d93c41c4c

     

    Breaking that down:

     

    xe vm-param-set other-config:pci=0/0000:[PCI address for the device] uuid=[UUID of VM]

     

    Starting the VM – in this case a Windows 7 VM – we can check for the device to see that it has appeared (in this case the drivers were already installed so it has been immediately identified):

     

    xenserver-passthrough-to-windows

    Success! In a Linux system you should be able to do:

     

    lspci

     

    to see the newly passed through hardware.

  • Gigabyte Brix: Which way up does the base plate attach?

     

    If you’ve taken off the Brix base plate and can’t remember which way was up originally (it attaches with the arrow pointing in two opposite directions…) here’s a picture which should help:

     

    gigabyte-brix-haswell-i5-4200-small-form-factor-which-way-does-the-lid-go-back-on

    The handle in the base should be on the rear side (the one with the most connections)!