Monday 16 December 2013

How to replace all Uppercase letters with spacing in PHP?

What about something like this :


$string = "MaryGoesToSchool";

$spaced = preg_replace('/([A-Z])/', ' $1', $string);
var_dump($spaced);


This :
  •     Matches the uppercase letters
  •     And replace each one of them by a space, and what was matched


Which gives this output :


string ' Mary Goes To School' (length=20)



And you can then use :


$trimmed = trim($spaced);
var_dump($trimmed);


To remove the space at the beginning, which gets you :


string 'Mary Goes To School' (length=19)

Thursday 21 March 2013

Change Netbeans settings to optimize its performance.

1. Open your installation folder of Netbeans in Ubuntu 12.04 (home/<username>/netbeans-7.x.x).
2. Open "etc" folder edit file "netbeans.conf" file in your favorite editor.
3. Replace this line "netbeans_default_options" with following:

netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.zip.disableMemoryMapping=true -J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=on --laf javax.swing.plaf.metal.MetalLookAndFeel"

4. Restart your netbeans then you will see optimized netbeans. see image below: