Archive for category Tips and Tricks

How to convert an array or object into a string in php

2
Digg me

I am asked “How do I convert an array or object into a string” very frequently so I thought I would put a quick little tutorial together explaining the various different methods.

Converting an array OR object into a string(BEST METHOD)

We are going to use the functions serialize and unserialize.

These functions are very easy to use, for example converting an array or object you would do the following:


$string = serialize($objectorarray);

Now to convert the string back into an object or array we would do:


$objectorarray = unserialize($string);

It really is as simple as that, however sometimes the serialize function doesn’t do a good job at escaping characters so to get around this we do the following:


$string =base64_encode(serialize($objectorarray)); // This converts into a string

$objectorarray = unserialize( base64_decode($string)); // This converts a string into an array or object

Converting an array into a string (OLD FASHIONED METHOD).

Implode and Explode can be used to convert an array.

Look at my example below.


$myarray[] = 'Apple';

$myarray[] = 'Orange';

$string = implode('|',$myarray);

echo $string; // This would return Apple|Orange

Using the example above, the implode function takes two parameters.  First our separator and second our array.

To now convert the string BACK into an array we use explode. See the example below.


$string = 'Apple|Orange';

$myarray = explode('|',$string);

print_r($myarray);

The explode function takes pretty much the same parameters as implode except it looks for a string rather then an array.

Why would you want to convert an array or object into a string?

When saving vast amounts of data into a mysql table or even a text file, all you would need to do using the method above is save the string into the file or into a table row.  Very useful if you have plenty of dynamic data… No need to create lots of column names when you can save the object or array into a single row!

  • Share/Bookmark

, , , , , , , , ,

1 Comment

How to burn a Wii game / iso

3
Digg me

IMPORTANT: You should only ever burn a game that you already own. Downloading a burning games that you do not own is illegal.

What you need.

  • DVD Writer
  • High quality DVD-R discs – I use Verbatim they are by far the best quality (Click here to view)
  • The game ISO that you have downloaded from Usenet or Torrents.
  • Nero Burning Rom or something similiar.

Instructions

  1. Open up Nero Burning Rom and go to File -> Open -> Browse to the ISO, Click it and then Click “Open”. For Nero Express Click “Image, Project, Copy” and then Click “Disc Image or Saved project”
  2. Now it is very important that you burn at a low speed, the Wii console will simply struggle to read it if you burn at a fast speed.
    If you are using Nero Burning Rom you will now see a window titled “Burn Compilation”. Make sure “Write” and “Finalize Disc” are ticked. Make sure “Write Speed” is set to 2x now click burn.
    If you are using Nero Express you will see some options appear.  There should be a little arrow to the left of the window, click it and some more options will appear.  Change the “Write Speed” to 2x and now click burn.
  3. If you have a blank disk in the drive it will start burning, if not it will open the drive and ask for a blank disc.
  4. Now all you have to do it wait.  Once it has finished burning (around 30 minutes) go pop it in your chipped Wii and you are ready to go.
  • Share/Bookmark

, , , , , , ,

9 Comments

How to stop spam – junk mail

0
Digg me

Sick of receiving emails with the following subjects: tramadole, buy tramadol, online casino, buy soma, buy viagra, buy viagra online, cheap viagra, tramadole online etc…

Everybody suffers from spam at some point, so here’s some tips on fighting spam.

  1. Be very careful entering your email address on websites.  Some websites sell this information on to advertising company’s who then spam your inbox.
  2. Keep your personal/business email account separate. Get your self a free Hotmail account at http://www.hotmail.com and use it for filling in on-line forms.
  3. Google’s Gmail has the best Junk Mail filter I have ever seen! Creating an email address with Gmail is free and I would highly recommend this.
  4. RING THE INTERNET SERVICE PROVIDER. Ring your ISP whether it’s BT, Tiscal, Aol etc and see what they have to offer.  If they try to sell you anti-spam software then DO NOT ACCEPT.  Software based anti-spam filters work by looking at the emails once they are downloaded on your computer, we want it to be deleted BEFORE you download it!
  5. If you own a domain based email address such as matt@mybusiness.com, contact who ever hosts the email and tell them your problem.  If they have access to the machine/server hosting your emails they should be able to install anti-spam software such as Spam Assassin.  Ask them about this.

Please note this is just a small guide on how to prevent spam. If everything fails, why not just create a new email address?

  • Share/Bookmark

, , , , , , , , , ,

2 Comments

Delete your computers history and temporary internet files

4
Digg me

CCleaner is a free program that specializes in deleting all your computers history, temporary internet files and cookies. If you have never ran a clean up procedure before then you will be amazed in the amount of junk this will remove.

How to delete the temporary internet files, history and cookies.

  1. Download CCleaner V2.08 installation here ( Latest version as of 25/06/2008 is v2.08 ) If you would like to check for the latest version then click here http://www.ccleaner.com/download/downloading
  2. Once the file has downloaded, run the installation.
  3. Click Next >
  4. Accept the license agreement by clicking I Agree.
  5. By default the installation will install CCleaner into the program files, [RECOMMENDED] if you are happy with this click Next >
  6. The installation will try to install the Yahoo Tool bar and add some Windows Shell Extensions which are not required, However if you would like to support this great program then leave the Add CCleaner Yahoo Tool bar ticked. I personally would leave it not ticked as I hate unnecessary tool bars.
  7. Click Install.
  8. Click Finish – CCleaner is now installed.
  9. You can access CCleaner from the Windows Desktop or from the Start Menu.
  10. On Windows Desktop the icon will appear like this.
    CCleaner Icon
  11. Double click CCleaner on the Windows DesktopCCleaner Menu
  12. If you want to delete all history on the computer I would recommend ticking all the boxes, ignoring the warnings and then click Run Cleaner

If you let Internet Explorer remember search information, user names or passwords then I would recommend not ticking the “Autocomplete Form History” box.

CCleaner can also be used as a registry cleaner. Click the Registry icon in the menu to use this feature.

Thanks to Piriform Ltd. for creating this great application.

* CCleaner stands for Crap Cleaner :)

  • Share/Bookmark

, , , , , , , , , ,

No Comments

The ultimate free disk defrag tool

1
Digg me

The most common application I recommend to my customers is JkDefrag created by Jeroen Kessels.

It is by far the best disk defragmenter and optimizer I have ever come across!

Best of all IT’S FREE!

Click here to Download

I recommend this disk defragmenter because it is so simple to use, you do not need to be very technical minded at all.  You just run JkDefrag.exe and then it starts.  You can stop it at any time just by closing the program.  When it has finished it will display “Finished” in the top left corner of the application. I would recommend doing a disk defrag at least once a month to keep your hard drive at optimal performance.

Here is what Jeroen Kessels (Creator) says about JkDefrag.

What is “disk fragmentation”?
Imagine a book split into several parts, some pages are over here, other pages in another room on another floor altogether. You will have to walk a lot when you need to read the book. It may sound silly, but this is exactly what happens to files on your harddisk. Defragmentation will put all the parts (fragments) back together, making your computer a lot faster.

What is “disk optimization”?
Imagine a big library with lot’s of books, spread out all over the building and not sorted whatsoever. There is an index telling you exactly where every book is, but you will have to walk a lot when you need several books. This is exactly what happens on your harddisk, the files that belong to an application can be all over the place, anywhere on the harddisk. Optimization will bring all the files together in one place, leaving the rest of the harddisk empty, and will sort the files, for example alphabetically.
JkDefrag is based on the standard defragmentation API by Microsoft, a system library that is included in Windows 2000, 2003, XP, Vista, and 2008. Most defragmenters are based on this API, including the free defragmenter that comes with Windows and many commercial defragmenters. Basically all JkDefrag does is send “move this file to that location” commands to the API. JkDefrag does not modify the disk by itself, and is therefore extremely solid.

