Items filtered by date: December 2015

Saturday, 28 August 2010 00:00

Single Quotes vs Double Quotes in PHP

use single quotes unless escaping characters

Article 1

I don’t write about PHP very often — this is the first time since the launch one year ago. However, I do quite a lot of work with PHP and relational databases such as MySQL. Almost every single time I review someone else’s work a common error related to using strings in PHP is made. Misunderstanding the way of defining strings in PHP is often the cause of many hours of debugging as well. If you are relatively new to programming and PHP you’ll most likely recognize this situation.

PHP lets you define strings using single quote, double quotes or heredoc. There’s a crucial difference between the first two and for some reason many people new to PHP start using double quotes. Hopefully the following explanation will save a couple of hours debugging for the starters among us.

The most important difference between the two is that a string enclosed in double quotes is parsed by PHP. This means that any variable in it will be expanded.

echo $var; // Results in the value of $var being printed
echo '$var'; // Results in the word '$var'
echo "$var"; // Results in the value of $var being printed

This means that concatenating strings can be done in two different ways as well.

$var = 'Ipsum';

echo 'Lorem ' . $var; // Results in 'Lorem Ipsum'
echo "Lorem $var"; // Results in 'Lorem Ipsum'

This possibly isn’t anything new to you, but if you are working with HTML you can output valid markup while keeping your code readable. Using double quotes in a string enclosed with single quotes requires no escaping and vica versa. Using a double quote in a string enclosed in double quotes (idem for single quotes) does require escaping, which —in my opinion— degrades readability tremendously.

$text = 'Lorem Ipsum';
$uri = 'http://www.lipsum.com';

echo '<a href="' . $uri . '">' . $text . '</a>';
echo "<a href=\"$uri\">$text</a>";

Personally, I always stick to using single quotes and the dot syntax to concatenate strings, unless I need special characters such as new lines. Whatever you use is up to you, but hopefully this heads-up cleared a lot of confusion and puts an end to unreadible code and markup using single quotes.


Not to mention... using " " where not needed, is just wasting processing, potentially even slowing down your website, if it's as big as say deviantART =P, since PHP has to try to parse something that does not need parsing...

Using single quotes where possible results in nominally faster execution, but we're talking fractions of milliseconds.


As with double quotes, you can escape single quotes in a string enclosed in single quotes as well. I agree that backlashes make it unreadable, but in a rare occassion I use it.

echo 'Hi, how are you? I\'m fine.'; // Single quotes
echo "Hi, how are you? I'm fine."; // Double quotes

Depending on the situation I might deviate and opt to use double quotes instead.


Article 2

The advantage to using single quotes is that you don't need to escape any double quotes in your code, which makes it neater.

However, using double quotes would allow you to place variables inside without having to escape them.

Code:
$variable = 'moo';
// This will work.
echo "Double Quotes. $variable";
// This wont.
echo 'Single Quotes. $variable';

I prefer using single quotes, as it makes echo'd HTML (the php code) look neater. My opinion, of course. :P


PHP Code:
$var $_POST['name']; 

is 7 times faster than

 

PHP Code:
$var $_POST[name]; 

Which method you choose is entirely personal, but I use 'apostrophes' to mark my strings instead of "quotes". The downside is that I must break my string in order to include a variable in it.

I do this for two reason. First, my code editor makes variables inserted in a string bold only if I break the string around them. This makes them easier to spot when I'm troubleshooting or testing. Secondly, it allows me to paste properly validated HTML into my echos and prints without having to escape all of the quotations.

You face a small inconvenience either way, but with my method, they are fewer in number.


Single quotes versus double quotes is a huge issue in PHP. Nobody seems to understand what sort of problems they run in to using double-quotes when they arn't needed.

When you use double quotes, you are asking PHP to parse through the string and search for possible variable matches and escaping characters (like \n).

This is obviously a slow process. Do you think it'd be faster to read a book looking for a secret clue in every 4 words, or to simply read it straight through? Same difference.

If you arn't using escaping characters, it is pointless to use double quotes unless your goal is to make your application slower. Here are a few examples to demonstrate:
 

Code:
$wtf = 'is';
$output = "My name $wtf monokrome"; // This is SLOW.
$output = 'My name ' . $wtf . ' monokrome'; // This is much more efficient.

$wtf = 'google';
  // This is the only sort of time where you ever really need double quoted strings.
$output = '<a href="http://google.com">' . $wtf . "</a>\n"; // Notice the newline(\n)?

As for the array keys being used as $_POST[name], of course that's slow. When you do that, PHP is trying to determine name as a keyword. Since that keyword doesn't exist, it automatically assumes that you are wanting 'name'. Obviously it's faster to not make PHP make that assumption.


Generally, for most scripts, you aren't going to see the script running slower with double quotes. However, when you get to the point where your code is getting more advanced and doing more things, or if you're deploying the script in a real world environment, that is when you need to cut back on double quotes.

Personally I use single quotes everywhere. Using single quotes plus concatenation is faster than double quotes every time.

Published in PHP

 

This applies to xampp-1.5.3a:
(don’t know about other versions since I only have this one. It works also for xampplite)

Yes, after a fresh install of a xampp program you are welcomed with a xampp pseudo website which is located in <path of xampp installation>/htdocs/xampp/. Clicking security you are given some important points to secure your website. That includes changing the root password. But alas, after changing it you’ll not be given a chance to use the ever-friendly phpMyAdmin.

Find <path of xampp installation>/htdocs/xampp/phpmyadmin/config.inc.php

$cfg['Servers'][$i]['password'] = ”; // MySQL password

Change this so that it’ll reflect your current mysql password.

$cfg['Servers'][$i]['password'] = ‘your_password_here‘; // MySQL password

Don’t forget to save it aight?!

 

Published in Web Server
Friday, 27 August 2010 00:00

Page breaks in HTML

Page breaks in HTML

Date created: ~1999

There are several strategies you can use to insert page breaks within an HTML document, thus ensuring that the printed document does not break over lines, graphics, etc. There are limitations, however, and these are listed below.

Limitations

  • The page-break styles work with the following block elements: BLOCKQUOTE, BODY, CENTER, DD, DIR, DIV, DL, DT, FIELDSET, FORM, Hn, LI, LISTING, MARQUEE, MENU, OL, P, PLAINTEXT, PRE, UL, XMP.
  • Only applicable to Cascading Style Sheets 2 specification
  • Only applicable to Internet Explorer 4.x and later at this stage - adding page breaks will not cause any ill effects on other browsers.
  • Do NOT try and use within a table - they won't work! See Strategy 6 (below) for breaking a table when printing.

TinyMCE

When you paste from Microsoft Word 2010 page break are represented by

<br style="page-break-before: always;" />

Strategy 1

<style>
.break { page-break-before: always; }
</style>
<body>
content on page 1...
<h1 class="break">text of Heading 1 on page 2</h1>
content on page 2...
<h1 class="break">text of Heading 1 on page 3</h1>
content on page 3...
<p class="break">content on top of page 4</p>
content on page 4...
</body>

Notes about Strategy 1

This example can be part of an external (CSS) or internal style.

Using a class such as .break and not prefacing it with any form of formatting, means that you can add the information wherever you want a page break to occur - including the middle of the text.

Examples:

  • If you want the page break to occur before each heading 1, you'd add <h1 class="break"> instead of <h1>. Note that the first <h1>, likely to be on the first page, should probably remain as <h1> and only subsequent <h1>'s need the class attribute.
  • If you want to insert a page break part way through the text, then insert <p class= "break">instead of the standard <p> for the text you want to be printed on a new page.

Strategy 2

<style>
h6 {page-break-before: always;}
</style>

Notes about Strategy 2

The reason I used H6 here is that it is a little-used heading for most web pages. By emulating a H1 in font, font size, etc., then adding this code to H6 in addition to the page break information, you can substitute H6 for H1 wherever you want a page break to occur. You can still keep H1 for sections where you don't want to force a page break. Naturally if you want to force a page break at EVERY H1, then you would include the page break information within the H1 style. This strategy can be used with both CSS and internal styles.


Strategy 3

<div style="page-break-before: always">blah blah</div>

Notes about Strategy 3

Make sure you include some text between the <div> opening and closing tags, otherwise this may not work.


Strategy 4

<p style="page-break-before: always">blah blah</p>

Strategy 5

<style>
p.page { page-break-after: always; }
</style>
<body>
content on page 1
<p class="page"></p>
content on page 2
</body>

Notes about Strategy 5

This example can be part of an external (CSS) or internal style.


Strategy 6

......
</tr>
</table>
</center>
</div>

<p class="break"><!--Appendix 2 (continued)--></p>

<div align="center"><center>

[start next table here...]

Notes about Strategy 6

Tables need to be broken in order to force a page break.

In the code in this example, the table has been "chopped" where the break is to occur, a <p> tag inserted with the class attribute added, then the table restarted.

A comment has also been added to alert anybody dealing with the code at a later date that the table is continued.

Links

Published in HTML
Wednesday, 25 August 2010 00:00

Retrospect Restore Procedure

 

How To restore Backup Up Data to the Office Laptop

  1. prepare laptop
  2. transfer files
  3. rebuild catalog file for retrospect
  4. extract files
  5. run sage and payroll to verify data 

1. Prepare Laptop

  • On the laptop delete all files, if present in the folder 'Backup Transfer' which is on the desktop
  • On the laptop any files and folders present in c:\shared Files
  • Empty the recycle bin 

2. Transfer Files

  • Get  the appropriate external drive and attach it to the laptop
  • browse to the external hard drive, retrospect folder and arrange all files by date

    similar to this location F:\Retrospect\Backup Set D\1-Backup Set D
     
  • currently there is more than 1 file per backup, so select all the files belong to the latest date (currently about 9.1gb). This is done by sorting by ‘Date Modified’ and then copy all the files from the latest date (or one date required) these files to the 'Backup Transfer' folder on the laptop’s desktop.
  • once copied, unplug the external hdd and power it down and return it back to the top of the cupboard 

3. Rebuild Catalogue File for Retrospect

All the files required are now on the laptop but they require a new catalog file to be able to extract them, this is like an index file. Please follow the instructions below. 

Tutorial to rebuild Retrospect Catalog file
 

This tutorial will walk you through the process of completely rebuilding your Retrospect Catalog File

Step 1 of 7: Start a Catalog Rebuild

 

 

 

Figure 1a: Retrospect Navigation Bar – Tools

 

 

 

Figure 1b: Tools Overview

 

 


To begin the Catalog File rebuild process, launch Retrospect from the Retrospect Programs group found within the Windows Start Menu.

Once Retrospect is open, you will be presented with the Retrospect Navigation Bar (Figure 1a). To begin the Catalog File rebuild, click Tools. You will be presented with the Tools Overview window. Click the Repair Catalog button as illustrated in this screenshot (Figure 1b).  

Step 2 of 7: Select a Catalog Repair Function

 

 

 

Figure 2: Catalog Repair Selection

 

 


You will then be asked to select the Catalog File repair function.

You will need to select the catalog rebuild type that corresponds with the type of backup hardware you are currently using. In this example we are rebuilding the catalog from a hard disk so we have chosen to "Recreate from disks." Once you have selected the repair type, click OK (Figure 2).

Step 3 of 7: Insert Media From Backup Set

 

 

 

Figure 3a: Media Selection

 

 


You will be presented with this dialog box that asks you to catalog from All disks from the Backup Set, or the Last Disk option for a Fast Catalog Rebuild. When using Groomed backup sets, you must pick "All disks" (Figure 3a). I Select All Disks.

 

 

 

Figure 3b: The Storage Media

 

 

Choose the hard disk (storage media) where the data from your backup was stored and click OK (Figure 3b). When browsing select the ‘Backup Transfer’ Folder and click open. If you try and select the files in the folder it will not work.

 

 

 

Figure 3c: Select a Backup Set

 

 


Retrospect will find all of the Backup Sets on the hard disk. Click the Backup Set from which you want to rebuild the Catalog File and click OK (Figure 3c). In this example we chose to rebuild the Catalog File from “Backup Set A.”  Other Backup Set letters might appear instead, A – D.

 

 


Because I select All disks I am prompted with the option below

Select No

There might be occasions where Retrospect believes there are missing files, in actuality it is the rest of the backup set we have not copied over.

Click Continue

Figure 3d: Forget

Note: Not all users will receive this dialog box.

For those that are asked, "There is already a known backup set named Backup Set A. Recreate a new catalog anyway, forgetting the existing one?” you must click OK to proceed with the Catalog rebuild process (Figure 3d).

Step 4 of 7: Save the Rebuilt Catalog

 

 

     

 

Figure 4a: Save Catalog Window

 

 


You will next be prompted to save your catalog file to the hard disk (Figure 4a). The default location is "My Documents" folder.

 

 

 

Figure 4b: Replace Catalog Window

 

 


If your hard disk already contains a file with a name identical to your Catalog File name, you may be asked if it is safe to replace that file on the hard disk. You typically can replace the item you are saving, or choose a different location to keep the old file with this name, as well as begin the rebuild to a new file (Figure 4b).  

Step 5 of 7: The Catalog Rebuild Starts

 

 

 

Figure 5: Building Catalog

 

 


Once the catalog file has been saved to the hard disk, Retrospect will begin the catalog rebuild process. Retrospect will open the Activity Monitor that will display the Executing tab to show the process of Recatalog(Figure 5).

You should start to see the names of your files appear on the screen within a few minutes.

Note: If the file names do not change, or if at any point in the process the text "Resynchronizing (Slow)" appears on the screen for more than a few minutes, please consult the Knowledgebase for troubleshooting instructions.

Step 6 of 7: Insert More Members

This might not be applicable at the moment

 

 

 

Figure 6: More Members Window

 

 


When Retrospect reaches the end of the first disk you will be prompted with this dialog box (Figure 6).

If you have additional disks (members) in this backup set that need to be recataloged, then click Yes. If you do not have any additional members to rebuild, click No.
When you have inserted all of the members that need rebuilding, click (Figure 6).

Step 7 of 7: Recatalog Finished

 

 

 

Figure 7: Recatalog Finished

 

 


When the rebuild completes Retrospect will report "Execution completed successfully" in the History tab (Figure 7).

You should now be safe to perform future backup or restore operations with this backup set.

       
             

 4. Extract / Restore Files 

  • Open retrospect on the laptop
  • Click on the restore menu item and then

    Restore files and folders from a point in time



     
  • Click next on the wizard
  • Select the backup set you have just created. There should only be one anyway.
  • Select the snapshot to restore and click next. There should only be one anyway.



     
  • On the next page you can select original location or select a new location. If you select original location the files will be restores to c:\Shared Files. Sometimes retrospect will create a ‘Shared Files’ folder within ‘Shared Files’ and so will need to be moved.
  • If Original location option is greyed out  you can select another location using the following method.

    -

 -  Make sure c:\Shared Files folder exists using My computer etc.. if it does not exist create it

  1. Click Add folders
  2. A new window called Subvolume Selection comes up, this is a confusing name, just select c:\Shared Files and then click define



    - You will now return to the previous window which will now look like



    - Make sure you have select ‘Shared Files’ and then click next 
  • With either option, Original location or new location the following window now appears




It is important to leave the top option selected and click next, for obvious reasons. 

  • Click on select files



 

  •  The following window now appears




click on the empty box next to shared files, this should now select all files in the backup to be restored and should look like



click OK

  • You should no have returned to the ‘Select Files To Restore’ window. Click next 
  • The following prompt box appears



    If you select never, files will not be replace if they exist already. In our case becase the laptop has already been prepared this can be left selected. If you select always it will replace files already on the disk. Unless needed leave this setting as it is.

    Click Next
     
  • The restore summary will be now shown.




Click Start and the files will now be restored to the selected location, c:\Shared Files

  • The following windows should now be shown.





 

  •  Click Close. The restore is now complete 
  •  Exit Retrospect

5. Run Sage and Verify Files 

  • The Files have been restored to where the Sage programs expect the company data so no additional steps are required such as import. Only new companies added since the last restore will have to be added in the normal manor through Sage.
  • This is the simplest section, just open Sage Accounts and pick a few random or specific companies to have a look at their data and verify they are correct for that date. Repeat this for Sage Payroll and if needed look at some of the other shared files.
  • If a few companies are correct it is highly likely that the rest  are. I would recommend that you check different companies every month or whenever you restore a backup.

 

Published in Data Recovery
Wednesday, 25 August 2010 00:00

Using Windows XP

Using Windows XP

(© 2008 Lancastrian IT)

The Desktop:

 The Desktop

 

  • Desktop – This is your main work area, it is where you access your computer’s function, i.e. running programs, moving files or changing your screen saver.
  • Icons – These are pictures that can be moved or placed where the user wants them and if they are double clicked (tapping the left mouse button twice with the cursor over the icon) they will run/open programs that are assigned to them.
  • Recycle Bin – This icon opens the recycle bin; this is a hidden folder that contains deleted files. When you delete a file it is put here just in case you deleted it by accident.
  • Taskbar – This is the bar normally at the bottom of the screen. When you have more than one program open at the same time the Taskbar will show you what is open. Also, it contains the Start Button and System Tray.
  • System Tray – This is a part of the Taskbar where some programs that are running in the background are represented by icons (these cannot be moved) so you can get easy access to change their settings.
  • Start Button –When the cursor is moved over the button and the left mouse button is clicked it will reveal a hidden menu consisting of icons relating to programs and computer functions, the Start Menu.
  • Start Menu – This is accessed when the Start Button is pressed (clicking the mouse over the button).
  • Email – This icon, if clicked will run Outlook Express, your program for sending and receiving email (only single click is required in the Start Menu).
  • All Programs – This is another hidden menu but it is within the Start Menu, if clicked on it will show another list of icons, the rest of your computers installed programs, please note that some in the list will have hidden icons, this is shown by a little black arrow and if the cursor is moved over the icon the hidden icons will be displayed.
  • Turn Off – This if clicked once will present you with some options; 1-Standby, 2-Turn Off, 3-Restart. Only 2 and 3 should be used, Turn off, if clicked will close all open programs and turn the computer off, the third option (Restart) will also close all open programs and the computer will start to load again as if you had just turned the computer on. For technical reasons, occasionally this is necessary as with Turn Off just click once.

 Sending and Receiving Email:

Starting from the Desktop, click on the Start Button.When the Start Menu pops up click on the Email icon. This will make Outlook Express load and you will see the following window, shown below.

 

 Outloo Express Opening

 

  • To Explain a Window if you think of the computer’s Desktop as an actual desk and the windows as different pieces of paper with different information, you can put the papers on top of each other without losing any information and you can put them in any order or anywhere on the desk or desktop. This is the same in XP, by using windows on the desktop you can put the windows anywhere on the desktop and on top of each other without losing information, however instead of hand writing the windows contain different programs. This allows you to use more powerful aspects of the computer and make work or play easier.


Once Outlook Express is open it will either appear in a small window as above or as a full screen window, below, where you can only see that program. The other windows will still be there but they will be underneath the full screen window.

 The Inbox

 

  • Folder List – This is where you can swap between sent and received emails by clicking on the name i.e. Inbox – all received emails, Outbox emails waiting to be sent, Sent Items copies of emails that you have sent, Deleted Items – emails that you have deleted (similar to Recycle Bin but for emails) and Drafts – emails that you are writing or have not finished.
  • Inbox –This as mentioned holds your mail that you have received and can be selected by clicking the cursor over the writing ‘Inbox’ with the left mouse button (same for the other categories) and to the right of the folder list will appear all the received emails that you have. Unread emails will appear in bold.
  • Drop Down Menus – These are hidden menus that drop down to shown extra and advanced functions for this particular program. To get them to drop down just click (left click once) on the menu name.
  • Tool Bar – The Tool Bar gives you quick and easy access to some, not all of the programs functions. Usually frequently used actions like sending and receiving emails. The Tool Bar is made up of buttons, like icons but they perform actions within the program rather than running a program and they only require one click. If in doubt of a button’s function if you just move the cursor of the button but do not click it a yellow box will appear with a description of the button.
  • Preview Pane – This shows a quick view of the email that is selected. Good for browsing a lot of emails.

 
To send an email you first have to write it, to do this click on Create Email button shown below (Number 1).
 

 Create Email

 

  • Note the Send/Receive button labelled number 2.

 After clicking the Create email button a further window will appear to write your email with, as shown below.

  The Email Window

  • 1.     To -- This is where you type the email address you want to sendthe message too.
  • 2.     CC – Carbon copy. You can send a copy of the email toanotherrecipient without resending the email, to do this just type theiremail address in the CC box.
  • 3.     Subject – What it says, the subject of the email i.e. holidays plans for the weekend. Its purpose is to enable the recipient to sort his email quicker.


So type your email message and enter the recipient’s address, then you are ready to send your first email.

Click the send button at the top left of the Email Window, which will now disappear. This will put the email in to the outbox ready to send over the Internet when a connection is available. This allows you to compose emails without being connected through your telephone line to the Internet when it is not necessary.

Once you have finished composing your emails you need to click on the Send/Receive button, which you will find in the toolbar of the main window of Outlook Express. The computer will now start to send and receive your emails. If you are prompted for a response by a new window, just click ok. When you have sent your emails and the computer has finished doing this task, check and make sure that you are no longer connected to the internet by checking in the bottom right of the desktop to see if two ‘flashing TVs’ are present as shown below.

  The TVs

If the TVs are present, you are still connected to the Internet. If this is the case, too disconnect from the Internet right click on the TVs icon and a hidden menu will appear. One of the options is ‘Disconnect’ left click this and you will turn your Internet connection off.

And that’s it, you have now moved round the XP desktop and sent emails. Keep this handout nearby so if you get stuck you can reference too it easily and make using your computer enjoyable rather than a chore.

Published in Windows XP
Wednesday, 18 August 2010 22:47

Prevent Code stripping in JCKeditor

** currently not working for new versions of jckeditor, possibly because the config.js is not getting read **

This prevents code stripping or manipulation of code between the geshibot tags (using curly braces) in CKeditor WYSIWYG. (or anyother specified tag)

{code class="brush: text"}CKEDITOR.config.protectedSource.push( /<\?[\s\S]*?\?>/g ); // PHP Code CKEDITOR.config.protectedSource.push( //g ); // ASP Code CKEDITOR.config.protectedSource.push( /(]+>[\s|\S]*?<\/asp:[^\>]+>)|(]+\/>)/gi ); // ASP.Net Code{/code}

Firstly make sure you have set Joomla's whitelist/blacklist thing properly as descibed in this article.

j1.5 http://docs.joomla.org/Why_does_some_HTML_get_removed_from_articles_in_version_1.5.8%3F
j2.5

The easiest way of checking this is to turn off your editor, paste some code in, save the article and see if joomla has stripped the code out.

Next choose CKditor as your WYSIWYG, install if needed.

To prevent any code in between the geshibot tags being stripped out we need to add some code to

/plugins/editors/jckeditor/config.js - if it does not exist create one

The config.js by default is very empty and will probably look like the following:

