<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="weebly" -->
<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/" >

<channel><title><![CDATA[Lee Silver - Blog]]></title><link><![CDATA[http://www.leesilver.net/blog.html]]></link><description><![CDATA[Blog]]></description><pubDate>Tue, 08 May 2012 03:14:05 -0800</pubDate><generator>Weebly</generator><item><title><![CDATA[How to Train for a Marathon]]></title><link><![CDATA[http://www.leesilver.net/1/post/2012/02/how-to-train-for-a-marathon.html]]></link><comments><![CDATA[http://www.leesilver.net/1/post/2012/02/how-to-train-for-a-marathon.html#comments]]></comments><pubDate>Thu, 09 Feb 2012 10:08:01 -0800</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">http://www.leesilver.net/1/post/2012/02/how-to-train-for-a-marathon.html</guid><description><![CDATA[     [...] ]]></description><content:encoded><![CDATA[<div >  <!--BLOG_SUMMARY_END--></div>  <span class='imgPusher' style='float:left;height:0px'></span><span style=' float: left; z-index: 10; position: relative; ;clear:left;margin-top:0px;*margin-top:0px'><a><img src="http://www.leesilver.net/uploads/5/0/2/8/5028765/1328809815.png" style="margin-top: 5px; margin-bottom: 10px; margin-left: 0px; margin-right: 10px; border-width:0;" alt="Picture" class="galleryImageBorder" /></a><div style="display: block; font-size: 90%; margin-top: -10px; margin-bottom: 10px; text-align: center;"></div></span> <div  class="paragraph editable-text" style=" text-align: left; display: block; ">Just the thought of running 42km (26miles) can make anyone &nbsp;want to<br />vomit, even before making it to the starting line. For most, it sounds<br />impossible. The truth is, anyone can run a marathon. It all has to do<br />with a little bit of planning.<br /><br />Here are a few tips to prepare for a marathon.<br /><br /><strong>Track your runs so you can measure your progress</strong><br />There are a&nbsp;number of GPS devices out there. I use my iPhone with a GPS app called&nbsp;TrailBlazer.<br /><br /><strong>Bring your body to being comfortable running 5 kilometers</strong><br />3 or 4 times a week, run a comfortable distance so your body starts&nbsp;getting used to it. If you are starting from zero, run until you get&nbsp;tired. This may be 2 kilometers or even just one. If that's the case,&nbsp;42 km must sound crazy to you, but don't worry, nobody is asking you&nbsp;to run a marathon tomorrow. You'll get there.<br /><br />You'll notice that each run gets better. Your distances will increase&nbsp;before you get tired.<br /><br /><strong>Plan your running schedule</strong><br />I plan for 2 to 3 short runs during the week, and one long run on the&nbsp;weekend. My short runs are 4 - 6 KM and I do them in the morning. That&nbsp;works for me but time of day depends on the person. My long runs are&nbsp;key. I have my distances planned from when I start training until the&nbsp;day of the marathon. Each week I set a goal. I write my planned&nbsp;distances on my calendar for every week. I start at 8Km and add&nbsp;kilometers until I reach 30Km, two weeks before the marathon. Once you&nbsp;are comfortable running 5 Km, set your first long run to 8Km. The week<br />after, if you didn't have too much trouble with 8Km, run 10Km. Keep on&nbsp;adding 1 or 2 Km to your long runs week after week. you can also run&nbsp;the same distance if you feel you are not ready to increment. Don't&nbsp;forget, you are also running 2 to 3 short runs during the week. You&nbsp;will be surprised at how fast you start to get comfortable running 10,&nbsp;15, or even 20 KM.<br /><br />Two weeks before the marathon, your long run should be about 30Km.&nbsp;I don't run a full 42Km for training. I think of the marathon as the&nbsp;Superbowl of runs, and therefore, run a maximum of 30Km while&nbsp;training.<br /></div> <hr  style=" clear: both; visibility: hidden; width: 100%; "></hr>  <span class='imgPusher' style='float:right;height:0px'></span><span style=' float: right; z-index: 10; position: relative; ;clear:right;margin-top:0px;*margin-top:0px'><a><img src="http://www.leesilver.net/uploads/5/0/2/8/5028765/9064092.jpg?1328810773" style="margin-top: 5px; margin-bottom: 10px; margin-left: 10px; margin-right: 0px; border-width:1px;padding:3px;" alt="Picture" class="galleryImageBorder" /></a><div style="display: block; font-size: 90%; margin-top: -10px; margin-bottom: 10px; text-align: center;"></div></span> <div  class="paragraph editable-text" style=" text-align: left; display: block; "><strong>Eating</strong><br />Before long runs, eat lots of carbs. Pasta is my choice. After runs,&nbsp;eat lots of protein to build and repair your muscles.<br /><br /><strong>Go to the washroom before runs</strong>&nbsp;<br />On long runs, something happens to&nbsp;the body that I don't want to get into. It's not the fact that you&nbsp;will be out for a few hours without a washroom. It's that when you are&nbsp;straining yourself on long runs (10KM +) your body can't hold anything&nbsp;in. Need I say more.<br /><br /><strong>On long runs, bring water</strong><br />You don't need the extra weight during&nbsp;the marathon since there are water stations every few kilometers.<br /><br /><strong>Stretch before and after runs or you will be sore for days</strong><br />I, for one, like the feeling of sore muscles the day after a workout&nbsp;but being sore after really long runs is very painful. I don't&nbsp;recommend it.<br /><br /><strong>Knee Pains</strong><br />For beginners it's hard to believe, but knee pains are related to the&nbsp;shoes that you wear. Go invest in a new pair of shoes at the running&nbsp;room. They will watch you walk and recommend shoes based on your gait.<br />Don't just look for color, the areas of support the shoe focuses on is&nbsp;very important.<br /><br /><strong>Electrolytes&nbsp;and gels</strong><br />I tend to train without&nbsp;electrolytes&nbsp;and gels and only use them during&nbsp;the marathon. On marathon day, I drink a pouch of lemon flavoured&nbsp;electrolyte&nbsp;powder mixed with water and eat a gel pack right before&nbsp;the race. During the race I drink Gatorade at every water/Gatorade&nbsp;station and finish a gel pack every 30 minutes or so. Training without&nbsp;this stuff makes the race feel easier when I actually use it.<br /><br /><strong>Visualize</strong><br />Visualize yourself running past the finish every day. It helps.<br /><br /><strong>Create a playlist</strong><br />I love running with music. Some days I'm in the mood for mellow, and&nbsp;other days I'm in the mood for loud and fast. Make a playlist for&nbsp;whatever suits you. It helps keep you energized during the run.<br /><br /><strong>Race day</strong><br />If you made it this far, race day can be very exciting. It actually is&nbsp;easier than training only because you are running with thousands of&nbsp;other people and you have thousands of other people cheering you on,<br />on the sidelines. There is music and flags, and a buzz in the air.&nbsp;It's a great feeling.&nbsp;The downside of running with other people is&nbsp;that you tend to try to keep up with those that are faster than you.&nbsp;Keep your own pace. Use your GPS and check your speed so you don't go&nbsp;over your comfortable pace.&nbsp;<br /><br />Drink at every gatorade station, and eat&nbsp;your gels every half hour. In Toronto, where I am, the weather is cold<br />during both marathons. One is in early May, and the other is in late&nbsp;September or October. Perfect weather for running but too cold in the&nbsp;morning when the race starts. Bring disposable gloves so you can toss&nbsp;them aside when you start to get warm. Never take a long break. I ran&nbsp;30Km without stopping during my first marathon and then took a 15&nbsp;minute break. I sat on the grass and drank water and did some&nbsp;stretches too. The last 12 Km was extremely difficult because my&nbsp;muscles locked up. I couldn't run for more than a Kilometer &nbsp;without<br />stopping.<br /><br />When you finally cross the finish, enjoy it. Get a free massage and&nbsp;eat the bagel they give you at the end. Bask in the victorious&nbsp;feeling.</div> <hr  style=" clear: both; visibility: hidden; width: 100%; "></hr>  <div  class="paragraph editable-text" style=" text-align: left; ">This is your new blog post. Click here and start typing, or drag in elements from the top bar.</div>  ]]></content:encoded></item><item><title><![CDATA[Great Visual Of Airflow Across A Wing. ]]></title><link><![CDATA[http://www.leesilver.net/1/post/2012/02/great-visual-of-airflow-across-a-wing.html]]></link><comments><![CDATA[http://www.leesilver.net/1/post/2012/02/great-visual-of-airflow-across-a-wing.html#comments]]></comments><pubDate>Fri, 03 Feb 2012 03:56:11 -0800</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">http://www.leesilver.net/1/post/2012/02/great-visual-of-airflow-across-a-wing.html</guid><description><![CDATA[     [...] ]]></description><content:encoded><![CDATA[<div >  <!--BLOG_SUMMARY_END--></div>  <div  style=" margin-top: 10px; margin-bottom: 10px; "><div style="text-align: center;"><object width="400" height="330"><param name="movie" value="http://www.youtube.com/v/UqBmdZ-BNig"></param><param name="wmode" value="transparent"></param><param name="allownetworking" value="internal"></param><embed src="http://www.youtube.com/v/UqBmdZ-BNig" type="application/x-shockwave-flash" allownetworking="internal" wmode="transparent" width="400" height="330"></embed></object></div></div>  <div  class="paragraph editable-text" style=" text-align: left; ">Read more here:&nbsp;<a href="http://www.cam.ac.uk/research/news/how-wings-really-work/" target="_blank">http://www.cam.ac.uk/research/news/how-wings-really-work/</a></div>  ]]></content:encoded></item><item><title><![CDATA[Great GPS iPhone App for Outdoor Sports]]></title><link><![CDATA[http://www.leesilver.net/1/post/2012/01/great-gps-iphone-app-for-outdoor-sports.html]]></link><comments><![CDATA[http://www.leesilver.net/1/post/2012/01/great-gps-iphone-app-for-outdoor-sports.html#comments]]></comments><pubDate>Fri, 27 Jan 2012 11:29:47 -0800</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">http://www.leesilver.net/1/post/2012/01/great-gps-iphone-app-for-outdoor-sports.html</guid><description><![CDATA[     [...] ]]></description><content:encoded><![CDATA[<div >  <!--BLOG_SUMMARY_END--></div>  <span class='imgPusher' style='float:left;height:0px'></span><span style=' float: left; z-index: 10; position: relative; ;clear:left;margin-top:0px;*margin-top:0px'><a><img src="http://www.leesilver.net/uploads/5/0/2/8/5028765/5231346.png?171" style="margin-top: 5px; margin-bottom: 10px; margin-left: 0px; margin-right: 10px; border-width:1px;padding:3px;" alt="Picture" class="galleryImageBorder" /></a><div style="display: block; font-size: 90%; margin-top: -10px; margin-bottom: 10px; text-align: center;"></div></span> <div  class="paragraph editable-text" style=" text-align: left; display: block; "><br />For all you fellow flyers, hickers, bikers, and runners, I've been using an app that suits all of our needs. I bought it a few years ago but recently noticed just how often I use it, for so many different activities.&nbsp;On one of my early morning runs, I glanced at my iPhone, which was holstered snug on my wrist on multi layers of winter running clothes. A few days earlier, I had it attached to my hang glider, and in the summer, it was on my bike and my boat. The App is TrailBlazer. It's a GPS IPhone app that tracks your distance, averages, speeds, and altitude. It was around before multi-processing was available on the iPhone so music and the camera can be accessed without switching apps. At the end of your flight/run/bike/whatever, you can see graphs, maps, and pictures associated with the event. I am sure there are a ton of apps like it out there, but what makes this one great is that it also caters to flying sports as well as gravity bound. It seems like most of these type of apps care about speeds and distances but not altitude. The KMZ &nbsp;file you can export will show you your track over land as well. You can also re-live you trip by pressing the play button on Google Earth and it will recreate the experience for you.</div> <hr  style=" clear: both; visibility: hidden; width: 100%; "></hr>  <div ><div class="wsite-image wsite-image-border-thin " style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"> <a> <img src="http://www.leesilver.net/uploads/5/0/2/8/5028765/8554841.png?491" alt="Picture" style="width:auto;max-width:100%" /> </a> <div style="display:block;font-size:90%"></div> </div></div>  <div  class="paragraph editable-text" style=" text-align: left; ">Some other great features include: the ability to compete against your previous track, emailing your track as an image or KMZ, downloading the track straight from your iPhone, graphs, and the ability to have your friends or family track you.<br /><br />I use a running arm band when running and an iPhone bike mount for sailing, hang gliding, and biking. Read more on this app at <a href="http://www.trixsoftware.com" target="_blank">http://www.trixsoftware.com</a></div>  ]]></content:encoded></item><item><title><![CDATA[Excellent Way to Kill Bordom]]></title><link><![CDATA[http://www.leesilver.net/1/post/2012/01/excellent-way-to-kill-bordom.html]]></link><comments><![CDATA[http://www.leesilver.net/1/post/2012/01/excellent-way-to-kill-bordom.html#comments]]></comments><pubDate>Tue, 24 Jan 2012 07:36:04 -0800</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">http://www.leesilver.net/1/post/2012/01/excellent-way-to-kill-bordom.html</guid><description><![CDATA[     [...] ]]></description><content:encoded><![CDATA[<div >  <!--BLOG_SUMMARY_END--></div>  <span class='imgPusher' style='float:left;height:0px'></span><span style=' float: left; z-index: 10; position: relative; ;clear:left;margin-top:0px;*margin-top:0px'><a href='http://excitefind.com'><img src="http://www.leesilver.net/uploads/5/0/2/8/5028765/3079338.png" style="margin-top: 5px; margin-bottom: 10px; margin-left: 0px; margin-right: 10px; border-width:0;" alt="Picture" class="galleryImageBorder" /></a><div style="display: block; font-size: 90%; margin-top: -10px; margin-bottom: 10px; text-align: center;"></div></span> <div  class="paragraph editable-text" style=" text-align: left; display: block; "><a href="http://excitefind.com/" title="" style="">http://ExciteFind.com</a><br /><br />Here is a site with unique search capabilities that will find exciting local adventures around your city. Gift vouchers will also be sold so you can buy those hard-to-get people the time of their lives. From the small to the extreme, this site has it all. Activities for kids, ideas for dates, extreme sports, or suggestions for bachelor parties. Fill out the short&nbsp;questionnaire&nbsp;and the results are catered to you based on weather, age group, number of people, etc.&nbsp;<br /></div> <hr  style=" clear: both; visibility: hidden; width: 100%; "></hr>  ]]></content:encoded></item><item><title><![CDATA[Creating a Drop Down List for IOS App]]></title><link><![CDATA[http://www.leesilver.net/1/post/2011/11/creating-a-drop-down-list-for-ios-app.html]]></link><comments><![CDATA[http://www.leesilver.net/1/post/2011/11/creating-a-drop-down-list-for-ios-app.html#comments]]></comments><pubDate>Wed, 09 Nov 2011 12:47:37 -0800</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">http://www.leesilver.net/1/post/2011/11/creating-a-drop-down-list-for-ios-app.html</guid><description><![CDATA[    I was asked to replicate a windows application and make it for the iPad. Users of this app were not expected to be tech savvy so I was told to create drop down boxes so they won't get confused by the newer Pick View control.           [...] ]]></description><content:encoded><![CDATA[<div >  <!--BLOG_SUMMARY_END--></div>  <div  class="paragraph editable-text" style=" text-align: left; ">I was asked to replicate a windows application and make it for the iPad. Users of this app were not expected to be tech savvy so I was told to create drop down boxes so they won't get confused by the newer Pick View control.</div>  <div  class="paragraph editable-text" style=" text-align: left; "></div>  <div >     <div id="doc_72186942" style="padding:20px 0"></div> <script type="text/javascript"> if (!window.scribd_js_loaded) { 	window.scribd_js_loaded = true; 	document.write("<script type=\"text/javascript\" src=\"http://www.scribd.com/javascripts/view.js\"></scr"+"ipt>"); } </script> <script type="text/javascript"> var scribd_doc_72186942 = scribd.Document.getDoc(72186942, "key-29eueccb27nl41cye2hd"); scribd_doc_72186942.addParam("jsapi_version", 1); scribd_doc_72186942.addParam("height", 500); scribd_doc_72186942.write("doc_72186942"); </script> </div>  <div  class="paragraph editable-text" style=" text-align: left; "><em>Tags: IOS, iPhone, iPad, iPod, XCode, Objective C, dropdown, drop down, UIPickerView, Cocoa</em></div>  ]]></content:encoded></item><item><title><![CDATA[ Importing Data Into a SQLite Database for IOS Project]]></title><link><![CDATA[http://www.leesilver.net/1/post/2011/10/-importing-data-into-a-sqlite-database-for-ios-project.html]]></link><comments><![CDATA[http://www.leesilver.net/1/post/2011/10/-importing-data-into-a-sqlite-database-for-ios-project.html#comments]]></comments><pubDate>Mon, 31 Oct 2011 08:24:23 -0800</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">http://www.leesilver.net/1/post/2011/10/-importing-data-into-a-sqlite-database-for-ios-project.html</guid><description><![CDATA[    I recently had to write a program for the iPad that verifies Canadian postal codes. I already had a database, with millions of rows, as an MS Access database table. I wanted to use it for my project. Here is how I imported the data.               1.&nbsp;&nbsp;&nbsp;&nbsp; Export your existing data to a CSV file.   2.&nbsp;&nbsp;&nbsp;&nbsp; Create an SQLite file by typing [...] ]]></description><content:encoded><![CDATA[<div >  <!--BLOG_SUMMARY_END--></div>  <div  class="paragraph editable-text" style=" text-align: left; ">I recently had to write a program for the iPad that verifies Canadian postal codes. I already had a database, with millions of rows, as an MS Access database table. I wanted to use it for my project. Here is how I imported the data.<br />               1.&nbsp;&nbsp;&nbsp;&nbsp; Export your existing data to a CSV file. <br /><br />  2.&nbsp;&nbsp;&nbsp;&nbsp; Create an SQLite file by typing &ldquo;sqlite3 yourFileName.sql&rdquo; into your terminal window.<br /><br />  3.&nbsp;&nbsp;&nbsp;&nbsp; Create a table with the same number of columns as the table from which you are importing your data.<br />&nbsp; &nbsp; &nbsp; &nbsp; e.g. CREATE TABLE emp(NAME VARCHAR(50), ADDRESS VARCHAR(50));<br /><br />  4.&nbsp;&nbsp;&nbsp;&nbsp; Set the separator value of the CSV file by typing .seperator &ldquo;,&rdquo; in the command prompt<br /><br />  5.&nbsp;&nbsp;&nbsp;&nbsp; Import your data with the command .import TheImportFile.csv emp<br /><br />  </div>  <div  class="paragraph editable-text" style=" text-align: left; "><em>Tags: IOS, iPhone, iPad, iPod, XCode, Cocoa, Objective C, SQLite, SQL, CSV, importing data, database</em></div>  ]]></content:encoded></item><item><title><![CDATA[Creating a SQLite Database for an IOS Project]]></title><link><![CDATA[http://www.leesilver.net/1/post/2011/10/creating-a-sqlite-database-for-an-ios-project.html]]></link><comments><![CDATA[http://www.leesilver.net/1/post/2011/10/creating-a-sqlite-database-for-an-ios-project.html#comments]]></comments><pubDate>Mon, 31 Oct 2011 07:48:45 -0800</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">http://www.leesilver.net/1/post/2011/10/creating-a-sqlite-database-for-an-ios-project.html</guid><description><![CDATA[    Open terminal on your Mac.Navigate to, or create the directory you would like to create the database file in(mkdir = make directory, ls = list files within the directory, cd = change directory)&nbsp;Create the .sql file by typing sqlite3 nameOfFile.sqlCreate a table and add rows using standard SQL commands.&nbsp;&nbsp; &nbsp; &n [...] ]]></description><content:encoded><![CDATA[<div >  <!--BLOG_SUMMARY_END--></div>  <div  class="paragraph editable-text" style=" text-align: left; "><ol><li>Open terminal on your Mac.<br /></li><li>Navigate to, or create the directory you would like to create the database file in(mkdir = make directory, ls = list files within the directory, cd = change directory)<br /></li><li>&nbsp;Create the .sql file by typing sqlite3 nameOfFile.sql<br /></li><li>Create a table and add rows using standard SQL commands.&nbsp;</li></ol>&nbsp; &nbsp; &nbsp; &nbsp;CREATE TABLE emp (ID INTEGER PRIMARY KEY, NAME VARCHAR(50), PHONE VARCHAR(20)) <br />&nbsp; &nbsp; &nbsp; &nbsp;INSERT INTO emp (NAME, PHONE) VALUES ('Lee', '416-123-4567'); <br /><br />  5.&nbsp;&nbsp;&nbsp;&nbsp; When finished editing your database, type .quit to exit SQLite command prompt.<br /><br />  6.&nbsp;&nbsp;&nbsp;&nbsp; Open your XCode project.<br /><br />  7.&nbsp;&nbsp;&nbsp;&nbsp; Add the SQLite framework &ldquo;libsqlite3.0.dylib&rdquo;.<br /><br />  8.&nbsp;&nbsp;&nbsp;&nbsp; Add your newly create .sql file to the resources folder of your project.<br /><br />  </div>  <div  class="paragraph editable-text" style=" text-align: left; "><em>Tags: IOS, iPhone, iPad, iPod, SQL, XCode, Cocoa, Objective C, SQLite, iphone database,&nbsp;</em></div>  ]]></content:encoded></item><item><title><![CDATA[Mapping Home/End Buttons on a Mac]]></title><link><![CDATA[http://www.leesilver.net/1/post/2011/10/mapping-homeend-buttons-on-a-mac.html]]></link><comments><![CDATA[http://www.leesilver.net/1/post/2011/10/mapping-homeend-buttons-on-a-mac.html#comments]]></comments><pubDate>Fri, 28 Oct 2011 09:27:16 -0800</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">http://www.leesilver.net/1/post/2011/10/mapping-homeend-buttons-on-a-mac.html</guid><description><![CDATA[    One of the things that I cannot get used to is clicking on the Home or End buttons on a Mac, and it takes me right to the top of bottom of my document. It especially gets frustrating when the document is very long and I have to find my spot. There is a way to fix this so that your Mac keyboard behaves like Windows when it comes to home and end. Here is how:1. Open up terminal [...] ]]></description><content:encoded><![CDATA[<div >  <!--BLOG_SUMMARY_END--></div>  <div  class="paragraph editable-text" style=" text-align: left; ">One of the things that I cannot get used to is clicking on the Home or End buttons on a Mac, and it takes me right to the top of bottom of my document. It especially gets frustrating when the document is very long and I have to find my spot. There is a way to fix this so that your Mac keyboard behaves like Windows when it comes to home and end. Here is how:<br /><br />1. Open up terminal<br /><br />2. Navigate to "Library" in your user account. (<strong>cd library</strong>)<br /><br />3. Make the directory KeyBindings (<strong>mkdir KeyBindings</strong>)<br /><br />4. Create the file DefaultKeyBinding.dict (<strong>touch&nbsp;DefaultKeyBinding.dict</strong>)<br /><br />5. Open the new file for editing. Do this with PICO (<strong>pico DefaultKeyBinding.dict</strong>). I first tried to do this with text edit and it didn't work. I think it's because Textedit adds more information to the document such as fonts. PICO creates pure text.<br /><br />6. Enter this script:&nbsp;{"\UF729"  = "moveToBeginningOfLine:";&nbsp;"$\UF729" = "moveToBeginningOfLineAndModifySelection:";"\UF72B"  = "moveToEndOfLine:";&nbsp;"$\UF72B" = "moveToEndOfLineAndModifySelection:";"\UF72C"  = "pageUp:";&nbsp;"\UF72D"  = "pageDown:";&nbsp;}<br /><br />7. Save your document and log off, and back on.Your home and end button should now behave like they do in Windows. End = end of line, and Home = beginning of line.<br /><br /></div>  <div  class="paragraph editable-text" style=" text-align: left; "><em>Tags: Home, end, buttons. mac, keyboard, mapping, remapping, beginning of line, end of line, Windows, OSX, Terminal</em></div>  ]]></content:encoded></item><item><title><![CDATA[Storing Data Locally on plists in IOS]]></title><link><![CDATA[http://www.leesilver.net/1/post/2011/08/storing-data-locally-on-plists-in-ios.html]]></link><comments><![CDATA[http://www.leesilver.net/1/post/2011/08/storing-data-locally-on-plists-in-ios.html#comments]]></comments><pubDate>Thu, 25 Aug 2011 13:25:25 -0800</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">http://www.leesilver.net/1/post/2011/08/storing-data-locally-on-plists-in-ios.html</guid><description><![CDATA[    Storing data on the iphone or iPad is fairly simple. What you will need to do is create a plist file, which is an xml database file, where you can create tags and store data within them. Here is code that will create a plist file if it doesn't already exist, write to the file, and then read it. The elements I am storing are strings and an image which I am storing an NSData.Keep  [...] ]]></description><content:encoded><![CDATA[<div >  <!--BLOG_SUMMARY_END--></div>  <div  class="paragraph editable-text" style=" text-align: left; ">Storing data on the iphone or iPad is fairly simple. What you will need to do is create a plist file, which is an xml database file, where you can create tags and store data within them. Here is code that will create a plist file if it doesn't already exist, write to the file, and then read it. The elements I am storing are strings and an image which I am storing an NSData.<br /><br />Keep in mind that EAppAppDelegate class stores the variables ID, and data which are NSStrings. I also use a variable 'drawImage' which is a&nbsp;<span>UIImageView</span>&nbsp;that I declared in my .h file. drawImage is used to save an image which is done outside of the scope of this example.        </div>  <div > <div style="padding-top: 20px; padding-bottom: 20px;"> <object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" align="middle"	height="500" width="100%" name="doc_63131166" id="doc_63131166"> <param name="movie" value="http://d.scribd.com/ScribdViewer.swf?document_id=63131166&access_key=key-1z6tl4pcfoepey3qaiim&page=1&version=1&viewMode=">  <param name="quality" value="high">  <param name="play" value="true">  <param name="loop" value="true">  <param name="scale" value="showall">  <param name="wmode" value="opaque">  <param name="devicefont" value="false">  <param name="bgcolor" value="#ffffff">  <param name="menu" value="true">  <param name="allowFullScreen" value="true">  <param name="allowScriptAccess" value="always">  <param name="salign" value="">  <embed name="doc_63131166" src="http://d.scribd.com/ScribdViewer.swf?document_id=63131166&access_key=key-1z6tl4pcfoepey3qaiim&page=1&version=1&viewMode=" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" play="true" loop="true" scale="showall" wmode="opaque" devicefont="false" bgcolor="#ffffff" menu="true" allowfullscreen="true" allowscriptaccess="always" salign="" type="application/x-shockwave-flash" align="middle"  height="500" width="100%"></embed> </object> </div></div>  <div  class="paragraph editable-text" style=" text-align: left; "><em>Tags: IOS, iPad, iPhone, plist, saving data, save, iphone database, storing data on iphone, reading plist, writing plist, accessing plist, Xcode, Cocoa, Objective C, Apple</em></div>  ]]></content:encoded></item><item><title><![CDATA[Calling a web service from objective C]]></title><link><![CDATA[http://www.leesilver.net/1/post/2011/08/calling-a-web-service-from-objective-c.html]]></link><comments><![CDATA[http://www.leesilver.net/1/post/2011/08/calling-a-web-service-from-objective-c.html#comments]]></comments><pubDate>Fri, 19 Aug 2011 10:31:12 -0800</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">http://www.leesilver.net/1/post/2011/08/calling-a-web-service-from-objective-c.html</guid><description><![CDATA[    Here is a little example of how you could connect to a web service from within your iphone objective C app.1. To get the information you need for the web service, type the address of the .asmx file into your browser and navigate to it. e.g. http://myTestWebService.com/TestService.asmx   [...] ]]></description><content:encoded><![CDATA[<div >  <!--BLOG_SUMMARY_END--></div>  <div  class="paragraph editable-text" style=" text-align: left; ">Here is a little example of how you could connect to a web service from within your iphone objective C app.<br /><br />1. To get the information you need for the web service, type the address of the .asmx file into your browser and navigate to it. e.g. http://myTestWebService.com/TestService.asmx</div>  <div ><div style="text-align: center;"><a><img src="http://www.leesilver.net/uploads/5/0/2/8/5028765/1313768788.jpg" style="margin-top: 10px; margin-bottom: 10px; margin-left: 10px; margin-right: 10px; border-width:0;" alt="Picture" class="galleryImageBorder" /></a><div style="display: block; font-size: 90%; margin-top: -10px; margin-bottom: 10px;"></div></div></div>  <div  class="paragraph editable-text" style=" text-align: left; ">2. &nbsp;A list of the methods available will be displayed. Click on the web method you want to call to see the information.</div>  <div ><div style="text-align: center;"><a><img src="http://www.leesilver.net/uploads/5/0/2/8/5028765/7952610.png?634" style="margin-top: 10px; margin-bottom: 10px; margin-left: 10px; margin-right: 10px; border-width:1px;padding:3px;" alt="Picture" class="galleryImageBorder" /></a><div style="display: block; font-size: 90%; margin-top: -10px; margin-bottom: 10px;"></div></div></div>  <div  class="paragraph editable-text" style=" text-align: left; ">3.Copy the lower portion of the SOAP XML, from "&lt;?xml" to &lt;/soap:Envelope&gt;", into a variable in your project and put the necessary escape characters in the right places. (\)<br /><br /><font color="#3366ff">        NSString *soapMessage = [NSString stringWithFormat:<br /> &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @"&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;"<br /> &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "&lt;soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"&gt;"<br /> &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "&lt;soap:Body&gt;\n"<br /> &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "&lt;testWS xmlns=\"http://www.MyTestWebServices.com/\"&gt;\n"<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "&lt;xmlIn&gt;\n"<br /> &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "&lt;![CDATA[%@]]&gt;\n"<br /> &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "&lt;/xmlIn&gt;\n"<br /> &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "&lt;/testWS&gt;\n"<br /> &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "&lt;/soap:Body&gt;\n"<br /> &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "&lt;/soap:Envelope&gt;\n", query ];</font><br /><br /><br /></div>  <div  class="paragraph editable-text" style=" text-align: left; ">4. In the example above, my web method accepts one parameter, xmlIn. In the "xmlIn" tag, I inserted my variable "query" which I have created before.<br /><br /><font color="#3366ff">        NSString *query = &lt;DOCUMENT&gt;&lt;FIELD1&gt;testing WS&lt;/FIELD1&gt;&lt;/DOCUMENT&gt;<br /></font><br /><br />5. I've been having a lot of problems transmitting XML within the soap:body. My quick and dirty solution to fix it was to wrap my xml in a CDATA section.&nbsp;<font color="#3366ff">&lt;![CDATA[%@]]&gt;. </font><font color="#333333">This would mean that the XML parser will not parse that section. According to most blogs, that alone should work but it didn't for me. What I did after was replace the &lt; and &gt; with &amp;lt; and &amp;gt;. If it still doesn't work, change them back in your web service if you have access to it.</font><br /><br /><font><font color="#3366ff">           query = [query stringByReplacingOccurrencesOfString:@"&lt;" withString:@"&amp;lt;"];<br />query = [query stringByReplacingOccurrencesOfString:@"&gt;" withString:@"&amp;gt;"];<br /></font><br /></font><br /><font>6. Next, I created an NSMutableURLRequest and set it up with the information from the web method details page that I've navigated to in step 1.&nbsp;</font><br /><br /><font><font color="#3366ff">           NSURL *url = [NSURL URLWithString:@"http://MyTestWebServices/TestService.asmx"];<br /> 	NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];<br /> 	NSString *msgLength = [NSString stringWithFormat:@"%d", [soapMessage length]];<br /> 	<br />[theRequest addValue:@"text/xml" forHTTPHeaderField:@"Content-Type"];<br />[theRequest addValue: @"http://www.MyTestWebService/testWS" forHTTPHeaderField:@"SOAPAction"];<br />[theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];<br />[theRequest setHTTPMethod:@"POST"];<br />[theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]];</font><br /></font><br /><br />7. Create a NSURLConnection and initialize it with the NSMutableURLRequest we just created.<br /><font color="#3366ff">        NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];<br /> 	if( theConnection )<br /> 	{<br /> 		conWebData = [NSMutableData data];<br /> 	}<br /> 	else<br /> 	{<br /> 		NSLog(@"theConnection is NULL");<br /> 	}</font><br /><br />        <br />8. Some of the variables you might not recognize. I've declared them in my .h file<font color="#3366ff">NSMutableData *conWebData;<br />NSMutableString *soapResults;<br />NSXMLParser *xmlParser;<br />BOOL recordResults;</font><font color="#3366ff">        @property(nonatomic, retain) NSMutableData *conWebData;<br /> @property(nonatomic, retain) NSMutableString *soapResults;<br /> @property(nonatomic, retain) NSXMLParser *xmlParser;</font><br /><br />9. Without going into too much detail. I've added these standard functions which are called during a connection.        -<font color="#3366ff">(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response<br /> {<br /> 	[conWebData setLength: 0];<br /></font><font color="#3366ff"> }<br /><br /> </font><br /><font color="#3366ff">-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data<br /> {<br /> 	[conWebData appendData:data];<br /> }<br /><br /> </font><br /><font color="#3366ff">-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error<br /> {<br /> 	NSLog(@"ERROR with theConenction");<br /> }<br /><br /> </font><br /><font color="#3366ff">-(void)connectionDidFinishLoading:(NSURLConnection *)connection<br /> {<br /> 	NSLog(@"DONE. Received Bytes: %d", [conWebData length]);<br /> 	NSString *theXML = [[NSString alloc] initWithBytes: [conWebData mutableBytes] length:[conWebData length] encoding:NSUTF8StringEncoding];<br /> 	NSLog(theXML);<br /> 	xmlParser = [[NSXMLParser alloc] initWithData: conWebData];<br /> 	[xmlParser setDelegate: self];<br /> 	[xmlParser setShouldResolveExternalEntities: YES];<br /> 	[xmlParser parse];<br /> }<br /><br /> </font><br /><font color="#3366ff">-(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *) namespaceURI qualifiedName:(NSString *)qName&nbsp; &nbsp;attributes: (NSDictionary *)attributeDict<br /> {<br />if( [elementName isEqualToString:@"testWSResult"])<br />&nbsp; &nbsp;{<br />&nbsp; &nbsp; &nbsp; &nbsp;if(!soapResults)<br />&nbsp; &nbsp; &nbsp; &nbsp;{<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;soapResults = [[NSMutableString alloc] init];<br />&nbsp; &nbsp; &nbsp; &nbsp;}<br />&nbsp; &nbsp; &nbsp; &nbsp;recordResults = TRUE;<br />&nbsp; &nbsp;}<br /> }</font><br /><br /><font color="#3366ff"><br /> -(void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string<br /> {<br />&nbsp; &nbsp;if( recordResults )<br />&nbsp; &nbsp;{<br />&nbsp; &nbsp; &nbsp; [soapResults appendString: string];<br />&nbsp; &nbsp;}<br /> }</font><br /><font color="#3366ff"><br /> -(void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName<br /> {<br />&nbsp; &nbsp;if( [elementName isEqualToString:@"testWSResult"])<br />&nbsp; &nbsp;{<br />&nbsp; &nbsp; &nbsp; &nbsp;recordResults = FALSE;</font><br /><font color="#3366ff">&nbsp; &nbsp; &nbsp; &nbsp; //for debugging<br />&nbsp; &nbsp; &nbsp; &nbsp; UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"" message:soapResults delegate:nil &nbsp; cancelButtonTitle:@"OK" otherButtonTitles:nil];<br /> &nbsp; &nbsp; &nbsp; &nbsp; [alert show];<br />&nbsp; &nbsp; &nbsp; &nbsp;soapResults = nil;<br />&nbsp; &nbsp; &nbsp;}<br /> }</font><br /><br /><br /><br /><br />Full Code:<br /><br /></div>  <div > <div style="padding-top: 20px; padding-bottom: 20px;"> <object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" align="middle"	height="500" width="100%" name="doc_62661014" id="doc_62661014"> <param name="movie" value="http://d.scribd.com/ScribdViewer.swf?document_id=62661014&access_key=key-1gyk6gtmwtcs9z7kc9sp&page=1&version=1&viewMode=">  <param name="quality" value="high">  <param name="play" value="true">  <param name="loop" value="true">  <param name="scale" value="showall">  <param name="wmode" value="opaque">  <param name="devicefont" value="false">  <param name="bgcolor" value="#ffffff">  <param name="menu" value="true">  <param name="allowFullScreen" value="true">  <param name="allowScriptAccess" value="always">  <param name="salign" value="">  <embed name="doc_62661014" src="http://d.scribd.com/ScribdViewer.swf?document_id=62661014&access_key=key-1gyk6gtmwtcs9z7kc9sp&page=1&version=1&viewMode=" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" play="true" loop="true" scale="showall" wmode="opaque" devicefont="false" bgcolor="#ffffff" menu="true" allowfullscreen="true" allowscriptaccess="always" salign="" type="application/x-shockwave-flash" align="middle"  height="500" width="100%"></embed> </object> </div></div>  <div  class="paragraph editable-text" style=" text-align: left; "><em>Tags: iPad, iPhone, iPod, Web Services, .NET, XML, soap:body, SOAP, soap:envelope, xml in soap:body, web services from iphone, IOS, XCode, Objective C, NSURLConnection</em></div>  ]]></content:encoded></item></channel></rss>

