Wednesday, March 19, 2014

Logging Tools Log4Net vs ELMAH

Both needs configuration files.

Log4Net

  • Simple general purpose logging tool.
  • Easy to integrate.
  • Creates text file.
  • Log levels: DEBUG, INFO, WARN, ERROR, FATAL.

Pros
  1. Highly configurable logging framework.
  2. Best used by calling explicitly through code.
  3. Can implement exception handling with handlers.
  4. Output: file, console, email.
  5. Thread-safe.
  6. Will not throw unexpected exceptions at run-time potentially causing application to crash.
Cons
  1. Not reliable.

ELMAH (Error Logging Modules And Handlers)

  • Logging and notification of unhandled exceptions.
  • Since it handles all unhandled exceptions, log level is always ERROR.
  • Ability to display a  list of errors and the details of a specific error from a web page.
  • View exceptions via different mechanisms (SQL, RSS, Twitter, files, email etc).
  • Customize filtering logic.
  • Custom HandleError with ELMAH Attribute in ASP.NET MVC

Pros
  1. Good for reporting overall errors and unhandled exceptions.
  2. No change in application code for implementing ELMAH.
  3. Few configuration change.
  4. Good solution for YSOD (Yellow Screen Of Death).

Cons
  1. Can go complex.
  2. Only used for exception messages.


Log4Net - ELMAH - Appender
  • Communicate with ELMAH library on behalf of Log4Net.
  • Adds the ability to make Log4Net entries routed to ELMAH

Thursday, March 13, 2014

Remove first character from string C#

Use substring() method.

string str = "/a.txt";
str = str.substring(1);


Output

a.txt
When passing multiple parameters as query string, the redirection will work properly in Internet Explorer. This is because the special character '&' is escaped automatically.

But in Mozilla, Chrome it will not work.
www.example.com/controller/action?a=1&b=2

In order to work we need to escape the ampersand special character using Razor syntax @Html.Raw(string).

www.example.com/controller/action?a=1&b=2


Is it rediculous? May be or not. Might be for more security.

Any way this error is showing in iOS 7.1. When we see this in first time we will get confused.

Install error
Error

The above alert is coming while installing applications in iOS 7.1.


Analysis

From iOS 7.1 Apple is enabled additional security feature, that the enterprise apps manifest file (.plist) to be served with HTTPS. Only the .plist file needs to be in HTTPS format.

Solution


Since the URL for the plist file must be in HTTPS format you need to obtain a valid SSL certificate.
In IIS we can create self-signed certificate which will not work for creating plist url.

If you are not having any valid SSL certificate in your server, you can upload plist file in dropbox and create a https format url for plist in order to work in iOS7.1.

In dropbox the link created will be

https://www.dropbox.com/s/glwllqmnwutl2rm/test.plist

Change www.dropbox.com to dl.dropboxusercontent.com, and add to the url.So it will become

https://www.dl.dropboxusercontent.com/s/glwllqmnwutl2rm/test.plist

Add this HTTPS format to the OTA (Over The Air) link, it becomes:

itms-services://?action=download-manifest&url=https://www.dl.dropboxusercontent.com/s/glwllqmnwutl2rm/test.plist










Saturday, March 1, 2014

For checking which .NET Framework is installed in your PC, follow the below steps

Steps:
  1. Click on Start.
  2. Type regedit in  Search and files area.
  3. You will see Registry Editor popup window.
  4. Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework.
You will see different version which are already installed.
Check the latest version installed in your PC. :)



Tuesday, February 25, 2014

Cross platform mobile development tools

Pros
  • Code reusable.
  • Easily accessible to plugins.
  • Easy for web developers.(HTML5, CSS3)
  • Reduce development cost.
  • Support for enterprise and cloud services.
  • Easy Deployment.

Cons

  • Might not support every features of OS or device.
  • Can’t Always Use Your Own Tools: Most frameworks want users to use their own development tools and suites, and that can mean that a developer has to forgo his or her own IDE preferences and use something else. PhoneGap (which Adobe acquired last summer) is different in this regard; in that it uses the native IDE for each platform it supports (XCode for iOS, Eclipse for Android, Visual Studio for Windows Phone).
  •  High end graphics and 3D support is often limited.
  • Vendor lock-in : Most of the cross-platform frameworks build using their own subsets of JavaScript, which means that if you want to switch to another platform, that code you wrote before is likely not going to be reusable without a lot of work.
