CSS: Make text bold on hover without size of component changing

Say, for example, you have a button where you wish the text to become bold on hover. However, as you hover, the button becomes slightly wider – as the component expands to fit the larger text.

One method of avoiding this is to apply a shadow to the text on hover – which does not affect the dimensions of the button.

One thing to note, depending on the font size of the component or just your own personal preference, is that this technique may make the individual letters look very close to each other.

One way to dodge this is to add more spacing between the letters pre-hover, like so:

Posted in Design/Dev | Tagged | Leave a comment

AngularJS: How to turn on and off $log.debug

If you’re using $log.debug() for your AngularJS debugging, there’s a very easy way to stop those messages appearing in your browser console when you are ready to release – without commenting out every line.

Simply add $logProvider.debugEnabled(false); to the config section of your main app file. Then use true when you’re ready to make them visible again. Don’t forget to pass $logProvider as a parameter to the config function.

A basic example would look like the following:

Note that this does not affect the other message types such as .log(), .info(), etc.

Posted in Design/Dev | Tagged , , , | Leave a comment

Linux: Using “Screen” command

This is a very useful tool I only discovered today.

Screen is a full-screen window manager that allows you to manage multiple shell sessions from one terminal window or console, view multiple shell sessions at the same time, and even log into the same session from more than one location at a time.

In my case, I used Screen to create a new session for the purpose of starting an 11 gigabyte download – but was then able to shutdown my laptop and go home, without the download being cancelled. I was then able to resume this session later and confirm that the download had completed successfully.

To use:

  1. If not already installed, use your normal technique for installing, e.g. yum install screen
  2. To create a new screen session, simply type screen at the command prompt
  3. This opens another identical looking prompt. Now start whatever process you have in mind.
  4. To return to your original prompt (but with the new screen still running in the background) press Ctrl-a then d
  5. If you wish to return to the screen session later, just type screen -r
  6. At this point (while in the screen session) if you want to kill the session, press Ctrl-a then k and press y when it asks if you really want to kill the session.

Useful Links:
Screen user’s manual
Nice tutorial on more common usage

Posted in Code Monkey | Tagged , , , | Leave a comment

Python: View what file is currently being extracted from a tar file

As part of a Python script, you are extracting a tar file. But you want to output the name of each file in the tar as it is being extracted (for logging, etc). How to do this?

Below is a code snippet that worked well for me:

getmembers() returns the members of the archive as a list of TarInfo objects.
You can then simply print the .name of each member, before then extracting that file.

Therefore, if your extract failed for any reason, this allows your logs to show which file the extract failed on.

Posted in Design/Dev | Tagged | Leave a comment

The Spotify engineering culture

Interesting animated videos from Spotify that describe their engineering culture.

Self-promotional or inspirational? You decide…

https://labs.spotify.com/2014/03/27/spotify-engineering-culture-part-1/
https://labs.spotify.com/2014/09/20/spotify-engineering-culture-part-2/

Posted in Design/Dev | Tagged , , | Leave a comment

How to know what version of Linux is being used (Red Hat)

Some commands to find out what version of Linux is running on a system, along with kernel and CPU types.

Note: These commands have only been tested on a Red Hat environment.

1) Get Linux version:

# cat /etc/issue
e.g. Red Hat Enterprise Linux Workstation release 6.2 (Santiago)

2) Get kernel type:

# uname -m

64-bit kernel = x86_64
32-bit kernel = i386, i486, i586, i686

3) Get CPU type:

# cat /proc/cpuinfo | grep flags     (or cat /proc/cpuinfo for more general information)

Sample output:
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss syscall nx lm constant_tsc arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperf unfair_spinlock pni ssse3 cx16 sse4_1 hypervisor lahf_lm dts

Look for the following flags (as highlighted in blue above):
16-bit processor = rm
32-bit processor = tm
64-bit processor = lm

Posted in Computers | Tagged , , , | Leave a comment

How to save the layout of Desktop icons (Windows 7 and XP)

(Updated to include Windows 7 solution)

We’ve all been there. Your Desktop icons have been lovingly and painstakingly placed into specific locations –  work spreadsheets top-left, links to cat videos bottom-right – then BANG, your screen resolution gets changed and they all get mashed together into the corner of the screen. There are a number of free methods available to save your desktop layout (and restore it again if your icons are moved) – below are a couple I have used successfully.

Windows 7

The Desktop Restore (64-bit) utility is simple to install and use, and allows you to store multiple desktop layouts, depending on different monitor configurations. The developers claim it can also be used for Windows 98/ME/2000/XP/Vista – but I have only verified it on Windows 7 personally.

Windows XP

On my previous Windows XP system, I used Microsoft’s Layout.dll file, which is included in the Windows NT Resource Kit.  This should also install successfully on Windows 2000 and Vista systems – but I have not tested this.

Installing the Layout.dll shell extension

  • First, download layout.zip and save it to a folder.
  • Extract the files to your Desktop.
  • Move the file LAYOUT.DLL to the C:\Windows\system32 folder.
  • Right-click LAYOUT.REG and choose Merge. Click Yes when asked for confirmation.

Using the Layout.dll shell extension

After installation, you should now have two new menu options when you right-click on an empty part of your Desktop.  To save your layout, simply select the Save Desktop Icon Layout option (see below).

If the save has been successful, you should see the following message:

Then, to restore your saved layout at any time, simply follow the same steps and select the Restore Desktop Icon Layout option.

Uninstalling the Layout.dll shell extension

To uninstall, right-click the file Uninstall.reg (also available in layout.zip) and choose Merge.  Then manually delete the file LAYOUT.DLL from your C:\Windows\system32 folder.

Posted in Computers | Tagged , , , , | 15 Comments

Saving an SSL Certificate to a .CER file

To save an SSL certificate to a file, follow the steps below:

Firefox (17.0.1)

  1. Navigate to the secure website (https) in your browser.
  2. Click on the lock icon to the left of the Address Bar.
  3. Click on the “More Information” button.
  4. Select the “Security” tab.
  5. Click on the “View Certificate” button.
  6. Click on the “Details” tab.
  7. Click on the “Export” button”.
  8. Give the file a new name if required, and choose the location where the file is to be saved.
  9. Choose the “Save as type”  option that you require. “X.509 Certificate (PEM)” is the default choice.
  10. Click the “Save” button.
Posted in Internet | Tagged , , , , , | Leave a comment

Eclipse Errors: “Missing requirement: Maven Integration for Eclipse”

When attempting to install the Maven plugin for Eclipse (m2eclipse) from the following location…

http://download.eclipse.org/technology/m2e/releases

…I was encountering the following error:

Missing requirement: Maven Integration for Eclipse (Editors) 1.2.0.20120903-1050 (org.eclipse.m2e.editor 1.2.0.20120903-1050) requires 'bundle org.eclipse.wst.sse.core 0.0.0' but it could not be found

To solve this, return to the Install New Software window and add http://download.eclipse.org/releases/indigo as a software site.

At this point, you should now be able to install the Maven plugin at the next attempt.

Posted in Code Monkey | Tagged , , , , | Leave a comment

Transferring pictures and videos from iPhone using Windows XP

There are many, many articles and blog posts out there devoted to this topic – but none had worked for me.  Below is my eventual solution (that finally allowed me to transfer 1326 pics & vids collected over 3 years), which is pieced together from the different suggestions.

First, the specs I was working with…
iPhone: 3GS
iOS: 3.1.3
Windows OS: XP
iTunes: Not installed.

1) Make sure to unlock your iPhone first (enter the passkey), and then connect it via USB to your computer.

2) Check if your iPhone has appeared directly as a device in My Computer/Windows Explorer. Can you access and copy your photos from here? If not, move to Step 3.
(For me, the iPhone would always be “empty” when I clicked on it)

3) Access the Scanner and Camera Wizard via Start > All Programs > Accessories > Scanner and Camera Wizard. Can you access and copy your photos using the Wizard tool? If not, move to Step 4.
(For me, the Wizard always reported that there were no pictures on the ‘camera’)

4) On one of the Apple support pages, it was suggested that Windows Live Photo Gallery or Adobe Photoshop Elements could also be used to import pictures. I went for the free Windows option, which I downloaded from here. The Windows Live installer will prompt you to install multiple apps – but Photo Gallery is all you need.

5) Go to File > Import from a camera or scanner and select your iPhone.
(For me, on first use, Photo Gallery acted the same as the Scanner and Camera Wizard, in that it detected my iPhone but could not access any pictures. At this point, I disconnected the iPhone from the computer, entered my passkey once again and then reconnected the iPhone to the computer)

6) Eureka. On the second try, Photo Gallery was able to detect all of my pictures and videos – and gave me options on how to import, create groups, delete the pictures from the iPhone afterwards, etc.

Notes:
* For ease, you may wish to disable the passkey functionality on your iPhone permanently during this process – but make sure to re-enable it once you’re finished.

* A number of forums mention installing or uninstalling an Apple driver in Device Manager. I did not have this driver installed.

* You may need to disconnect and reconnect your iPhone a number of times, and always make sure your iPhone is unlocked before attempting to import. Unfortunately trial and error seems to be the main course of action!

Posted in Mobile/Cell | Tagged , , , , , | 4 Comments