Jul
07
2011
0

PHP: Write to a file

The following code writes to a file, it will overwrite the current contents of the file:


$string = "file contents goes here";
$myFile = "file.php";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, $string);
fclose($fh);

Make sure you give file.php write access on the server (Apache chmod 775 normally works).

Written by Pete in: php |
Jul
07
2011
0

PHP: Limit a strings characters

This function will limit the number of words shown if the total character limit is over a certain number and add … after the string. Very useful if you want to trim titles or anywhere where you are limited by space:


function limitCharacters($string){
$count = strlen($string);
// change 50 to the number of characters you want to check for
if($count > 50){
//change 5 to the number of words you want to limit to.
//change ... to anything you want to use to show its clipped
$newstring = implode(' ',array_slice(explode(' ',$string),0,5)).'...';
}else{
$newstring = $string;
}
return $newstring;
}

To call the function simply use:

limitCharacters($mystring);

Written by Pete in: php |
Jul
07
2011
0

Dreamweaver Locked Files

When opening a file in dreamweaver in OSX you get the following message:

“index.html is a locked files and can be viewed but not changed.”

1. To fix this open finder.
2. Right click on the file or folder.
3. Under sharing and permissions give everyone read and write access.
4. If its a folder click the cog and select ‘Apply to enclosed items’

Written by Pete in: dreamweaver,OS X |
Jul
06
2011
0

BES Server Logs

Here are the abbreviations for the BES Server Logs:

ACNV = BlackBerry Attachment Conversion
ALRT = BlackBerry Alert
ASRV = BlackBerry Attachment Service
BBUA = BlackBerry User Admin Service
CBCK = Backup Connector
CEXC = Exchange Connector
CMNG = Management Connector
CNTS = Notes Connector
CONN = BlackBerry Synchronization Connector
CTRL = BlackBerry Controller
DISP = BlackBerry Dispatcher
HHCG = BlackBerry Configuration Tool
MAGT = BlackBerry Messaging Agent
MDAT = BlackBerry Mobile Data Service
MDBC = BlackBerry Database Consistency Service
MNGR = BlackBerry Manager
POLC = BlackBerry Policy Service
ROUT = BlackBerry Router
SYNC = BlackBerry Synchronization Service

These are located in:

C:\Program Files\Research In Motion\BlackBerry Enterprise Server\Logs

Written by Pete in: Blackberry |
Jul
05
2011
0

Double-Clicked Documents Slow to Open In Word

Click start > run
Type cmd
In the black box type:
netstat -a
Look for “SYN_SENT” and the IP associated with it.

Click start > run
Type regedit
Search for that IP and delete any references to it as a network share (often in printer folders).
Close and restart.

Written by Pete in: Microsoft Office |
Jul
04
2011
0

Blackberry Administration Service Won’t Start

You get the following error:

“The BlackBerry Administration Service – Application Server service terminated unexpectedly.
It has done this 1 time(s). The following corrective action will be taken in 60000 milliseconds: Restart the service.”

Implement the following fix:

Click Start, click Run, type regedit, and then click OK.
Locate and then click the following subkey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
Right-click ReservedPorts, and then click Modify.
Paste the following at the bottom.
48855-48858
45588-45588
49955-49955
45599-45599

Restart the server.

Written by Pete in: Blackberry |

Powered by WordPress | Aeros Theme | TheBuckmaker.com WordPress Themes