25 oktober, 2011

Utveckling: Notepad++ Länka till CHM PHP Manual

Här är ett tips, som jag fann precis nu, för er PHP-utvecklare som vill integrera PHP manualen in i välkända Notepad++.

Skapa ett nytt kommando i Notepad++ (engelsk version) på följande sätt:
  1. Tryck på knappen F5 för att öppna fönstret "Run"
  2. Klistra in följande text i rutan:

    hh.exe mk:@MSITStore:C:\manuals\php_enhanced_en.chm::/res/function.$(CURRENT_WORD).html

  3. Tryck på knappen "Save..." och välj vilka tangenter som skall aktivera genvägen. Jag valde t.ex CTRL+ALT+F10
  4. Det som händer är att jag kan markera en PHP funktion i koden jag redigerar för tillfället och kan då öppna den lokala PHP manualen genom att aktivera genvägen med tangentbordet.



Tips!
Detta kommando fungerar även på andra CHM-dokument för att skapa genvägar, men du måste ändra sökvägen.

20 oktober, 2011

Windows XP: Symboliska länkar / Symbolic links

Åh, jag fann precis ett underbart program till Windows XP som fungerar för er som har NTFS och som vill skapa symboliska länkar.

Det heter Junction, är utvecklad av Microsoft, och kan skapa en symbolisk länk (symbolic linc) [1]

När vill man använda detta? Jag använder det t.ex när jag vill säkerhetskopiera min iPad till en annan plats än den förkonfigurerade sökvägen inuti iTunes, vilket inte går att redigera.

iTunes vill spara alla säkerhetskopieringar till följande sökväg:
C:\Documents and Settings\\Application Data\Apple Computer\MobileSync\Backup

Men jag vill spara filerna här istället:
G:\ipad_backup

Då kan jag köra följande kommando i Windows XP:
C:\junction\> junction.exe "C:\Documents and Settings\\Application Data\Apple Computer\MobileSync\Backup" G:\ipad_backup -s

Nu fungerar det så att om iTunes kopierar filer till katalogen "Backup" så skickas de istället till katalogen "ipad_backup". Bra va!

I Windows Vista och Windows 7 finns det inbyggda kommandon för detta men jag har ännu inte provat själv.

Referenser
[1] http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx

04 oktober, 2011

Tutorial/Network: How to subnet a Class A IP Address (VLSM/CIDR)

Introduction
Hi everyone!
I am going to go through how to subnet a class A IP address network for CIDR. This is not going to be a tutorial for complete beginners but instead towards network technicians that are either studying or work with IT Networks and Communication.

Usually I write articles in Swedish but I thought that this would fit best in english because I think that more english-speaking people are trying to find solutions on this topic. This article is also written in memory for myself so I don't have to search through so many websites when I have this problem in the future.


The goal with this tutorial
Take one IP address network and create more smaller networks from that. This is good when we for example want to summarize addresses.

Take this IP network address: 28.32.0.0/11
We want 4 networks with prefix /14
and the results will be something like this:

Address. Prefix Subnetmask....... Range............Broadcast
28.32.0.0 /14 255.252.0.0 28.32.0.1 - 28.35.255.254 28.35.255.255
28.36.0.0 /14 255.252.0.0 28.36.0.1 - 28.39.255.254 28.39.255.255
28.40.0.0 /14 255.252.0.0 28.40.0.1 - 28.43.255.254 28.43.255.255
28.44.0.0 /14 255.252.0.0 28.44.0.1 - 28.47.255.254 28.47.255.255

Note:
Please not that this is not optimized for real networks. This is just an example and you have to adapt it to your situation and planning. But I think you can make it work.


Let's start
We have IP network address 28.32.0.0/11 and we want to create several subnetworks with prefix /14.

Let's calculate the subnetmask and binary for prefix 11 and 14:
Prefix /11: 255.224.0.0 => 11111111.11100000.00000000.00000000 (eleven 1s)
Prefix /14: 255.252.0.0 => 11111111.11111100. 00000000.00000000 (fourteen 1s)

The fourteen bits are the network bits and they are marked with red
The three bits marked with orange color are subnet bits.
The zeroes are host bits and they are marked with blue color.

Total number of hosts
To calculate the total number of hosts for each subnet we need to cound how many zeroes we have: 2 + 8 + 8 = 18

Then we can use a formula for the total number and the usable total number of hosts IP addresses.

Total number of hosts: 2^18 = 262144
Usable total number of hosts: 2^18 - 2 = 262142

Note:
We subtract two because we remove the network address and broadcast address for the assignable range of host IP addresses.


Calculate the subnet IP ranges
First we search for our increment, a value that helps us to verify the calculation later on. You find the increment by looking at the right most binary 1 in the subnetmask. Then you convert that binary 1 to its decimal equivalent.

Example
28.32 = 00011100.00100000
255.252 = 11111111.11111100

00000100 = 4

The increment is marked with green color. The increment is used to easier check that the ranges are correct. Every new subnet has incremented the octet by 4 when we calculate the range.

Remember this rule: We only change the zeroes and the subnet bits when calculating the ranges.

We start with subnet zero and I only show the second octet (28.32.0.0) because it's most important. The bits are marked with their respective colors to make it easier for you to follow. I only show the network address and the broadcast address for each subnet. The usable host IP addresses are contained within.

Subnet bits are orange
Host bits are blue
Network bits are red

Can you see the pattern? Please note that the network and broadcast addresses are incremented by 4 for each new subnet. 36-32 = 4
#0 00100000 - 00100011 (32-35)
#1 00100100 - 00100111 (36-39)
#2 00101000 - 00101011 (40-43) <-- See example below
#3 00101100 - 00101111 (44-47)
#4 00110000 - 00110011 (48-51)
... etc ...
Here is an example of subnet #2:

Network..First IP....Last IP.......Broadcast
28.40.0.0 28.40.0.1 - 28.43.255.254 28.43.255.255

Decimal.........Binary
28.40.0.0.... = 00011100.00101000.00000000.00000000
28.40.0.1.... = 00011100.00101000.00000000.00000001
28.43.255.254 = 00011100.00101011.11111111.11111110
28.43.255.255 = 00011100.00101011.11111111.11111111
And now we're done! At least we now have a table with numbers that we can expand further and assist us in our network design and planning phase.


Extra assignment ahead
Try to come up with an IP address that summarizes subnets #1 to #3?

Summarization is used mostly in routers to reduce the size if the routing tables and to reduce flapping routes; routes that changes, get added or get removed. If you summarize these routes, they will not be noticed futher down. This is especially useful in OSPF networks between areas to reduce memory and CPU processing. The core routers have summarized routes to surrounding areas.


Read here if you want the solution
28.36.0.0/12

How did I come up with that? First I compared subnet #1, #2 and #3 to see what bits that were in common. The first four bits (0010) in the second octet were the same in all three subnets.

Then I calculate the new subnetmask prefix value for that octect, which is obviously 4, and then adding 8 from the first octet. 8+4 = 12. That's because I only want to use the subnetmask that includes these four bits that were same.

At last I just take the value of the octet from subnet number #1 and we have the final IP network address.

Have a nice day!

Välkomna till bloggen

Välkomna ska ni vara kära besökare. Jag skriver om IT för att det är kul och för att jag vill dela med mig av information och kunskap. Jag försöker hålla bloggen så kategoriserad som möjligt för att ni enklare ska hitta intressanta länkar och artiklar.