
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>blog</title>
	<atom:link href="http://blog.andrevenancio.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.andrevenancio.com</link>
	<description>random thoughts on iOS, actionscript and HTML5</description>
	<lastBuildDate>Sat, 21 Apr 2012 20:28:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Accessing iOS device Camera</title>
		<link>http://blog.andrevenancio.com/accessing-ios-device-camera/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=accessing-ios-device-camera</link>
		<comments>http://blog.andrevenancio.com/accessing-ios-device-camera/#comments</comments>
		<pubDate>Sat, 21 Apr 2012 00:35:12 +0000</pubDate>
		<dc:creator>andrevenancio</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[uiimagepickercontroller]]></category>
		<category><![CDATA[uiimagepickercontrollersourcetypecamera]]></category>

		<guid isPermaLink="false">http://blog.andrevenancio.com/?p=107</guid>
		<description><![CDATA[Every developer wants to build the next instagr.am and sell it to Facebook for 1Billion dollares ;) Why not start today? Please notice that myCustomMethod invokes the UIImagePickerController directly and this will lead to a memory leak. You should place the imagePicker in the header file and release it in the dealloc method! While where [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.andrevenancio.com/wp-content/uploads/2012/04/Screen-Shot-2012-04-21-at-01.49.20-AM.png"><img src="http://blog.andrevenancio.com/wp-content/uploads/2012/04/Screen-Shot-2012-04-21-at-01.49.20-AM-159x300.png" alt="" title="camera preview" width="159" height="300" class="aligncenter size-medium wp-image-109" /></a></p>
<p>Every developer wants to build the next <a href="http://instagr.am/" title="instagram" target="_blank">instagr.am</a> and sell it to Facebook for 1Billion dollares ;)<br />
Why not start today?</p>
<p>Please notice that myCustomMethod invokes the UIImagePickerController directly and this will lead to a memory leak. You should place the imagePicker in the header file and release it in the dealloc method! While where on it, please include UINavigationControllerDelegate and UIImagePickerControllerDelegate reference in the header file. </p>
<pre class="wp-code-highlight prettyprint">
-(void)myCustomMethod
{
    UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
    imagePicker.sourceType =  UIImagePickerControllerSourceTypeCamera;
    imagePicker.delegate = self;
    imagePicker.allowsEditing = NO;

    [self presentModalViewController:imagePicker animated:YES];
}

-(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
    NSLog(@&quot;user cancel&quot;);
    [self dismissModalViewControllerAnimated:YES];
}

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    UIImage *pickedImage = [[info objectForKey:UIImagePickerControllerOriginalImage] retain];
    UIImageWriteToSavedPhotosAlbum(pickedImage, self, @selector(image:didFinishSavingWithError:contextInfo:), nil );

    [self dismissModalViewControllerAnimated:YES];
}

- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
{
    if (error) {
        NSLog(@&quot;Unable to save image to Camera Roll&quot;);
    } else {
        NSLog(@&quot;Image saved to Camera Roll&quot;);
    }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrevenancio.com/accessing-ios-device-camera/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UIActionSheet</title>
		<link>http://blog.andrevenancio.com/uiactionsheets/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=uiactionsheets</link>
		<comments>http://blog.andrevenancio.com/uiactionsheets/#comments</comments>
		<pubDate>Fri, 20 Apr 2012 22:39:19 +0000</pubDate>
		<dc:creator>andrevenancio</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[actionsheet]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[uiactionsheet]]></category>

		<guid isPermaLink="false">http://blog.andrevenancio.com/?p=87</guid>
		<description><![CDATA[A very good way of displaying extra options or any action confirmation, its using UIActionSheet. In the header (.h file) make a reference to UIActionSheetDelegate. Demo.h @interface Demo : UIViewController &#60;UIActionSheetDelegate&#62; { } @end Next, in the Demo.m -(void)someMethod:(id)sender { UIActionSheet *actionsheet = [[UIActionSheet alloc] initWithTitle:@&#34;This is a title&#34; delegate:self cancelButtonTitle:@&#34;Cancel&#34; destructiveButtonTitle:nil otherButtonTitles:@&#34;Item 1&#34;, @&#34;Item [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.andrevenancio.com/wp-content/uploads/2012/04/Screen-Shot-2012-04-20-at-11.46.30-PM.png"><img src="http://blog.andrevenancio.com/wp-content/uploads/2012/04/Screen-Shot-2012-04-20-at-11.46.30-PM-159x300.png" alt="" title="UiActionSheet preview" width="159" height="300" class="aligncenter size-medium wp-image-92" /></a></p>
<p>A very good way of displaying extra options or any action confirmation, its using UIActionSheet.<br />
In the header (.h file) make a reference to UIActionSheetDelegate.</p>
<p>Demo.h</p>
<pre class="wp-code-highlight prettyprint">
@interface Demo : UIViewController &lt;UIActionSheetDelegate&gt;
{
}
@end
</pre>
<p>Next, in the Demo.m</p>
<pre class="wp-code-highlight prettyprint">
-(void)someMethod:(id)sender
{
	UIActionSheet *actionsheet = [[UIActionSheet alloc]
			initWithTitle:@&quot;This is a title&quot;
			delegate:self
			cancelButtonTitle:@&quot;Cancel&quot;
			destructiveButtonTitle:nil
			otherButtonTitles:@&quot;Item 1&quot;, @&quot;Item 2&quot;, nil];

	[actionsheet showInView:[self view]];
	[actionsheet release];
}
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
	NSLog(@&quot;button %i clicked&quot;, buttonIndex );
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrevenancio.com/uiactionsheets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>List all properties of an object</title>
		<link>http://blog.andrevenancio.com/list-all-properties-of-an-object/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=list-all-properties-of-an-object</link>
		<comments>http://blog.andrevenancio.com/list-all-properties-of-an-object/#comments</comments>
		<pubDate>Thu, 19 Apr 2012 13:54:39 +0000</pubDate>
		<dc:creator>andrevenancio</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[object]]></category>

		<guid isPermaLink="false">http://blog.andrevenancio.com/?p=82</guid>
		<description><![CDATA[var obj = {x:100, y:0, z:-15, alpha:1}; for (var key in obj) { if (obj.hasOwnProperty(key)) { console.log(&#34;the property &#34; + key + &#34; has the value of &#34; + obj[key]); } }]]></description>
			<content:encoded><![CDATA[<pre class="wp-code-highlight prettyprint">
var obj = {x:100, y:0, z:-15, alpha:1};

for (var key in obj)
{
	if (obj.hasOwnProperty(key))
	{
		console.log(&quot;the property &quot; + key + &quot; has the value of &quot; + obj[key]);
	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrevenancio.com/list-all-properties-of-an-object/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mediatemple and websockets</title>
		<link>http://blog.andrevenancio.com/media-temple-and-websockets/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=media-temple-and-websockets</link>
		<comments>http://blog.andrevenancio.com/media-temple-and-websockets/#comments</comments>
		<pubDate>Mon, 16 Apr 2012 11:28:14 +0000</pubDate>
		<dc:creator>andrevenancio</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[nodejs]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[metiatemple]]></category>
		<category><![CDATA[node]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[pico]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[websockets]]></category>

		<guid isPermaLink="false">http://blog.andrevenancio.com/?p=20</guid>
		<description><![CDATA[I was pretty happy with my mediatemple (gs) server until I wanted to play with HTML5 websockets and I had to install node.js! So, I decided to upgrade to a (ve) server. If your a mediatemple owner and you want to start building and hosting your own websocket applications, please keep reading! If your not familiarized [...]]]></description>
			<content:encoded><![CDATA[<p>I was pretty happy with my mediatemple (<a title="grid server" href="http://mediatemple.net/webhosting/gs/">gs</a>) server until I wanted to play with HTML5 websockets and I had to install <a title="node.js" href="http://nodejs.org/" target="_blank">node.js</a>!<br />
So, I decided to upgrade to a (<a title="ve server" href="http://mediatemple.net/webhosting/ve/">ve</a>) server. If your a mediatemple owner and you want to start building and hosting your own websocket applications, please keep reading!</p>
<p>If your not familiarized with command line language, don&#8217;t worry, neither was I until I had to learn it! (not that hard, thanks to google!)<br />
So, the first thing to do is to login to your website via ssh (you can use <a title="putty" href="http://www.chiark.greenend.org.uk/~sgtatham/putty/">putty </a>if your on windows, or you can use the terminal if your on a mac).</p>
<h2>1) Connect, update and install Lamp</h2>
<p>Log in to your (ve) Server as root or another user with sudo privileges. Please use your server ip instead of 205.186.163.156<br />
<terminal>ssh root@205.186.163.156</terminal></p>
<p>Make sure your server is up to date<br />
<terminal>apt-get update<br />
apt-get upgrade</terminal></p>
<p>Next we are going to install <a title="lamp on wikipedia" href="http://en.wikipedia.org/wiki/LAMP_(software_bundle)" target="_blank">LAMP</a> on our server. After the process is complete you will be asked to set the root MySQL password.<br />
<terminal>apt-get install apache2 php5 libapache2-mod-php5 mysql-server mysql-client php5-mysql</terminal></p>
<h2>2) Configure your website</h2>
<p>Now that you completed your LAMP install, we need to add some websites using virtual entries. This will allow you to host multiple sites using the one IP address that comes with your (ve) Server. If your new to command line language I recommend you to use the <a title="pico" href="http://www.uic.edu/depts/accc/software/pine/pico.html" target="_blank">pico </a>editor, it makes your life easier!</p>
<p>Now, lets go editing our first file using the command line! First, go to the directory of apache, and then edit &#8220;ports.conf&#8221; file<br />
<terminal>cd /etc/apache2<br />
sudo nano ports.conf</terminal></p>
<p>In this file, you should change the NameVirtualHost line to include your own IP address which you can easily find in your AccountCenter Server Guide. Make sure you are listening on port 80 as well.</p>
<pre class="wp-code-highlight prettyprint">
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz

NameVirtualHost 205.186.163.156:80
Listen 80

&lt;IfModule mod_ssl.c&gt;
# If you add NameVirtualHost *:443 here, you will also have to change
# the VirtualHost statement in /etc/apache2/sites-available/default-ssl
# to &lt;VirtualHost *:443&gt;
# Server Name Indication for SSL named virtual hosts is currently not
# supported by MSIE on Windows XP.
	Listen 443
&lt;IfModule&gt;
&lt;IfModule mod_gnutls.c&gt;
Listen 443
&lt;/IfModule&gt;
</pre>
<p>Now you need to change the default file in the sites-available directory to allow us to configure multiple sites.<br />
<terminal>sudo nano /etc/apache2/sites-available/default</terminal></p>
<pre class="wp-code-highlight prettyprint">
&lt;VirtualHost 205.186.163.156:80&gt;
	ServerName andrevenancio.com
	ServerAdmin webmaster@localhost
	DocumentRoot /var/www
	&lt;Directory /&gt;
		Options FollowSymLinks
		AllowOverride None
	&lt;/Directory&gt;
	&lt;Directory /var/www/&gt;
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	&lt;/Directory&gt;
	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	&lt;Directory &quot;/usr/lib/cgi-bin&quot;&gt;
		AllowOverride None
		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
	&lt;/Directory&gt;
	ErrorLog ${APACHE_LOG_DIR}/error.log
	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn
	CustomLog ${APACHE_LOG_DIR}/access.log combined
	Alias /doc/ &quot;/usr/share/doc/&quot;
	&lt;Directory &quot;/usr/share/doc/&quot;&gt;
		Options Indexes MultiViews FollowSymLinks
		AllowOverride None
		Order deny,allow
		Deny from all
		Allow from 127.0.0.0/255.0.0.0 ::1/128
	&lt;/Directory&gt;
&lt;/VirtualHost&gt;
</pre>
<p>Now lets restart the apache server using this command<br />
<terminal>sudo /etc/init.d/apache2 reload</terminal></p>
<p>You should now be able to see the default page on your website!</p>
<h2> 3)Install Node.js</h2>
<p>There are a few options out there for using websockets, but I prefered to go along with <a href="http://nodejs.org/" title="node" target="_blank">node</a>!</p>
<p>First install the dependencies<br />
<terminal>sudo apt-get install g++ curl libssl-dev apache2-utils<br />
sudo apt-get install git-core</terminal></p>
<p><terminal>git clone git://github.com/ry/node.git<br />
cd node<br />
./configure<br />
make<br />
sudo make install</terminal></p>
<p>And thats it! You should now have node installed on your system! Lets test it out! Open your favorite editor and save this into hello_node.js</p>
<pre class="wp-code-highlight prettyprint">
    var http = require('http');
    http.createServer(function (req, res)
    {
        res.writeHead(200, {'Content-Type': 'text/plain'});
        res.end('Hello Node.js\n');
    }).listen(8124, &quot;127.0.0.1&quot;);

    console.log('Server running at http://127.0.0.1:8124/');
</pre>
<p>save this into your /var/www/ folder and then in command line utility run:<br />
<terminal>sudo cd /var/www/<br />
node hello_node.js</terminal><br />
You should see a message saying: &#8220;Server running at http://127.0.0.1:8124&#8243; and if you use your browser to access that link you should see your &#8220;Hello Node.js&#8221; message</p>
<p>And thats it! Have a look at <a href="http://howtonode.org/" title="how to node" target="_blank">this</a> website for some node resources!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrevenancio.com/media-temple-and-websockets/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

