Clipdiary clipboard manager for Windows

Clipdiary is a full featured clipboard manager for Windows.

  • It can be installed it from here.

  • It does what any clipboard manager should: storing the previous clipboard entries as a list. You can pick any older clipboard entry and paste it back.

  • It adds on many keyboard shortcuts, which I don’t actually require. So, I delete all of them.

  • I like that if I minimize or close its window, it sticks around in the system tray. That is good default behavior for a clipboard manager.

  • It is a paid software, that you can try for 30 days. But, it is free for personal use if you register for a Personal License within 30 days. To do that go to Help → Activate Free.

Tried with: Clipdiary 5.1 and Windows 10

Advertisements

How to find version of Windows

To find out the exact version of Windows you are using open the winver program. You can type this command at the Start menu or at the command prompt too. It opens up a dialog showing the Windows version and build number.

Tried with: Windows 10 Enterprise

How to export a registry entry to file

The reg program can be used to operate on the Windows registry from the command-line. Exporting registry entries is one of the tasks it can perform. Exporting registry entries is useful to save settings to a file and restoring or importing those settings on a different computer.

To export a registry entry, provide its registry path and an output filename. For example, to export the settings of the PuTTY program I used this invocation:

reg export HKEY_CURRENT_USER\Software\SimonTatham\PuTTY putty.reg

This exported the entries to the putty.reg registry entry file.

There is also a program from NirSoft called RegFileExport that offers to do this job. But I found that it did not work for me. It probably only works on offline registry hives.

Tried with: Windows 10 Enterprise

Arrow keys not working in tmux from PuTTY

Problem

I SSH into a Ubuntu computer from a Windows computer using PuTTY. I run tmux (actually byobu which runs tmux underneath) and at a shell inside tmux I find that the left and right arrow keys do not work. They are actually detected as shift+left and shift+right arrow keys inside tmux.

Solution

This problem has been discussed here. One of the suggested solutions was to add set enable-keypad on to ~/.inputrc. That did not seem to work for me.

However, the above bug report also mentioned that this was a bug in tmux and it was fixed in tmux 2.4. So, I used this tmux PPA and updated the tmux 2.1 shipping in Ubuntu 16.04 to a tmux 2.6. The arrow key problem disappeared.

How to always run a program as Administrator in Windows 10

When you first run a GUI program that requires Administrator privileges, Windows 10 will show a dialog prompting you to give it that privilege. Subsequently, that executable or shortcut gets the “Run as Administrator” privilege. Executables and shortcuts that have this privilege will get a shield (🛡️) icon added to the bottom-right of their icon.

However, if you run a command-line program that requires Administrator privileges, it will silently fail. Windows 10 will not show the dialog prompting you to give the program that privilege, like it did with GUI programs.

So, for command-line programs that need such Administrator privilege, right-click on their icon and choose Properties. Choose the Compatibility tab → Settings and enable the “Run this program as an administrator” setting and click OK. You will notice that the command-line program now gets a shield (🛡️) icon added at the bottom-right of its icon. You will now get prompted for administrator privileges when this command-line program is executed at the command prompt.

How to play ARF file on Linux

Problem

Cisco Webex stores its video recordings as ARF files with extension .arf. I wanted to play such recordings on Linux.

Solution

No solution is working right now

There is a converter to MP4 provided by Webex here. I downloaded the nbr2mp4.tar file and unpacked it.

  • I ran the nbr2mp4.sh script to unzip the files.
$ cd nbr2_mp4
./nbr2mp4 file.arf

This did not output any MP4 file.

  • The NBR player too did not work:
$ ./nbr_play file.arf
nbr_play: error while loading shared libraries: libgtk-x11-2.0.so.0: wrong ELF class: ELFCLASS64

Perforce cheatsheet

Perforce is a version control system. p4 is its primary commandline tool. p4g is its GUI tool. The reference for all this is the p4 command reference.

  • To get help on any p4 command named foobar:
$ p4 help foobar
  • To list all depots:
$ p4 depots
  • To view info about your workspace:
$ p4 info
  • To view all workspaces of all users:
$ p4 clients
  • To view or change the specification of your current client:
$ p4 client

You typically use this command to add new branches or paths from the depot to your directory view.

  • To sync all the latest branches and paths of your client from the depot:
$ p4 sync
  • To list (and not actually sync) the unsynced files between workspace and depot:
$ p4 sync -n
  • To sync only a specific directory or file use its depot path:
$ p4 sync //dev/foo/some.cpp

Changelist

A changelist has a number that identifies it, a list of modified files and a description. When you inform Perforce that you have created a file, deleted a file or modified a file, such files are by default added to a default changelist that has no changelist number.

  • To create a changelist with the files in the current default changelist:
$ p4 change

This opens your default editor to a temporary text file showing an empty description and the list of files from the default changelist. You have to use the editor and provide a description. If you do not want some of the files to be in the changelist you are creating, you can delete those lines in the editor. Once you save the file, the changelist is created with a unique number. After a changelist is created, p4 prints out its changelist number, say 123456.

  • To add a new file to an existing changelist 123456:
$ p4 reopen -c 123456 joe/foobar.cpp
  • To edit the description of an existing changelist 123456:
$ p4 change -u 123456
  • To view the description of a changelist:
$ p4 describe 123456
  • To view all the details of an existing changelist 123456:
$ p4 change -o 123456
  • To shelve the files in a changelist:
$ p4 shelve -c 123456
  • To update a shelved changelist 123456 with newly updated files from disk:
$ p4 shelve -f -c 123456
  • To update a shelved file with newly changed file from disk:
$ p4 shelve -f -c 123456 foobar.cpp
  • To unshelve the files that were shelved from a changelist 123456 back to the same changelist:
$ p4 unshelve -s 123456 -c 123456
  • To unshelve the files that were shelved from a changelist 123456 back to a different changelist 789012:
$ p4 unshelve -s 123456 -c 789012
  • To unshelve the files that were shelved from a changelist 123456 back to the default changelist:
$ p4 unshelve -s 123456
  • To delete the shelved files of a changelist:
$ p4 shelve -d -c 123456
  • To submit a changelist 123456 to your branch in the depot:
$ p4 submit -c 123456
  • To create a changelist from the default changelist and submit it to your branch in the depot:
$ p4 submit

Log

  • To view all the changelists from the server:
$ p4 changes

This will list all changelists of everybody, so it is pretty much useless. You want to filter it down using other criteria, like shown below.

  • To view all the changelists of a particular depot:
$ p4 changes //somedepot/
  • To view all the changelists of a particular branch in a depot:
$ p4 changes //somedepot/somebranch/
  • To view the most recent 5 changelists added to the server:
$ p4 changes -m5
  • To view the changelists added by a particular user:
$ p4 changes -u joe
  • By default, a single truncated line of information is shown for each changelist. To view a more detailed description of each changelist:
$ p4 changes -l
  • To view the changelists of a particular status, say pending:
$ p4 changes -s pending
  • To add a new file, either cause you want to create a new file or add an existing file to be tracked by version control:
$ p4 add foobar.txt

If it is a new file, then you will need to create the file yourself after this command. This command just indicates to p4 to start tracking such a file.

  • To delete a file:
$ p4 delete foobar.txt
  • To open a file for editing:
$ p4 edit foobar.txt
  • To revert a specific file or all files in directory with versions from depot:
$ p4 revert foobar.txt
$ p4 revert ...
$ p4 revert src/...

Note that you will lose changed made your files on disk with this operation. This operation can be used after shelving a changelist to revert the files back to their original state.

  • To revert back only unchanged (but opened) files:
$ p4 revert -a
  • To view the currently changed files as seen by p4:
$ p4 opened
$ p4 opened ...
$ p4 opened src/...

File information

  • To view the changelist of a file:
$ p4 changes //somedepot/somepath/foobar.txt
  • To view the log of a file:
$ p4 filelog //somedepot/somepath/foobar.txt
  • To see a beautiful timelapse view of file history, it is better to view it in p4g by right-clicking the file and choosing Timelapse view. The color of the lines show their age and the slider can be used to move through history.

  • To print all the lines of a file:

$ p4 print //somedepot/somepath/foobar.txt
  • To print the revision numbers of every line of a file:
$ p4 annotate //somedepot/somepath/foobar.txt
  • To print changelists for every line of a file:
$ p4 annotate -c //somedepot/somepath/foobar.txt
  • To print the user who last changed every line of a file:
$ p4 annotate -u //somedepot/somepath/foobar.txt

Diff

  • To view the diff of all currently open files:
$ p4 diff

This prints a text diff at the shell by default. If you set the P4DIFF environment variable to a GUI program, like Meld, it will use that to show the diffs.

  • To view the diff of opened files that are actually changed:
$ p4 diff -sa
  • To diff two files in the depot:
$ p4 diff2 //branch1/some.cpp //branch2/some.cpp

This prints a diff at the shell. Set the P4DIFF2 environment variable to a GUI diff program to view the diff using that.

Branch

To create a new branch from an old branch, there are typically 3 steps:

First, create the branch:

$ p4 integrate //foo/old_branch/... //foo/new_branch/...

Now the branch is created, but you cannot yet view the files in the new branch in your filesystem.

Second, change the client specification add the new branch files to your view and sync:

$ p4 client
$ p4 sync

Finally, submit the new branch to depot:

$ p4 submit //foo/new_branch/...

Merge

  • To merge, resolve automatically and finally only resolve merge conflicts manually:
$ p4 integrate //foo/from_branch/... //foo/my_branch/...
$ p4 resolve -a
$ p4 resolve
  • After an integrate, show what files cannot be resolved automatically:
$ p4 resolve -n
  • Integrate a specific changelist 123456 from one branch to another:
$ p4 integrate from_branch/...@=123456 to_branch/...
$ p4 resolve to_branch/...
$ p4 change

Perforce sync clobber writable error

Problem

I was trying to sync a Perforce client and got this error:

$ p4 sync
Can't clobber writable file: /home/joe/p4_workspace/foobar.txt

Solution

Perforce keeps its files read-only until they are opened for editing. I had for some reason made this file writeable and Perforce was complaining about that with this error message.

The error was fixed and the sync worked once I made the file read-only:

$ chmod -w /home/joe/p4_workspace/foobar.txt

Perforce sync write permission error

Problem

I tried to sync a Perforce client and got this error:

$ p4 sync
open for write: /home/joe/p4_workspace/foobar/tmp.30935.46: Permission denied

The strange thing is that there is no tmp.30935.46 in this repository!

Solution

Turns out that Perforce writes some temporary files to subdirectories during the sync operation. This error indicates that it is failing in this write because the directory does not have write permissions.

The error went away and the sync worked once I added write permissions to that directory:

$ chmod +w /home/joe/p4_workspace/foobar