blog.plee.me About software, technology and random things

8Apr/120

Hiding the Closing Button (X) on the Firefox Add-on Bar

Hey!

Since the introduction of Firefox 3 or 4 (I don't quite remember) and the removal of the status bar I have liked to use the Add-on bar instead. In the newer versions of Firefox, however, that Add-on bar comes with a closing button, an X on the very left.

Unfortunately, there is no built-in option to disable that particular button. Right-clicking and "Customize ..." doesn't allow moving or removing that button either.

After searching the web for a while, I stumbled upon a Google Groups thread: https://groups.google.com/group/mozilla.support.firefox/browse_thread/thread/d4a77426b84fe2b0

In that thread, Chris Ilias gave a simple solution (thank you!):

  1. Go to your Firefox profile directory. For that, just enter about:support in your URL bar (or click on Firefox => Help => Troubleshooting) and click on the "Open Containing Folder" button next to "Profile Directory".
  2. Close Firefox. (So maybe it would be better to continue reading these instructions beforehand and/or copy them into a text editor. 🙂 )
  3. Enter the subfolder "chrome" in the profile directory.
  4. Open the file "userChrome.css". If it does not exist, copy "userChrome-example.css" and rename the copy to "userChrome.css".
    If you are using Notepad, you won't be able to see line breaks / new lines. Therefore I recommend using a program that can interpret these kinds of line breaks, for example TextPad, Notepad++ or even WordPad, which comes with Windows itself.
  5. Add the following line to the file:
    #addonbar-closebutton { display: none }
  6. That's it! Save the file, start up Firefox again and enjoy the Add-on bar without a closing button!

These instructions were written for Firefox 11, but they should stay viable for the next couple of versions as well.

I hope this was of any help to you.

Thanks for reading!

10Mar/120

Restoring Syntax Highlighting to Vim

Hi!

After doing a couple of updates on my servers today, I noticed that one of them had syntax highlighting in vim disabled. I double-checked to see that it was still vim that was installed, and not vi. Indeed it was, so I tried entering a couple of vim commands in order to re-enable syntax highlighting.

A couple of minutes of trying and searching the Internet went by till I got the idea to directly compare the vim version info both on one of my servers that had it working properly and the one that didn't. It turned out that even though it was the same version number and build with the same compile time it had a certain difference: one line said "Tiny version without GUI." vs. "Huge version without GUI.". The tiny version was the one that wasn't highlighting correctly.

So I checked out what the package manager thought of this:

# yum list *vim*
[...]
Installed Packages
vim-common.i386                                   2:7.0.109-7.el5                                  installed
vim-enhanced.i386                                 2:7.0.109-7.el5                                  installed
vim-minimal.i386                                  2:7.0.109-7.el5                                  installed
Available Packages
vim-X11.i386                                      2:7.0.109-7.el5                                  base

Somehow during updating it had apparently decided to install the vim-minimal package as well. And of course it wasn't installed on the server on which vim worked as it should.

Fair enough. I thought to myself that removing should fix it, but when I tried to it said the following:

# yum remove vim-minimal
Loaded plugins: fastestmirror
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package vim-minimal.i386 2:7.0.109-7.el5 set to be erased
--> Processing Dependency: vim-minimal for package: sudo
--> Running transaction check
---> Package sudo.i386 0:1.7.2p1-13.el5 set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================
 Package                   Arch               Version                         Repository               Size
============================================================================================================
Removing:
 vim-minimal               i386               2:7.0.109-7.el5                 installed               581 k
Removing for dependencies:
 sudo                      i386               1.7.2p1-13.el5                  installed               861 k

Transaction Summary
============================================================================================================
Remove        2 Package(s)
Reinstall     0 Package(s)
Downgrade     0 Package(s)

Is this ok [y/N]:

That was weird. It felt the need to remove sudo along with it. Of course that was not okay for me, so I tried looking for a parameter for vim in order to ignore the dependencies, but apparently there are none (any more).

The solution I found after a couple of more minutes of searching the Internet was to remove the package via the actual rpm program. But don't you need the original rpm file for vim-minimal? No, you don't!

First you have to find out the complete package name, however. That can be done like this:

# rpm -qa | grep vim-minimal
vim-minimal-7.0.109-7.el5.i386

And finally just use the following command:

# rpm -e --nodeps vim-minimal-7.0.109-7.el5.i386

whereas the last parameter is of course the proper name of the package in question. --nodeps, as you might have figured already, stands for "no dependencies" and removes the package without any questions asked.

In the end, these simple steps restored the syntax highlighting functionality for my vim.

Let's hope that after the next update it doesn't decide to go monochrome again.

Thanks for reading!

1Jan/120

Using Different Color Schemes with Vim

Hey!

If you have been using the Linux console text editor vim (or: Vi IMproved), you have probably noticed already that at times - especially in files with a large amount of comments - the default color scheme on a black background is less than ideal. Dark blue on black is pretty hard to read and can strain the eyes a lot.

So today I went out to see if somebody had come up with a solution for this particular problem. I saw people who changed console colors by exporting and overwriting certain system variables, and others who edited the default color scheme.

The simplest solution I have found to this problem is just switching the color scheme. You can do that by typing the following in the already open vim session:

:colorscheme desert

where desert is just an example for the scheme of choice. Desert - for me - has just the right color for comments: aquamarine / light blue.

If you are satisfied with the scheme and would like it to be applied each time you launch vim, you can just edit /etc/vim/vimrc (or in my case with CentOS: /etc/vimrc) and add the following line:

colorscheme desert

with desert again, of course, being the chosen color scheme. This would apply this setting automatically for each vim instance that is launched system-wide. If you do not have access to the system-wide preferences or prefer just using it for your own user account, edit the ~/.vimrc instead.

The blog entry I got this tip from (Asher's space) has further instructions on how to edit existing color schemes and even a link to a blog post that explains how to edit the dark blue color for directories in ls listings with color, but I did not feel the need to go that far. If you are interested in that topic I can only encourage you to visit the original post.

Thanks for reading!

Update (2012-01-04):
Okay, looks like pingback isn't working, so here's a direct link to the original blog post:
vi code highlighting: change the default comments color from dark blue to light blue (https://asher2003.wordpress.com/)

2Jun/110

Detecting the Linux Distribution / Version

Hi!

Just a quick method to (roughly) detect your linux distribution and version:

$ cat /etc/issue
or
$ cat /etc/*release

Cheers 🙂

24May/110

Blocking the Facebook Like Button via Adblock Plus

Hi!

This particular tip was written over at http://www.ohnekontur.de/2011/05/13/adblock-facebook-like-button-blockieren/. Any credit goes to the original author. I am merely posting this on my blog to have a reference for myself in the long run.

You might have heard about the fact that even without clicking on Facebook's Like buttons you might be tracked by Facebook (technically it is absolutely possible for them to see which site it is you visited and had the Like button on it).

So if you are using Firefox and have the Adblock Plus addon installed (which I strongly recommend in the times of annoying flash advertisements) you can just add the following lines under the Adblock Plus preferences => "My Ad Blocking Rules":

||facebook.com^$domain=~facebook.com|~facebook.net|~fbcdn.com|~fbcdn.net
||facebook.net^$domain=~facebook.com|~facebook.net|~fbcdn.com|~fbcdn.net
||fbcdn.com^$domain=~facebook.com|~facebook.net|~fbcdn.com|~fbcdn.net
||fbcdn.net^$domain=~facebook.com|~facebook.net|~fbcdn.com|~fbcdn.net

These rules disable any Facebook scripts that are not used from the Facebook domains (facebook.com, facebook.net, fbcdn.com, fbcdn.net) themselves, including the Like buttons or any other webpage widgets they offer.

Of course, if you are using a different browser or a different kind of ad blocking / script blocking script, the idea is the same: forbid Facebook's scripts to run anywhere but their own website.

As always, I hope to have been of any help to you.

Thanks for reading.

29Apr/100

Internet Connection Reset on the Speedport W 722V (Type B)

Hi!

Since I've recently found out that my new router, the T-Home Speedport W 722V Type B, apparently does not support automatic disconnecting at a specific time (in order to circumvent the 24-hour connectionreset by my ISP), I took a route that my good friend Pool has been using for quite some time.

It is a batch script, so in order to use it, you have to be able to execute it.

On a side note, the Type A model of this router does support automatic disconnecting! Make sure you choose "Other provider" when you're in the internet configuration menu in order to be able to see the setting for that. The "T-Online" option sadly does not show it.

What you need:

  • A Windows machine that is running at the given time (has to execute the script)
  • cURL for Windows, preferably the win32-ssl-sspi version (download page). win32-ssl should be fine as well.
  • Configure a scheduled task for the script, which is not covered in this guide (but quite simple. Just make it execute the script.)

The batch script:

REM Speedport W 722V Type B Internet Reset Script v1.0 - 2010-04-29
REM Written by pl (plee.me)
REM
REM Works with the T-Home Speedport W 722V Type B home router.

REM START CONFIGURATION
REM Adjust these variables to your own ones!
SET PWD=12345678
SET COOKIEFILE="routercookies.txt"
REM END OF CONFIGURATION

@echo off
curl -k https://speedport.ip/cgi-bin/login.cgi -d "pws=%PWD%" -e "https://speedport.ip/hcti_start_passwort.stm" -c "%COOKIEFILE%"
curl -k https://speedport.ip/cgi-bin/status_startseite.cgi -d "connect=0&disconnect=1&block=0&nonblock=0&abc=0" -e "https://speedport.ip/hcti_startseite.stm" -b "%COOKIEFILE%"
curl -k https://speedport.ip/cgi-bin/status_startseite.cgi -d "connect=1&disconnect=0&block=0&nonblock=0&abc=0" -e "https://speedport.ip/hcti_startseite.stm" -b "%COOKIEFILE%"
curl -k https://speedport.ip/cgi-bin/logoutall.cgi -e "https://speedport.ip/hcti_startseite.stm" -b "%COOKIEFILE%"
del "%COOKIEFILE%"

What this script does:

It logs on the web administration interface, uses a hidden option to disconnect the internet connection, then uses a hidden option to connect, and finally logs out again.

Because the cookie is cached in a text file, it is deleted at the end of the script.

Additional information:

The lines beginning with REM are comments, so you might as well leave them out.

If you run the script, make sure that you either have the cURL directory in the PATH environment variable, or that you set its folder as the working directory, so that it can find the curl.exe and actually execute the (central) steps of the script.

I'm sure that this script can be optimized (probably a lot), but for now, it's doing the job.

I hope that was of any help to you, and thanks for reading! 🙂

13Jan/100

PDFCreator and mybrowserbar.com (Adware!)

Hi!

If you have recently encountered a weird behavior within your browser (I only know of Firefox because that's what I use), chances are that Adware has been installed onto your computer.

When I was looking for a picture on my own website and I mistyped the URL, I noticed that immediately after it showed me my custom 404 page, I was redirected to a domain called mybrowserbar.com. The URL was:

http://www.mybrowserbar.com/cgi/errors.cgi?q=[404URL]&type=404&ISN=[funkystring32]&ccv=130&cnid=302398&cco=US&ct=12

with [404URL] as the wrong URL. [funkystring32] seemed to be some kind of MD5 string (32 characters, 0-9, A-F), maybe a unique identifier.

After searching the internet for a couple of minutes, I read a thread on the official Avira forums. In it it was explained that PDFCreator comes with an Adware called "Search Settings Plugin" that installs and enables itself in Firefox. Luckily, being a normal addon, the problem was quickly solved from there: Tools => AddOns => Extensions => Search Settings Plugin => Uninstall/Disable.

I can only shake my head at things like this.

There has also been discussion on the official pdfforge (PDFCreator) forums about this:

http://en.pdfforge.org/forum/open-discussion/3140-search-settings-plugin-installed-wo-users-knowledge-along-yahoo-search

http://www.pdfforge.org/files/old_forum/2903.html

Thanks to the people at the official Avira forums! Oh, and nevertheless, in all honesty: thanks to pdfforge for providing such a nice tool. I have the feeling it's gonna be of great help to me in the future 🙂

Source: http://forum.avira.com/wbb/index.php?page=Thread&postID=895237

13Oct/090

OpenVPN on Windows Vista / 7 – Ping says: TTL expired in transit

Hi there!

When I set up my VPN with OpenVPN yesterday, I found out about a little difficulty under Windows Vista and 7. Thankfully it was not that much of a hurdle as the UAC was the reason for this bug just like for a series of other bugs with different software I experimented with over the last few weeks. Nevertheless I hope that this piece of information helps you get rid of the following problem.

If you have set up your VPN and got it running without any major problems, and everything seems to be running just fine (connecting works), but you still can't establish connections to the other machines, you might find that pinging returns the error message "TTL expired in transit". This is due to the fact that Vista (or Windows 7) needs administrator privileges to adjust your computer's settings properly in order to function when you've connected to the VPN successfully. I think it's about the route.exe process, but I'm not 100% sure.

Windows Vista and 7 have the equally famous as infamous UAC (User Account Control) that prevents even administrator privileged accounts from executing programs with administrator rights by default. In order to enable these rights you have to right-click the program (or program shortcut) and click on "Run as administrator" next to the yellow-blue shield if it does not run with administrator rights exclusively anyway (in which case you'd see the yellow-blue shield in the bottom right corner of the program icon itself and would be asked for administrator privileges automatically when you launch it as any other program).

Please note that the following steps are for on-demand OpenVPN connections. For automatic connections, read further below.

OpenVPN on-demand connection

So what you need to do is launch the connection with UAC. But how do you do that if you usually launch OpenVPN connections with a right-click and "Start OpenVPN on this config file"? Even creating a shortcut to the .ovpn file doesn't give you the "Run as administrator" option.

A simple solution is to create a batch file that simply changes to the work directory and executes .ovpn with the openvpn.exe.

Example file "ovpn_connection1.bat":

@echo off
D:
cd \Programs\OpenVPN\config-ondemand\
D:\Programs\OpenVPN\bin\openvpn.exe D:\Programs\OpenVPN\config-ondemand\connection1.ovpn

This batch file has the following parameters/assumptions:

  • Your OpenVPN dir is on the D: partition (otherwise change the drive letter in the respective paths and leave the "D:" line out altogether).
  • The path to your OpenVPN dir is D:\Programs\OpenVPN.
  • Your connection configuration file is located in the config-ondemand subdirectory.

Basically, you just switch to the work directory and execute OpenVPN's openvpn.exe located in its bin dir on the configuration. In a way, this works as a shortcut, but just as an executable batch.

The @echo off part is just so that you won't see the other commands displayed in the window each time you start the connection.

Now you either make a shortcut to this batch file or use it itself.

Whenever you want to start the connection, right-click on it and select "Run as administrator".

Done! Test your ping and it should be fine.

OpenVPN automatic connection

All you need to do is to move the .ovpn configuration file and all the other required files into the config subdirectory of your OpenVPN installation.

When the OpenVPN service (Start => Run => services.msc) is started, it will look for .ovpn files in its config subdirectory and execute them all - with SYSTEM privileges. No UAC circumvention needed.

So just set your OpenVPN service to "Automatic" and you're good to go!

OpenVPN on-demand connection with OpenVPN service

Just do what is described under the "OpenVPN automatic connection" paragraph except for setting the service to "Manual".

Now each time you want to launch the connection, you just need to type "net start OpenVPNService". To stop it, type "net stop OpenVPNService".

Note on using connections with the OpenVPN service

As the OpenVPN service feature executes *all* .ovpn configuration in the config subdirectory, there is no way to manually interfere with one particular connection of that directory and let's say disable it shortly. All config-connections are handled as a group with the OpenVPN service.

So if you need manual independency, look at the on-demand section.

I hope this wasn't all too fuzzy with the wordings and such.

Please comment or contact me if you have any questions on this matter.

Thanks for reading!

13Aug/090

Disabling Windows Vista / 7 / 8 / 10 Explorer’s Automatic Folder Type Discovery

Hey!

Update from 2015-09-06: I just used this for Windows 10 and it still works!

I very recently installed Windows 7 on my desktop computer and I'm loving it so far.

One of the major things that bugged me though was the new Explorer behavior. The automatic folder type discovery just goes ahead and tries to determine a folder type just by looking at how many (or if there are) files of a certain type (pictures, videos, songs, ...) are in the current folder, and then it adjusts the viewing settings accordingly. For example, if you open a folder that contains mainly video files, it would show those with big icons instead of my default, a detailed list. Pictures are displayed as thumbnails.

Disabling this behavior proved to be interestingly difficult. As with most things that have been declared a default setting by Microsoft, it luckily can be done - but only via registry.

First we need to delete our current folder type settings.

  • Close all open Explorer windows.
  • Open the registry editor with Start => Run => regedit and browse to HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell.
  • Delete and confirm the deletion of the keys BagMRU and Bags.
  • Now create a Key (right-click on the current key in the left pane and select New => Key) called Bags.
  • Create a subkey for Bags called AllFolders.
  • Create a subkey for AllFolders called Shell.
  • Create a String value (right-click in the right pane and select New => String Value) called FolderType and set the value to NotSpecified.
  • That's it for Windows 7. Please read the note for Windows Vista x64 below. Otherwise, just reboot and your new settings should be applied.

That's it for Windows 7. If you're using Windows Vista x64, it might be possible that there is a copy of (or a similar) the Local Settings\Software\Microsoft\Windows\Shell key in HKEY_CURRENT_USER\Software\Classes\Wow6432Node. I could not confirm this for Windows 7, though I am using the 64 bit version (it just had a CLSID subkey, nothing more). In that case, delete the Shell\Bags and Shell\BagMRU folders like I told you above before finishing your modifications with a reboot.

Warning: as always, playing around with the Windows registry can be dangerous when done incorrectly. If you do not feel safe about it, make sure to back up the keys you're about to modify via File => Export, or leave it altogether. I do not take any responsibility for any damage, nor do I give any guarantee that the steps I provided here will work for you. At least they worked for me.

Hopefully that was of help to you 🙂

I discovered the initial instructions on mydigitallife.info. Thank's so much 🙂 Had a hard time finding a guide for that.

10Jun/090

How To: Migrate an Existing Windows System to Another Hard Drive Using Acronis TrueImage

Hi!

Because of a new hard drive I bought a week ago I decided to transfer my existing system, running on a 250 GB hard drive, to my new 1 TB one. I was lucky enough to at least have made some experiences with migrating an existing system to a Virtual Machine in conjunction with Acronis TrueImage Home 2009 before, so that's what came in handy for me.

What you need

  • Backup software like Acronis TrueImage Home 2009
  • BartPE with Acronis TrueImage Plug-In / bootable version of your backup software
  • Windows installation disc (preferably the same Windows version as your current system)
  • New system hard drive which is either empty or ready to be re-formatted (backup your important data on it!)

Procedure

  1. Start Acronis TrueImage Home 2009 and make a backup of your system partition.
  2. Save the backup to a partition / hard drive that you will have access to later on while using the bootable backup restorer. This means: No (TrueCrypt-)encrypted partition. Ideally it would fit on a disc or USB stick (which my didn't with a size of 7 GB). Just make sure you will be able to access it later on. I know BartPE is able to access all hard drives (without encryption at least) and should give you access to a USB drive as well, as long as you have it connected while it's booting up. If you don't want to move it over to a USB drive or DVD or anything else, there is also a nice little trick at the end of this howto: (*).
  3. Shut down your computer and make sure your new system drive is connected as the first device to avoid improper device numbering. This means using the first connector for SATA/IDE or whatever. If you are using both SATA and IDE, I don't know how that's handled. I'm just assuming you somehow have figured it out 🙂
  4. Boot from your Windows installation disc.
  5. If you haven't done it previously under Windows, partition the new system drive properly. That means to have the partitions created in the correct order. If you haven't (or aren't sure any more), delete them and do it over again just to make it right. Maybe the order is not necessary, but I had a lot of trouble with that before, so I'm just playing safe.
  6. Install Windows as usual to the point when you've started up your brand new Windows installation for the first time and are watching the Start Menu in awe.
  7. Boot from your bootable backup software (or BartPE with the plugin) and fire it up.
  8. Restore the image. Don't select MBR / Track 0, however, because we just created a proper MBR (Master Boot Record) by installing Windows.
  9. That's it! You should be done. Now a reboot should provide you with your old system on a new hard drive. Congratulations 🙂

I don't guarantee anything, and I admit to having tried several methods for half a day till I got it right 🙂 This should work fine though, because it basically is what I did the time when it finally worked.

If you have partitions with programs on it that would be started on bootup, make sure you copy it (file by file) before you start your system on the new hard drive.

While you could do that by connecting your old system drive and booting from that, then copying the files over, you could also do it beforehand by using the Windows Disk Management tool to erase all partitions and partition it properly before the Windows installation. This allows you to format the specific partitions and copy the files over to it while you're still on your old system. (*) Also, you can add the backup image onto that partition, so you don't have to burn a DVD or move the image over to a USB stick or ... (you get the point). However, if you create and format the partitions on your old system, make sure to

  • (naturally) not touch them during the Windows installation progress or your data on them will be inaccessible
  • rename your partitions properly after booting up your new system because your old Windows already assigned them (probably different) drive letters. You can do that in the Windows Disk Management tool as well.

I hope I didn't forget anything. If I did, I'll be sure to add it later on 🙂

Thanks for reading and good luck!

%d bloggers like this: