<?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>Aaron Jefferson Villanueva&#039;s Blog Site&#187; Coding/Programming</title>
	<atom:link href="http://malebolgia.shadowsonawall.net/category/code-programming/feed" rel="self" type="application/rss+xml" />
	<link>http://malebolgia.shadowsonawall.net</link>
	<description>Programming / Designing Blogging from windows to mac.</description>
	<lastBuildDate>Fri, 06 Aug 2010 02:40:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PodCast Software</title>
		<link>http://malebolgia.shadowsonawall.net/code-programming/podcast-software.html</link>
		<comments>http://malebolgia.shadowsonawall.net/code-programming/podcast-software.html#comments</comments>
		<pubDate>Fri, 06 Aug 2010 02:39:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.Net (C#/VB)]]></category>
		<category><![CDATA[Coding/Programming]]></category>
		<category><![CDATA[C# Desktop Application Software]]></category>
		<category><![CDATA[PodCast Software]]></category>

		<guid isPermaLink="false">http://malebolgia.shadowsonawall.net/?p=396</guid>
		<description><![CDATA[A Podcast Desktop Application Software I created Last month for TsemachAdonai.org. It reads XML data for podcasting also can insert new data within it.


More Description: 

1. Browse The Previously Added PodCasts. 





2. Adding New PodCast - Select the MP3 file and automatically upload it, also update the XML with the new entry. 





3. Channel Settings [...]]]></description>
			<content:encoded><![CDATA[<p>A Podcast <span style="color: #993300;"><span style="text-decoration: underline;">Desktop Application Software</span></span> I created Last month for <span style="color: #003300;"><strong>TsemachAdonai.org</strong></span>. It reads <strong>XML</strong> data for podcasting also can insert new data within it.
<br />
<br />
<strong>More Description:</strong> <br /><br />

<strong>1</strong>. Browse The Previously Added PodCasts. <br />
<a title="ScreenShot 1" rel="rokzoom[tsemachadonai]" href="http://malebolgia.shadowsonawall.net/images/csharp/tsemachadonai/01.png">
<img title="ScreenShot 1" src="http://malebolgia.shadowsonawall.net/images/csharp/tsemachadonai/01_small.png" alt="Description 1" width="350" height="331"  border="0"   />
</a>
<br /><br />

<strong>2</strong>. Adding New PodCast - Select the MP3 file and automatically upload it, also update the XML with the new entry. <br />
<a title="ScreenShot 2" rel="rokzoom[tsemachadonai]" href="http://malebolgia.shadowsonawall.net/images/csharp/tsemachadonai/02.png">
<img title="ScreenShot 2" src="http://malebolgia.shadowsonawall.net/images/csharp/tsemachadonai/02_small.png" alt="Description 2" width="350" height="325"  border="0"   />
</a>
<br /><br />

<strong>3</strong>. Channel Settings - Will update some portion of XML data. <br />
<a title="ScreenShot 3" rel="rokzoom[tsemachadonai]" href="http://malebolgia.shadowsonawall.net/images/csharp/tsemachadonai/03.png">
<img title="ScreenShot 3" src="http://malebolgia.shadowsonawall.net/images/csharp/tsemachadonai/03_small.png" alt="Description 3" width="350" height="327"  border="0"   />
</a>
<br /><br />

<strong>4</strong>. FTP Settings - Here where you are gonna set the settings for FTP for upload, and also where is the XML file it should be reading and writing. You can save your settings via registry or saving it on a file. <br />
<a title="ScreenShot 4" rel="rokzoom[tsemachadonai]" href="http://malebolgia.shadowsonawall.net/images/csharp/tsemachadonai/04.png">
<img title="ScreenShot 4" src="http://malebolgia.shadowsonawall.net/images/csharp/tsemachadonai/04_small.png" alt="Description 4" width="350" height="326"  border="0"   />
</a>
<br /><br />

<strong>5</strong>. About - NonSense part <img src='http://malebolgia.shadowsonawall.net/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> . <br />
<a title="ScreenShot 5" rel="rokzoom[tsemachadonai]" href="http://malebolgia.shadowsonawall.net/images/csharp/tsemachadonai/05.png">
<img title="ScreenShot 5" src="http://malebolgia.shadowsonawall.net/images/csharp/tsemachadonai/05_small.png" alt="Description 5" width="350" height="328"  border="0"   />
</a>
<br /><br />

I'm trying to create a Java version for this, since my client uses Mac now. <br /><br />

</p>]]></content:encoded>
			<wfw:commentRss>http://malebolgia.shadowsonawall.net/code-programming/podcast-software.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="1" length="" type="" />
		</item>
		<item>
		<title>NSConcreteMutableData</title>
		<link>http://malebolgia.shadowsonawall.net/code-programming/objective-c-cocoa-touch-iphone/nsconcretemutabledata.html</link>
		<comments>http://malebolgia.shadowsonawall.net/code-programming/objective-c-cocoa-touch-iphone/nsconcretemutabledata.html#comments</comments>
		<pubDate>Fri, 09 Jul 2010 15:55:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Objective C / Cocoa Touch [iPhone]]]></category>
		<category><![CDATA[instruments]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Memory Leak]]></category>
		<category><![CDATA[NSConcreteMutableData]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://malebolgia.shadowsonawall.net/?p=342</guid>
		<description><![CDATA[
For some reason I experienced another odd memory leak and I'm not sure what causing it, when I try to access one of my view controllers.





The thing was... I mistakenly selected "Simulator 3.0" which the bug exists.




Apple already fixed this issue with 3.1.  

Under "Known Issues and Fixes/Core Data" 

"The memory leak of an [...]]]></description>
			<content:encoded><![CDATA[
For some reason I experienced another odd memory leak and I'm not sure what causing it, when I try to access one of my view controllers.
<br /><br />
<a title="NSConcreteMutableData Memory Leak" rel="rokzoom[nsconcrete]" href="http://malebolgia.shadowsonawall.net/images/xcode/NSConcreteMutableData/NSConcreteMutableData_medium.png">
<img title="NSConcreteMutableData" src="http://malebolgia.shadowsonawall.net/images/xcode/NSConcreteMutableData/NSConcreteMutableData_small.png" alt="NSConcreteMutableData" width="293" height="59"  border="0"   />
</a>
<br /><br />
The thing was... I mistakenly selected "Simulator 3.0" which the bug exists.
<br /><br />
<img title="Simulator 3.0" src="http://malebolgia.shadowsonawall.net/images/xcode/NSConcreteMutableData/simulator.png" alt="Simulator 3.0" width="282" height="36"  border="0"   />
<br /><br />

<a href="http://developer.apple.com/iphone/library/releasenotes/General/RN-iPhoneSDK-3/index.html" target="_blank" >Apple already fixed this issue with 3.1. </a> <br />

Under "Known Issues and Fixes/Core Data" <br />

"<em>The memory leak of an NSConcreteMutableData instance when processing object changes has been fixed.</em>"



]]></content:encoded>
			<wfw:commentRss>http://malebolgia.shadowsonawall.net/code-programming/objective-c-cocoa-touch-iphone/nsconcretemutabledata.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="1" length="" type="" />
		</item>
		<item>
		<title>Premiere CS4 Export Video Problem</title>
		<link>http://malebolgia.shadowsonawall.net/design/premiere-cs4-export-video-problem.html</link>
		<comments>http://malebolgia.shadowsonawall.net/design/premiere-cs4-export-video-problem.html#comments</comments>
		<pubDate>Sat, 12 Jun 2010 22:53:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Adobe Media Encoder CS4]]></category>
		<category><![CDATA[Adobe Media Encoder CS5]]></category>
		<category><![CDATA[Flash Catalyst]]></category>
		<category><![CDATA[Premiere CS4 Pro]]></category>
		<category><![CDATA[Video Editing]]></category>

		<guid isPermaLink="false">http://malebolgia.shadowsonawall.net/?p=328</guid>
		<description><![CDATA[


After Editing a video using  Premiere CS4 , and try exporting the sequence I have - Adobe Media encoder  pops out, and for some reason I couldn't find the sequence I was just trying to export. After few hours figuring out why - I noticed that the version on Media Encoder popping out [...]]]></description>
			<content:encoded><![CDATA[<p style="margin:0px; padding: 0px;">
<img title="Premiere CS4" src="http://malebolgia.shadowsonawall.net/images/adobe/premiereCS4.png" alt="Premiere CS4" width="100" height="100" align="right" hspace="5"   />
<img title="Flash Catalyst CS5" src="http://malebolgia.shadowsonawall.net/images/adobe/flash_catalyst.png" alt="Flash Catalyst CS5" width="100" height="100" align="right" hspace="5"   />
After Editing a video using <strong> <span style="color:#939">Premiere CS4 </span></strong>, and try exporting the sequence I have - <strong><span style=" color:#C33 ">Adobe Media encoder </span></strong> pops out, and for some reason I couldn't find the sequence I was just trying to export. After few hours figuring out why - I noticed that the version on Media Encoder popping out is CS5. This Encoder came with <strong><span style=" color:#C96">Flash Catalyst</span></strong> cause I'm trying their Demo Version - which is very promising for Designers to be able to communicate and explain well to the Developers on how they want the site should function. 
<br /><br />
So what I did was just <strong><span style="color:#F03">uninstall </span> </strong>the Flash Catalyst since I was done of studying it anyway. And Everything worked fine, when I tried to export the Sequence I have on Premiere CS4 its popping out Media Encoder CS4 and finally I can see the sequence on the list.
</p>]]></content:encoded>
			<wfw:commentRss>http://malebolgia.shadowsonawall.net/design/premiere-cs4-export-video-problem.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="1" length="" type="" />
		</item>
		<item>
		<title>Remove number of words&#8230;</title>
		<link>http://malebolgia.shadowsonawall.net/code-programming/remove-number-of-words-at-the-beginning-of-string.html</link>
		<comments>http://malebolgia.shadowsonawall.net/code-programming/remove-number-of-words-at-the-beginning-of-string.html#comments</comments>
		<pubDate>Sat, 01 May 2010 23:12:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.Net (C#/VB)]]></category>
		<category><![CDATA[Coding/Programming]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[strings]]></category>
		<category><![CDATA[Visual Studio .Net 2008]]></category>
		<category><![CDATA[Windows Form]]></category>

		<guid isPermaLink="false">http://malebolgia.shadowsonawall.net/?p=285</guid>
		<description><![CDATA[Remove number of words at the beginning of string? 

Looking for a function that you want to make string only return the last words within the strings? and remove number of words at the beginning Using C# 


This function could help you:
  


        /// &#60;summary&#62;
   [...]]]></description>
			<content:encoded><![CDATA[<strong>Remove number of words at the beginning of string?</strong> 
<br /><br />
Looking for a function that you want to make string only return the last words within the strings? and remove number of words at the beginning Using <span style="color:#C00"><strong>C#</strong></span></p> <br />
<img src="http://malebolgia.shadowsonawall.net/images/csharp/removewords/01.png" alt="Windows Form Remove words" />
<br /><br />
<strong>This function could help you:</strong>
  <br />


<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">        <span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
        <span style="color: #008080; font-style: italic;">/// Return only last several words  and remove the number of words at the beginning from string.</span>
        <span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #FF0000;">string</span> RemoveFirstWords<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> input, <span style="color: #FF0000;">int</span> numberWords<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #0600FF;">try</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> Split <span style="color: #008000;">=</span> input.<span style="color: #0000FF;">Split</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">new</span> <span style="color: #FF0000;">Char</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#123;</span> <span style="color: #666666;">' '</span> <span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                input <span style="color: #008000;">=</span> <span style="color: #FF0000;">string</span>.<span style="color: #0000FF;">Empty</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">//After passing the words to Split - Empty in again</span>
                <span style="color: #0600FF;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span> i <span style="color: #008000;">=</span> numberWords<span style="color: #008000;">;</span> i <span style="color: #008000;">&lt;</span> Split.<span style="color: #0000FF;">Count</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span> i<span style="color: #008000;">++</span><span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    input <span style="color: #008000;">+=</span> Convert.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span>Split<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot; &quot;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">//Get Only the last words</span>
                <span style="color: #000000;">&#125;</span>
                <span style="color: #0600FF;">return</span> input<span style="color: #008000;">;</span>
            <span style="color: #000000;">&#125;</span>
            <span style="color: #0600FF;">catch</span> <span style="color: #000000;">&#40;</span>Exception<span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #008080; font-style: italic;">// Log the error.</span>
            <span style="color: #000000;">&#125;</span>
            <span style="color: #0600FF;">return</span> <span style="color: #FF0000;">string</span>.<span style="color: #0000FF;">Empty</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span></pre></div></div>



<strong>Use the function like this:</strong>


<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> removeWords_Click<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> sender, EventArgs e<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>stringToRemove.<span style="color: #0000FF;">Text</span> <span style="color: #008000;">==</span> <span style="color: #FF0000;">string</span>.<span style="color: #0000FF;">Empty</span><span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                MessageBox.<span style="color: #0000FF;">Show</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;The String is Empty&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #000000;">&#125;</span>
            <span style="color: #0600FF;">else</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #FF0000;">int</span> paramNumOfWords <span style="color: #008000;">=</span> Convert.<span style="color: #0000FF;">ToInt16</span><span style="color: #000000;">&#40;</span>numOfwords.<span style="color: #0000FF;">Text</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #FF0000;">string</span> returnOnlyLastWords <span style="color: #008000;">=</span> RemoveFirstWords<span style="color: #000000;">&#40;</span>stringToRemove.<span style="color: #0000FF;">Text</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>, paramNumOfWords<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                <span style="color: #008080; font-style: italic;">//Return Words</span>
                MessageBox.<span style="color: #0000FF;">Show</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Return Words: &quot;</span> <span style="color: #008000;">+</span> returnOnlyLastWords<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span></pre></div></div>



<br />
<strong><a href="http://malebolgia.shadowsonawall.net/downloads/StringTest.zip"> Download Source code MVS version 9 C# </a></strong><br /><br />]]></content:encoded>
			<wfw:commentRss>http://malebolgia.shadowsonawall.net/code-programming/remove-number-of-words-at-the-beginning-of-string.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="1" length="" type="" />
		</item>
		<item>
		<title>Cannot Create MSSQL Database.</title>
		<link>http://malebolgia.shadowsonawall.net/code-programming/database/mssql/file-path-is-compressed-cannot-create-mssql-database.html</link>
		<comments>http://malebolgia.shadowsonawall.net/code-programming/database/mssql/file-path-is-compressed-cannot-create-mssql-database.html#comments</comments>
		<pubDate>Sat, 01 May 2010 21:38:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[compression]]></category>
		<category><![CDATA[MSSQL Server 2008]]></category>

		<guid isPermaLink="false">http://malebolgia.shadowsonawall.net/?p=275</guid>
		<description><![CDATA[
File Path is compressed Cannot Create MSSQL Database.  
While trying to add Database which I want to name "SimpleCMS" to MSSQL server and trying to put it under App_Data folder, I encountered this error.



Error Details:An exception occured while executing a Transact-SQL statement or batch.(Microsoft.SqlServer.ConnectionInfo)The file "you mssql db path here" is compressed but does [...]]]></description>
			<content:encoded><![CDATA[<p>
<strong>File Path is compressed Cannot Create MSSQL Database.</strong> <br /> <br />
While trying to add Database which I want to name "<em><span style="color: #008000;">SimpleCMS</span></em>" to MSSQL server and trying to put it under <strong><span style="color: #ff9900;">App_Data</span></strong> folder, I encountered this error.<br /><br />

<div style="background-color:#C00;">
<br />
<span style="color: #FFF;">Error Details:<br />An exception occured while executing a Transact-SQL statement or batch.<br />(Microsoft.SqlServer.ConnectionInfo)<br /><br />The file "you mssql db path here" is compressed but does not reside in a read-only database or filegroup. The file must be decompressed. CREATE DATABASE failed. Some file names listed could not be created. Check related errors.<br />...</span>
</div>

<br />
<img title="MSSQL Error Message" src="http://malebolgia.shadowsonawall.net/images/mssql/01.png" alt="Cannot Create Database"  /> 
<br />

<br /><br />Most cases this was cause that the Project folder is <span style="color: #993300;"><strong>inside a compressed drive or under a compressed folder</strong></span>, which will save space for your drive.<br /><br /><strong><span style="color: #808000;">I just want to share how I resolved this.</span></strong><br /><br />
<em>Note:</em> That You can uncompressed only the Project folder and leave other compressed.<br />
<br />I'm using <strong><span style="color: #003366;">windows XP </span></strong>so what I did was <br />1.) Right Click on the folder (Project Folder) in General Tab &gt; Click Advanced<br />2.) Under Compress or Encrypt attributes<br />3.) uncheck "Compress Contents to save disk space"<br />

<br />
<a title="Compress and Encrypt Attributes" rel="rokzoom[mssql]" href="http://malebolgia.shadowsonawall.net/images/mssql/02.png">
<img title="Compression" src="http://malebolgia.shadowsonawall.net/images/mssql/02_small.png" alt="Compression"  /> 
</a>
<br />

<br />From here I can now add the database "<span style="color: #008000;"><em>SimpleCMS</em></span>" under the <span style="color: #ff9900;"><strong>App_Folder</strong></span> inside the Project Folder.
<br /><br />
<img title="Database Added" src="http://malebolgia.shadowsonawall.net/images/mssql/worked.png" alt="Database Added"  /> 

<br /><br />

</p>]]></content:encoded>
			<wfw:commentRss>http://malebolgia.shadowsonawall.net/code-programming/database/mssql/file-path-is-compressed-cannot-create-mssql-database.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="1" length="" type="" />
		</item>
		<item>
		<title>UIColor Color Codes</title>
		<link>http://malebolgia.shadowsonawall.net/code-programming/uicolor-color-codes.html</link>
		<comments>http://malebolgia.shadowsonawall.net/code-programming/uicolor-color-codes.html#comments</comments>
		<pubDate>Sun, 18 Apr 2010 19:53:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Coding/Programming]]></category>
		<category><![CDATA[Objective C / Cocoa Touch [iPhone]]]></category>
		<category><![CDATA[DigitalColor Meter]]></category>
		<category><![CDATA[mac OS 10.5]]></category>
		<category><![CDATA[RGB values]]></category>
		<category><![CDATA[UIColor]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://malebolgia.shadowsonawall.net/?p=239</guid>
		<description><![CDATA[



I Just realize how hard it was to just assign RGB Values color by code using UIColor, Well heres a little work around. Using the utilities in mac, which will you can find at Applications/Utilities folder. Open it.  


  


Make sure you selected "RGB As Percentage",  Use your mouse to move the [...]]]></description>
			<content:encoded><![CDATA[<p>
<a title="Utilities DigitalColor Icon" rel="rokzoom[digital]" href="http://malebolgia.shadowsonawall.net/images/digitalcolor/Utilities.png">
<img title="DigitalColor Meter Icon" src="http://malebolgia.shadowsonawall.net/images/digitalcolor/DigitalColorMeterIcon.png" alt="DigitalColor Meter Icon" width="133" height="110" align="right" hspace="10"   />
</a>
I Just realize how hard it was to just assign RGB Values color by code using UIColor, Well heres a little work around. Using the utilities in <strong><span style="color: #333300;">mac</span></strong>, which will you can find at <strong><span style="color: #ff0000;">Applications/Utilities</span></strong> folder. Open it.  

<br /><br /><br /><br />
<img title="DigitalColor Meter" src="http://malebolgia.shadowsonawall.net/images/digitalcolor/DigitalColorMeter.png" alt="DigitalColor Meter"  />  
<br /><br />

Make sure you selected <span style="color: #000080;"><em>"RGB As Percentage"</em></span>,  Use your mouse to move the cursor over the pixel you want to sample, and read off the values, once you got the color you want; press<span style="color: #800000;"><span style="text-decoration: underline;"> Command-Shift-H</span></span>, This will hold the color values you got for the moment. <span style="text-decoration: underline;"><span style="color: #800000;">Press F4</span></span> for Dashboard use calculator, 

<br /><br />
<img title="Dashboard Calculator" src="http://malebolgia.shadowsonawall.net/images/digitalcolor/DigitalColorMeterCalculator.png" alt="Dashboard Calculator"  />  
<br /><br />

Divide the values you got to 100, for example <span style="color: #333399;"><strong>R%: 78.8 = .788</strong></span>; Then you can finally put the RGB values on your <span style="color: #993366;"><strong>UIColor parameter</strong></span>.

<br /><br />
<img title="UIColor" src="http://malebolgia.shadowsonawall.net/images/digitalcolor/UIColor.png" alt="UIColor"  />  
<br /><br />


<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#define COLOR_FOR_THIS [UIColor colorWithRed:0.788f green:0.207f blue:0.271f alpha:1.0f]</span></pre></div></div>




</p>
]]></content:encoded>
			<wfw:commentRss>http://malebolgia.shadowsonawall.net/code-programming/uicolor-color-codes.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NSZombieEnabled Causes memory Leak.</title>
		<link>http://malebolgia.shadowsonawall.net/code-programming/nszombieenabled-causes-memory-leak.html</link>
		<comments>http://malebolgia.shadowsonawall.net/code-programming/nszombieenabled-causes-memory-leak.html#comments</comments>
		<pubDate>Sat, 10 Apr 2010 08:53:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Coding/Programming]]></category>
		<category><![CDATA[Objective C / Cocoa Touch [iPhone]]]></category>
		<category><![CDATA[EXC_BAD_ACCESS]]></category>
		<category><![CDATA[Memory Leak]]></category>
		<category><![CDATA[NSZombie]]></category>
		<category><![CDATA[Xcode Instrument]]></category>

		<guid isPermaLink="false">http://malebolgia.shadowsonawall.net/?p=220</guid>
		<description><![CDATA[Noobie Mistake while trying to traced memory leak with the app I am working on using the instrument provided by xcode , I got series of pink spikes,  
    

and I'm not sure what was causing it, I thought that the managedObject Context was the culprit. I noticed tons of _NSZombie_ [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #993300;"><img title="Instruments" src="http://malebolgia.shadowsonawall.net/images/xcode/instruments.png" alt="Xcode's Instrument" width="100" height="100" align="right" hspace="50"   />Noobie Mistake</span> while trying to traced memory leak with the app I am working on using the instrument provided by xcode , I got series of pink spikes,  <br /><br />
<a title="Leak Test with Xcode Instrument" rel="rokzoom[instruments]" href="http://malebolgia.shadowsonawall.net/images/xcode/instrumentLeaking.png"> <img title="Leaking" src="http://malebolgia.shadowsonawall.net/images/xcode/instrumentLeaking_small.png" alt="Xcode's Leaking Instrument"  />  </a> <br /><br />

and I'm not sure what was causing it, I thought that the<span style="color: #008000;"> managedObject</span> Context was the culprit. I noticed tons of _<span style="color: #ff0000;"><strong>NSZombie</strong></span>_ prefix listed and I remember that I added the NSZombieEnabled tag under the Argument in "Executable App Info",

 <br /><br />
<a title="Xcode NSZombieEnabled" rel="rokzoom[instruments]" href="http://malebolgia.shadowsonawall.net/images/xcode/NSZombieEnabled_medium.png"> <img title="NSZombieEnabled" src="http://malebolgia.shadowsonawall.net/images/xcode/NSZombieEnabled_small.png" alt="Xcode NSZombieEnabled"  />  </a> <br /><br />

 I added NSZombieEnabled  environment variable because it can be helpful to track down the elusive object causing the problem, mostly tracing the <strong><span style="color: #800000;">EXC_BAD_ACCESS</span></strong> error message. So after I disabled it, the app I am working on had no leak after all.
 <br /><br />
<a title="Leak Test with Xcode Instrument" rel="rokzoom[instruments]" href="http://malebolgia.shadowsonawall.net/images/xcode/instrumentNoLeak.png"> <img title="No Leak" src="http://malebolgia.shadowsonawall.net/images/xcode/instrumentNoLeak_small.png" alt="Xcode's No Leak Instrument"  />  </a> <br /><br />
 </p>
<p> <br /> </p>]]></content:encoded>
			<wfw:commentRss>http://malebolgia.shadowsonawall.net/code-programming/nszombieenabled-causes-memory-leak.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Desktop Application Icon</title>
		<link>http://malebolgia.shadowsonawall.net/code-programming/desktop-application-icon.html</link>
		<comments>http://malebolgia.shadowsonawall.net/code-programming/desktop-application-icon.html#comments</comments>
		<pubDate>Thu, 04 Mar 2010 10:59:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.Net (C#/VB)]]></category>
		<category><![CDATA[Coding/Programming]]></category>
		<category><![CDATA[Desktop Application]]></category>
		<category><![CDATA[Icon]]></category>
		<category><![CDATA[Visual Studio .Net 2008]]></category>

		<guid isPermaLink="false">http://malebolgia.shadowsonawall.net/?p=251</guid>
		<description><![CDATA[Visual Studio .Net 2008, On Solution Explorer. Right Click. Choose Properties. Select Application, 
Look for Resources/Icon and Manifest, 





Browse for Icon you want for the release build.

 



]]></description>
			<content:encoded><![CDATA[<p><strong>Visual Studio .Net 2008</strong>, On Solution Explorer. <span style="color: #008000;"><span style="text-decoration: underline;">Right Click</span></span>. Choose <span style="color: #008000;"><span style="text-decoration: underline;">Properties</span></span>. Select <span style="color: #008000;"><span style="text-decoration: underline;">Application</span></span>, 
Look for <span style="color: #008000;"><span style="text-decoration: underline;">Resources/Icon and Manifest</span></span>, 
<br /><br />
<a title="Project Settings Visual Studio.net" rel="rokzoom[iconproject]" href="http://malebolgia.shadowsonawall.net/images/csharp/application-icon/IconProjectSettings.png">
<img title="Project Settings Visual Studio.net" src="http://malebolgia.shadowsonawall.net/images/csharp/application-icon/IconProjectSettingsSmall.png" alt="Project Settings Visual Studio.net"    />
</a>
<br /><br />
Browse for Icon you want for the release build.

<br /> <br />
<img title="Application With Custom Icon" src="http://malebolgia.shadowsonawall.net/images/csharp/application-icon/ApplicationWithCustomIcon.png" alt="Application With Custom Icon"    />

</p>
]]></content:encoded>
			<wfw:commentRss>http://malebolgia.shadowsonawall.net/code-programming/desktop-application-icon.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash AS3 and Mootools Slimbox</title>
		<link>http://malebolgia.shadowsonawall.net/code-programming/flash-as3-and-mootools-slimbox.html</link>
		<comments>http://malebolgia.shadowsonawall.net/code-programming/flash-as3-and-mootools-slimbox.html#comments</comments>
		<pubDate>Fri, 26 Feb 2010 16:14:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Coding/Programming]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Mootools]]></category>
		<category><![CDATA[Actionscript 3.0]]></category>
		<category><![CDATA[bridge]]></category>
		<category><![CDATA[integration]]></category>
		<category><![CDATA[slimbox]]></category>

		<guid isPermaLink="false">http://malebolgia.shadowsonawall.net/?p=199</guid>
		<description><![CDATA[
Most the site I made were based on mootools library but when it comes to Overlay Images Scripts I prefer to use Light box v2 that also you can easily call with in Flash AS3 using the ExternalInterface.call using a bridge which is available for download - flashlightboxinjector unfortunately this is base on jQuery library [...]]]></description>
			<content:encoded><![CDATA[<div style="margin-top:10px;margin-bottom:10px">
Most the site I made were based on <span style="color: #800080;">mootools</span> <a href="http://web-kreation.com/index.php/articles/48-incredible-mootools-sripts/" target="_blank"><strong><span style="color: #993300;">library</span></strong></a> but when it comes to Overlay Images Scripts I prefer to use Light box v2 that also you can easily call with in <strong><span style="color: #ff0000;">Flash AS3 </span></strong>using the <span style="color: #008000;"><span style="text-decoration: underline;"><strong>ExternalInterface.call</strong></span></span> using a bridge which is available for download - <a href="http://www.bram.us/projects/flashlightboxinjector/" target="_blank"><span style="color: #993300;">flashlightboxinjector</span></a> unfortunately this is base on <span style="color: #003300;">jQuery</span> library so I tried to find a "Lightbox" similar Overlay Image function that has available javascript that I can call within Flash AS3 code so <a href="http://www.digitalia.be/software/slimbox" target="_blank"><span style="color: #993300;">Slimbox</span></a> I guess the easiest for me to follow, it got API documentation you can follow <a href="http://code.google.com/p/slimbox/wiki/MooToolsAPI" target="_blank"><span style="color: #993300;">http://code.google.com/p/slimbox/wiki/MooToolsAPI</span>.</a>
</div>
<div style="margin-top:10px;margin-bottom:10px">
<strong>So this is the code inside the flash movie</strong>
</div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #009900;">//Begin AS3 Script</span>
  <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.geom</span>.<span style="color: #000000; font-weight: bold;">*</span>
  <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #000000; font-weight: bold;">*</span>
&nbsp;
<span style="color: #009900;">//Mouse Events  </span>
  <span style="color: #0033ff; font-weight: bold;">import</span>  <span style="color: #004993;">flash.events</span>.<span style="color: #004993;">MouseEvent</span>;
<span style="color: #009900;">//External Command</span>
  <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.external</span>.<span style="color: #000000; font-weight: bold;">*</span>;
&nbsp;
<span style="color: #009900;">//gradient background color  </span>
  <span style="color: #6699cc; font-weight: bold;">var</span> fillType<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #004993;">GradientType</span>.<span style="color: #004993;">LINEAR</span>;
  <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">colors</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span> = <span style="color: #000000;">&#91;</span>0x330000, 0x333307<span style="color: #000000;">&#93;</span>;
  <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">alphas</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span> = <span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">1</span>, <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#93;</span>;
  <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">ratios</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span> = <span style="color: #000000;">&#91;</span>0x00, 0xFF<span style="color: #000000;">&#93;</span>;
  <span style="color: #6699cc; font-weight: bold;">var</span> matr<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Matrix</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Matrix</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
  matr.<span style="color: #004993;">createGradientBox</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">150</span>, <span style="color: #000000; font-weight:bold;">20</span>, <span style="color: #000000; font-weight:bold;">0</span>, <span style="color: #000000; font-weight:bold;">0</span>, <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span>;
  <span style="color: #6699cc; font-weight: bold;">var</span> spreadMethod<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #004993;">SpreadMethod</span>.<span style="color: #004993;">PAD</span>;
  <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">beginGradientFill</span><span style="color: #000000;">&#40;</span>fillType, <span style="color: #004993;">colors</span>, <span style="color: #004993;">alphas</span>, <span style="color: #004993;">ratios</span>, matr, spreadMethod<span style="color: #000000;">&#41;</span>;  
  <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span>,<span style="color: #000000; font-weight:bold;">0</span>,<span style="color: #000000; font-weight:bold;">250</span>,<span style="color: #000000; font-weight:bold;">200</span><span style="color: #000000;">&#41;</span>;
<span style="color: #009900;">//gradient background color  </span>
&nbsp;
<span style="color: #009900;">//Add handler Event</span>
  img1.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span>.<span style="color: #004993;">CLICK</span>, onClickHandler01<span style="color: #000000;">&#41;</span>;
&nbsp;
&nbsp;
&nbsp;
<span style="color: #339966; font-weight: bold;">function</span> onClickHandler01<span style="color: #000000;">&#40;</span>myEvent<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
    <span style="color: #009900;">//call	Javascript Command</span>
	<span style="color: #004993;">ExternalInterface</span>.<span style="color: #004993;">call</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Slimbox.open&quot;</span>,<span style="color: #990000;">&quot;/images/demon.png&quot;</span>, <span style="color: #990000;">&quot;This Kanji means Demon&quot;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #000000;">&#125;</span>		
&nbsp;
<span style="color: #009900;">//End AS3 Script</span></pre></td></tr></table></div>





<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #004993;">ExternalInterface</span>.<span style="color: #004993;">call</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Slimbox.open&quot;</span>,<span style="color: #990000;">&quot;/images/demon.png&quot;</span>, <span style="color: #990000;">&quot;This Kanji means Demon&quot;</span><span style="color: #000000;">&#41;</span>;</pre></div></div>



<div style="margin-top:10px;margin-bottom:10px">
This simply calls the javascript Slimbox.open function that will open an Overlay Image also make sure that parameters that <strong><span style="color: #993300;">"wmode" = "transparent"</span></strong> and <strong><span style="color: #993300;">"allowScriptAccess" =  "always"</span> </strong>
</div>
<div style="margin-top:10px;margin-bottom:10px">
I used <span style="text-decoration: underline;"><span style="color: #ff6600;">swfobject</span></span> to render my Flash movies. So here how you implement the html code to make the flash work with slimbox.
</div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">    &lt;!-- Slimbox Start //--&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;js/swfobject.js&quot;&gt;&lt;/script&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;js/mootools.js&quot;&gt;&lt;/script&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;js/slimbox.js&quot;&gt;&lt;/script&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;css/slimbox.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;
    &lt;!-- Slimbox End //--&gt;
&nbsp;
&nbsp;
               <span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
                             window.<span style="color: #660066;">addEvent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'domready'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">//for IE 7 problem</span>
			<span style="color: #003366; font-weight: bold;">var</span> soSlim <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> SWFObject<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;slimbox.swf&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;slimbox&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;250&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;200&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;8&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;#FFFFFF&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			soSlim.<span style="color: #660066;">addParam</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;quality&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;high&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			soSlim.<span style="color: #660066;">addParam</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;wmode&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;transparent&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			soSlim.<span style="color: #660066;">addParam</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;allowScriptAccess&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;always&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			soSlim.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;flashcontentSlim&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                            <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   
		<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>




Demo:

<!-- Slimbox Start //-->
    <script type="text/javascript" src="http://malebolgia.shadowsonawall.net/js/slimbox.js"></script>
    <link rel="stylesheet" href="http://malebolgia.shadowsonawall.net/css/slimbox.css" type="text/css" media="screen" />
<!-- Slimbox End //-->
       <div id="flashcontentSlim">
			Flash required 
		</div>
<script type="text/javascript">
                             window.addEvent('domready', function(){
			var soSlim = new SWFObject("http://malebolgia.shadowsonawall.net/flash/slimbox.swf", "slimbox", "250", "200", "8", "#FFFFFF");
			soSlim.addParam("quality", "high");
			soSlim.addParam("wmode", "transparent");
			soSlim.addParam("allowScriptAccess", "always");
			soSlim.addParam("menu","false");
			soSlim.write("flashcontentSlim");
     				});   
		</script>

<br /><br />

You can also try <a href="http://reghellin.com/milkbox/" target="_blank">milkbox</a>

<br /><br />
<a href="http://malebolgia.shadowsonawall.net/downloads/mootoolsAS3.zip">Download Source Code.</a>]]></content:encoded>
			<wfw:commentRss>http://malebolgia.shadowsonawall.net/code-programming/flash-as3-and-mootools-slimbox.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
