Tuesday 26 February 2013

iPhone Application Table View

Here we are going to see about creating a simple table view with array of string as table contents. As I have already explained about creating a new project and redirecting the application to home screen in previous post, I am jumping directly to table view. In Blackberry and Android app development, we have separate fields like table view and list view / table field and list field. But in IPhone app development, we have only table view which acts as both.

iPhone Application Table View

Read more »
Share:

Windows Developers Maximize your revenue on the Windows Store with Lotaris

Microsoft has decided that Windows developers are not required to use the Microsoft’s commerce engine to support the purchasing options from within their applications. From that aspect, Lotaris has launched a new product for Windows developers call Lotaris in-appCommerce which unlike the default Microsoft commerce engine,

Maximize your revenue on the Windows Store
Read more »
Share:

Sunday 24 February 2013

JSON Input String using JavaScript.

If you are working with Restful API’s and you must need to send a JSON input response via web project, especially for Node projects. This post helps you to create a JSON input string using JavaScript. It's very useful, converting Data objects to JSON data format implemented with $.toJSON Jquery plugin.

JSON Input String using JavaScript.

Read more »
Share:

Wednesday 20 February 2013

AngularJS 1.0.5 flatulent-propulsion and 1.1.3 radioactive-gargle released!



What's new in this round? For starters, from now on you will find both the stable and unstable releases on the Google CDN. We're highly confident about the stability of angular's 1.1.x branch from here, and want to make it easy for developers to start using the new features, many of which are already in use by our own Google-developed apps.

Worth noting, in both 1.0.5 and 1.1.3: $compile now sanitizes values bound to <a href="{{expression}}">  for improved security, and also includes a fix for a memory leak when a template contains empty top level text nodes (see change notes 9532234b and 791804bd).

The unstable branch 1.1.3 radioactive-gargle includes all the bug fixes from 1.0.5 flatulent-propulsion, plus some new features to try out in your code. In particular, in 1.1.3 we've introduced promises on $resource. For docs on features exclusive to 1.1.3, check out the 1.1.3 repository.

For full details in both these releases, see the changelog.

Special white hat thanks to Zach Jones for reporting the security deficiency addressed in this release. We've also created a new contact address, security@angularjs.org, where you can email us to report any potential security issues in AngularJS in the future. We've built AngularJS to be secure by default (and went through a through security review at Google to prove it), so even though the security issue is not a critical one and is better addressed on the server-side, we added an extra layer of sanitization into our data-binding layer so that Angular developers have one less thing to worry about.

Our appreciation to the community contributors responsible for the PRs in these releases: Pete Bacon Darwin, Rosina Bignall, Fredrik Bonander, Trotter Cashion, Jesse Cooke, Ewen Cumming, Partap Davis, Brian Ford, Lucas Galfasó, Maxim Grach, Kury Kruitbosch, Vineet Kumar, Luis Ramón López, Daniel Luz, Sam McCall, metaweta, Will Moore, James Morrin, Mark Nadig, Enrique Paredes, PowerKiKi, Dylan Pyle, radu, Philip Roberts, Per Rovegård, Fred Sauer, Thomas Schultz, Dean Sofer, Cedric Soulas, theotheo.

Links

1.0.5 flatulent-propulsion (stable branch)

Google CDN
Downloads
angular-seed
Complete Changelog

1.1.3 radioactive-gargle (unstable branch)

Google CDN
Downloads
Complete Changelog
Share:

Sunday 3 February 2013

iPhone Application Development

I received lots tutorial requests from my readers that asked to me, how to start iPhone and iOS application development. We are planning to write a iPhone and iOS application development tutorial series for this you need a Mac iOS and Xcode IDE. Just follow these steps and you can create a simple “Hello World” program.

Getting Started with Iphone
Read more »
Share:

Saturday 2 February 2013

Image Upload and Preview Control in ASP.NET Ajax

Image upload and previewing is a very basic requirement usually when we come across user registration page or add and edit an institution, etc. In this post I am providing here the sample which does the same using ASP.NET Ajax.

I had given here just a simple example just to upload and preview the image, I am not going to save the image in the Database or Load from the Database, but of course you can extend this control based on your requirements.

This is how the final screen will look once you complete the code:

image

You will need Ajax Control Toolkit for AsyncFileUpload control, this controls helps to perform the asynchronous operation without page refresh. Best way to get this through NuGet package manager in you project.

