When I search for things in my codebase I find that using the terminal and grep is usually the best option. Here is what I usually run:
# find meng in all files under a specific directory
# switches i - case insensitive, r - recurrsive, H - show file and path, n - line number
grep -irHn 'meng' current/
# you can count using c
grep -irc 'meng' current/
# you can use regex
grep -ire ^d current/
# search files in current direct for any line that starts with d or D
# make sure e is an the end for example I want line numbers
grep -irne ^d current/
# to skip binary files use I (uppercase i)
grep -iIHrn 'meng' current/
I find myself using this often while debugging errors or trying to figure why a server is slow or unresponsive.
# show all processes
# to quit top type q
# to sort press Shift+O
# K for cpu % or use Shift+P
# show all processes from a specific user
top -u username
# example for me using deployer as the user to run web processes
top -u deployer
# highlight working process
# show path for process
# kill pid
# get help
Use one found here: http://www.vagrantbox.es you can use one of those to build upon or you can create one.
These steps are if you want to to create a fresh box.
Grab the latest CentOS image here:
I use the minimal image http://ftp.usf.edu/pub/centos/7.0.1406/isos/x86_64/CentOS-7.0-1406-x86_64-Minimal.iso
First you need to create a VM using Fusion.
- Select “Install from disc or image” >> Continue
- “Use another disc or disc image” >> Find your iso >> Continue
- Uncheck “Use Easy Install” make sure “Make your home folder accessible to the virtual machine is unchecked. >> Continue
- Click “Customize Settings” >> Rename your vm and place it somewhere safe.
Swift has conventions to convert a string into an int
var intString = "10"
var myInteger = intString.toInt()!
But for doubles, lets say you want var dblString = “5.559” converted from a string to a double. You can’t just do dblString.toDouble()!, not going to happen it just gives an error. So the solution for now is to use Objective-C
var dblString = "5.559"
var myNSString = NSString(string: dblString)
var myDouble = myNSString.doubleValue