Monday, 27 April 2015

Installing JVisualVM plugins manually

Today I had an annoying problem. We have some network restrictions at work, which mean that we cannot access a large number of sites nor download certain file types from the internet.

I had to run JVisualVM to fiddle a few MBeans in a running app. Nowadays, JVisualVM doesn't include the MBean browser, as it's included in the MBean tab plugin, which can be downloaded automatically... unless you don't have access to the internet (like all those guys working on super secret projects) or you have some other odd network restrictions.

To install the plugins manually, I had to try to download them from inside JVisualVM, as the error message shows the url from where it's trying to download it (I couldn't find anywhere a list of all the plugins and their download urls... it looks like they are distributed in the JVisualVM download area inside different releases).

After getting the files, I was able to ask someone to download them for me, and last I was able to import them in JVisualVM from Tools -> plugins (Downloaded tab). There had to "Add plugins" and once they were added, click on install.

Easy peasy... 1/2 hour gone in something that should have taken 1 minute :(.

Monday, 23 February 2015

Kaspersky - is it the worst security suite?

I recently upgraded to windows 8 after a series of problems I had with windows 7, which started when I uninstalled Kaspersky Internet Secuirty 2012 to upgrade to KIS 2014.

After the upgrade, most of the USB devices I connected were not recognized (luckily the wired mouse and keyboard did keep working). Quite a few people experienced this and there's some registry voodoo to fix this. Unfortunately the fix didn't work, and since I had to reinstall windows to fix this, I decided to upgrade to win 8.1.

After I installed Win8 I had yet another 2 issues. The first one with VMWare Workstation. For some reason, VMWS wasn't able to create a bridged connection (most of my VMs use this rather than NAT)... going through the Kaspersky Forums, a few people recommended in this case to uninstall KIS, create the network bridge, reinstall KIS. What a PITA, but it did work.

So now I have everything ready to start coding? Not really. Some encrypted connections kept dying on me (something as simple as a git pull from a tiny github repo would take 10 minutes and end up in a connection failure). Pausing the protection didn't help, so I went through the pain of uninstalling KIS, trying, reinstalling KIS just to prove that the problem was KIS (rather than a dodgy router). Finally I found that KIS 2015 has a feature to snoop on all encrypted connections and that was affecting the connection. So I had to go to settings -> additional -> Network -> uncheck Scan encrypted connections.

I'm quite sure that companies providing security suites are having more and more trouble to provide working, compatible software, as malware becomes more advanced, the number of consumer applications multiply, and the incompatibility matrix becomes a 1000000000x1000000000 minesweeper game with half of the cells with bombs which move around.

I think at some point I'm going to install Sophos UTM and see how that goes...

Sunday, 14 December 2014

Squid on cygwin "Unable to determine IP address from host name"

I recently started using vagrant+docker which meant that I started downloading a lot of RPMs, docker images and vagrant boxes.

To reduce the amount of time I spend waiting for packages to be downloaded, I set up squid on cygwin. The set up wasn't too complicated, but I got stuck with something. Squid reads /etc/resov.conf to find out which nameserver to use... and cygwin doesn't create (nor need) this file. This mean that I spend 1 hour trying to figure out why squid wasn't able to resolve names. This is part of the html Squid generated to report the error.
The following error was encountered while trying to retrieve the URL: http://google.com/

     Unable to determine IP address from host name "google.com"
So if you want to run squid on cygwin, don't forget to create a /etc/resolv.conf file similar to the following one

search local
nameserver 8.8.8.8
I chose to use google's DNS (8.8.8.8) for the time being, but the best solution would be to run a script when I launch cygwin that creates/updates the resolv.conf file with my current DNS... but I have no idea at the moment how to get this data from windows.

How to install synaptics drivers on windows 8/8.1

A while ago Synaptics started to ship drivers which are not digitally signed, which means that they cannot be installed on Windows 8/8.1 (and maybe 7 too).
And to add insult to injury, some laptop manufacturers (Hi Dell!) provide their own Synaptics drivers, with some trimmed down features, such as no 3 and 4 finger gestures (Hi again Dell!).

After spending quite a bit of time trying to figure out how to install the drivers, I found the answer in on of Microsoft forums. Check Jesperten answer, which I reproduce below. I had to do both parts, as the driver was not loaded after installing it.

Here is a trick on how to install Synaptics Touchpad Driver v17.0.19 on Windows 8.1
    > WIN + I
    > Change PC Settings
    > Update and Recovery
    > Recovery
    > Under 'Advanced startup' click 'Restart Now'. Make sure to save your work first.
    > Select 'Troubleshoot'
    > Advanced Options
    > Startup Settings and click Restart
    > When it boots up, press 7 to Disable driver signature enforcement
    > Install Synaptics as you would normally do.
    > Restart

If the driver is not working properly and if the Synaptics settings does not appear under Mouse properties after completing the preceding steps, try the following:
    > Open device manager
    > Find the touchpad device (“PS/2 Compatible Mouse”)
    > Right click on the device and click “Update Driver Software”
    > Select “Browse my computer for driver software”
    > Select “Let me pick from a list of device drivers on my computer”
    > Uncheck the option “Show compatible hardware”
    > Under “Manufacturer”, scroll down to “Synaptics”
    > Under “Model”, the 17.0.19 driver should appear.
    > Select the driver and click next.
    > Click “Yes” to the “Update Driver Warning” pop-up.
    > Restart 
Now, the Synaptics settings should appear under Mouse properties, from where it should be possible to change all the desired modifications to the touchpad like disabling Edge Swipe and invert two finger scroll directions.

This worked for me at least. I hope that others might find this trick helpful.


Thanks a lot Jesperten!!

Saturday, 13 December 2014

Remapping application and pause/break keys

I recently started using a laptop (Dell XPS 15) which doesn't have an menu / application key or a pause/break key. I use those two keys quite often: the application key because I'm too lazy to move my hand to perform a "right click" with a touchpad or mouse and the pause/break key for RDP sessions, to enter or exit full screen (I'm a shortcut junkie).

Using the amazing tool SharpKeys 3.5, I remapped
  • Right Alt Gr (code E0_38)=> Menu / Application key (code E0_5D)
  • Print screen (code E0_37) => Break (code E0_46)


I wish the Function key on laptops would work as alt/ctrl and could be used to remap key.

Thursday, 11 December 2014

Enable core parking to safe precious battery life

This will allow windows to park cores dynamically, which (hopefully) translates into precious mWh saved.

  • Open regedit
  • Search for the data 'unparked cores' (or just find the key below)
  • Keep searching until you get to the following key (in CurrentControlSet).
    • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\54533251-82be-4824-96c1-47b60b740d00\0cc5b647-c1df-4637-891a-dec35c318583
  • Find the value "Attributes" and rename it to "Attributes.off" (this doesn't actually do anything apart from preventing windows from finding the real key... and it gives you a rollback path).
  • Now search for the term 'unparked cores' and you should end up on the following key
    • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\54533251-82be-4824-96c1-47b60b740d00\ea062031-0e34-4ff1-9b6d-eb1059334028
  • Again, find the value "Attributes" and rename it to "Attributes.off"
  • Reboot
The key allows to change the minimum number of parked cores, while the second one allows to set the maximum number of parked cores.
Now you can go to Control Panel -> Power Options and edit the power profile. You'll find two new entries under Processor power management.

Saturday, 5 July 2014

Synaptics trackpad configuration and the dreaded "Windows Shell Common Dll has stopped working"

Recently, I've been repurposing my wife old laptop (a dell 1520 from 2007) after I was surprised how much faster it bacame after installing an SSD.
One of the things that I wanted to configure was the synaptics touchpad to have finger gestures (specially the 3 finger back and forward for the browser). After finding a suitable driver (as the lastest Synaptics drivers don't work on windows 8.1), I had to manually update the driver to the Synaptics one, because windows would keep setting it as a generic touchpad.

So finally, I had the driver installed, and I was ready to configure it... but when I tried to access the configuration screen I got the helpful message "Windows Shell Common Dll has stopped working".

Mouse properties
Windows Shell Common Dll has stopped working
After searching for about 1 hour, I found a few posts from people who got the same error when they tried to play a video... and the Synaptics tool does try to play a video to demonstrate each feature... a smoking gun.

Since my hacking skills are non-existent, I decided to take the low cost approach of removing all the wmv files from the folder where the driver was installed (c:\Program Files\Synaptics\SynTP\ in my case). After that I was able to access the configuration window.

Synaptics configuration window
It's a pitty that Synaptics doesn't have an option to configure right clicks in the same way as MacBooks (one finger pressed + one tap). It does have a right click with a 2 tap, but I think the other gesture is easier to use.