Now lets see the ASP.NET Page and the Code Behind for that.

   1: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="UploadImage.aspx.cs" Inherits="UploadImage" %>



   2:  



   3: <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>



   4:  



   5:  



   6: <!DOCTYPE html>



   7:  



   8: <html xmlns="http://www.w3.org/1999/xhtml">



   9: <head runat="server">



  10:     <title></title>



  11:  



  12:     <script language="javascript" type="text/javascript">
   1:  
   2:         function getRandomNumber() {
   3:             var randomnumber = Math.random(10000);
   4:             return randomnumber;
   5:         }
   6:  
   7:         function OnClientAsyncFileUploadComplete(sender, args) {
   8:             var handlerPage = '<%= Page.ResolveClientUrl("~/ImageRequestHandler.ashx")%>';
   9:             var queryString = '?randomno=' + getRandomNumber() + '&action=preview';
  10:             var src = handlerPage + queryString;
  11:             var clientId = '<%=previewImage.ClientID %>';
  12:         document.getElementById(clientId).setAttribute("src", src);
  13:     }
  14:     
</script>



  13:  



  14: </head>



  15: <body>



  16:     <form id="form1" runat="server">



  17:         <ajaxToolkit:ToolkitScriptManager ID="toolKitScriptManager" runat="server">



  18:         </ajaxToolkit:ToolkitScriptManager>



  19:         <div>



  20:             <asp:Panel ID="pFileUpload" runat="server">



  21:                 <label>



  22:                     Image Source:</label>



  23:                 <ajaxToolkit:AsyncFileUpload ID="asyncFileUpload" runat="server" 



  24:                     OnClientUploadComplete="OnClientAsyncFileUploadComplete"



  25:                     OnUploadedComplete="OnAsyncFileUploadComplete" Width="374px" />



  26:                 <br />



  27:                 <asp:Image runat="server" ID="previewImage" Width="150px" BorderStyle="Double" BorderColor="Green" />



  28:             </asp:Panel>



  29:         </div>



  30:     </form>



  31: </body>



  32: </html>




The code above is very simple and self explanatory, still let me quickly give you a walkthrough. In the Script section of this page I am writing an function which gets called by the AsyncFileUpload control once the file upload to server is completed. Basically in Server side we are just saving the image temporarily in Session which is referenced in Handler section which I am going to cover very soon. In the same function we are calling the ImageHandler which gets the image from the session as mentioned above and write the image to response stream. Once the operation is over this function maps the source to the image control in the client side.



While calling the Image Handler sometimes in certain cases the browser caches the response stream due to which we may face the problem in refreshing the images. To overcome this you can see In the same script I have used a function to generate a random number which basically used to get the unique URL to call the ImageHandler and overcome the response caching issue.



I have almost explained the entire functionality still lets look into the ImagePreviewHandler and Code Behind part of the application.





   1: protected void OnAsyncFileUploadComplete(object sender, AsyncFileUploadEventArgs e)



   2: {



   3:     if (asyncFileUpload.FileBytes != null)



   4:     {



   5:         Context.Session.Add("SessionImage", asyncFileUpload.FileBytes);



   6:     }



   7: }








   1: <%@ WebHandler Language="C#" Class="ImageRequestHandler" %>



   2: using System;



   3: using System.Web;



   4:  



   5: public class ImageRequestHandler : IHttpHandler, System.Web.SessionState.IRequiresSessionState



   6: {



   7:     public void ProcessRequest(HttpContext context)



   8:     {



   9:         context.Response.Clear();



  10:  



  11:         if (context.Request.QueryString.Count != 0)



  12:         {



  13:             byte[] imageData = context.Session["SessionImage"] as byte[];



  14:  



  15:             if (imageData != null)



  16:             {



  17:                 context.Response.OutputStream.Write(imageData, 0, imageData.Length);



  18:                 context.Response.ContentType = "image/JPEG";



  19:             }



  20:         }



  21:     }



  22:  



  23:     public bool IsReusable {



  24:         get {



  25:             return false;



  26:         }



  27:     }



  28:  



  29: }






In the first snippet I have given the code behind of the ASP.NET page, which simple saves the image byte array into the Session in the  OnUploadedComplete  event of AsyncFileUpload control. This image byte array is used later in Image Handler to process further.



And finally in the second snippet I am showing the ASP.NET Generic Handler, in ProcessRequest I am fetching the image byte array from the Session and writing the image to the response of the page. A part from implementing IHttpHandler, I am also deriving the System.Web.SessionState.IRequiresSessionState, which provides me the ability to read and write to the session. This is very important in our case since we are using session variable to read the images in the Image Request Handler.



And that all we need. You can download the code from here.



Link: https://docs.google.com/file/d/0BzIjFd_Ps-MSaUhwdzl6NXRQMVE/edit?usp=sharing

Share: