Today, I am proudly introducing the SwiftyBeaver Logging Platform private beta.
SwiftyBeaver will make the life of Swift and Objective-C developers, UX designers, app analytics experts, and product owners better and comes with a fresh, year 2016 approach to logging and app analytics.
In Part 1 I introduced you to the main randomizing functions in Swift. In this article we will now use these functions to randomly generate some more complex data which work great if you need to test fake user input in a UITextView, UILabel or CGRect:
a random text of a defined length consisting of digits, letters & spaces
It is often necessary to add some randomness to a Swift application during development. For example if you need to fake data from a user input during a unit test or to display some dynamic placeholder text to get comfortable with your Auto-Layout. Click the title to read more ...
This guide shows how to install the latest 2.x release of Python and all important Python packaging / sandboxing utilities like Pip and Virtualenv under Mac OS X 10.10 Yosemite.
I am using Homebrew to install pre-compiled software. I checked Homebrew 4 years ago and it had issue but now in 2015 it became a more mature solution for the installation of complex Unix software under Mac.
Let’s start.
1. Install Homebrew
Open Terminal.app and type (copy & paste) the following lines to install Homebrew and to check if it worked:
the brew help command should display a list of brew (= Homebrew) commands as validation of a successful installation of Homebrew.
2. Install Python 2.7.9 & Pip
Enter in Terminal.app:
brew install python python -V
The newly installed Python version should be displayed. That was easy!
Now you need update Pip which is a Python package manager. It was already installed together with Python.
3. Update Pip
Enter in Terminal.app:
sudo pip install --upgrade pip pip -V
The Pip version is displayed and can be used to install and upgrade all further Python packages and libraries.
But one key component of every Python development environment is still missing: Virtualenv. Virtualenv is something like a sandboxing system which separates applications (your Python projects) and their installed packages from each other. That separation is very important due because Python has its own internal (not so easy to understand) package dependency system.
All that becomes important latest when you want to deploy your project and its dependencies so better do sandboxing from Day 1.
4. Install Virtualenv & Virtualenvwrapper
Let’s start sandboxing by installing the necessary tool Virtualenv (“virtual environments”). Enter in Terminal.app:
Correct, you just uninstalled it before installing! That is necessary because we also install Virtualenvwrapper which may require a certain Virtualenv version.
The second part of all the entered commands created a hidden file in your home directory which contains the Virtualenv settings. And as last step you created autostart magic of all that.
5. Finished, now let’s test!
Congratulations, you successfully installed Python 2.7.9 (or later), Pip and all sandboxing tools under Mac OS X 10.10 Yosemite.
Now it is time to create our first test project and sandbox (often called virtualenv but that may be confusing due to the Virtualenv project).
Enter in Terminal.app:
cd ~ mkdir PythonProjects cd PythonProjects mkdir test1 cd test1
You created a new folder called PythonProjects in your home folder and a subfolder called TestProject. You can browse that still empty folder in Finder, too.
Now it is time to create the sandbox of TestProject which we call test1. Enter in Terminal.app:
cd ~/PythonProjects/test1 mkvirtualenv test1
You just made / created a virtualenv sandbox called test1. Now it is necessary to work on that sandbox before you do any Pip operation.
Good to know: The name of the active Sandbox is displayed directly at the beginning of the Terminal command prompt which is very helpful to see if you are currently inside a sandbox or not!
To leave / close the sandbox just type deactivate. So let’s continue with the test by activating the sandbox, installing an the Python package PyTest (just as example), test all that and deactivate / close the sandbox:
The package PyTest was installed because the call at line 3 displayed the version. Now we left the sandbox and if we do the same call again then the package should not be available anymore (because we just installed it inside the test1 sandbox) and an ImportError is displayed:
So always keep in mind to enter workon before you do any Pip operation or start working on a project. Also check the installed Virtualenvwrapper, it comes with some further handy commands and automation.
And finally, delete the sandbox because it was just a test:
rmvirtualenv test1
I hope you enjoyed that guide and it was helpful. Please leave a comment if it worked and also if not.
Cloud computing, which boils down to renting server space and software off premises, has become a massive growth target. Every large Internet enterprise is backing the public cloud and hoping to turn hosting your projects into a long term revenue stream.
From a business perspective this makes perfect sense. Every CEO dreams of a bottomless pit of revenue pouring into their coffers, and in this age of information, those wannabe terabyte landlords are in a race to build the swankiest file hosting apartments. The cloud: What's not to love?
In our quest to create the world's greatest development suite we think long and hard about how to make the best tools, offering the greatest value, with the least complexity possible, to our users. But we are all products of our environment, and our tools too are products of theirs. So, in an effort to support them, we investigated the best way to create the perfect environment for our tools, which in turn creates the best environment for our users.
After taking that step back and analysing the contenders, one solution stood out above all others: Nix Package Manager.
Read more ...
The software development life cycle (SDLC) within the agile environment requires the ability to iterate extremely quickly. Over the last few years, when large enterprises have switched to the "fail fast, fail often" approach, they have had to implement this dynamic development approach on top of tools designed and created during the age of "build it and they will come".
Read here to learn more.
Setup your own Git & Mercurial server with RhodeCode
If you ever needed an own in-house Git or Mercurial server with a nice graphical frontend, powerful code review, user permissions and online editing capabilities then RhodeCode Enterprise is something for you.
RhodeCode Enterprise is free up to 20 users, written in Python and the leading open source system to manage Git & Mercurial repositories in teams up to 1000+ users.
The installation under Linux is super easy with a very convenient interactive Installer script. Just run the following lines and you are ready to go:
The Installation under Windows is even easier. Just read here.
Disclaimer: I am RhodeCode’s co-founder and was responsible for the first iterations of the Installer. It is really dead-simple, try it out and please leave comments here if you have questions or feedback. Thank you!
I wrote down my experiences with making the Python application RhodeCode more easier to install and upgrade by evolving from the many ways of achieving that under Python. A recommended read for all interested in Python.
Install Python 2.7, Pip, Virtualenv under Fedora, RedHat Linux and CentOS
While developing the RhodeCode Installer I found a good (and reliable!) way to install Python 2.x, Pip (PyPI) and Virtualenv under current Fedora, RedHat Enterprise and CentOS Linux systems. I added an additional line after each line to make it more clear what should go on the same line.
Firstly, we install Python and make/build tools and then download a custom script which itself downloads and builds Pip. After that we update Pip just in case and install virtualenv:
Install / update to Python 2.7 and latest Pip on EC2 Amazon Linux
EDIT (May 20, 2015): I brought the article up-to-date and it works again. Thanks for all your comments!
Unfortunately Amazon Linux 3.4 AMIs still ship with Python 2.6 which makes it impossible to run many Python apps. Also the installation and update/upgrade of Pip through yum python-pip fails and puts packages into the old 2.6 lib folder.
Here is my solution to upgrade to Python 2.7 including the latest Pip & Virtualenv. Just copy & paste line by line:
# install build tools
sudo yum install make automake gcc gcc-c++ kernel-devel git-core -y
# install python 2.7 and change default python symlink
sudo yum install python27-devel -y
sudo rm /usr/bin/python
sudo ln -s /usr/bin/python2.7 /usr/bin/python
# yum still needs 2.6, so write it in and backup script
sudo cp /usr/bin/yum /usr/bin/_yum_before_27
sudo sed -i s/python/python2.6/g /usr/bin/yum
sudo sed -i s/python2.6/python2.6/g /usr/bin/yum
# should display now 2.7.5 or later:
python -V
# now install pip for 2.7
sudo curl -o /tmp/ez_setup.py https://bootstrap.pypa.io/ez_setup.py
sudo /usr/bin/python27 /tmp/ez_setup.py
sudo /usr/bin/easy_install-2.7 pip
sudo pip install virtualenv
# should display current versions:
pip -V && virtualenv --version
Want to display see at what version control system branch you are currently at your Bash or ZSH? I tested some stuff, but this is the fastest and easiest to setup.
You just download vcprompt and install it in typing this on your Ubuntu shell:
The Ultimate Setup Guide: Ubuntu 13.04 in Virtualbox 4.2 on Mac OS X
This step-by-step guide will provide you with a Ubuntu 13.04 server as guest using Virtualbox 4.2 on Mac OS X 10.8 as host. It has all the bells & whistles like password-less SSH, full network settings, Ubuntu guest additions and a shared and auto-mounted folder of the host inside the guest.
Ubuntu guest will have the following cool features:
SSH from your Mac to the Ubuntu guest
Ubuntu can reach external websites
Ubuntu can "see" other started guests / Virtualboxes
Network settings work even if you move between office and home
Access Mac OS X folder inside the guest
Step 1: Downloads
Download the latest Virtualbox for Mac OS X from https://www.virtualbox.org/wiki/Downloads and install it
Download Ubuntu 13.04 Server as .iso file from http://www.ubuntu.com/download/server
Step 2: Install Ubuntu
Open Virtualbox and click on "New" and enter the Name "Ubuntu 13.04". The type and version which automatically change to Linux and Ubuntu.
Move through all the next steps of the assistant without changing anything. The defaults are okay. You should now see a new Virtualbox in the list called "Ubuntu 13.04".
Click on "Start" to start the newly created Ubuntu Virtualbox.
An assistant will pop up and ask you for the location of an .iso file. Click on the small folder icon and select your downloaded Ubuntu iso-file called ubuntu-13.04-server-amd64.iso and click "Start"
The Ubuntu installation wizard will start, please go through it doing your preferred settings and create their the user ubuntu. If things look odd, just press ENTER or select CONTINUE. Oh, and one important thing: when it asks for "Software selection" please mark (press SPACE) on OpenSSH Server. The remaining installation may take some minutes, just be patient and grab some coffee :)
Step 3: Update Ubuntu
Now we log in for the first time into the new Ubuntu guest and install updates.
Start the guest (if not already running) and login as ubuntu
Enter the following on the command line inside the guest’s Virtualbox window:
I recommend installing the Virtualbox Guest Additions to enable features like shared folders, hardware gfx acceleration and more (more features at http://www.virtualbox.org/manual/ch04.html). The installation is complicated, but if you follow my steps you will be safe :)
In Mac OS X, open your Finder and browse to your Applications folder
Right-click on the Virtualbox icon and select "show package content"
Click there on the folder "Contents" and then on "MacOS"
You are now in the MacOS folder of the application Virtualbox (odd, right?)
Search the file VBoxGuestAdditions.iso and copy it to your Mac’s desktop
Now you can close all your Finder windows and head back to the running Virtualbox application
Ubuntu should be rebooted, now shut it down (click on the guests window and select "send shutdown signal")
In Virtualbox, click on "Edit" while having selected the Ubuntu in the list of virtual machines
There at a system preferences browse to "Mass Storage " and click on the empty disc under Controller:IDE
On the right side of the window is a small CD icon. Click on it and select the VBoxGuestAdditions.iso on your desktop and click on "Open" and then on "OK". It is now mounted as a CD on your Ubuntu guest
Start your Ubuntu virtual machine and login as ubuntu
run the following lines line by line in Ubuntu:
sudo apt-get install dkms -y cd /media sudo mkdir vbox sudo mount /dev/sr0 vbox/ cd vbox/ sudo sh ./VBoxLinuxAdditions.run
Guest Additions is installed now.
Step 5: Network Settings
Now it's time to setup the networking of Ubuntu. Again, it looks very heavy, but just follow the steps. We will setup the network in a way that you can SSH from your Mac OS X into the Ubuntu, that your Ubuntu can reach the Internet and that Ubuntu can see other possibly running Virtualbox virtual machines.
Virtualbox Network settings for internet in and out plus static IP for private networking between VMs:
in the main preferences of Virtualbox, under Network, add the host-only network vboxnet0
in the preferences for the Ubuntu VM in Virtualbox set the following network settings:
adapter 1 is NAT
adapter 2 is host-only using vboxnet0
adapter 3 is internal networking (important for networking between VMs)
In Ubuntu guest, open the network settings:
sudo vim /etc/network/interfaces
paste the following text into the file and save it:
# The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp # The secondary network interface (static IP) auto eth1 iface eth1 inet static address 192.168.56.10 netmask 255.255.255.0
This Virtualbox VM window is not so awesome, so we better connect via SSH into Ubuntu via Terminal.app. And it should be without password of course.
We generate keypair. On your Mac, open Terminal and type:
cd ~/.ssh/ ssh-keygen -N '' -f ubuntu_virtualbox -t rsa -q less ubuntu_virtualbox.pub
Copy the output of the last command (less) to your Mac’s clipboard. Until the text ".local"
Go back into your Ubuntu and create the .ssh folder and
mkdir /home/ubuntu/.ssh cd /home/ubuntu/.ssh
Now create the SSH authorized_keys file on Ubuntu and paste your Mac’s clipboard content in:
vim authorized_keys
save and close vim
Change the permission of the file:
chmod 0600 authorized_keys
Go back to your Mac OS X host and its Terminal.app window and open your Mac’s SSH config file:
vim ~/.ssh/config
add the following lines to this file (last line is double, just indentation is different):
Host ubuntu HostName 192.168.56.10 User ubuntu IdentityFile ~/.ssh/ubuntu_virtualbox IdentityFile ~/.ssh/ubuntu_virtualbox
save and close your Mac’s vim
Try to connect from your Mac OS X host via SSH to your Ubuntu guest:
ssh ubuntu
Step 7: Shared & Auto-Mounted Folder
Wouldn’t it be cool if you could access your Project folder of Mac OS X (or any other folder) inside of Ubuntu? We will do this now and I take as example a folder called "Projects". Please replace this just with the one that you like.
Open the preferences of the Ubuntu VM (you need to shut it down before)
Go to "Shared Folder" and click on "+"
In the first line of the popup select the folder on your Mac which you want to see in Ubuntu
In the second line of the popup enter the name "Project" (or whatever your prefer)
Activate the second checkbox "automatic mounting" (or a similar wording)
Click "OK" and start your Ubuntu VM
In Ubuntu (maybe even connected via SSH?) type the following to add a mounting point for the shared folder:
Now enable auto-mounting. For this, we open the file which is always run at the start of Ubuntu:
sudo vim /etc/rc.local
Add the following line above(!!!) the line with "exit 0":
sudo mount -t vboxsf -o uid=1000,gid=1000 Projects /mnt/Projects
save and close vim
from now on your Mac OS X folder is always in /mnt/Projects inside Ubuntu, even after a reboot
Step 8: Snapshot
Now you should stop your Ubuntu VM and make a snapshot, because we are finished with the general setup!
From now on you can always take this snapshot as base for further Virtualboxes. Just keep in mind, that you maybe need to change the IP, but this on a later guide.
If you have feedback, please post it here as comment. Thanks & enjoy your new Virtualbox Ubuntu!
Following the latest studies from 451 Research and Gartner, 6.1% of the global hosting market ($51bn) are already using public, cloud-based infrastructure (IaaS & PaaS).