text: tag:blogger.com,1999:blog-48368972889389697412022-06-08T03:36:30.564-04:00The Mobile ExperienceTony - The user is always rightAfter some amazing designer time and some scrambling to get all the UI changes in we got to let a bunch of people play with the app on actual devices, the feed back was awesome! As in extremely useful awesome.<br /><br />Nothing beats first hand feedback!<br /><br />Here's a few of the fun things we discovered we had to get right:<br /><br /><span style="font-weight:bold;">1. If the app does not respond to user touch as expected by the user, there will be confusion!</span> <br /><br />One of our views had editable text fields. Tapping a field would bring up the key pad but there was no cursor indicating that the specific text field was selected and typing would allow you to enter a value. <br /><br />Result: "The app is broken!", "Um its not working?". <br /><br />The funny thing is that if you had started typing you would see the values being entered, and it would work, but the lack of a prompt from the text field was enough to cause confusion. Needless to say this important issue has been fixed.<br /><br /><span style="font-weight:bold;">2. Very detailed views will be expected to be zoom-able.</span><br /><br />Several of our views contain graphs, these occupy about half the full screen size. These graphs contained points and grids and axes so users would automatically try to zoom into them. Unfortunately, we had not yet put this functionality in. Currently this is a to do item on our list, but it is obvious that our users will expect this functionality, and will be disappointed if its not there. <br /><br /><span style="font-weight:bold;">3. Universal hatred for pop-up warnings about invalid entries.</span><br /><br />If a user entered an invalid value, we were displaying pop-up warning messages that would tell you the valid range to use. Almost everyone who tried out the app and got a warning message automatically hated the message. Somehow it would create frustration, even when we thought we were being helpful. I guess the pop-up warnings make a user feel like they've done something really wrong and its broken while all they want is for the d#$# thing to work! We have replaced this with the more user friendly way of indicating invalid values, where a tiny red message is displayed under the text field.<br /><br /><span style="font-weight:bold;">4. Saving should succeed even when not all fields are complete.</span><br /><br />If in the users mind, the information they are filling doesn't all need to be specified, then saving should work as long as some required fields have values. This allows the user to enter in the information they have in the moment and still continue using the app, and fill the rest later. Not being able to save what they have entered already discourages them from continuing to use the app or even returning to it later. So be very careful about what and how many fields are marked as required fields.<br /><br /><span style="font-weight:bold;">5. Respond to device orientation change.</span><br /><br />While users didn't try or expect this with all our views, there did seem to be an expectation for the app to support this on the graph views. They expected the graph to be zoomed in and centered on device orientation change with all other elements not getting screen space. Returning to the original orientation should then return the user to the screen with the smaller graph and the rest of the view elements. Again a to do item which would be cool to have. <br /><br />Well, now we all know when making other apps of some expectations and behaviors to keep in mind to ensure a wonderful user experience!Ayesha Khan - The WOW factorAbout a few weeks ago our little project got lucky, and received some designer time! Our design hero put together some screen shots at first, and then sent us the images and specifications that we would need. It was amazing how polished our application started to look as soon as we started to add in the changes! We were completely WOWED with the end result! See for yourself:<br /><br />Images of Main Screen Before.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href=""><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 221px; height: 320px;" src="" alt="" id="BLOGGER_PHOTO_ID_5483425034746338738" border="0" /><204227711522" /></a><br /><br />Images of Main Screen After.351331645986" /></a><br />483425438673625842" /></a><br /><br />Now a few discoveries about adding background images, specifying table and cell backgrounds, separators and text formatting.<br /><br /><span style="font-weight: bold;">1. Image as background</span><br /><br />You can use an image as the background for a UIView by adding the following code in the view controller's viewDidLoad:<br /><br /><span style="color: rgb(51, 102, 255);">self.view.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed:@"imgname.png"]];</span><br /><br />colorWithPatternImage is a really powerful method and can be used to set images as colors for tables, cells, labels etc.<br /><br /><span style="font-weight: bold;">2. Specify a color not available in the interface builder</span><br /><br /:<br /><br /><span style="color: rgb(51, 102, 255);">[UIColor colorWithRed:219.0f/255.0f green:63.0f/255.0f blue:97.0f/255.0f alpha:1.0f];</span><br /><br />You can assign this UIColor to backgrounds, and separators etc. In the following code I've applied it to the separator line defined for tables.<br /><br /><span style="color: rgb(51, 102, 255);">self.table.separatorColor = [UIColor colorWithRed:219.0f/255.0f green:63.0f/255.0f blue:97.0f/255.0f alpha:1.0f];</span><br /><br /><span style="font-weight: bold;">3. Programmatic formatting of text</span><br /><br /.<br /><br /><span style="color: rgb(51, 102, 255);">CGRect frame = CGRectMake(0, 0, 400, 44);</span><br /><span style="color: rgb(51, 102, 255);">UILabel *label = [[[UILabel alloc] initWithFrame:frame] autorelease];</span><br /><span style="color: rgb(51, 102, 255);">label.backgroundColor = [UIColor clearColor];</span><br /><span style="color: rgb(51, 102, 255);">label.font = [UIFont boldSystemFontOfSize:20.0];</span><br /><span style="color: rgb(51, 102, 255);">label.text = @"This is a label";</span><br /><span style="color: rgb(51, 102, 255);">label.shadowColor = [UIColor whiteColor];</span><br /><span style="color: rgb(51, 102, 255);">label.textAlignment = UITextAlignmentCenter;</span><br /><span style="color: rgb(51, 102, 255);">label.shadowOffset = CGSizeMake(0,1);</span><br /><span style="color: rgb(51, 102, 255);">label.textColor = [UIColor colorWithRed:102.0f/255.0f green:51.0f/255.0f blue:0.0f/255.0f alpha:1.0f];</span><br /><br /><span style="font-weight: bold;">4. Grouped tables, selected row issue</span><br /><br />When using a UITableView, and setting the style to Grouped. You'll notice that when the top or bottom cell is selected, the grey or blue is outside of the rounded corners. Also the separators disappear for any selected cell. The workaround<br />for this issue is to always set the cell's background color for selected and unselected. In the view controller make sure you have a reference to the cell and in the viewDidLoad add the following code:<br /><br /><span style="color: rgb(51, 102, 255);">self.myCell.backgroundColor = [UIColor colorWithRed:219.0f/255.0f green:63.0f/255.0f blue:97.0f/255.0f alpha:1.0f];</span><br /><br /.Ayesha Khan - View ControllersView controllers are one of the most fundamental building blocks of Iphone applications. How you implement the view controllers in you application determines how information is displayed to the user over multiple screens, or even within the limited space of one screen. They allow you to manage the showing and hiding of information within one screen as well as switching back and forth between screens. This article is a general overview of view controllers and has special focus on the Navigation View Controller.<br /><br />There are three types of view controllers:<br />- Custom View Controller<br />- Container View Controller<br />- Modal View Controller<br /><br />Custom View Controllers are controller objects that manage the content of one screen. Most applications will have several screens that display different information, each of these can have its own view controller that manages the presentation of data for that particular screen only.<br /><br />A Container View Controller on the other hand controls other View Controllers. These are used to define navigation between several different views. A Navigation View Controller and Tab Bar View Controller are examples of Container View Controllers.<br /><br />The diagram below shows an example interface with three different views that the user can navigate back and forth between, as well as a portion of the screen being used to navigate between four other views.<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href=""><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 291px;" src="" alt="" id="BLOGGER_PHOTO_ID_5477432345750558450" border="0" /></a>There are several ways the diagram's flow could be achieved in an application. Lets say we decide to go down the following scenario:<br /><br /><ul><li>Each of the 7 views gets its own custom view controller.</li><li>Implement a main navigation controller using UINavigationController class provided by the system. This allows us to go back and forth between the three main views.</li><li>For the four views, that only change a potion of the screen, we have two different options: Implement a UITabBar class in the central view, that switches between the four views or display the Toolbar that is defined within the UINavigationController class.<span style="font-weight: bold;"> Note that we cannot use the UITabBarController class at this point since the programming guideline prohibits incorporating a UITabBarController into a UINavigationController. However, the guideline does allow having a UINavigationController within a UITabBarController</span>.<br /></li></ul>The UINavigationViewController is an amazing class that maintains track of a navigation stack. It contains several views that help define a navigation interface: Navigation Bar, Navigation View, Custom Content and the hidden by default Navigation Toolbar. The content of the Navigation bar and Toolbar can be customized however these views do not change. The only view that changes is the Custom Content view. This view always shows the view of the view controller that is at the top of the navigation stack.<br /><br />The Navigation Bar already has a default back button defined, which displays the name of the previous view's title. If the previous view has no title then the button displays "back" by default. The behavior for this button is already defined and clicking it changes the view to the previous view. Very convenient. <span style="font-weight: bold;">Sadly, if the previous view had a title the button says the title of the page and you cannot simply change the text to say "back" or any other custom text. You actually have to define a custom UIBarButtonItem and assign it to the <span style="font-style: italic;">leftBarButtonItem</span> property of the Navigation Bar. This also means that you have to define the behavior of the button as well. </span> The middle of the Navigation Bar generally displays the view title. You can specify a custom title by setting the <span style="font-style: italic;">titleView </span>Property of the Navigation Bar. The right side of the Navigation Bar by default displays nothing unless the <span style="font-style: italic;">rightBarButtonItem</span> property has been set to a custom UIBarButtonItem. The <span style="font-style: italic;">rightBarButtonItem</span> property is often used to specify a next button or a cancel button, all you have to do is put the next view on top of the navigation stack for the controller to know which view to load.<br /><br />For navigating between the four sub views we used the UITabBar class. The UITabBar class allows you to define two or more tab items, clicking on which changes the selected view. <span style="font-weight: bold;">The issue</span><span style="font-weight: bold;"> to note here is that placing a view within a view required a lot of fine tuning sizing wise. Even if the views properties for auto sizing are set they didn't always render correctly within each other and we had to specify size in code.</span> Even though we were successful with this avenue, in the end it was easier and cleaner to repeat in each of the four sub views the content of the central view that was common to them and switch the whole of the central with one of these four when a Tab Bar Item was clicked.<br /><br />I hope you found this introduction / summary helpful. Choosing the path that best suits your application is very important and can have many challenges: unavailable options, rules and regulations, time for fine tuning etc. This is a decision that could determine how much re-work or re-design you may have to do later on in the project.<br /><br />References and recommended reading:<br /><br /><ul><li><a href="">View Controller Programming Guide</a></li><li><a href="">UIViewController Class</a></li><li><a href="">UINavigationController Class</a></li><li><a href="">UITabBarController Class</a></li><li><a href="">UITabBar Class</a></li><li><a href="">UIBarButtonItem Class</a><br /></li><li><a href="">Combining View Controllers</a><br /></li></ul>Ayesha Khan navigation with the trackballLet's talk about using the trackball in android applications.<br /><br /><br /.<br /><br />. <br /><br />. <br /><br /> That's all for now about strange behavior of focus when using the trackball.Varduhi Experimentation - Part 2As a follow up to my <a href="">first post</a> about managing experimentation I would like to cover an interesting aspect of this project: progression tracking.<br /><br />There.<br /><br /.<br /><br />See for yourself:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href=""><img style="cursor: pointer; width: 320px; height: 200px;" src="" alt="" id="BLOGGER_PHOTO_ID_5469632012075704418" border="0" /></a><br /><br />The red line is showing tasks creation while the green is showing tasks resolutions.<br /><br />As you can clearly see the team has been creating as many tasks as they have been resolving since the initial task creation initiative. And this pretty much from day one. This is very positive.<br /><br /. <br /><br /.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4836897288938969741.post-74027313630097069772010-05-07T15:20:00.009-04:002010-05-10T03:14:43.459-04:00Chart Control for Windows Phone 7The experiences that we've gone through on Windows Phone 7 so far have been very astonishing. Loads of controls are absent from .NET Compact. You have to find a workaround for anything that's not there. This makes life bitter.<div>Here are a few limitations to outline. They are not encompassed with something general, just a list of what I faced so far:</div><div><ul><li>no local database support (as already mentioned in <a href="">this</a> and <a href="">this</a> blogs)</li><li>no TabControl, no DatePicker (the complete list can be found on <a href="">msdn</a>)</li><li>no IComparer<t><t> (the common IComparer is supported, but for templates it's not)</t></t></li><li>in usual WPF there is Button.Children, but here we don't have it</li><li>no ChartControl (about them we've talked on <a href="">those</a> <a href="">two</a> pages)</li></ul><div>OK, enough of disappointments now. Here is the good part. Macadamian developed a Chart Control which you can pick up <span style="font-weight: bold;">for free</span>. The chart looks like the one in the screenshot below.</div><div><br /></div><div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href=""><img style="margin: 0pt 10px 10px 0pt; cursor: pointer; width: 164px; height: 320px;" src="" alt="" id="BLOGGER_PHOTO_ID_5468620034787632370" border="0" /></a></div><div><br /></div><div>Don't pay specific attention to that outrageous pile of letters called "Parandzem". That's an Armenian name (by the way that's a female name) that I left to appear on the phone. The rest are the "Baby Weight Tracker" application left-offs, and the chart of course.</div><div><br /></div><div>You can download the dll of the chart <a href="">here</a>.</div><div><br /></div><div>In the coming days another control will be available to fetch - <b>DatePicker</b>. Stay tuned!</div><div><br /></div><div><br /></div><div><br /></div><div><br /></div></div>Ani Windows Phone Developer Tools?The news told me that a new release of Windows Phone Developer Tools has been released recently. To not copy all the lines down here of <span style="font-weight: bold;">what's new</span> in this release, here is the short and simple <a href="">page</a> to see it.<br />It's always nice to move on with newer stuff, isn't it? At least it is for me, so I immediately downloaded the installer from <a href="">here</a> to see what's in there. And.... boom! The screen that I get tells me it's time to go to bed:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href=""><img style="margin: 0pt 10px 10px 0pt; cursor: pointer; width: 274px; height: 320px;" src="" alt="" id="BLOGGER_PHOTO_ID_5465654216558917426" border="0" /></a><br />Requires removing all my environment to proceed. Disappointment!<br /.Ani of percentile and projecting<div style="text-align: justify;font-family:Verdana;"><br />Hi everyone. I'm going to post about how to calculate percentiles for infants and how to calculate projecting.<br /><br /><span style="font-weight: bold;">Percentile Data Files with LMS Values. How to calculate measurement, z-score and percentile</span><br /><br /.<br /><ol><li><a href="">WTAGEINF [XLS - 34 KB]</a><br />Weight-for-age charts, birth to 36 months, LMS parameters and selected smoothed weight percentiles in kilograms, by sex and age<br /></li><br /><li><a href="">LENAGEINF [XLS - 67 KB]</a><br />Length-for-age charts, birth to 36 months, LMS parameters and selected smoothed recumbent length percentiles in centimeters, by sex and age<br /><br /.<br />percentiles in kilograms, by sex and recumbent length (in centimeters)<br /></li><br /><li><a href="">HCAGEINF [XLS - 34 KB]</a><br />Head circumference-for-age charts, birth to 36 months, LMS parameters and selected smoothed head circumference percentiles in centimeters, by sex and age<br /></li></ol><br /.<br /><br />The LMS parameters are the median (M), the generalized coefficient of variation (S) and the power in the Box-Cox transformation (L). To obtain the value (X) of a given physical measurement at a particular z-score, use the following equation:<br /><pre style="text-align: center;">X = M (1 + LSZ)**(1/L), L != 0<br /><br />or<br /><br />X = M exp(SZ), L == 0</pre><br />**.<br /><br /.<br /><br />To obtain the z-score (Z) for a given measurement (X), use the following equation:<br /><pre style="text-align: center;">((X/M)**L) - 1<br /> Z = ------------------, L != 0<br />LS<br /><br />or<br /><br />Z = ln(X/M)/S, L == 0</pre><br /.<br /><br /.<br /><br /.<br /><br />Below is the java code for that class.<br /><div><br />/**<br /> * This class contains routines to calculate the normal cumulative distribution function (CDF) and its inverse.<br /> */<br /><br />public class CDFNormal {<br /><br /> /**<br /> * This method calculates the normal cdf inverse function.<br /> * <br /> *@param percentile<br /> * p must lie between 0 and 1. inverseCumulativeProbability returns the normal cdf inverse evaluated at<br /> * percentile.<br /> */<br /><br /> public static double inverseCumulativeProbability(double percentile) {<br /> if (percentile < 0 || percentile > 1) {<br /> throw new IllegalArgumentException("p should lie in [0, 1]");<br /> }<br /> double arg, t, t2, t3, xnum, xden, qinvp, pc;<br /><br /> final double[] c = { 2.515517, .802853, .010328 };<br /><br /> final double[] d = { 1.432788, .189269, .001308 };<br /><br /> if (percentile <= 0.5) {<br /> arg = -2.0 * Math.log(percentile);<br /> t = Math.sqrt(arg);<br /> t2 = t * t;<br /> t3 = t2 * t;<br /><br /> xnum = c[0] + c[1] * t + c[2] * t2;<br /> xden = 1.0 + d[0] * t + d[1] * t2 + d[2] * t3;<br /> qinvp = t - xnum / xden;<br /><br /> return -qinvp;<br /> } else {<br /> pc = 1.0 - percentile;<br /> arg = -2.0 * Math.log(pc);<br /> t = Math.sqrt(arg);<br /> t2 = t * t;<br /> t3 = t2 * t;<br /><br /> xnum = c[0] + c[1] * t + c[2] * t2;<br /> xden = 1.0 + d[0] * t + d[1] * t2 + d[2] * t3;<br /><br /> return t - xnum / xden;<br /> }<br /> }<br /><br /><br /> /**<br /> * This method calculates the normal cumulative distribution function.<br /> * <p><br /> * It is based upon algorithm 5666 for the error function, from:<br /> * </p><br /> * <br /> * <pre><br /> * Hart, J.F. et al, 'Computer Approximations', Wiley 1968<br /> * </pre><br /> * <br /> * @param zScore<br /> * The method returns the value of the normal cumulative distribution function at zScore.<br /> */<br /><br /> public static double cumulativeProbability(double zScore) {<br /> double zabs;<br /> double p;<br /> double expntl, pdf;<br /><br /> final double p0 = 220.2068679123761;<br /> final double p1 = 221.2135961699311;<br /> final double p2 = 112.0792914978709;<br /> final double p3 = 33.91286607838300;<br /> final double p4 = 6.373962203531650;<br /> final double p5 = 0.7003830644436881;<br /> final double p6 = 0.3526249659989109E-1;<br /><br /> final double q0 = 440.4137358247522;<br /> final double q1 = 793.8265125199484;<br /> final double q2 = 637.3336333788311;<br /> final double q3 = 296.5642487796737;<br /> final double q4 = 86.78073220294608;<br /> final double q5 = 16.06417757920695;<br /> final double q6 = 1.755667163182642;<br /> final double q7 = 0.8838834764831844E-1;<br /><br /> final double cutoff = 7.071;<br /> final double root2pi = 2.506628274631001;<br /><br /> zabs = Math.abs(zScore);<br /><br /> // |z| > 37<br /> if (zScore > 37) {<br /> return 1;<br /> }<br /> if (zScore < -37) {<br /> return 0;<br /> }<br /><br /> // |z| <= 37.<br /> expntl = Math.exp(-0.5 * zabs * zabs);<br /> pdf = expntl / root2pi;<br /><br /> // |z| < cutoff = 10/sqrt(2).<br /> if (zabs < cutoff) {<br />);<br /> } else {<br /> p = pdf / (zabs + 1.0 / (zabs + 2.0 / (zabs + 3.0 / (zabs + 4.0 / (zabs + 0.65)))));<br /> }<br /><br /> return (zScore < 0 ? p : 1 - p);<br /> }<br />}<br /></div><br /><span style="font-weight: bold;">How to calculate projecting</span><br /><br />In the Android application we are using the following scheme to calculate the projecting:<br /><ul><li>Get percentiles for last measurements (if there is no, use 55)</li><br /><li>If 1 < percentile < 99, calculate projecting using this percentile</li><br /><li>There might be problems when percentile < 1 or percentile > 99, so we calculate measurement using 1 or 99 percentile respectively, and then add/subtract necessary value.</li></ul><br />For example, if baby's weight is 12kg which percentile is great than 99 and measurement for 99 percentile is 10 we calculate the measurement using 99 percentile (e.g. measurement = 15kg) and then add 20% to it (15kg + 20% = 18kg).<br /></div>Erik Experimentation<div>At Macadamian we are very good at managing expectations. While the expectations in the context of this project are very clear from a deliverable stand point, they are not so clear from a project management stand point. </div><div><br /></div><div>Well... they are clear in a way since we do not treat that project any differently than any customer projects but since this project is internal it carries some "attributes" we do not always have the freedom to play with... for example:</div><div><br /></div><div><b>Innovation & Creativity</b></div><div>We are not always sought for our innovations abilities. Sad reality. This is not the case here, let's innovate and be creative!</div><div><br /></div><div><b>Experimentation</b> </div><div>For obvious reasons, a service company continuously works at mitigating risks. In this case we allow ourselves some freedom and expect experimentation to take place.</div><div><br /></div><div><b>Agilefullness</b></div><div! </div><div><br /></div><div>In retrospective, these are common themes in a product company. A product company must innovate and be creative, it is doing so via experimentation and it expects its people to take ownership and highly collaborate. </div><div><br /></div><div>The message from me at this point from a product management stand point is this: get your team engaged in the project give them ownership and empower them to take the right decision. Doing so you might very well be giving them the ingredients required for success. </div><div><br /></div><div>Next week I intend to provide some progression metrics. </div><div><br /></div><div>Stay tuned!</div>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-4836897288938969741.post-63490808638341277612010-04-23T10:22:00.017-04:002010-04-23T12:49:51.100-04:00Creating web-based iPhone applications (Part I)<style type="text/css"><!-- span.default { font-family: Courier New; font-stretch: normal; font-weight: 500; font-style: normal; color: #000000; font-size: 10pt; text-decoration: none; } span.default a { font-family: Courier New; font-stretch: normal; font-weight: 500; font-style: normal; color: #000000; font-size: 10pt; text-decoration: underline; } span.string-face-0003 { color: #8b2252; font-family: Courier New; font-stretch: normal; font-weight: 500; font-style: normal; font-size: 10pt; text-decoration: none; } span.string-face-0003 a { color: #8b2252; font-family: Courier New; font-stretch: normal; font-weight: 500; font-style: normal; font-size: 10pt; text-decoration: underline; } span.variable-name-face-0002 { color: #a0522d; font-family: Courier New; font-stretch: normal; font-weight: 500; font-style: normal; font-size: 10pt; text-decoration: none; } span.variable-name-face-0002 a { color: #a0522d; font-family: Courier New; font-stretch: normal; font-weight: 500; font-style: normal; font-size: 10pt; text-decoration: underline; } span.underline-0001 { font-weight: 700; font-family: Courier New; font-stretch: normal; font-style: normal; color: #000000; text-decoration: underline; font-size: 10pt; } span.underline-0001 a { font-weight: 700; font-family: Courier New; font-stretch: normal; font-style: normal; color: #000000; text-decoration: underline; font-size: 10pt; } span.function-name-face-0000 { color: #0000ff; font-family: Courier New; font-stretch: normal; font-weight: 500; font-style: normal; font-size: 10pt; text-decoration: none; } span.function-name-face-0000 a { color: #0000ff; font-family: Courier New; font-stretch: normal; font-weight: 500; font-style: normal; font-size: 10pt; text-decoration: underline; } --></style><br /><br />First off, this is my first blog post here so I wanted to say 'hi' to everyone. I look forward to working with you all.<div><br /></div><div>This is the first part of what I hope to turn into a three part series about creating web-based iPhone applications. In this part, I'll show how to set up jQTouch and create a very basic webpage that looks and behaves like a native iPhone application.</div><div><br /></div><div>Much of my experience, at least at developing GUI applications, is on the web. While I'd never developed native iPhone applications before starting at Macadamian, I did toy around with creating an iPhone front-end to a web application. It turns out you can go a long way with this approach, and I think it may be useful on this project for mockups.</div><div><br /></div><div>The first software I want to introduce is jQTouch, an extension to the jQuery library which adds CSS and Javascript to make webpages that behave like native iPhone applications. It's pretty fancy. Let's get started.</div><div><br /></div><div>First, download <a href="">jQTouch from here</a> and extract it somewhere a web server can find it. Then, create an "index.html" in that directory, and put this in it:</div><br /><br /><pre><<span class="keyword-face-0004">!DOCTYPE</span> html><br /><<span class="function-name-face-0000">html</span>><br /><<span class="function-name-face-0000">head</span>><br /><<span class="function-name-face-0000">title</span>><span class="underline-0001">jQTouch test page</span></<span class="function-name-face-0000">title</span>><br /><<span class="function-name-face-0000">script</span> <span class="variable-name-face-0002">type</span>=<span class="string-face-0003">"</span><span class="string-face-0003">text/javascript</span><span class="string-face-0003">"</span> <span class="variable-name-face-0002">src</span>=<span class="string-face-0003">"</span><span class="string-face-0003"></span><span class="string-face-0003">"</span>></<span class="function-name-face-0000">script</span>><br /><<span class="function-name-face-0000">script</span> <span class="variable-name-face-0002">type</span>=<span class="string-face-0003">"</span><span class="string-face-0003">text/javascript</span><span class="string-face-0003">"</span>> google.load(<span class="string-face-0003">"</span><span class="string-face-0003">jquery</span><span class="string-face-0003">"</span>, <span class="string-face-0003">"</span><span class="string-face-0003">1.3.2</span><span class="string-face-0003">"</span>); </<span class="function-name-face-0000">script</span>><br /><<span class="function-name-face-0000">script</span> <span class="variable-name-face-0002">src</span>=<span class="string-face-0003">"</span><span class="string-face-0003">jqtouch/jqtouch.min.js</span><span class="string-face-0003">"</span> <span class="variable-name-face-0002">type</span>=<span class="string-face-0003">"</span><span class="string-face-0003">application/x-javascript</span><span class="string-face-0003">"</span> <span class="variable-name-face-0002">charset</span>=<span class="string-face-0003">"</span><span class="string-face-0003">utf-8</span><span class="string-face-0003">"</span>></<span class="function-name-face-0000">script< "jqtouch/jqtouch.min.css";</<span class="function-name-face-0000">style< "themes/apple/theme.min.css";</<span class="function-name-face-0000">style</span>><br /><br /><<span class="function-name-face-0000">script</span> <span class="variable-name-face-0002">type</span>=<span class="string-face-0003">"</span><span class="string-face-0003">text/javascript</span><span class="string-face-0003">"</span>><br />var jQT = new $.jQTouch({<br />icon: 'jqtouch.png',<br />statusBar: 'black-translucent',<br />preloadImages: [<br /> 'themes/apple/img/backButton.png',<br /> 'themes/apple/img/toolButton.png',<br /> 'themes/apple/img/toolbar.png',<br /> 'themes/apple/img/pinstripes.png',<br />]<br />});<br /></<span class="function-name-face-0000">script</span>><br /></<span class="function-name-face-0000">head</span>><br /><br /><<span class="function-name-face-0000">body</span> <span class="variable-name-face-0002">class</span>=<span class="string-face-0003">"</span><span class="string-face-0003">fullscreen</span><span class="string-face-0003">"</span>><br /><<span class="function-name-face-0000">div</span> <span class="variable-name-face-0002">id</span>=<span class="string-face-0003">"</span><span class="string-face-0003">home<">#world</span><span class="string-face-0003">"</span>>Hello</<span class="function-name-face-0000">a</span>><br /></<span class="function-name-face-0000">li</span>><br /></<span class="function-name-face-0000">ul</span>><br /></<span class="function-name-face-0000">div</span>><br /><br /><<span class="function-name-face-0000">div</span> <span class="variable-name-face-0002">id</span>=<span class="string-face-0003">"</span><span class="string-face-0003">world<">#home</span><span class="string-face-0003">"</span>>World</<span class="function-name-face-0000">a</span>><br /></<span class="function-name-face-0000">li</span>><br /></<span class="function-name-face-0000">ul</span>><br /></<span class="function-name-face-0000">div</span>><br /></<span class="function-name-face-0000">body</span>><br /></<span class="function-name-face-0000">html</span>><br /></pre><br />Everything in the head tag is boilerplate that loads jQuery from Google's JSAPI servers, then loads the CSS and Javascript for jQTouch and the "Apple" theme. It also initializes jQTouch and preloads some images so they are displayed immediately.<div><br /></div><div>(Notice the doctype at the top: that's means it's an HTML5 page. That'll become important in the next part. We're living in the future.)</div><div><br /></div><div>The important parts are the top-level div tags in the body. Each one is a screen. When the page is loaded, the first one is displayed. jQTouch adds some magic to handle clicks on links to anchors in the page, so that linking to anchors will change to a screen with that ID. For example, linking to "#foobar" displays the div with<img src="" border="0" alt="" id="BLOGGER_PHOTO_ID_5463359229820887138" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 320px; height: 288px; " /></a><div>It looks a little strange with the black bar at the bottom on a desktop browser (like Chrome here), because it's sized for an iPhone screen. Clicking on the "Hello" will change to another page with a "World" button. Clicking the "World" button returns you to the first page. In Webkit browsers like Safari (or Mobile Safari, like on an iPhone or iPod Touch) it will also have a sliding transition.</div><div><br /></div><div>In Mobile Safari you can also click the "+" in the bottom toolbar to add it to the home screen. In addition to making it easier to get back to later, this gets rid of the Safari chrome.</div><div><a href=""><img src="" border="0" alt="" id="BLOGGER_PHOTO_ID_5463369867336996946" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 194px; height: 320px; " /></a></div><div><br /></div><div>That's the end of Part I. I've just scratched the surface of what jQTouch can do, but I hope it gives you a feel for what it can do. In the next part, I'll show how to make forms to take input from the user, how to application accessible even with no internet connection, and how to store data offline on the device.</div></div>Michael Melanson Cells for Iphone Table ViewLets say you've added a nice new View XIB file, and thrown on a UITableView using the Interface Builder's Library tool.<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href=""><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 128px; height: 200px;" src="" alt="" id="BLOGGER_PHOTO_ID_5461907745783330034" border="0" /></a>And now you want to create a custom cell, how do you go about it? After scouring through several blogs and sites I couldn't quite figure out how to create just a custom cell:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href=""><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 320px; height: 151px;" src="" alt="" id="BLOGGER_PHOTO_ID_5461908254535875330" border="0" /></a>I always ended up adding a new View XIB file, grabbing the UITableViewCell from the Interface Builder Library, dropping it in and getting this:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href=""><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 204px; height: 320px;" src="" alt="" id="BLOGGER_PHOTO_ID_5461908543093025938" border="0" /></a>That's one massive cell and not very useful. So, this is how you really do it and its so simple you'll wonder why you didn't immediately get it yourself.<br />1. Add a new View XIB file, lets call it CustomCell.<br />2. In the Interface Builder in the window titled CustomCell.xib notice that by default a UIView has been added.<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href=""><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 306px; height: 289px;" src="" alt="" id="BLOGGER_PHOTO_ID_5461909153673212786" border="0" /></a>3. Select the UIView that was added by default and hit delete.<br />4. Now grab UITableViewCell from the Library and drop it into the CustomCell.xib window,<br />just like you would in the View Window.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href=""><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 320px; height: 155px;" src="" alt="" id="BLOGGER_PHOTO_ID_5461909415432331874" border="0" /></a>5. Voila! You now have just a UITableViewCell and can customize it as you please.<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href=""><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 320px; height: 151px;" src="" alt="" id="BLOGGER_PHOTO_ID_5461909619752808082" border="0" /></a><br />Jake's blog post about <a href="">SubViews and Table Views</a> and the following reference cover how to implement the code to populate and handle these custom cells:<br /><a href=""></a><a href="">r</a>Ayesha Khan charts in the Windows Phone 7 using Silverlight's graphical API, part 2. <br /><br /: <br /><br /><Canvas><br /><TextBlock name ="tbTitle" Canvas.</TextBlock><br /></Canvas>. <br /><br /: <br /><br />Canvas.SetLeft(tbTitle, 20); <br />Canvas.SetTop(tbTitle, 45); <br /><br /><br />And finally, there are two more properties of the TextBlock element which can affect the position of a Text - Margin and Padding. <br /,. <br /.Emil Karapetian Challenges for Android<span class="Apple-style-span" style="font-family: monospace; font-size: 20px; white-space: pre;"></span><br /><pre>Hello Everyone, here I’ll be blogging about using Google Image<br />Charts in Android phone. Let’s get acquainted with Google Image <br />Charts. The Google Chart API lets you dynamically generate <br />charts with a URL string. You can embed these charts on your <br />WebView or download the image for local or offline use. It<br />returns a PNG image of a chart in response to a URL GET or<br />POST request.There are a lot of types of charts and you can<br />specify its size,colors,labels and other properties. Let’s <br />create a simple chart.<br /><br />1.Decide on a chart type.<br /> Chart type is specified by the "cht" parameter.<br /><br />2.Choose a data format and decide whether your data must be<br /> scaled to fit your chart.<br /> Data is specified using the "chd" parameter<br /><br />3.Specify the chart size.<br /> Chart size is specified using the "chs" parameter.<br /><br />4.Add additional parameters.<br /> You can find some of possible parameters below.<br /><br /> chxr - specifies the range of values that appear on <br /> each axis independently<br /> chds - specifies parameters to scale the numeric<br /> value displayed<br /> chg - specifies solid or dotted grid lines<br /> chco - specifies the colors of a specific series<br /> chf - specifies fill colors and styles for the <br /> chart data are and/or the whole chart<br /> background<br /> chxl - specifies string axis labels on any axis<br /> chm – specfies graphical markers for data points<br /> on a chart<br /><br />5.Build your URL String.<br /> The URL start with?<br /> and is followed by all required and optional parameters.<br /><br />6.Use GET or POST to get image.<br /> URL-s are limited to 2k in length, so if you have<br /> more data you should consider using POST.</pre>Varduhi Subviews and Table Views in the IPhone<div style="text-align: left;">Coming from C# and ASP.Net I've always made UI's easier by taking big complex UI's and breaking them down into manageable, often reusable, chunks. You have some tab on your app that you suddenly want to turn into a dialog? Sure, np: Drag, Drop, Done. You want to add another custom data field editor somewhere? Sure, np: Drag, Drop, Done. Wait, what? you want to have 50 custom data field editors on the same page!? I'll have to go and manually rename the fields for each one to make sure they don't cause conflicts, wow, thats going to be horible to debug... or not: Drag, Drop, Done.</div><div><div><br /></div><div>This pattern has worked very well for me in the past. Yes you spend a bit of extra time up front, but I've found you always get it back when you have to make changes, or do maintence.</div><div><br /></div><div>Enter Xcode. My first week's expirence has shown me that "Drag, Drop, Done" and XCode don't mix. Doesn't mean it's not doable, just takes a bit more more effort, and we can't do it all in one step from the Interface Builder. </div><div><br /></div><div><b>Step 1 - Divide and Conquer</b></div><div>This step is common regardless of what language or platform you're aiming for. Take your UI mockups (you do have mockups, right?) and group the controls. As a general rule of thumb group items to minimize the cost of adding things later. it usually works out as group first by common purpose, then by proximity, but there may be exceptions. Lets suppose we have a dialog that lets the user select a few specific files and perform an action on them. We can group the controls pertaining to a single file, and then drop a control for each instance of files we need to have in our dialog. We could also have grouped the controls by function, all the buttons, all the labels, etc, but that wouldn't have helped us because we'd still need to edit multiple places to add an extra control later or do maintence. </div><div><br /></div><div><a href=""><img src="" border="0" alt="" id="BLOGGER_PHOTO_ID_5460071547958648194" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 400px; height: 82px; " /></a></div><div><b>Step 2 - Create the Xib File and Controller for our custom controller</b></div><div>In the project, add a new file. UI Controller (with Xib). Use the interface builder to make the control look the way we want it. Edit the controller files to give the control specific behavior like we would normally.</div><div><br /></div><div><b>Step 3 - Adding Placeholders for our custom control</b></div><div>In Xcode open the interface (.h file) and implementatio (.m file) for the controller for the window/view that will be holding our custom control. We need to manually add a field to reference our custom control's placeholder.</div><div><br /></div><div><u>.h file</u></div><pre>{<br />//Add our private fields<br />MyCustomControl* customControllController;<br />IBOutlet UIView* CustomControlPlaceHolder;<br />}</pre></div><div><span class="Apple-style-span" style="font-family:'courier new';"></span></div><div><span class="Apple-style-span" style="font-family:'courier new';">//Add public properties</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">@property UIView* CustomControlPlaceHolder;</span></div><div><span class="Apple-style-span" style="font-family:'courier new';"><br /></span></div><div><span class="Apple-style-span" style="font-family:arial;"><u>.m file</u></span></div><div><span class="Apple-style-span" style="font-family:'courier new';">@synthesize CustomControlPlaceHolder;</span></div><div><br /></div><div>Now open the xib file for the window/view that will be holding our custom control in the Interface Builder. From the library window, drag a new View over and adjust size to fit. This blank view is a placeholder that will get replaced at run time with our custom control. Right click on the controller/File's Owner icon and create a link from the placeholder field we created in the controller and the view object we added in the interface builder.</div><div><br /></div><div><a href=""><img src="" border="0" alt="" id="BLOGGER_PHOTO_ID_5460072720975149266" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 400px; height: 268px; " /></a></div><div><br /></div><div><b>Step 4 - Write code to load our custom control at run time</b></div><div>The code to actually load the control can be done in the AppDelegate (if its a top level control) or can be implemented in the parents controller function, AwakeFromNib, to do it when the parent view is being loaded.</div><pre>customControlController = [[MyCustomControl alloc] initWithNibName:"MyCustomControl" bundle:nil]<br />[ParentViewControl.CustomControlPlaceHolder addSubView:customControlController.view];</pre><div>make sure to release the custom control when the app exits to prevent memory leaks</div><div><span class="Apple-style-span" style="font-family:'courier new';">[customControlController release]</span></div><div><br /></div><div>You may be tempted to use autorelease here, but I'd recommend avoiding it. We're creating our view inside an event, and <a href="">events maintain their own autorelease pools</a>. If you autorelease your view, you may encounter weird errors later on. </div><div><br /></div><div><b>Custom Table Views</b></div><div>For tables the process is the same, except that we need more code to handle the table specific parts, and the code for loading the nib files is slightly different. Also instead of dragging a View to our custom control, we'll want to drag a table cell view to our custom control and you should explicitly give it an identifier in the inspector.</div><div>Here are the two function you _must_ implement in order to get basic tables working. The names are specific and cant be changed.</div><pre>//this is where we load our cell's view<br />- (UITableViewCell*) tableView:(UITableView*)tableView cellForRowAtIndexPath:NSIndexPath*) path<br />{<br /> UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@"MyCustomTableCell"];<br /> if (cell == nil)<br /> {<br /> MyCustomTableCellController* newCell = [MyCustomTableCellController alloc];<br /> [[NSBundle mainBundle] loadNibNamed:"MyCustomTableCell" owner:newCell options:nil];<br /> //Figure out how to release this later, can't use autorelease<br /> cell = newCell.customCellPlaceHolder;<br /> }<br /> return cell;<br />}<br /><br />//return the number of rows to display<br />- (NSInteger) tableView:(UITableView*) tableView numberOfRowsInSection:(NSInteger) section<br />{return 42;}<br /><br /></pre><div><br /></div><div>You will probably find you'll want more control. Check out <a href="">UITableViewDataSource Protocol</a> and</div><div><a href="">UITableViewDelegate Protocol</a> for a list of optional functions you can implement to have more control over the table</div><div><br /></div><div><b>Tada</b></div><div><a href=""><img src="" border="0" alt="" id="BLOGGER_PHOTO_ID_5460072831194033138" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 400px; height: 132px; " /></a></div><div>Ok so it's not done, but it works! Yay.</div><div><br /></div><div><b>What's Next?</b></div><div>Next I have to figure out how to load the specific data inside my table cells. I'm thinking I'll look for a function that gets called when a cell is created/dequeued similar to how AwakeFromNib is called when a control is loaded and use that to switch the display to the model indicated by the NSIndexPath... Another thing I have to figure out is how to merge the table with my actual data so that I can do that :)</div><div><br /></div><div><b>Viewing your control at design time</b></div><div>Unfortunetly I haven't found an easy way to "view" our control at design time. If you _need_ this functionality try looking into making a custom Interface Builder Plugin, this is beyond my needs though so I won't be covering this anytime soon.</div><div><br /></div><div><b>References</b></div><div><div><ul><li></li><li></li><li></li><li></li><li></li></ul></div></div>Jake the Iphone in 80 days.. or more..Hello Everyone, I'm Narcis and I'll be blogging about my first iPhone development experience building a Hello World application for the iPhone. You have to start small.<br /><br />When I'm starting to learn a new language or framework what gets me pumped up is to see some UI eye candy, real out-of-the-box stuff. And as you might guess with the iPhone there is a lot of this with the UI controls. My first steps were to drag a button and a textbox from the interface builder and see a message box popped-up with the TexBox's text when the button is pressed.<br /><br />Code. Build. Run. Wide neophyte eyes on the awesome iPhone emulator - Apples really done a good job here. I clicked the textbox control I just made - sweet keyboard and bang! I cannot escape the keyboard. I clicked the return button like a thousand times and got myself thinking.. wow.. I just got started and there's a major Bug.<br /><br />.. or was it? As it turns out ..<br /><br />What you have to do is implement the return button functionality. Which after some thinking it makes sense - this is the first real paradigm shift away from languages like .Net. First you must set the text input traits attribute:<b> Return Key</b> to <i><b>Done </b></i>on the text field in the Inspector (Attributes Tab). When the user taps the Done button, a "<b>did end on exist</b>" event will be generated. At that time you need to tell the text field to give up control so that the keyboard will go away. In order to give up control, you need to add and action method to your controller class.<br /><br />Example:<br /><br /><b> - (IBAction) textFieldDoneEditing:(id)<wbr></wbr>sender<br /> {<br /> [sender resignFirstResponder];<br /> }</b><br /><br />When the emulator appears click the text field, type something, and then tap the Done button and the keyboard disappears. Alright! But what about the numeric keypad? Where is the <i>Done </i>button on that one? Well, crud! Not all keyboard layouts feature a <i>Done </i>button. So what's the solution for that numeric keypads?<br /><br />The answer is probably going to surprise you because of its simplicity. You need to create an invisible button that sits behind everything else and does nothing except tell our text fields to yield first responder status when it detects a touch. It's perfectly alright to call resignFirstResponder on a control that is not the first responder. So you can call it on all your view's text fields without having to check which one is the first Responder(if any).<br /><br />I know this is a but awkward but.. it's that's the way it is. There are probably some other ways to do it (which you are welcome to comment about them) but this how I've seen it on a couple of forums and some books.<br /><br />My next post will be about some slick animations done on iPhone when you change the view.<br /><br />Side note: Add the Date Picker Control - even if you don't do anything with it at first - it's just so damn cool.Narcis charts in the Windows Phone 7 using Silverlight's graphical APIThere:<br /><br /><canvas><polyline stroke="Red" strokethickness="2" points="10,150 30,140 50,160 70,130 90,170 110,120 130,180 150,110 170,190 190,100"></polyline></canvas><br /><br />This markup will create chart’s line at design time so we don’t need to run the application with emulator to see the result.<br /><br />It can be useful in some cases, but we must be able to create charts at run time based on user’s action. In the C# code we can add items to Points collection of the Polyline. We have two options.<br />The first one is good for cases when we know in advance the number of charts to be shown, so we can create as many Polyline elements as needed at design time:<br /><br /><canvas><polyline name="ChartLine" stroke="Red" strokethickness="2"></polyline></canvas><br /><br />But now we must define names (ChartLine in the example) for them they will be used in the C# code, where we can create chart by adding Point objects to Polyline’s Points collection:<br /><br /> ChartLine.Points.Add(new Point(50, 330));<br /> ChartLine.Points.Add(new Point(100, 270));<br /> ChartLine.Points.Add(new Point(150, 200));<br /> ChartLine.Points.Add(new Point(200, 130));<br /> ChartLine.Points.Add(new Point(250, 110));<br /> ChartLine.Points.Add(new Point(300, 40));<br /><br />Next option is to create Polyline element at run time, define points as in the previous example and finally add the Polyline object<br />to the layout container’s Children collection:<br /><br />Polyline ChartLine = new Polyline();<br />ChartLine.Stroke = new SolidColorBrush(Colors.Green);<br />ChartLine.Points.Add(new Point(50, 330));<br />......................<br /> _Canvas.Children.Add(ChartLine);<br /><br /><br /><br />Now a bit of information about line's appearance.<br />In order to draw dashed line we can use StrokeDashArray. It is a collection of Double values that indicate the pattern of dashes and gaps that is used to outline shapes. Here is its usage in XAML and C#:<br /><br /><polyline stroke="Red" strokethickness="1" strokedasharray="5 2" name="ChartLine" points="10,150 30,140 50,160 70,130 "></polyline><br /><br /> DoubleCollection DashArray = new DoubleCollection();<br /> DashArray.Add(5); <br /> DashArray.Add(2);<br /> ChartLine.StrokeDashArray = DashArray;<br /><br /><br /><br /><br /><br />To be continued.Emil Karapetian and IsolatedStorage as a data persistency approach for Windows Phone 7<span style="font-family: arial; font-weight: bold;"></span>So, We don't have a local db support. What we can do to accomplish a workaround for that ?<br />First thing I've thought about was Serialization. We can create our objects, Specify them as Serialized and Save them either in binary format (using BinaryFormatter- to store binary data such images) or XML format (using SoapFormatter).<br />Looking into Windows Phone Application References, you will see that System.Runtime.Serialization is supported. add that and then import into your code class.<br /><ul><li>See that we can't achieve this approach because we don't have:<br /><ol><li>BinaryFormatter and SoapFormatter</li><li>ISerializable interface</li></ol></li></ul>Ok, let's try creating <a href="">POCOS </a>and saving them using IsolatedStorage.<br /><ul><li>add the reference then import System.Runtime.Serialization</li><li>Define the POCO, like this<br /><span style="font-family: courier new;">[<span style="color: #000099;">DataContract</span>]</span><br /><span style="font-family: courier new;">public class MyObject</span><br /><span style="font-family: courier new;">{</span><br /><span style="font-family: courier new;">[<span style="color: #000099;">DataMember</span>]</span><br /><span style="font-family: courier new;">public int P1 {get; set;}</span><br /><br /><span style="font-family: courier new;">[<span style="color: #000099;">DataMember</span>]</span><br /><span style="font-family: courier new;">public MyObject2 O1 {get; set;}</span><br /><span style="font-family: courier new;">...........</span><br /><span style="font-family: courier new;">}</span></li><li>Remember to define MyObject2 as a POCO again</li><li>after defining all your POCOS, create a Serializer class and try to Save data using IsolatedStorageFile and IsolatedStorageFileStream).</li><li>Well, I've created a Test UI and this worked for me, but... again, The Emulator didn't persist the data after reloading it.I'm still not sure what's the reason for that, and seems like WP7 Emulator doesn't have an SD card option like Andriod.</li></ul>The next thing I'm going to try is the creation of a class library for this code and then trying to incorporate it, Or the use of XML and XML Parsing.Alex Phone 7 and Local Database SupportIn this post I want to talk about the experiment and the effort I've done investigating the support of local database on a Window Phone 7.<br /><ul><li>First of all, I thought about using SQL Server Compact, since this was supported in Windows Phone 6.5. But, I didn't find any way to accomplish that.</li><li>Researching the web, I've faced the first frustration: Windows Phone 7 Doesn't support Local databases. Microsoft intends to adopt cloud services approach and push everything towards Windows Azure and SQL Azure !</li><li>Still, I didn't give up and looked and researched if there are any possible approaches.</li><li>One of the things I've found is the use of csharp-sqlite solution developed by noah.hart.<br /></li><li>I've tried using that, but... <span style="font-weight: bold;">The Emulator was not persisting data</span>.I've lost the data after I've started the emulator. The data was persistent only when the emulator was running (we know that we can keep the emulator running, change the code and deploy again and our changes will be reflected to the emulator without restarting it).<br /></li><li>I'm not sure, if this is reflected again to a real Windows Phone 7 device, since I didn't try that in reality.</li><li>I did another try. I've tried to use SQLite. You can find it here:<br /></li><li>After the installation, try the following:<br />Run Visual Studio 2010 Professional<br />View the Server Explorer.Create a new database and name the file.<br /><ol><li>Note: If you run Visual Studio 2010 Express you won't find the Server Explorer there! (Another proof of : "We do not support local db" )<br /></li></ol>Create a new project (windows phone application using Silverlight)<br />click on the references > Add Reference<br />Notice that in the .Net tab <span style="font-weight: bold;">you don't have any reference to System.Data </span>(again ?)<br />Browse tab > Navigate to SQLite.Net and add System.Data.SQLite.dll from the bin folder<br />Check that the new reference is added.<br />Now let's try to write some code in MainPage.xaml.cs.<br />import both System.Data and System.Data.SQLite.<br />now try using SQLiteConnection object.. WOW... It's there... I'm not getting errors.<br />Now Build... and you will get this:<br /><ol><li>Error 1 The type 'System.Data.Common.DbConnection' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. </li><li>some resources assumed that adding the reference in the CompactFramework folder will fix this. Tried that, but it's still the same.</li><li>I've also added the references from GAC (Global Assembly Cache).. Still the same ! :(</li><li>Tried the same SQLite reference with a Windows Form Application. Worked !</li></ol><span style="font-weight: bold;">Conclusion:</span> I think for now, SQLite is not supported for Windows Phone Applications development.</li><li>Next thing came to my mind is Serialization, POCOS, IsolatedStorage. Those were mentioned as an alternative approach for local data persistence on WP7. I'll talk about them in the next post.<br /><br /><br /><br /><br /><br /></li></ul>Alex Phone 7 Developement-Installation and Setup ProblemsIn this section I want to talk about the difficulties I passed through when I started Windows Phone 7 Development.<br /><ul><li>First, I needed to install Phone development tools as stated on the development site.<br /></li><li>The tools are located at:<br /></li><li>I faced the first surprise: Those tools are working and running on only Windows 7 Operating System. No Support for XP.My PC's OS was Windows XP.</li><li>I Decided to create a virtual machine for this purpose. Second note: You Need VM Ware 7. older versions don't support Windows 7.</li><li>After preparing my VM, I was able to download and install the Developer tools, which included Microsoft Visual Studio 2010 Express (for phone development) + an Emulator.</li><li>Creating and working with Visual Studio was fine, but...The Emulator refused to work in any way ! It starts loading but hanging after a while and giving an error such: "can't establish a connection" and when you turn it off, you see an error in Visual Studio stating that: "Deployment error on line 0" !</li><li>At first, I've thought that could be a memory problem, so I've added a new RAM to my pc. but nothing has changed.</li><li>Then moved to install VM Tools and Visual Studio 2010 full Professional Edition. again, with no hope.</li><li>I've done a research about this.And, as stated by some people and developers: "The Emulator is not supported on a VM" or "The Emulator is implemented like a VM, so it would be a VM inside a VM and won't work".</li><li>I've done my last try.I Installed Windows 7 Locally on my PC. But, the Installation didn't complete.My PC was refusing to accept Windows 7, It was a hardware compatibility problem!.</li><li>Then I Moved the VM to another PC, and here I faced a surprise ! The Emulator was working without any changes. So, the things which were said about the Emulator and The VM working together are not absolutely right !</li><li>My final advice: Be sure that your MotherBoard, Processor , and Display card are compatible with Windows 7. In that Case your emulator should work locally and on a VM.<br /></li></ul>Alex: Graph drawing?My favorite playthings are drawing on screen and optimizations. So I was the one who did the graph drawing research for the iPhone project.There are several graphing components on the internet available, but all are more generalized than we need.<br />We don't have GraphKit available on the iPhone, so I think it is the best to work with our own component. It took two days to write the code for it, it's easily used, and it has all the features we need.<br />As far as I know, there is no curve drawing trough arbitrary points on the iPhone, so one must write his own algorithm for this.<br /><br />Calculating all points for the curve isn't a good idea, because it consumes lots of processor power, so I've chosen to create segments of lines - more segments, the curve is smoother.<br />Ok, segments, but how to get new point on the curve to draw these segments?<br />And here comes the math part - Lagrange Polynomial (you will love this):<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href=""><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 287px; height: 122px;" src="" alt="" id="BLOGGER_PHOTO_ID_5459915709147592338" border="0" /></a>where N is the number of points we already have.<br />It's not the best interpolation (best would be natural cubic spline) - we have the start and end points fixed, otherwise the curve ends would fly off fast from the screen with this formula<br /><br />The drawing itself is based on Quartz2D. If you have the right math formula, the rest is easy. Rock on!Bela: Core Data or SQLite3?I've been studying SQLite access from Objective C in one of these days. As you may know already, there are two native ways to access SQLite database.<br />Let's see their advantages and drawbacks:<br /><ol><li>SQLite native commands</li> <ul><li>ANSI C functions to direct<b> </b>access the database</li><li>dev should write it's own data access module and DAOs</li><li>SQL scripts can be ported from the Android project</li><li>queries can be hand optimized</li><li>have to learn the nitpicks too (for example there may be query timeouts, in this case the request should be resent), mid learning difficulty</li><li>reinvent the wheel by reimplementing Model and DAOs<br /></li><li>available on all iPhone OS versions</li><li>there are 3rd party frameworks available, but they're overkill for a small application<br /></li></ul><li>Core Data framework, provided by Apple</li> <ul><li>native Obj C objects, but without direct access to the database<b>, </b>instead it has graphic data designer and it's pretty well optimized<br /></li></ul><ul><li>has high level managed objects, you can work directly with them when using your data</li><li>whole database has to be recreated from a scratch<br /></li><li>fast for small applications, small queries</li><li>easy to learn</li><li>available in iPhone OS 3.0 and above<br /></li></ul></ol>The access modes cannot be mixed.<br /><br />We have chosen Core Data for our application, because it's all we need, it has steep learning curve.<br />Which would you choose for your application?Bela Phone 7 OverviewSo here we go, Windows Phone 7 and all the appealing environment that comes with it - Windows 7, Visual Studio 2010, .NET Framework 4, Silverlight 4, Expression Blend 4, and what not! Don't think that this is optional and I chose all those, it's just the prerequisites for a Windows Phone 7. I love it.<br /><br />The <a href=""><span style="text-decoration: underline;">Windows Phone Developers</span></a> can be a good start point for you. Actually, what you have to do for quick development start up is just download the developer tools from Microsoft <a href="">here</a> and kick it off! This is a little 3MB download file which then brings up over a 200MB of download. Initially I didn't know what this kit includes in all, so I installed Visual Studio 2010 RC, knowing it is required for WP7. But afterward it turned out that the kit brings Visual Studio 2010 Express with it. So now I have two VS2010-s on my machine (conscience won't let me remove either of them).<br /><br />Now we're all set up to play with Windows Phone 7. What you need to know is that there are lots of fundamental changes compared to previous versions of Windows Mobiles - no local database support, limitations regarding controls (no TabControl for example), only 2 technologies can be used, either Slverlight or XNA (depending on what you're targeting), only C# is supported as a programming language.<br /><br />So we may say that Windows Phone 7 is a completely new world and a great exposure on behalf of Microsoft.<br />Whoever disagrees is invited for a nice chess game and a discussion around the board ;) (kidding)Ani*Something* .... has gone wrong.... somewhere...<div>2010-04-12 Day 5</div><div><br /></div><div>As of last week it seemed that I really had the core concepts down so I decided to take my hello world project and minimize it to the smallest working size possible so I could repeat what I'd learned in a non-hello world project. Unfortunetly at some point *something* changed. I know the source code and header files are not modified because I didn't modify them, but the xib and other project files... I'm not sure. Before on friday afternoon the touch handler was working consistently, now the touch handler is failing consistently just like it was before I restarted from scratch the first time. Even deleting the elements, readding and rebinding them does not fix the error. Once the error is there, it stays there.</div><div><br /></div><div>I recreated my hello world project from scratch -again- and this time took a snapshot of the files while it was working to compare with the broken project. The broken project xib's files seem to be missing some references inside common nodes, also the broken file has multiple copies of the objects. I'm not sure how it happened but I think the Interface Builder got confused somehow while I was using it. Note to self, copy working files often when using Interface Builder.</div><div><br /></div><div>I've also made another change today, instead of loading the project off the local drive on the mac, I've set up a symbolic link to a network share on my actual computer. This means that I'm no longer forced to try and figure out how to do ridiculously common tasks like comparing two files with <del>stupidly unfriendly</del> new and different mac tools. In order to make this work I had to change the default build directory to a local folder. Right Click on the project in XCode -> getInfo. "Place build products in > Custom Location" (pick any local folder).</div><div><br /></div><div>-Update- </div><div>Just in case anyone is curious, the problems with interface builder happened<i><u> before</u></i> I switched to using network shares.</div>Jake to get the hang of it<div>2010-04-09 - Day 4</div><div>Things which seem odd to me right now:</div><div>IBOutlet UILabel label;</div><div><br /></div><div>UILabel is the class, label is the name. IBOutlet feels like an attribute but it's just chilling out there all by itself with nothing special to make it stand out or assist in parsing. What does it <u><i>really</i></u> do? If this is valid syntax then there must be other things that can go in front of class names too, can multiple things be applied to a member at once?</div><div><br /></div><div><b>New Project Files Summary</b></div><div><br /></div><div>Main.m - this is where the "main" function is. It sets up the AutoRelease pool and loads the main window. To figure out which nib/xib to load it looks to the applications property list, presumably using reflection. </div><div><br /></div><div>HelloWorld-Info.plist - this is a property list. You can set various attributes like company name here, version, icon, and Main window file</div><div><br /></div><div>MainWindow.xib - This file is loaded in the "main" function. It contains information on things like which class to use as the app delegate, and other application details which are not general high level properties. </div><div><br /></div><div>HelloWorldAppDelegate - This is where the main window loads. The "page_load" equivalent function is "didFinishLaunchingWithOptions", this appears to be called when your application is first opened. You can programatically load sub views here and add them to the window if you want to.</div><div><br /></div><div>HelloWorldController (with Xib) - This is a controller/View combo. XCode links the files together so you don't have to. This is a 1-1 relationship similar to a asp Web Page, or Win Forms control where you have a view containing buttons, labels, etc, and a codebehind file where you handle touch events, do other things you need to do in response to events.</div><div><br /></div><div>SomeOtherController (not with Xib) - you can create other controllers and other views, you are not forced to have a 1-1 relationship.</div><div><br /></div><div>HelloWorld_Prefix.pch - this is a precompiled header file. It's created when you build and you can more or less just ignore it.</div><div><br /></div><div>NOTE ON INTERFACE BUILDER: You will not be prompted to save files when building. Save them manually when you make a change... It will save you from scratching your head later wondering why your new events aren't firing the way you expect.</div>Jake, Hello World<div>2010-04-08 Day 3</div><div>For the last day or so I've been stuck on seemingly random errors every time I try to bind an event handler to a method in my controller. Finally today I decided I must have done something wrong at stage one since nothing I'm doing seems to have any effect on the weird errors. So I scrapped my current project and started fresh. I now have a hello world program working in just under an hour! woot. </div><div><br /></div><div>I Wish had decided to restart from scratch a while ago. Having a working hello world program is a very minor accomplishment, but it feels really good. Just when I was starting to worry objective C would get the best of me, I get a nice small victory to end my Friday with. Now that I have a working button I want to minimize my code, clean it up, and compare it with the project that was giving me all those errors.</div><div><br /></div><div>I did track down one error I was getting for a while. There was a typo in one of the tutorials I was reading that had addSubView instead of addSubview. Again, really missing intellisense.</div>Jake