<enclosure url="1" length="" type="" />
		</item>
		<item>
		<title>Animating View</title>
		<link>http://malebolgia.shadowsonawall.net/code-programming/make-view-move-upward-uitextfield-begin-editing.html</link>
		<comments>http://malebolgia.shadowsonawall.net/code-programming/make-view-move-upward-uitextfield-begin-editing.html#comments</comments>
		<pubDate>Thu, 21 Jan 2010 01:55:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Coding/Programming]]></category>
		<category><![CDATA[Objective C / Cocoa Touch [iPhone]]]></category>
		<category><![CDATA[Cocoa Touch]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://malebolgia.shadowsonawall.net/?p=181</guid>
		<description><![CDATA[
  Make View move upward - UITextField Begin Editing


Attached is the video - what I was trying to do, it happens that my first iPhone app has UITextField positioned where the text keypad will appear also, which will hide the current UITextField. Well I realized that I will encounter this often, so I guess [...]]]></description>
			<content:encoded><![CDATA[<p>
  <strong>Make View move upward - UITextField Begin Editing</strong>
</p>
<br />
<p>Attached is the video - what I was trying to do, it happens that my first <strong><span style="color: #808000;">iPhone</span></strong> app has <span style="color: #003300;">UITextField</span> positioned where the text keypad will appear also, which will hide the current <span style="color: #003300;">UITextField</span>. Well I realized that I will encounter this often, so I guess it's <span style="color: #333333;"><span style="text-decoration: underline;"><strong>important</strong></span></span> to have this <em><span style="color: #333333;">piece of code</span></em>.</p>
<br />
<p>in your interface builder assign the UITextField as <u>delegate</u></p>

<div id="attachment_187" class="wp-caption aligncenter" style="width: 299px"><a href="http://malebolgia.shadowsonawall.net/wp-content/uploads/2010/01/delegate.png"><img src="http://malebolgia.shadowsonawall.net/wp-content/uploads/2010/01/delegate.png" alt="UITextField as delegate" title="delegate" width="289" height="98" class="size-full wp-image-187" /></a><p class="wp-caption-text">UITextField as delegate</p></div>

<p>
on your .m file declare the static constant at the top of the code. </p>


<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #a61390;">static</span> <span style="color: #a61390;">const</span> CGFloat KEYBOARD_ANIMATION_DURATION <span style="color: #002200;">=</span> <span style="color: #2400d9;">0.3</span>;
<span style="color: #a61390;">static</span> <span style="color: #a61390;">const</span> CGFloat MINIMUM_SCROLL_FRACTION <span style="color: #002200;">=</span> <span style="color: #2400d9;">0.2</span>;
<span style="color: #a61390;">static</span> <span style="color: #a61390;">const</span> CGFloat MAXIMUM_SCROLL_FRACTION <span style="color: #002200;">=</span> <span style="color: #2400d9;">0.8</span>;
<span style="color: #a61390;">static</span> <span style="color: #a61390;">const</span> CGFloat PORTRAIT_KEYBOARD_HEIGHT <span style="color: #002200;">=</span> <span style="color: #2400d9;">216</span>;
<span style="color: #a61390;">static</span> <span style="color: #a61390;">const</span> CGFloat LANDSCAPE_KEYBOARD_HEIGHT <span style="color: #002200;">=</span> <span style="color: #2400d9;">140</span>;</pre></div></div>




<p>after at the @implementation put this global variable to be used for all events </p>


<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"> CGFloat animatedDistance;</pre></div></div>




<p>at the textFieldDidBeginEditing event </p>


<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>textFieldDidBeginEditing<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UITextField <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>textField <span style="color: #002200;">&#123;</span>
&nbsp;
	CGRect textFieldRect <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>self.view.window convertRect<span style="color: #002200;">:</span>textField.bounds fromView<span style="color: #002200;">:</span>textField<span style="color: #002200;">&#93;</span>;
    CGRect viewRect <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>self.view.window convertRect<span style="color: #002200;">:</span>self.view.bounds fromView<span style="color: #002200;">:</span>self.view<span style="color: #002200;">&#93;</span>;
&nbsp;
    CGFloat midline <span style="color: #002200;">=</span> textFieldRect.origin.y <span style="color: #002200;">+</span> <span style="color: #2400d9;">0.5</span> <span style="color: #002200;">*</span> textFieldRect.size.height;
    CGFloat numerator <span style="color: #002200;">=</span>
	midline <span style="color: #002200;">-</span> viewRect.origin.y <span style="color: #002200;">-</span> MINIMUM_SCROLL_FRACTION <span style="color: #002200;">*</span> viewRect.size.height;
    CGFloat denominator <span style="color: #002200;">=</span>
	<span style="color: #002200;">&#40;</span>MAXIMUM_SCROLL_FRACTION <span style="color: #002200;">-</span> MINIMUM_SCROLL_FRACTION<span style="color: #002200;">&#41;</span> <span style="color: #002200;">*</span> viewRect.size.height;
    CGFloat heightFraction <span style="color: #002200;">=</span> numerator <span style="color: #002200;">/</span> denominator;
&nbsp;
&nbsp;
	<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>heightFraction &lt; <span style="color: #2400d9;">0.0</span><span style="color: #002200;">&#41;</span>
    <span style="color: #002200;">&#123;</span>
        heightFraction <span style="color: #002200;">=</span> <span style="color: #2400d9;">0.0</span>;
    <span style="color: #002200;">&#125;</span>
    <span style="color: #a61390;">else</span> <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>heightFraction &gt; <span style="color: #2400d9;">1.0</span><span style="color: #002200;">&#41;</span>
    <span style="color: #002200;">&#123;</span>
        heightFraction <span style="color: #002200;">=</span> <span style="color: #2400d9;">1.0</span>;
    <span style="color: #002200;">&#125;</span>
&nbsp;
	UIInterfaceOrientation orientation <span style="color: #002200;">=</span>
	<span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIApplication sharedApplication<span style="color: #002200;">&#93;</span> statusBarOrientation<span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>orientation <span style="color: #002200;">==</span> UIInterfaceOrientationPortrait ||
        orientation <span style="color: #002200;">==</span> UIInterfaceOrientationPortraitUpsideDown<span style="color: #002200;">&#41;</span>
    <span style="color: #002200;">&#123;</span>
        animatedDistance <span style="color: #002200;">=</span> <span style="color: #a61390;">floor</span><span style="color: #002200;">&#40;</span>PORTRAIT_KEYBOARD_HEIGHT <span style="color: #002200;">*</span> heightFraction<span style="color: #002200;">&#41;</span>;
    <span style="color: #002200;">&#125;</span>
    <span style="color: #a61390;">else</span>
    <span style="color: #002200;">&#123;</span>
        animatedDistance <span style="color: #002200;">=</span> <span style="color: #a61390;">floor</span><span style="color: #002200;">&#40;</span>LANDSCAPE_KEYBOARD_HEIGHT <span style="color: #002200;">*</span> heightFraction<span style="color: #002200;">&#41;</span>;
    <span style="color: #002200;">&#125;</span>
&nbsp;
	CGRect viewFrame <span style="color: #002200;">=</span> self.view.frame;
    viewFrame.origin.y <span style="color: #002200;">-=</span> animatedDistance;
&nbsp;
    <span style="color: #002200;">&#91;</span>UIView beginAnimations<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span> context<span style="color: #002200;">:</span><span style="color: #a61390;">NULL</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>UIView setAnimationBeginsFromCurrentState<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>UIView setAnimationDuration<span style="color: #002200;">:</span>KEYBOARD_ANIMATION_DURATION<span style="color: #002200;">&#93;</span>;
&nbsp;
    <span style="color: #002200;">&#91;</span>self.view setFrame<span style="color: #002200;">:</span>viewFrame<span style="color: #002200;">&#93;</span>;
&nbsp;
    <span style="color: #002200;">&#91;</span>UIView commitAnimations<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>




<p>at textFieldDidEndEditing event </p>


<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>textFieldDidEndEditing<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UITextField <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>textField <span style="color: #002200;">&#123;</span>
    CGRect viewFrame <span style="color: #002200;">=</span> self.view.frame;
    viewFrame.origin.y <span style="color: #002200;">+=</span> animatedDistance;
&nbsp;
    <span style="color: #002200;">&#91;</span>UIView beginAnimations<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span> context<span style="color: #002200;">:</span><span style="color: #a61390;">NULL</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>UIView setAnimationBeginsFromCurrentState<span style="color: #002200;">:</span><span style="color: #a61390;">YES</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>UIView setAnimationDuration<span style="color: #002200;">:</span>KEYBOARD_ANIMATION_DURATION<span style="color: #002200;">&#93;</span>;
&nbsp;
    <span style="color: #002200;">&#91;</span>self.view setFrame<span style="color: #002200;">:</span>viewFrame<span style="color: #002200;">&#93;</span>;
&nbsp;
    <span style="color: #002200;">&#91;</span>UIView commitAnimations<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>




<p>This event is textfield resign responder, once you press the return keypad it will hide the iPhone keyboard, this is important to test if the view will come back to its previous state.  </p>


<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span>textFieldShouldReturn<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UITextField <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> textField
<span style="color: #002200;">&#123;</span>
	<span style="color: #002200;">&#91;</span>textField resignFirstResponder<span style="color: #002200;">&#93;</span>;
	<span style="color: #a61390;">return</span> <span style="color: #a61390;">YES</span>;
<span style="color: #002200;">&#125;</span></pre></div></div>




Demo.

<div id="container_UIText"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</div>
<script type="text/javascript">// <![CDATA[
var s3UIText = new SWFObject("http://malebolgia.shadowsonawall.net/flash/mediaplayer.swf","mediaplayer","388","794","8"); 
            s3UIText.addParam("allowfullscreen","true"); 		
            s3UIText.addVariable("width","388"); 		
            s3UIText.addVariable("height","794"); 		
             s3UIText.addVariable("file","http://media.shadowsonawall.net/videos/iphone_0001.flv");            
            s3UIText.addVariable("backcolor","0x000000");             
            s3UIText.addVariable("frontcolor","0xFFFFFF");             
                s3UIText.addVariable("lightcolor","0x840D16");             
                s3UIText.addVariable("screencolor","red"); 		
                s3UIText.write("container_UIText");
// ]]&gt;</script>
<br /><br />
<p> <strong><a href="http://media.shadowsonawall.net/downloads/KeyBoardTrickStudy.zip">Download the Source</a></strong> </p>]]></content:encoded>
			<wfw:commentRss>http://malebolgia.shadowsonawall.net/code-programming/make-view-move-upward-uitextfield-begin-editing.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