{code class="brush: text"}/* Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.editorConfig = function( config ) { // Define changes to default configuration here. For example: // config.language = 'fr'; // config.uiColor = '#AADC6E'; };{/code}Add these following lines:

These 2 lines will prevent the html entities being escaped or altered. I have added them because someone else thought it would be a good idea and in the CKeditor plugin config these cannot be set. These might not be required to prevent code stripping.

{code class="brush: text"}config.htmlEncodeOutput = false; config.entities = false;{/code}

These lines prevent anything that matches their RegEx being touched. In this case anything in between geshibot or code tags using curly braces.

{code class="brush: text"}config.protectedsource.push( /{code[\s\S]*?}[\s\S]*?{\/code}/g ) ; // Protects all code between code tag config.protectedsource.push( /{geshibot[\s\S]*?}[\s\S]*?{\/geshibot}/g ) ; // Protects all code between GESHI tags {/code}

The final code should look like:

{code class="brush: text"}/* Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.editorConfig = function( config ) { // Define changes to default configuration here. For example: // config.language = 'fr'; // config.uiColor = '#AADC6E'; // The following work outside this function config.htmlEncodeOutput = false; config.entities = false; config.protectedsource.push( /{code[\s\S]*?}[\s\S]*?{\/code}/g ) ; // Protects all code between code tag config.protectedsource.push( /{geshibot[\s\S]*?}[\s\S]*?{\/geshibot}/g ) ; // Protects all code between GESHI tags };{/code}

NB: The following examples and  the addtional lines above apear to work outside of the config function.

{code class="brush: text"}config.protectedSource.push( /<\?[\s\S]*?\?>/g ); // PHP Code config.protectedSource.push( //g ); // ASP Code config.protectedSource.push( /(]+>[\s|\S]*?<\/asp:[^\>]+>)|(]+\/>)/gi ); // ASP.Net Code{/code}

and possibly this syntax variation might work:

{code class="brush: text"}CKEDITOR.config.protectedSource.push( /<\?[\s\S]*?\?>/g ); // PHP Code CKEDITOR.config.protectedSource.push( //g ); // ASP Code CKEDITOR.config.protectedSource.push( /(]+>[\s|\S]*?<\/asp:[^\>]+>)|(]+\/>)/gi ); // ASP.Net Code{/code}

Save file, empty you browser cache to make sure nothing is left. CKeditor will now leave all code between the geshibot tags alone.

This code will allow you to specify the parameters of Geshibot in the first bracket aswell.

Please note, when you uninstall or upgrade this change will dissapear and will have to mod the file again. Also, the geshibot tags and the code between it will only be visible on the source page.

This technique can be used to protect other needed tags for CKeditor.

My sample config.js that i am using

{code class="brush: text"}/* Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.editorConfig = function( config ) { // Define changes to default configuration here. For example: // config.language = 'fr'; // config.uiColor = '#AADC6E'; // spell check as you type // config.scayt_autoStartup = true; // Whether the editor must output an empty value, if it's contents is made by an empty paragraph only. default is true // config.ignoreEmptyParagraph = false; // Whether to escape HTML when the editor updates the original input element, default value false config.htmlEncodeOutput = false; // Note: option now available in version 3.4.1 and will override this setting - does not affect protected storage config.entities = false; // Protects all code between code tag config.protectedSource.push( /{code[\s\S]*?}[\s\S]*?{\/code}/g ); // Protects all code between GESHI tags config.protectedSource.push( /{geshibot[\s\S]*?}[\s\S]*?{\/geshibot}/g ); // Whether to escape basic HTML entities in the document, default value true config.basicEntities = false; };{/code}

Published in Extensions
Tuesday, 17 August 2010 18:07

Vista error code 80073712

When you try to install Vista SP1 from windows update you may receive the error code 0x80073712


Getting the error code 80073712 when running Windows Update on a Vista Home Premium 32 bit system.
 


Option 1

So far have followed steps in this MS Support Article

also tried this other suggestion:

1. Click the Start icon and in the search field type "winsxs".
2. Double click this folder and scroll down to the file "pending.xml".
3. Right click it and select "Properties".
4. Under the "Security" tab, select "Advanced"
5. Highlight your User Account name from the list and click "Edit..."
6. Repeat 5.
7. Check the box marked "Full control". Then "OK" (x4).
8. You can now delete the file "pending.xml". Make a back up copy if
you wish and paste it somewhere else just in case!
9. Restart your PC (on boot up it should no longer say "Configuring
Updates..." any more).
10. Download the 'Windows Update Installer'
download.windowsupdate.com/v7/wi···ndalone/...).
Once downloaded, you may want to move it from your download folder to
somewhere else. Such as where the Windows Update File (wuapp.exe)
was to start with (C:\Windows\System32). Double click it
to install.
 



Option 2

This issue can be caused by the following factors:

1. The Windows Update service has been stopped.
2. Corrupted Windows Update Temporary folder.

In order to narrow down the cause of this issue and resolve it, please refer to the following steps. After finishing each step, please check the result again on the Windows Update website.

NOTE: Some third party programs can affect the Windows Update service. If you are running any third party applications such as Spyblocker, Internet or web accelerators (programs designed to boost the speed of the Internet connection), security or anti-virus programs (Norton, McAfee, etc.), I recommend we temporarily disable or shut them down and then try accessing Windows Update later. Please understand that we are disabling these programs only for the purpose of troubleshooting and we can re-enable these programs after we finish troubleshooting.

Step 1: Verify the relevant Windows Update services
=======================================
1. Click the Start Button, in Start Search box, type: "services.msc" (without quotes) and press Enter. If you are prompted for an administrator password or confirmation, type the password or provide confirmation.
2. Double click the service "Windows Update".
3. Click on the "General" tab; make sure the "Startup Type" is "Automatic" or "Manual". Then please click the "Start" button under "Service Status" to start the service.
4. Please repeat the above steps with the "Background Intelligent Transfer Service" service.

You can also temporarily stop these services, restart the computer, and then start these services again. If any service is missing or cannot be stopped or restarted, please let me know.

Step 2: Rename the Windows Update Softwaredistribution folder
================================================
This problem may occur if the Windows Update Software distribution folder has been corrupted. We can refer to the following steps to rename this folder. Please note that the folder will be re-created the next time we visit the Windows Update site.

1. Close all the open windows.
2. Click the Start Button, click "All programs", and click "Accessories".
3. Right-click "Command Prompt", and click "Run as administrator".
4. In "Administrator: Command Prompt" window, type in "net stop WuAuServ" (without the quotes) and press Enter.

Note: Please look at the cmd window and make sure it says that it was successfully stopped before we try to rename the folder. However, if it fails, please let me know before performing any further steps and include any error messages you may have received when it failed.

5. Click the Start Button, in the "Start Search" box, type in "%windir%" (without the quotes) and press Enter.
6. In the opened folder, look for the folder named "SoftwareDistribution".
7. Right-click on the folder, select Rename and type "SDold" (without the quotes) to rename this folder.
8. While still in the "Administrator: Command Prompt" window, type the command "net start WuAuServ" (without the quotes) in the opened window to restart the Windows Updates service.

Note: Please look at the cmd window and make sure it says that it was successfully started. However, if it failed, please let me know before performing any further steps and include any error messages you may have received when it failed.
 


Option 3 - original link

  • Delete the file  C:\windows\winsxs\pending.xml
  • Try Installing Updates again
  • If you and access denied error message check and restore appropiate permissions

 

Published in Windows Vista
Tuesday, 17 August 2010 17:54

View Email html source in Outlook 2007

Use 'Save As' and save message as HTML.

Published in Outlook
Thursday, 24 June 2010 18:42

Forgotten Acer Restore Password

No Restore CD / eRecovery / password / ALT + F10 or F10

If you have forgotten the Acer recovery password and do not have restore disks the following method will tell you have to recover the password.


1 - Recovery of data on the hidden partition PQSERVICE for password
A - Installing the software R-Drive Image to create an image of this partition (this file has the extension. ARC)
B - Always with this software, create a virtual disk logic to see the files
C - From the desktop, go to the newly created virtual disk and find the file aimdrs.dat. The open with the notepad and get the password.

2 - Reactivating the ALT + F10
A - Always on the virtual disk created, find 2 files: mbrwrwin.exe and rtmbr.bin.
B - Copy these 2 files on drive C: \
C - Since the MS-DOS (Pocket PC) to C: \, type the following command: mbrwrwin install rtmbr.bin
D - The function has been reactivated.

3 - Start of Restoration
A - At the start of the PC, go to the set-up to check if the function is well on D2D enabled (normally it is a default setting ... but hey you never know.)
B - Once the audit and that the PC has restarted once the ACER logo appears, simultaneously press ALT + F10 to start the restore utility.
C - When it asks for the password, you need to type one found in the file aimdrs.dat. CAUTION: The keyboard is QWERTY mode so we thought enter his password, but as some letters are reversed, it does not work.

4 - Normally at this stage there ... everything works and restoration is smooth.

Published in Data Recovery
Thursday, 24 June 2010 16:30

Hackintosh Vmware Notes

amd cpu need patch
intel cpu need patch
SSE2 - cpu encyrption?
SSE3 - cpu encyrption?
PPF1 - patch to allow the detection of hard drives
PPF2 - patch to allow the detection of hard drives

ie

Mac_OS_X_10.4.8_[JaS_AMD-Intel-SSE2-SSE3_with_PPF1__amp__PPF2].iso

Notes:

a pre patched disk is required to install mac os on vmware or a pc as the HFS+ disk structure of macs cannot be seen by normal PCs.

There then needs to be a modified bootload to get past the mac hardware tests.

-------------
there is a method to convert a *.dmg file in to a vmware hard disk using a utility

------------------
to get the ethernet utility to work in vmware the config file has to be altered as below:

add details

nb once altered do not reedit the virtual machine or the changes will be lost

-------------------
darwin seems to be the modified bootloader

-----------------
Settings indicate to set up the vmware machine as FreeBSD (Mac OS X is a modified Unix), but if you have a core duo (add other boards) you should set you vmware machine as a Window NT otherwise you will get a kernel/stack error.

------------------

also do not have vmware machine online while setting it up as it talks back to apple.

daves 10.4.1 -- works windows nt + freebsd
Jas 10.4.8 -- installs but locks up on 1st boot
hazard 10.5.6 intel only sse2 sse3 -- gets to the cursor only
XxX_x86_10.5.6_Install_Disc_Universal_Final -- craps out
Kalyway_10.5.2_DVD_Intel_Amd -- have to add shit in? very slow doesnt reaqlly boot
Mac OS Leopard 10.5.2 AMD Intel SSE2 SSE3
iPC 10.5.6 Leopard Hackintosh AMD.iso - kernel error

NB:
My CPU is Intel Core 2 Duo, I can only installed IDeneb 10.5.6 with VT enabled at BIOS. After it is successfully installed, I need to go back to BIOS to disabled the VT, otherwise I am unable to boot into the Mac OS(keep getting *** Virtual machine kernel stack fault (hardware reset) *** provided I have changed around different guest OS). I have this done using vmware 6.5.2. Hope this helps.


Keyboard Doesnt Work

on a hackintosh, to get the ps2 keyboard to work after install a ps2 mouse needs to be plugged in and the computer powered down and rebooted.

my setup that got it working was ps2 keyboard, ps2 mouse and a usb mouse
 

Published in Mac
Page 80 of 96