Rhodes:
  • Open source Ruby based framework.
  • Achieves cross-platform by providing a runtime environment wrapped around the native app.
  • The runtime VM is ported to different platforms, abstracts the communication between device and app.
  • MVC development pattern. Only framework that supports MVC.
  • IPhone, Android, RIM, Windows Phone 7 windows mobile (4 platforms)
  • Object relational mapper component(Rhom)
    • Mini ORM(object relational mapper).
    • High level way to create local database easier to program to.
    • Database is SQLite on all platforms except BlackBerry where it is HSQLDB.
      Supports two model types: Property bag/ Fixed Schema.
    • Property Bag:  all data stored in single table using object-attribute-value pair( Entity-Attribute-Value model).
    • Fixed Schema: each model will have separate table and each attribute exists as a column in the table.
    • UI – HTML, JavaScript, CSS, JavaScript UI frameworks.



  
           installs all Rho products, and provides an IDE for Rhodes and RhoConnect development.

  •  Eclipse installation for developing Rhodes Application.
  • Installs Rhodes development suite; Rhodes, RhoConnect.
  • Generate Rhodes application(s).
  • Generate Rhodes Model(s) and associated Controllers and View templates.
  • Generate RhoConnect applications.
  • Generate RhoConnect source adapters.
  • Manage build configuration (build.yml and rhobuild.yml) using the RhoStudio/Eclipse UI.
  • Build, run, and debug your application in the RhoSimulator.
  • Build and run your Rhodes application on iPhone, Android, Windows Mobile, and BlackBerry simulators and devices.
  • See the build and application execution logs in the Eclipse output console.
 

  • Synchronization Framework.
  • REST API.
  • Administration web console.
  • Asynchronous Job System.
 a synchronization framework consisting of a backend application (a client component on the mobile device) and a server component (a RhoConnect application) that runs on any server capable of running Ruby.   
  • RhoConnect requires that you write a small amount of code for the query, create, update and delete operations of your particular enterprise backend. You can write this code in Ruby as a RhoConnect source adapter, or you can write this code as a RhoConnect plugin application written in Java, .NET, or Ruby on Rails. 



  • Build online without installing iPhone sdk locally.
  • Can build complex codes from windows machine for iphone.
  • Rhohub cloud platform lets developers to work on both Mac and windows for all mobile platforms.
  • Option to convert app to any mobile platform, online.
              RhoGallery?



  • Handles all the work of connecting to enterprise back-end applications.
  • The alternative that is done with most iPhone Objective C or other framework-based apps is to do all the code to connect to backend applications yourself: connecting to the backend web service in SOAP or REST, retrieving the data as XML or JSON, parsing the data and populating and managing the local device database. Objective C developers tell us that they spend more than 50% of their app code on these tasks. RhoSync removes all of this effort.

Reference

http://www.rhomobile.com/blog/modern-app-development-goodness-for-native-apps-what-rhodes-offers-that-no-other-framework-or-underlying-sdk-does/





Phonegap

  • Developed by Nitobi now acquired by Adobe.
  • Standards-based, open-source development framework for building cross-platform mobile apps with HTML, CSS and JavaScript for iPhone/iPad, Google Android, Palm, Symbian, BlackBerry, Windows Mobile and more.
  • Supports 7 mobile OS – Apple iOS, Android, WebOS, BlackBerry, Windows, Symbian and bada.
  • Development environment. DreamWeaver CS5.5 has built-in PhoneGap framework. IDE like Eclipse and XCode supports PhoneGap.
  • MVC
    - Model = PhoneGap JS API + offline storage/cache
    - Controller = JavaScript
    -  View = HTML + CSS
  •  HTML for layout ( Better yet HTML5 ).
  • JavaScript for accessing device functionality.
  • CSS for rich look and feel. ( Better yet CSS3 ).
  • Phonegap apps are just webpages that access device functionality.
  • Rich UI. Supports javascript frameworks.
    • Images are usually loaded from the device, so it's quick.
    • Interaction is quick if you use touch events instead of click events.
  •  Architecture of App
    • Server component.
    •  Javascript calls the server via XHR to get the JSON data.
    • Javascript can stored retrieved data in SQLite database for offline access. Can cache images.
  •  Different from mobile website?
    •  Mobile websites are domain restricted to their origin url and cannot access other sites/APIs.
    •  PhoneGap applications are loaded from the file:// protocol so server requests are NOT restricted.
    •  With PhoneGap you can build powerful mashups accessing multiple services.

