This video shows how to get the lines of code in a PHP application by using PHPLoc from the command line or using Docker. PHPLoc is a command line application to generate a small but useful report. Adam Culp will show how to use it from a Docker Container using a Docker Image he created. PHPLoc demonstrated on the Concrete5 CMS codebase.
Why find the lines of code
PHPLoc is an application to find the lines of code in PHP
No matter what OS you’re cloning, using “dd” via command line will still work. I personally tested while cloning a 1TB Ubuntu hard drive to a fancy new 1TB SSD.
Backstory: I purchased a new Dell 7737 laptop with a 1TB hybrid drive, which turned out to be slower than watching paint dry compared to the old SSD I’d been using for a few years. Otherwise it is a kickass laptop. So I purchased a 1TB SSD after finding they are roughly 50 cents per GB these days…very affordable.
First I put the new SSD into USB caddy I had laying around for backup purposes.
Next I created a bootable USB stick with an Ubuntu ISO image following the instructions at:
With the USB stick created I booted the system to Ubuntu using the USB LiveCD disk image. It may require a BIOS change to enable the PC/Laptop to boot from USB device. Doing this will not make any changes to your current hard drive as long as “Install Ubuntu” is not chosen.
Once booted up I was able to use Gparted, which is a standard app on the LiveCD, to create a new partition table on the new drive in the external USB caddy.
I then used fdisk via command line to find all disks and gain their identifiers needed.
With the new partition and the identifier of the USB drive I was now ready to initiate the copy. I used the following command to do that:
ddif=/dev/sdc of=/dev/sdb mb=8M &&sync
dd if=/dev/sdc of=/dev/sdb mb=8M && sync
NOTE: ‘if’ = read from and ‘of’ = write to.
It takes a very long time for this to finish up, especially with larger drives, but the end result was a working drive with my data on it.
After completion I simply switched out the SSD from the caddy with the internal HD in the laptop and all worked well.
Now that I have Skype installed on Ubuntu 13.04 I discovered that the various Skype sounds were distorted. It was almost like the sounds had some static mixed in with them. I thought it was probably just a problem with the new version of Skype, or the new sound drivers. However, I made a discovery that fixed the issue.
I tried the AlsaMixer fix, but it didn’t work. (A reboot simply resets the PCM to 100 again, and the sound is still crackly.) So it all came down to a simple file edit to get it fixed.
Edit the file /etc/pulse/default.pa using the command:
sudo gedit /etc/pulse/default.pa
sudo gedit /etc/pulse/default.pa
Add the following to the end of the line shown:
So after adding “tsched=0” to the end of the line “load-module module-udev-detect” you will be all set. After a reboot the sounds is still good.
I am running the new version of Ubuntu 13.04 Raring Ringtail, and so far really like it. However I’ve had a bit of trouble with Skype, because I could not get it to use the indicator area of the tray. Other than that it seemed to work fine.
When I installed Skype I did it from the Skype website, and didn’t realize there was a package at http://archive.canonical.com/ partners already carrying it because that repository is not turned on by default for Aptitude.
The repository can be activated by either command line, or by using the Software & Updates which enable it for command line or Ubuntu Software Center, or Synaptic Package Manager.
Open the System Settings and click on the Software & Updates icon, or using the Dash you can simply type “Software & Updates”. Once it opens you can select the “Other Software” tab and check the first box titled Canonical Partners.
Now we are able to install Skype from the Canonical Partners repository no matter what method you wish to use.
sudoapt-get install skype
sudo apt-get install skype
Or search for it through Ubuntu Software Center or Synaptic Package Manager and install nromally.
It will install some other required packages with it, but after the install it now works as expected with the indicator and all.
We’ve all done it…opened a file using vi or vim to inspect the contents, and realize we need to alter it. Of course we totally ignored the message informing we didn’t have permission to edit, so we’re only allowed to view it as “read-only”. Then after we find the troublesome spot we hit “i” and happily edit the place needing changed, only to “face-palm” when we realize we cannot save the wonderful edit we just made.
In the past I handled this one of three ways: I either copied and pasted the change after reopening the file using sudo, or I reopened and retyped everything once again, or I save the file as a temp file and then rename it using sudo. Very stupid, stressful and time consuming.
However, now I know a better way. Using a combination of ‘tee’ and ‘sudo’ commands I can now save the read-only file rather than jumping through the hoops in the previous paragraph. Here is how:
Open a file as normal, forgetting to use “sudo”, and therefore viewing a read-only file.
Then mistakenly try to edit the read-only file in the traditional manner.
But when we try to save using ‘:w!’, SHIFT+ZZ, or :qw!, or whatever combination we normally fail with as an alternative. Here is sample output of what we see:
At this point is where the new magic can happen. Instead of the normal “face-palm” we do not “ENTER” and move on. We can enter a new command and successfully save the file after entering the sudo password:
At this point we will be presented with the content of the file and a prompt to press ENTER or type another command. To simply save the file and move on we just press ENTER, and then press the letter “O” (oh). (NOTE: “L” seems to do pretty much the same thing.) The file will be saved but remains open in vi/vim for more editing or reading. We can now exit normally by typing “:q!” since the file is still open as “read-only”.
What the command does:
:w = Write a file.
!sudo = Call shell sudo command.
tee = The output of the vi/vim write command is redirected using tee.
% = Triggers the use of the current filename.
Simply put, the ‘tee’ command is run as sudo and follows the vi/vim command on the current filename given.