Hide up/down arrows on inputs with type=”number”

HTML5 brought many cool things and input type number is one of them. It allows to input only numbers from the box and there is a way to specify limits for input values. However together with those useful features it has one annoying thing – up/down arrows on the right side, embedded into field. If you don’t like them just change field type to textinput and they disappear. But there is a more elegant way to hide them and the same time use all advantages of HTML5 number form input. Just add to your CSS file following code:
[code lang=”CSS”]
.no-spinners {
-moz-appearance:textfield;
}
.no-spinners::-webkit-outer-spin-button,
.no-spinners::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
[/code]
After that add class no-spinners to any number input you would like to see without up/down arrows.

Create a new VMWare Appliance from existing one

I use VMware player to run Maemo SDK environment. Recently Maemo released the latest version of its SDK – Diablo. So, I decided to upgrade Chinook VMware Appliance to Diablo. I copied maemo-sdk.vmdk (virtual disk) and maemo-sdk.vmx (definitions) to the new directory, modified title in the definition and run VMware player. But after booting I found that there is no eth0. Just lo.

To solve that problem the file /etc/udev/rules.d/70-persistent-net.rules should be deleted. It contains the virtual MAC address of Ethernet card. After reboot everything should be ok.

CSV files and IE

Today I spent about three hours to play with “extremely practical and user friendly” interface of WinXP. The problem was that Windows is too smart (at least for me). It tries to foresee your desires. But as result you wast your time to switch off next “intelligent” feature. In my case I heed to download CSV file from site supported IE only. But IE opens that file in browser window with Excel, corrupted its data. Finally I found solution:

  • Open Control Panel
  • Open Folder Options
  • Click File Types
  • Locate “CSV” and click the Advanced button
  • Check the box that says “Confirm open after download”
  • Do the same for “XLS Microsoft Excel Worksheet” as well
  • Click Ok

It was amazing. I checked Alan Simpson’s Windows XP Bible and O’Reilly – Fixing Windows XP Annoyances but without luck. Maybe that issue so trivial that everybody knows how to solve it. Anyway, once again I saw that Windows is not my choice!

Improve Your Perl Programming

Brian Foy – the author of Mastering Perl and one of the famous perlmonks, wrote an article on the ONLAMP where described five ways to improve Perl programming:

  • Cleaning up your code – I also hate to read unformatted code -without tabs, proper style etc.
  • Use configuration – sure, my favorite module – Config::General.
  • Logging – log4perl should be used in all your applications.
  • Persistence – Brian suggested to use Storable or DBM::Deep but I prefer to use Cache::FileCache (it’s used in my module IMDB::Film to cache already retrieved web content).
  • Subclasses for applications – it’s good practice to implement a common functionality in the modules instead of keeping it in your script. This approach allows to have more structured application and reuse the same functionality in some other scripts.

So, generally I didn’t find anything new for me in those recommendations. I just confirmed my own point of view 🙂

tar: Howto Exclude or Include Files

Recently I’ve had a little problem. I’ve needed to create an archive from some source directories but I’ve not needed to add in the archive some subdirectorives. I’ve made a quick search in Google and found an article “Telling tar Which Files to Exclude or Include”. Here is a short example:


$ find videoguide/ ! -type d -print | egrep '/,|%$|~$|.jpg$|.gif$|.png$' > /tmp/exclude_files

That command forms a list of excluded files and store it into temporary file.

$ tar vcfX ~/projects/arc/vg-19012004.tar /tmp/exclude_files

will remove files which listed into excluded_files from archive.

Updated: There is a more simple way to exclude file/dir from the archive. You can define a pattern in the command line instead of creation a file. Let’s image that we need to exclude Subversion directories from the archive:
tar vzcf my-project.tar.gz --exclude='.svn' ProjectDir
Note: you should always wrap the pattern by quotes!