Backup application for Windows Azure

I have written( with Vunvulea Radu and Catalin Gheorghiu)  a backup application for Azure. It is made with MVC + Azure Tables.

It was made initially for a contest, but I intend to work further and progress .

You can play at http://backupapp.cloudapp.net/

The code source is on http://myazurebackup.codeplex.com/ – and you can add also your feedback at http://myazurebackup.codeplex.com/workitem/list/advanced

And , if you are a programmer, you can also improve it – just leave a comment on codeplex!

Thank you,

Programmer Settings – Winmerge

Please click Edit-Options

clip_image001

 

Please left click on "General (outline item)" in "Options (Shell Integration)"

clip_image002

 

Please left click on "Automatically scroll to first difference (check box)" in "Options (General)"

clip_image004

 

Please left click on "Disable Splash Screen (check box)" in "Options (General)"

clip_image005

 

Please left click on "Compare (outline item)" in "Options (General)"

clip_image006

 

Please left click on "Ignore blank lines (check box)" in "Options (Compare)"

clip_image007

 

Please left click on "Ignore case (check box)" in "Options (Compare)"

clip_image008

 

Please left click on "Ignore time differences less than 3 seconds (check box)" in "Options (Compare)"

clip_image009

 

Please left click on "Editor (outline item)" in "Options (Compare)"

clip_image010

 

Please left click on "Archive Support (outline item)" in "Options (Editor)"

clip_image011

 

Please left click on "Shell Integration (outline item)" in "Options (Archive Support)"

clip_image012

 

Please left click on "Add to context menu (check box)" in "Options (Shell Integration)"

clip_image013

 

Please left click on "Include subfolders by default (check box)" in "Options (Shell Integration)"

clip_image014

 

Please left click on "Add Shell menu to context menu (check box)" in "Options (Shell Integration)"

clip_image015

 

Please left click on "Enable advanced menu (check box)" in "Options (Shell Integration)"

clip_image016

 

Please left click on "OK (push button)" in "Options (Shell Integration)"

clip_image017

 

Jquery and multiple Ajax

I have had 2 occasions where I need to know when the ajax call have been finished:
  1. When in the beginning of page I have to load specific items that the user have been seen last time
  2. When the page was full with ajax call  – and there was also a “submit” button that should send the information (saved already ) that the user have finished entering the fields .
