18 May 2011, 9:15 PM

We came across the issue of NSURLConnection not being called until the Modal was stopped using [NSApp stop] and this is the way around it. We have to use RunLoop.

- (void) awakeFromNib {

NSURL *url=[[NSURL alloc] initWithString:@"/linkout.php?url=olliekett.com"];

NSMutableURLRequest *urlRequest=[NSMutableURLRequest requestWithURL:url];

 

NSURLConnection *c = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self startImmediately:YES];

responseData=[[NSMutableData data] retain];

 

CFRunLoopRun();

}



Then you will need to stop CFRunLoopRun();

- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {

NSString *alert = [NSString stringWithFormat:@"Connection failed: %@", [error description]];

NSLog(alert);

 

CFRunLoopStop(CFRunLoopGetCurrent());

}

 

- (void)connectionDidFinishLoading:(NSURLConnection *)connection {

CFRunLoopStop(CFRunLoopGetCurrent()); 

 

NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];

NSLog(responseString);

 

[connection release];

}




27 February 2011, 1:48 AM

Simple code to allow you to pipe an email to PHP using Forwarder setup with cPanel. You can use by setting up a new Forwarder and using Advanced options.

To pipe you will need to enter this in the box requires changing the root to your PHP file.

/usr/bin/php -q /home/user1/scripts/pipemail.php

pipemail.php must have permission 0775

Contents of pipemail.php are as followed 

#!/usr/bin/php -q

// read from stdin

$fd = fopen("php://stdin", "r");

$email = "";

while (!feof($fd)) {

    $email .= fread($fd, 1024);

}

$lines = explode("\n", $email);

$myFile = "contentsOfMail.txt";

$fh = fopen($myFile, 'w') or die("can't open file");

fwrite($fh, $email);

fclose($fh);

?>




9 November 2009, 5:20 PM
ssh root@000.000.000.000 (Device IP)
password: alpine
iPhone~# passwd
New Password:
Again Password:

Change it using the above in Terminal on your iPhone device. This is important and must be done by all users as soon as SSH is installed




6 November 2009, 5:20 PM

This is handy function which i have been using i put it together myself and use it alot to get data out of documents. 

// (c) Ollie Kett 2009

function FindIt($content, $start, $end) {
$haystack = strstr($content, $start);
$r = substr($haystack, 0, strpos($haystack, $end));
$remove = array($start);
$with   = array('');
$output  = str_replace($remove, $write, $r);
return $output;
}



Run in the follow manner for example i will use the below content
$content = 'information'

I would run that like the follow

FindIt($content, '', '');


That will return the result of 
information


You may want to explore your data if you have information such as 10/100. Explode it to like this
//You use FindIt() instead of 10/100
$e = explode("/", "10/100");


This returns the result of
$e[0] -> 10
$e[1] -> 100





4 November 2009, 9:46 PM
Loading a remote image into UIImageView

UIImage *img = [[UIImage imageWithData: [NSData dataWithContentsOfURL: [NSURL URLWithString: @"/linkout.php?url=olliekett.com/okd.jpg"]]] retain]; if (img != nil) { // Image was loaded successfully. [disk setImage:img]; [disk setUserInteractionEnabled:NO]; [img release]; // Release the image now that we have a UIImageView that contains it. }



2 November 2009, 12:23 PM

With our ever growing API systems we have to parse alot of stuff over SSL to keep connect data secure at the moment we current have

https://olliekett.com


However we dont use wildcard SSL as it's very pricely. We're currelty registerting a new server and SSL which will run on
https://connect.olliekett.com


This will mean pass PHP sessions between different locations so that the data from our API is connected via SSL and send between the secure layer.

Do to this just put the following code before you start your session.
ini_set("session.cookie_domain", ".yourdomain.com");




19 October 2009, 12:41 AM

A simple line of code may have been annoying some of you that use our products in our activation platform some of you might have now we're been having a few issues over the last fews days this is actually because of a stupid error code mistake.

This part of the code 

or die();

Only being 9 characters long (include space) was causing error across the whole platform as it was performing an error out instead of running the code. 

Very annoying :( - Anyways a remote patch has been supplied and it seems to be working now.




13 October 2009, 6:46 PM

The LockMail Beta 1.0 has been rolled to developers on the LockMail Beta Repo. 

apt.lockmail.eu
 

You can download files however the program will not work unless you UDID has been registered on the Beta Program its not too late to register - Email me.

If you are using it you will need access to some vital data which includes the mail server setup use the following for the follow is required just enter the details as shown below

[qtitle]Google Mail[/qtitle][q]Server: gmail
User: @gmail.com
Pass: [/q]

[qtitle]Yahoo (Works for some and doesn't for others)[/qtitle][q]Server: yahoo
User: @yahoo.com
Pass: [/q]

[qtitle]Me (MobileMe)[/qtitle][q]Server: mobileme
User:
Pass: [/q]

[qtitle]Windows Live / MSN[/qtitle][q]Server: live
User: @msn.com (@live.com, @hotmail.com)
Pass: [/q]

[qtitle]Other (Personal)[/qtitle][q]Server:
User:
Pass: [/q]




12 October 2009, 8:58 PM

To connect to the LockMail Connect API / Platform you do so in the follow method

connect,udid,key


An example of this would be

connect,
8a883edc34e403ead20875d7bbd45bc4550a141f,
30d533ad1634573bd1ca9a4e71fe9e6a




6 October 2009, 5:21 PM

I use this normally to add stuff to a database. I insert by converting using this

[qtitle]PHP 4, 5[/qtitle]

$var = htmlspecialchars("Test", ENT_QUOTES)

Once i want to read out from the data i use.

[qtitle]PHP 5.1 >[/qtitle]

htmlspecialchars_decode($var);




8 September 2009, 6:33 PM

1.- Download Altermime from /linkout.php?url=www.pldaniels.com/altermime/a...e-0.3.9.tar.gz to your server, for example /usr/local/src/ doing:

 cd /usr/local/src/

wget /linkout.php?url=www.pldaniels.com/altermime/altermime-0.3.9.tar.gz

tar xvfz altermime-0.3.9.tar.gz

cd altermime-0.3.7

make

make install

2.- Create disclaimers files in plaintext and in html

/usr/local/etc/exim/textdisclaimer

and 

/usr/local/etc/exim/htmldisclaimer

-------------
Ollie Kett




3.- Go to WHM --> Exim Configuration Editor --> Advanced Editor

4.- Find ROUTERS CONFIGURATION and in the first textfield put:

disclaimer:

driver = dnslookup

domains = ! +local_domains

transport = ${if eq {$sender_address_domain}{yourdomain.com}\

{disclaimer_smtp}{remote_smtp}}

ignore_target_hosts = 127.0.0.0/8

no_more


5.- Find TRANSPORTS CONFIGURATION and in the textfield insert :

disclaimer_smtp:

driver = smtp
transport_filter = /usr/local/bin/altermime --input=- --disclaimer=/usr/local/etc/exim/textdisclaimer --disclaimer-html=/usr/local/etc/exim/htmldisclaimer

size_addition = 1


6.- go to the bottom of the page and click save.

That's all.

Now you can test it by sending an email to any account, maybe yourself.





8 February 2009, 2:36 PM

Creating a custom 404 error page. In .htaccess add the following code. 

ErrorDocument 400 /errordoc.php?e=400

ErrorDocument 401 /errordoc.php?e=401

ErrorDocument 403 /errordoc.php?e=403

ErrorDocument 404 /errordoc.php?e=404

ErrorDocument 500 /errordoc.php?e=500

Using the / before the documents will make the locations go to root of your website. If you use domain.com/a/b/c/d/ it will still show this page as so will domain.com/no_file_here will show the error page aswell.

In your file errordoc.php create a GET method and setup different messages using IF and ELSE statements to provide information for the user.




1 February 2009, 9:06 PM

RewriteCond %{HTTP_HOST} ^www.olliekett.com$ [OR] RewriteCond %{HTTP_HOST} ^olliekett.com$ RewriteRule ^track(.*)$ /linkout.php?url=track.olliekett.com$1 [R,L] RewriteCond %{HTTP_HOST} ^track.olliekett.com$ RewriteCond %{REQUEST_URI} !^/tracker RewriteRule ^(.*)$ tracker/$1 [L]




31 January 2009, 11:36 PM

Replasing Data using str_replace(); Here its sorting data ready for Database Input.

$letters = array('"',"'");
$fruit = array('"',"'");
$text = $html;

$text = str_replace($letters, $fruit, $text);

 


 




31 January 2009, 11:30 PM

DataGridView after connection is made you can now use it search by adding this do a Button and Text Feild. Then once is searched it will add information to dataGridView1

 using (MySqlConnection conn = new MySqlConnection(CONN_STRING))

                {

                    conn.Open();

                    MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM users WHERE domain LIKE '%" + search.Text + "%' ORDER BY id DESC LIMIT 100", conn);

                    da.Fill(dt);

                }

                if (!object.ReferenceEquals(dt, null))

                {

                    bs.DataSource = dt.DefaultView;

                }

 

                this.dataGridView1.ClearSelection();

                this.dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;

                this.dataGridView1.DataSource = bs;




31 January 2009, 11:28 PM

Add Refence

using MySql.Data.MySqlClient;

Then code also her is code to Create a DataGridView

 private DataTable dt = new DataTable();

        private BindingSource bs = new BindingSource();  

// Localhost if Local otherwise need SERVER name
string CONN_STRING = "SERVER=localhost;" +

                    "DATABASE=databasename;" +

                    "UID=username;" +

                    "PASSWORD=password;";




31 January 2009, 11:23 PM

Handy script for search a string of data to find information required

$user_agent = $_SERVER['HTTP_USER_AGENT']; // Client Brower

// Search string for Windows XP (Microsoft Build 5.1)

if(stristr($user_agent,'NT 5.1'))
{
$os = "Windows XP";
} else {
$os = "Other Windows OS";
}

 




6 December 2008, 11:56 PM

Cant find a download for Visual C++ 2005 as Microsoft changes there site and will only let you download C++ 2008. Never mind link is here.

» Download

 Please Note: If your using Vista you need to download then do Window Updates to get the Service Pack 1 for C++ 2005.




2 November 2008, 9:44 PM

Using .htaccess to create Vitrual Locations on server.

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^Blog/(.*)$ blog.php?cat=$1 [L]




22 October 2008, 1:00 PM

Handy code to count number of rows in MySQL. I use the code to search return results of how many posts are in on Catergry on my blog.

$db_con = mysql_connect("localhost", "username", "password");
mysql_select_db("database", $db_con);

$result = mysql_query("SELECT * FROM post WHERE catergory='Example'"$db_con);
$num_rows = mysql_num_rows($result);

echo $num_rows;




17 October 2008, 11:17 PM

When creating custom design in C# you want to move your application these codes will enable the whole application or just the outsides to move.

using Microsoft.Win32;
using System.Runtime.InteropServices;

On Form1 add this code


public Form1()
        {
            InitializeComponent();
        }
            public const int WM_NCLBUTTONDOWN = 0xA1;
            public const int HT_CAPTION = 0x2;

            [DllImportAttribute("user32.dll")]
            public static extern int SendMessage(IntPtr hWnd,
                int Msg, int wParam, int lParam);

            [DllImportAttribute("user32.dll")]
            public static extern bool ReleaseCapture();

        private void Form1_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                ReleaseCapture();
                SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
            }
        }



Or if you wish to apply it to move by an object only add

private void Object_MouseDown(object sender, MouseEventArgs e)
       {
            if (e.Button == MouseButtons.Left)
            {
                ReleaseCapture();
                SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
            }
        }




17 October 2008, 10:45 PM

Handy script to set an Intro on to application. Firstly create Form1 and then in Form1 create Form2.

Add a timer named "timer1". Set timer1 properties to Enabled is "True" and Interval is "5000" (5 Seconds).

Now use this script on timer tick

private void timer1_Tick(object sender, EventArgs e)
    {
        Form2 ShowForm2 = new Form2();
        this.Hide();
        ShowForm2.Show();
        timer1.Stop();
    }

Remember than Form1 is only hidden so when Form2 is closed Form1 will still be active in background.




6 October 2008, 8:49 PM

Just a general blog about one of first project created in C# most people do it and its most common way to start C#.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
        }
    }
}




30 August 2008

Ollie Kett Designs has developed a PHP / MySQL Website Stats and Online Tracking System called "TSys". You may see this system working on various networking sites. If you wish to be part of TSys or have it working on your site contact us.

TSys is a online system which takes time and dates of the users page impressions working scripts together it takes visits hits and then creates a log of the users root throughout the network. Every hit is added to a database which takes IP, Time & Date, Page Title, Page URL and User Agent and then combines to count the total page hits of a page and the total hits from that hit.

The TSys works via an Image and can be used as a URL seen below.

track.olliekett.com/?web=Website Name&url=domain.com

Now Working using Virtual Directory's
track.olliekett.com/Website Name/domain.com

 




We have a large portfolio of work we have completed for clients. Our portfolio always carries our current new iPhone applications. Take a look

Follow us on Twitter, We aim to provide Live Information - @olliekett
 

© OKD Limited 2010 | Contact Us
OKD Limited is a private registered company in England and Wales.
 
Ollie Kett Designs - Tracking System