Monday, 28 October 2019

bash - Execute a command if Linux is idle for 5 minutes

I would like to execute a command such as


 notify-send 'a'

if my Linux machine has been idle for 5 minutes.


By idle, I mean the same thing a screen saver that gets activated would use to define "idle".

vlc media player - Play two videos in sync as well as having seek in sync

I have two different videos. Now here's the thing, they have the same lengths, and they are related to each other. Is there a way that I can play these videos on at the same time using VLC and also have a unified seek bar, so that the times are the same for both, since one video is dependent on the other.

bash - Are my Linux symbolic links acting correctly?


I've been using Linux on and off for the last 15 years and today I came across something in bash that surprised me.


Setup the following directory structure:


$ cd /tmp
$ mkdir /tmp/symlinktest
$ mkdir /tmp/symlinktest/dir
$ mkdir /tmp/symlinktarget

Now create two sym links in symlinktest pointing to symlinktarget:


$ cd /tmp/symlinktest
$ ln -s ../symlinktarget Asym
$ ln -s ../symlinktarget Bsym

Now, in bash, the following tab completion does strange things. Type the following:


$ cd dir
$ cd ../A[TAB]

Pressing the tab key above completes the line to:


$ cd ../Asym/

as I expected. Now press enter to change into Asym and type:


$ cd ../B[TAB]

This time pressing the tab key completes the link to:


$ cd ../Bsym[space]

Note that there is now a space after the Bsym and there is no trailing slash.


My question is, why when changing from the physical directory "dir" to Asym it recognises that Asym is a link to a directory, but when changing from one sym link to another, it doesn't recognise that it's a link to a directory?


In addition, if I try to create a new file within Asym, I get an error message:


$ cd /tmp/symlinktest/Asym
$ cat hello > ../Bsym/file.txt
-bash: ../Bsym/file.txt: No such file or directory

I always thought that symlinks were mostly transparent except to programs that need to manipulate them. Is this normal behaviour?


Many thanks,


Andy



Answer



bash's cd builtin does a bit of magic with ...


When you do:


cd ../Bsym

It looks at $PWD, removes the last component, adds the Bsym component. This is what cd and cd -L do, as opposed to cd -P. Also see pwd -L and pwd -P.


When you do:


cat hello > ../Bsym/file.txt

This magic doesn't take place. $PWD isn't used, /proc/self/cwd is used instead. The cwd is an inode, and .. is just the parent inode, which happens to be /tmp.


windows 8.1 preview - Not receiving Toast Notifications. How to troubleshoot?


It's been about two weeks since upgrading to the Windows 8.1 Preview, and I haven't gotten a single toast from an app. There have been many restarts, and everything is up to date as far as Windows Update and the Store are concerned.


I used to get toasts from email, calendar, messaging, Skype, Xbox Live, etc. but I never get anything now, and I'm not sure how to troubleshoot.


I've tested email by making sure the program was running in the background and sending myself an email from a different address via webmail. I was never notified.


How can I troubleshoot this?



Answer



Just go to Settings charm / Change PC settings / Search & apps / Notifications and enable toast notifications for the relevant apps (toggle the setting if already enabled):


1


Windows Remote Desktop Connection for just a single window (or a single program)


Is it possible to have just one program running on the remote Windows machine appear in the local monitor, rather than the whole remote desktop?


I heard SeamlessRDP provides something like that but only for connecting from Linux to Windows. What should I use in the case of connecting from Windows to Windows?



Answer



This is a feature offered by Terminal Services RemoteApp on Windows Server 2008 and greater. However, your system administrator needs to set this up and publish the app for you.


A poor man's implementation of this would be to run a remote desktop session in a smaller-than-fullscreen window, then maximize the app you want inside that.


Is it possible to determine which version of windows XP goes with a licence key?

Is it possible to determine which version of windows XP goes with a licence key?


If so, how?


Full story. I got a windows xp licence key from MSDNAA while in college. I also got a Windows7 at the same time. I've only every used the Windows 7 and but now I'd like to use my XP key on a second box. I installed the box with a windows xp pro SP2 disk I had lying around, but it won't take the key.


Do I need an MSDNAA specific disk?
Should I try with XP Home?


I have some old OEM windows xp disks and keys but I've been told they will only work on Dell MoBo's (the computer is actually using a DELL HDD, DVD drive, and case, but the rest is new).

Is there software to tell what kind of hardware I have so I can find drivers for it?


Maybe I'm just lazy, but I really don't want to open this computer up and look. I'd like to know the type of wireless network card I have, but CPU-Z doesn't tell me. I need drivers for my wireless network card so the Device Manager just files it under Other Devices -> Network Controller.



Answer



You can use Device Manager to get the vendor and device IDs for the various PCI and USB devices on your system, and then a quick Google search will help you find the make and model.


How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...