Posts Tagged ‘Linux’

Interesting Ubuntu Terminal Keyboard Shortcut

By Mark Davidson on April 7th, 2010

A really quick post this one as I can’t find any documentation on it but thought it was fairly cool. If you use the “SHIFT + ALT + {” keyboard shortcut combo it does autocomplete to match all the files / folders in a directory or some of the files / folders if you have already started typing. Not sure if that makes any sense so an example is in order.

So say in your directory you have the following files ( This is my Zend/Validate/ dir incase anyone wonders)

Abstract.php  Alnum.php        Alpha.php         Barcode         Barcode.php
Between.php   Callback.php     Ccnum.php         CreditCard.php  Date.php
Db            Digits.php       EmailAddress.php  Exception.php   File
Float.php     GreaterThan.php  Hex.php           Hostname        Hostname.php
Iban.php      Identical.php    InArray.php       Interface.php   Int.php
Ip.php        Isbn.php         LessThan.php      NotEmpty.php    PostCode.php
Regex.php     Sitemap          StringLength.php

In this directory if you just do

SHIFT + ALT + {

{A{bstract.php,l{num.php,pha.php}},
B{arcode{,.php},etween.php},
C{allback.php,cnum.php,reditCard.php},D{ate.php,b,igits.php},
E{mailAddress.php,xception.php},F{ile,loat.php},
GreaterThan.php,H{ex.php,ostname{,.php}},
I{ban.php,dentical.php,n
{Array.php,t{.php,erface.php}},p.php,sbn.php},
LessThan.php,NotEmpty.php,PostCode.php,
Regex.php,S{itemap,tringLength.php}}

While if you type a “C” then do it you get

C{allback.php,cnum.php,reditCard.php}

I appreciate its not the most amazing thing in the world but can be pretty handy when you need something a tad more custom than a stand * wildcard. If anyone else knows of some cool keyboard shortcuts for Ubuntu I would be interested in hearing them I have not found any other site that documents this one so I would be interested to know if other people have come across any where that does talk about it.

NetBeans 6.9

By Mark Davidson on March 17th, 2010

I am a massive NetBeans fan and since NetBeans 6.9 is in the pipeline I thought I would do a quick post to point out some of the new features that are coming with the new release, which should be out some time in June.

So Whats New

You can check out a full list of whats new in 6.9 on the NetBeans Wiki New & Note Worthy Page. I will just be pointing out in this post a few of the features that paticularly interest me.

Build & Run JDK 6 Only

This has been coming for a long time I hadn’t read any release information when I first downloaded the latested source from mercurial and took me a bit to reliase I neeed to build with JDK 6. This is really good although slightly annoying if your running certain versions of OSX that don’t support Java 6.

Zend Framework Support (PHP)

This is one of the features I am most excited about since I am just starting to develop some web appliations using Zend its great to have my favourite IDE intergrate so well with the framework. As well as the obvious features such as being able to create a Zend Project and Syntax Completion there is also integration with all the Zend Commands that you would normally do with the zf.sh script. For more details check out the NetBeans PHP Blog most on Zend Framework Support.

Improved PHPDoc in Code Completion (PHP)

A minor feature in some respects but I personally think a really good improvment. As I think people should use PHPDoc a lot more and this can only encourage people to use it to full effect.

PHP Code Formatting Improvments (PHP)

Finally it looks like NetBeans code formatting for PHP now has caught up to how customisable it is with Java. I am really pleased about this as it can be paticually annoying on some big projects if you cant easily enforce coding standards.

CSS Refactoring / Find Usages Support & CSS Code Completion

I can’t even begin to explain how pleased I am about this. CSS has always been a bit of a pain paticually when it came to restructuring or making any significant changes. Now with refactoring support its got 100x easier. This combined with CSS code completion I belive makes NetBeans a Web Developers dream.

JDK 7 Support

JDK 7 Support is also being added to this release this is really awesome. There is some really interesting new features in JDK 7 I will probably do an article about them at some point but for now check out the notes on the features that are currently being added to the editor.


Thats all I want to cover for now lots of awesome new features as always with a NetBeans release do check it out. You either want to download Milestone 1 or compile the latest version from source which I wrote a guide on a few weeks ago for doing it under OSX.

Also check out these links for more details

http://wiki.netbeans.org/NetBeans_69
http://wiki.netbeans.org/NewAndNoteWorthy

sipcalc

By Mark Davidson on March 11th, 2010

While setting up some iptables rules the other day to allow connections from a clients IP range to are servers in London. I needed to translate an IP range expressed as a CIDR to real from and to values. I remembered being taught how to do so in college but that was a long time ago now so was looking for an online tool, I couldn’t find any I liked so I checked for a Linux tool. I found one called sipcalc which is really good. Not only can it do what I needed with translating the CIDR notation it can do a few other calculations / conversions as well.

Simple install process under Ubuntu just the usual

sudo apt-get install sipcalc

Once install its ready to go. To convert an IP range expressed in CIDR format you simply do

sipcalc 165.19.104.1/23
-[ipv4 : 165.19.104.1/23] - 0

[CIDR]
Host address            - 165.19.104.1
Host address (decimal)  - 2769512449
Host address (hex)      - A5136801
Network address         - 165.19.104.0
Network mask            - 255.255.254.0
Network mask (bits)     - 23
Network mask (hex)      - FFFFFE00
Broadcast address       - 165.19.105.255
Cisco wildcard          - 0.0.1.255
Addresses in network    - 512
Network range           - 165.19.104.0 - 165.19.105.255
Usable range            - 165.19.104.1 - 165.19.105.254

This is what I needed to do and it worked just fine giving me the network range and more.

Another useful one is to pass in an IP address and subnet mask this once again is a simple way of getting details about the IP range

sipcalc 10.0.1.84 255.255.0.0
-[ipv4 : 10.0.1.84 255.255.255.0] - 0

[CIDR]
Host address            - 10.0.1.84
Host address (decimal)  - 167772500
Host address (hex)      - A000154
Network address         - 10.0.1.0
Network mask            - 255.255.255.0
Network mask (bits)     - 24
Network mask (hex)      - FFFFFF00
Broadcast address       - 10.0.1.255
Cisco wildcard          - 0.0.0.255
Addresses in network    - 256
Network range           - 10.0.1.0 - 10.0.1.255
Usable range            - 10.0.1.1 - 10.0.1.254

The final example which is probably the most useful to people is to pass in an interface as the parameter

sipcalc -i eth0
-[int-ipv4 : eth0] - 0

[CIDR]
Host address            - 109.123.80.196
Host address (decimal)  - 1836798148
Host address (hex)      - 6D7B50C4
Network address         - 109.123.80.0
Network mask            - 255.255.255.0
Network mask (bits)     - 24
Network mask (hex)      - FFFFFF00
Broadcast address       - 109.123.80.255
Cisco wildcard          - 0.0.0.255
Addresses in network    - 256
Network range           - 109.123.80.0 - 109.123.80.255
Usable range            - 109.123.80.1 - 109.123.80.254