Menu Open


Slightly out dated but some useful information about OKD product releases and on goings mainly Code snippets related to PHP or iOS development.

Cent OS adding port into iptables - command line SSH

4 August 2013, 10:06 AM
The following can be used to allow connections to a port from any IP. Use the simple line below to accept a port in iptables.

To allow HTTP port 80
iptables -I INPUT -p tcp --dport 80 -j ACCEPT

To allow DNS port 53
iptables -I INPUT -p tcp --dport 53 -j ACCEPT

To add any port just change the number to the required port

Convert NSTimeInterval to NSString - iOS Development

17 September 2012, 4:38 PM
To convert NSTimeInterval to NSString the following code works perfect

NSTimeInterval today = [[NSDate date] timeIntervalSince1970];
NSString *intervalString = [NSString stringWithFormat:@"%f", today];

Find string in NSArray and return index of string - iOS Development

12 September 2012, 3:54 PM
Find a string in an NSArray
NSArray *animals = [NSArray arrayWithObjects:@"Dog", @"Mouse", @"Cat", nil];
NSLog(@"Index: %i", [animals indexOfObject:@"Cat"]);

This would provide the following 
Index: 2

Convert NSString to Int - iPhone Development iOS

4 September 2012, 11:34 PM
Some simple code for converting string to int and int to string

String to Int
NSString *name = @"10";int value = [name intValue];

Int to String
int value = 100;NSString *name = [NSString stringWithFormat:@"%i", value];

PHP - Show String as Currency - Comma Separated - number_format()

7 February 2012, 12:57 PM
Working to show currency in a readable format

// 1 million coins is easier to read as 1,000,000
$value = "1000000"; // echo as 1,000,000
echo number_format($value, 0, '.', ',');

// echo as 1,000,000.00
echo number_format($value, 2, '.', ',');

// echo as 1:000:000
echo number_format($value, 0, '.', ':');