Defragmentation and optimizing will not only make a harddisk faster, but also lengthen it’s life span. The disk will have less work to do and therefore have less wear and tear. Secondly, the sorting optimization strategies (see the “-a” option) will refresh all the magnetic data on your harddisk. However, defragmenting and optimizing is work, so excessive defragmenting and optimizing can actually cause more wear and tear than it prevents. JkDefrag is therefore set for “fast” optimization by default, intended to be used on a daily basis. The other optimizations should only be used occasionally.

Click here for a direct download to JkDefrag or Click here to view the creator’s website

  • Share/Bookmark

, , , , , , , , ,

2 Comments

How to install AVG 8 without the Web Shield

0
Digg me

Ever since the launch of AVG8 some people on low end computers have suffered from sluggish internet browsing, this slow browsing is caused from the Web Shield that AVG8 installs.

The way I see it the Web Shield scans the websites you visit, checking the websites source code to see if there is any code that could be harmful.  Great idea! but when using Google it checks every website in the Google results! Meaning SLOW browsing and sometimes even the Web browser such as Internet explorer fails to respond.

Here is what Grisoft says about their Web Shield component.

“AVG 8.0’s patent-pending safe surfing and safe searching technology is designed to protect users of Internet Explorer and Firefox browsers against drive-by downloads from poisoned web pages and to flag dangerous search results in Google, Yahoo and MSN search engines.

Complementing the safe surfing and searching technology, the new Web Shield module scans files during download or exchange over ICQ or MSN instant messaging to ensure they are safe and free of malicious content.”

Taken from – http://www.grisoft.com/us.90627

Interestingly enough it is under the title “AVG 8.0: Tough on threats. Easy on you”.

I think we should rephrase that to  “AVG 8.0: Tough on computers. Extremely slow browsing for you”.

I would like to point out that if you have a high end computer you may not suffer as much from this problem. I would still recommend removing it as its very resource hungry.

Installing AVG Free 8 without the Web Shield

Yes, we could just disable the Web Shield in the AVG8 control panel but then AVG8 is always in Error state by showing this icon “AVG8 Error State” in the system tray.

  1. THIS IS IMPORTANT. If you have AVG8 installed then go to (This is for Windows XP users) Add/Remove programs in Control panel. (This is for Windows Vista users) Programs and Features in Control Panel. Select AVG Free 8.0 and click Uninstall/Change and follow the wizard to uninstall AVG8 – This may require restarting the computer.
  2. Download the latest installation from http://www.grisoft.cz/filedir/inst/avg_free_stf_en_8_100a1323.exe – (Latest installation as of 23/06/2008) or from http://free.grisoft.com/ww.download?prd=afe#tba2 – (Always has the latest download listed)
  3. Save the installation file as avg.exe in the root of the C:\. See Below AVG8
  4. Now we go to (Windows XP users) Start Menu and click Run. (Windows Vista users) Go to Start Menu -> in the “Start Search” box type Run. At the very top of the results under Programs you should see Run click it.
  5. A box should appear, copy and paste this “C:\avg.exe  /NOAVGTOOLBAR /REMOVE_FEATURE fea_AVG_SafeSurf /REMOVE_FEATURE fea_AVG_SafeSearch /ADD_FEATURE fea_AVG_EmailPlugins /ADD_FEATURE fea_AVG_EMC /ADD_FEATURE fea_AVG_Office_2000_plugin” excluding the speech marks into the box labelled up Open then click OK
  6. Follow the installation through, you will notice that it will be on “Custom Installation”. Click next continuously.
  7. Eventually AVG8 will be installed and will require configuring, you will be shown a wizard to set-up scheduled scans and to update your virus definitions. Follow this through and make sure everything is up to date.
  8. If you still have the icon “AVG8 Error State” in the system tray, double click it and see which components need updating.
  9. Once everything is up to date and functional you should see thisAVG8 With out web shield
  10. The system tray icon should look like this

Finished!

  • Share/Bookmark

, , , , , , , , , , ,

No Comments