Question: I want to create virtual hosts for my project in zend framework. I have frontend and backend (admin) functionality. I created the virtual host for my frontend functionality with necessary configuration and it running properly.

Example: In /etc/apache2/sites-available I created the file roomstays and my code is in **var/www** folder.

```
<VirtualHost *:80>    
DocumentRoot "/var/www/roomstays/public"    
ServerName localhost

#This should be omitted in the production environment
SetEnv APPLICATION_ENV development

<Directory "/var/www/roomstays/public">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>    
</VirtualHost>

```

And it running properly with localhost.

Now I have admin i.e.backend code and as previous one I want to run this code. I put my newer code into same **var/www** directory with named roomstaysback. My question is how to create virtual host for this backend code. I want to run both frontend and backend side code. 

Please give me any solution I am completely new in it thanks.....

Answer: 
UIImages should be saved by creating a PNG or JPEG representation, then writing that NSData block out as you see fit. See [UIImagePNGRepresentation](http://developer.apple.com/library/ios/#documentation/uikit/reference/UIKitFunctionReference/Reference/reference.html#//apple_ref/c/func/UIImagePNGRepresentation).

UIButtons should be serialized/deserialized using the [NSCoding](https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Protocols/NSCoding_Protocol/Reference/Reference.html) protocol. Archives can take care of this for you.

NSData and UIButtons both support NSCoding, so I would recommend archiving instead of NSUserDefaults. See NSCoding for the beginning of that rabbit hole.
To store custom objects, you need to make sure your custom objects implemented NSCoding protocol. Here is Apple's doc on [NSCoding.](https://developer.apple.com/library/mac/ipad/#documentation/Cocoa/Reference/Foundation/Protocols/NSCoding_Protocol/Reference/Reference.html) . If you need a tutorial on how to implement NSCoding protocol, check out [this site.](http://www.raywenderlich.com/1914/how-to-save-your-app-data-with-nscoding-and-nsfilemanager)  To save UIImage to a file, you can convert the image to  [NSData](https://developer.apple.com/library/mac/ipad/#documentation/Cocoa/Reference/Foundation/Classes/NSData_Class/Reference/Reference.html) and then using NSData's writeToFile method to write to a file. There are numerous examples on how to do the last part on SO. Here is [one.](https://stackoverflow.com/questions/6821517/save-an-image-to-application-documents-folder-from-uiview-on-ios)