Limitations

  •  Complex games, intensive graphics. Use OpenGL for that, not PhoneGap.
  •  For slower phones (not iPhone, not Nexus One, not Xperia X10), PhoneGap apps using the latest interactive Google Maps APIs tend to be slow. Static maps OK, though.
 Reference

http://savagelook.com/blog/portfolio/8-things-to-know-about-phonegap
http://geekyfry.com/topics/tech-it/smartphones/phonegap/
http://savagelook.com/blog/portfolio/a-deeper-look-at-appcelerator-and-phonegap
http://www.slideshare.net/inouemak/rhodes-and-phone-gap
http://groups.google.com/group/phonegap/browse_thread/thread/f23fedaa06abd3b8/2c5005410e7da4e0


Appcelerator

  • while using the familiar JavaScript syntax, developers will also have to learn the Titanium API, which is quite different from familiar web frameworks such as jQuery.
  • is sometimes compared to Adobe Air for developing desktop applications.
  • Titanium Studio is a full open standards IDE that is derived from Aptana Studio.
  • Offers cloud based services for packaging, testing and distributing software applications developed on the Titanium platform.
  • Supports HTML,CSS, Javascript on all platforms and PHP, Ruby, Python for desktop platforms.
  • Supports various javascript frameworks.
  • API access to UI components and geolocation, maps, accelerometer.
  • Extensibility through open interfaces, licensing, support for other scripting languages,  media codecs.



jQuery Mobile = Unified UI system for myriad mobile devices. (layout/animation/interactivity)
Phonegap = library to access native hardware APIs.
jQuery Mobile + Phonegap = UI + Native Functionality.
SenchaTouch and JQueryMobile are both javascript mobile UI libraries. Their approaches to development and device support are very different,  but both can be used to construct the UI for mobile apps and should be considered peers.

You could also consider  other such libraries such as YUI3, dojo or even with appropriate licensing - Enyo from Palm/HP.
Phonegap can be used with any of these UI libraries to package the web.
UI for delivery as native apps with full access to phonegap APIs.


Monday, February 24, 2014

HTML Tags - DIV vs TABLE instead of DIV or TABLE

DIV/TABLE are HTML tags which can populate data inside the markup language. Most of us have come across the situation, where we have to choose between DIV and TABLE. Both have there own way of presenting data inside the HTML. Ofcourse TABLE tag gives easier way of displaying data like, showing a weekly/monthly/yearly report with legible heading for each column, any tabular data etc. So is it possible to use DIV instead of TABLE in the above example?, yes it is possible. Its hard for a beginner to go with a DIV, because inorder to make a perfect aligning of DIV, some styling basics (Cascading Style Sheet – CSS )also should be known. 

 Comparison

DIV TABLE
Loads faster. Loads slower.
Quite few tags needed (div). More tags needed (table , tr, td, thead , tfoot ,th).
Make use of Search Engine Optimization (SEO) more powerful. Less powerful.
Reduce size of the page significantly. Page size increases.
Flexible. Inflexible.
Styling issues compromised using CSS. Only partially.

 
DIV and SPAN tags

DIV which creates a division inside html content. Usually used to dynamically populate data, using AJAX calls.SPAN also creates a division. The main difference between these two is that
  • DIV creates a line break after the tag is closed.

Example 1
Example 2

Output

Example 1
Example 2

Inorder to make this in single line. This need to be changed to:


Example 1
Example 2


Output

Example 1 Example 2

  • SPAN will not create any line breaks. Usually SPAN is used for styling text with the help of CSS.

    Example 1
    Example 2
    


    Output

    Example 1Example 2