Category Archives: technical

Edit with Notepad++ without Admin access

I got a new machine at work and promptly installed Notepad++ through the software management tool that the office provided.
Notepad++ installed fine but the right click context menu option “Edit with Notepad++” was missing. I raised a ticket with desktop support team, they tried but were unsuccessful.
Quick google search provided some options like running NppShell.dll or adding registry to HKEY_CLASSES_ROOT. However these require Administrator access that I didn’t have.
I looked around, couldn’t find any solution so crafted my own to add the “Edit with Notepad++” option to all files without admin access.

Step 1. Go to Start and type regedit.exe

Step 2. HKEY_CURRENT_USER\Software\Classes\

Step 3. Right Click on Classes and create a new Key valued *

Step 4. Right Click on Classes and create a new Key valued shell
Step 5. Right Click on shell and create a new Key valued ‘Edit with Notepad++’
Step 6. Right Click on ‘Edit with Notepad++’ and create a new Key valued command

Step 7. Change the value of Default to the path to notepad++.exe file (‘C:\Program Files\Notepad++\notepad++.exe’ in this case)

You can download the registry file here. Edit file, correct the notepad++ path, save, close. Double click, say yes. and you are all set.

Why it works?
1. Most solutions out there ask you to change the HKEY_CLASSES_ROOT which requires admin access however we are changing HKEY_CURRENT_USER. It is the current user’s profile thus admin access isn’t required
2. The keys in HKEY_CURRENT_USER\Software\Classes\ are actually extensions, we created key * meaning any extension.

Hope this helps.

Simple Snake game in Jquery

There are several tutorials on the internet to create simple snake game in query. I readh through https://www.sourcecodester.com/tutorials/javascript/11260/creating-very-simple-snake-game-using-jquery.html and decided to enhance it.

The new code has following advantages over the original one:

  1. Added pause and play option
  2. Once the game ends, stops play. Original code just restarted the game
  3. Changed the position of game name and score
  4. Replaced absolute font size with relative sizes.

I created a github and uploaded the code for this simple game. You can also play it here

Setting up xdebug on scotch box/vagrant on Arch linux

Install Vagrant

sudo pacman -S vagrant

To install virtualbox

mkdir works

git clone https://github.com/scotch-io/scotch-box.git works

cd works

vagrant up

install sublime 3

install package control on sublime 3

http://packagecontrol.io/installation

install openssh

vagrant ssh
sudo apt-get update
sudo apt-get -y install php5-dev php-pear build-essential
sudo pecl install xdebug

copy the xdebug.so location
you can also find it with find / -name ‘xdebug.so’

/usr/lib/php5/20131226/xdebug.so

in /etc/php5/apache2/php.ini

;;;;;;;;;;;;;;;;;;;;;;;;;
; Added to enable Xdebug ;
;;;;;;;;;;;;;;;;;;;;;;;;;;
;
zend_extension="[enter path here]"
xdebug.default_enable=1
xdebug.idekey="sublime.xdebug"
xdebug.remote_enable=1
xdebug.remote_autostart=0
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_host=10.0.2.2 ; IDE-Environments IP, from vagrant box.
;

sudo service php5-fpm restart
sudo service apache2 restart

refresh phpinfo to check xdebug

in sublime -> tools -> command pallete

install package

xdebug client

Project -> Save project as

works.sublime-project
{
"folders":
[
{
"path": "/home/username/works/public"
}
],
"settings": {
"xdebug": {
"url": "http://192.168.33.10/",
"port": 9000,
"path_mapping": {"/var/www/public/" : "/home/username/works/public/"},
"super_globals": true,
"close_on_stop": true
}
}
}

Fixing Sony MDR-XB400

Recently I sat on a Sony MDR XB400 Stereo Headphone. One side of the headphone popped out of the socket.

SonyMDRXB400-Broken1

Below are the steps to fix the issue.

Wedge a screw driver below the silver cap and push to remove the silver cap.

SonyMDRXB400-Broken2

A screw will be visible. Remove the screw.

SonyMDRXB400-Broken4

Put the pieces apart

SonyMDRXB400-Broken5

Wedge the screwdriver at the base of the holder to remove the cap.

SonyMDRXB400-Broken6

Here is the cap is removed.

SonyMDRXB400-Broken7

Once the cover is removed, slide the holder onto the headband.

SonyMDRXB400-Broken8

Stick things back and screw it tightly.

SonyMDRXB400-Broken3

Replace the silver cap back.

One thing to keep in mind is to keep the wires straight, you don’t want them looping.

 

 

pip uses Python3 instead of Python2.7

If you are facing issue where pip chooses python3 over python2.7, then you need to use the correct alternative. Follow the following steps:

  1. First install pip for python2 and python3
    sudo zypper install python-pip python3-pip
  2. Choose the correct version
    sudo update-alternatives --config pip

    The following will be displayed

    There are 2 choices for the alternative pip (providing /usr/bin/pip).
    Selection Path Priority Status
    ------------------------------------------------------------
    * 0 /usr/bin/pip3.4 30 auto mode
     1 /usr/bin/pip2.7 20 manual mode
     2 /usr/bin/pip3.4 30 manual mode
    Press enter to keep the current choice[*], or type selection number:
  3. Type 1 (option infront of pip2.7) and press Enter

Chromecast not found on Opensuse linux

If you cannot see you chromecast device on opensuse linux, it is because of the firewall. You will need to open UDP ports 32768 thru 61000.
Follow the following steps:

1. Open Control Center (Yast)
Yast-Control Center

2. Search for Firewall
Yast-Firewall1

3. Select Firewall
Yast-Firewall2

4. Select Allowed Services
Yast-Firewall3

5. Click on Advanced
6. Type 32768:61000 in UDP
Yast-Firewall4

7. Click on OK

8. Click on Next
Yast-Firewall5
9. Click on Finish

Click on image to see full size image.

Installing: Picapy – A Picasa Web manager

Google pulled out its support from picasa for linux back in 2012. Picasa 3.9 works fine on wine but I was looking for something native to linux and found picapy. A small application written in python.

Steps to install:

    • Download picapy from here
    • Extract picapy and rename folder to picapy
    • Download gdata from here
    • Extract gdata
    • Open terminal, go to gdata folder and type

sudo python setup.py install

    • Go to picapy folder in terminal and type

sudo mkdir /usr/share/picapy;sudo cp -R * /usr/share/picapy; sudo cp img/* /usr/share/picapy;sudo cp picapy.svg /usr/share/pixmaps;sudo cp picapy.desktop /usr/share/applications;sudo cp picapy.desktop ~/Desktop;

All set. You can read how to use here

Upside down skype video on Mint Linux 64bit

A long time back I wrote a blog Upside down skype video on Fedora 14 64bit, it has worked for me since then. However on Mint Linux I had some issues. I will re-iterate all the steps

First try this:

  1. Go to Terminal
  2. Type the following:
    locate v4l1compat.so
    You should see the following:locate
  3. Now type the following
    LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libv4l/v4l1compat.so skype
  4. If you all goes well, skip to step #
  5. If you see the following error, go to step 6error
    ERROR: ld.so: object '/usr/lib/x86_64-linux-gnu/libv4l/v4l1compat.so' from LD_PRELOAD cannot be preloaded: ignored.
  6. Type the following
    sudo dpkg --add-architecture i386
    sudo apt-get update
    sudo apt-get install libv4l-0:i386
  7. Redo step 2
    skypefix
    LD_PRELOAD=/usr/lib/i386-linux-gnu/libv4l/v4l1compat.so skype
  8. You shouldn’t see the error this time. This is the library you need to use in future. To fix it forever,
    i. Log in to the super user

    $ su

    Enter the password
    ii. Go to /usr/bin

    # cd /usr/bin

    iii. Rename skype to skype.main

    # mv skype skype.main

    iv. Create a new file skype with the below content:
    LD_PRELOAD=/usr/lib/i386-linux-gnu/libv4l/v4l1compat.so /usr/bin/skype.main

    # echo “LD_PRELOAD=/usr/lib/i386-linux-gnu/libv4l/v4l1compat.so /usr/bin/skype.main” > skype

    v. Make the new skype executable

    # chmod 755 skype

Still getting issues? Leave a comment.

Integrated Library Management System for Hogwarts

Hogwarts should implement some library management system for the old books. The challenge would be to recreate the books that scream or bite.

Here are some open source library system:

Open-source

And here’s a wonderful slide show about some library systems.