So – jquery have 2 methods: ajaxStart and ajaxStop.
Code:
Put 2 divs on the page :
<div id=”divWait” style=”display:none”> Please wait…</div>
<div id=”divOK” style=”display:none”> All data submitted</div>
And put this on javascript:
$(“#divWait”).ajaxStart(function() {
$(“#divWait”).show();
$(“#divOK”).hide();
});
 $(“#divWait”).ajaxStop(function() {
$(“#divWait”).hide();
$(“#divOK”).show();
});

Javascript hell

In 1997-200x days, when I have been programming in VB3-6 , there was a problem named ”DLL Hell”.

I have been hoping that, with the introduction of .NET, we will escaping this – and I have had my request answered( ok, from .NET 2 )

However, a new problem is for WebDevelopers : JavaScript Hell. Why I am telling that ? Simple :

  1. I have an application that works well in IE 8Star – and uses Json.Stringify to post data. Normally, when I was trying with IE7, it does not work – because JSON.Stringify was not allowed …Of course , solution was adding javascript from http://www.json.org/js.html .
  2. Same application use jquery 1.4 + http://knockoutjs.com/ 1.1.2 (to can modify dynamically some textboxes) + other js( a date time formatter,jquery ui and others)- . Now , in IE9 RC , jquery1.4 does  not function – and you have to use jquery1.5.1.rc also.Please tell me how to know what modifications the other js files must have( in particular knockout) .

And the mock idea is not solving the issue. You must test either manually , either with an automated test for browser(like Selenium) and testing explicitely in browser version! And I have  speak only about IE, not Firefox and /or Chrome…

If you are a developer, how many javascript do you use? If more than 2 ,welcome to javascript hell!

Star : Please read the requirements from http://msdn.microsoft.com/en-us/library/cc836459%28v=vs.85%29.aspx :

Note:

Starting with JScript 5.8, by default, the JScript scripting engine supports the language feature set as it existed in version 5.7. This is to maintain compatibility with the earlier versions of the engine. To use the complete language feature set of version 5.8, the Windows Script interface host has to invoke IActiveScriptProperty::SetProperty.

Internet Explorer 8 opts into the JScript 5.8 language features when the document mode for Internet Explorer 8 is “Internet Explorer 8 Standards” mode. For other document modes, Internet Explorer uses the version 5.7 feature set.

JScript 5.8 includes native JavaScript Object Notation (JSON) support and the accessor methods for Document Object Model (DOM) prototypes.

Asp.NET MVC, Jquery and Razor – Cascading dropdown, retrieving partial views, Json send objects, handling errors

There are many blogs and other posts on using jQuery with MVC. You can find individual posts on:

·         How to send objects to an action method via JavaScript.

·         How to retrieve partial views.

·         How to handle errors.

asp.net mvc jquery razor cascading demo

I have written a sample showing how to do all of these together. The sample is written in  MVC 3 using Razor views

The sample demonstrates:

  1. Cascading dropdown ( see the button Populate from action and Cascading drop down)
  2. Populating a table from a Partial View(see the button Add New Employee(jquery call action and render)
  3. How to handle  error from action ( press Save 2 )
  4. How to send id parameters (long) from javascript to action ( press Delete 1 or Delete 2)
  5. How to send objects(Employee) from javascript to action ( press Save 1 or Save 2)

Without further ado, this is the project . Enjoy!

Jquery MVC Razor demo full

PS: If you seems that the code is too hard, here is a more detailed explanation :http://msprogrammer.serviciipeweb.ro/2011/12/05/jquery-ajax-request-and-mvcdetailed/

Programmer Sql Server Management settings

Please left click on “Tools (menu item)” in “Microsoft SQL Server Management Studio”
clip_image001[3]
Please left click on “Tools (menu item)” in “Microsoft SQL Server Management Studio”
clip_image002[3]
Please left click on “Options… (menu item)” in “&Tools”
clip_image003[3]
Please left click on “Prevent saving changes that require table re-creation (check box)” in “Options”
clip_image004[3]
Please left click on “Environment (outline item)” in “Options”
clip_image005[3]
Please left click on “At startup: (combo box)” in “Options”
clip_image006[3]
Please left click on “Open Object Explorer and new query (list item)”
clip_image007[3]
Please left click on “Text Editor (outline item)” in “Options”
clip_image008[3]
Please left click on “Transact-SQL (outline item)” in “Options”
clip_image009[3]
Please left click on “Line numbers (check box)” in “Options”
clip_image010[3]
Please left click on “Query Execution (outline item)” in “Options”
clip_image011[3]
Please left click on “Query Results (outline item)” in “Options”
clip_image012[3]
Please left click on “SQL Server (outline item)” in “Options”
clip_image013[3]
Please left click on “SQL Server (outline item)” in “Options”
clip_image014[3]
Please left click on “Results to Grid (outline item)” in “Options”
clip_image015[3]
Please left click on “Include column headers when copying or saving the results (check box)” in “Options”
clip_image016[3]
Please left click on “Multiserver Results (outline item)” in “Options”
clip_image017[3]
Please left click on “Add server name to the results (row)” in “Options”
clip_image018[3]
Please left click on “Page down (push button)” in “Options”
clip_image019[3]
Please left click on “OK (push button)” in “Options”
clip_image020[3]

MVC Zip Result

Sometimes you need to send to the user more than 1 file – or, maybe, the file is too large
The simplest way is : made a zip file that contains the others.

What do you need
1. SharpzipLib from http://www.icsharpcode.net/opensource/sharpziplib/ ( or download via NuGet in VS)
2. obtain the file(s) that you want as a string or as a byte[] – let’s say you have a byte[] to store in a str variable
3. make in your action something like that:

 var fcr = new ZipResult("Export.xls", str);
            fcr.AddFile("readme.txt","this zip file contains ..");
            return fcr;

4. copy the following code in your asp.net mvc projects:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.IO;
using ICSharpCode.SharpZipLib.Zip;
using System.Text;

namespace utilsResult
{
    public class ZipResult : FileResult
    {

        
        private Dictionary<string, byte[]> content = new Dictionary<string, byte[]>();
        public string FileNameZip;
        public ZipResult(string FileName, byte[] Contents)
            : base("application/octet-stream")
        {
            this.FileDownloadName = Path.GetFileNameWithoutExtension(FileName) + ".zip";
            AddFile(FileName, Contents);
        }
        public void AddFile(string FileName,  byte[] Contents)
        {
            content.Add(FileName, Contents);
        }
        public void AddFile(string FileName,string Contents, Encoding e = null)
        {
            if (e == null)
                e = ASCIIEncoding.ASCII;

            content.Add(FileName, e.GetBytes(Contents));
        }

        protected override void WriteFile(HttpResponseBase response)
        {

            using (ZipOutputStream zos = new ZipOutputStream(response.OutputStream))
            {
                zos.SetLevel(3);
                zos.UseZip64=UseZip64.Off;

                foreach (var item in content)
                {
                    ZipEntry ze = new ZipEntry(item.Key);
                    ze.DateTime = DateTime.Now;                    
                    zos.PutNextEntry(ze);
                    int count=item.Value.Length;
                    zos.Write(item.Value, 0, count);
                   
                    
                }                
            }
        }
    }
}

5. future improvements:
Zip the file(s) in a dll project to made fully testable!

Andrei Ignat weekly software news(mostly .NET)

* indicates required

Please select all the ways you would like to hear from me:

You can unsubscribe at any time by clicking the link in the footer of our emails. For information about our privacy practices, please visit our website.

We use Mailchimp as our marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp's privacy practices here.