CodeCloudy

Azure | .Net | JQuery | Javascript | Umbraco

Capture Dynamic value change in Elements using on change

 

$(‘#abc2’).on(‘change’, function(){
$(‘#abc1’).val($(this).val())
})

$(‘#abc1’).on(‘change’, function(){
alert(‘1’)
})

var originalVal = $.fn.val;
$.fn.val = function(){
var result =originalVal.apply(this,arguments);
if(arguments.length>0)
$(this).change(); // OR with custom event $(this).trigger(‘value-changed’);
return result;
};

 

http://jsfiddle.net/aw1htjzo/

Advertisements
Leave a comment »

Easiest way to fix the svn icon overlay issue in windows 10

Rub below command Script:

https://gist.github.com/HelderMagalhaes/37ca7bbdba2b693006c46df1d8481705

Leave a comment »

Log Everything in a complex object C#

Download and add reference of this dll > Newtonsoft.Json.dll or Json.NET

use below method to log the entire complex object:

public static string ToJson(object value)
{

var settings = new JsonSerializerSettings
{
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
};

return JsonConvert.SerializeObject(value, Newtonsoft.Json.Formatting.Indented, settings);

}

Leave a comment »

Request.Url

Get Only the Domain with protocol. in simple words base or first part of it.

String strPathAndQuery = HttpContext.Current.Request.Url.PathAndQuery;
String strUrl = HttpContext.Current.Request.Url.AbsoluteUri.Replace(strPathAndQuery, “/”);

Other Tips from Stackoverflow:

Main URL : http://localhost:8080/mysite/page.aspx?p1=1&p2=2

Get different parts of URL in C#.

Value of HttpContext.Current.Request.Url.Host
localhost

Value of HttpContext.Current.Request.Url.Authority
localhost:8080

Value of HttpContext.Current.Request.Url.AbsolutePath
/mysite/page.aspx

Value of HttpContext.Current.Request.ApplicationPath
/mysite

Value of HttpContext.Current.Request.Url.AbsoluteUri
http://localhost:8080/mysite/page.aspx?p1=1&p2=2

Value of HttpContext.Current.Request.RawUrl
/mysite/page.aspx?p1=1&p2=2

Value of HttpContext.Current.Request.Url.PathAndQuery
/mysite/page.aspx?p1=1&p2=2
Leave a comment »

Umbraco admin login doesn’t work after migrating Live to Local

Umbraco admin login doesn’t work after migrating Live to Local

Since, The schema is different, can’t login. simply change it for the user.

 

Leave a comment »

Umbraco Life Savers

Error:

The model item passed into the dictionary is of type ‘Umbraco.Web.Models.PartialViewMacroModel’, but this dictionary requires a model item of type ‘CWSStart.Web.Models.LoginViewModel’.

Solution:

http://stackoverflow.com/questions/28708282/this-dictionary-requires-a-model-item-of-type-umbraco-web-models-partialviewmac

The issue was that another member of my team had created a Banner.cshtml file in /Views/MacroPartials and this Partial View was being loaded instead of my one.

My case:

i had a view with the same name on the AuthSurface folder and in the views folder.

 

Leave a comment »

IIS

Services that make up the IIS 7 Web server include:

Service

Display Name

Description

Executable

Default Startup

AppHostSVC

Application Host Helper Service

Stores configuration history and application pool mapping in history subdirectories at set intervals.

svchost.exe

Automatic

FTPSVC

FTP Publishing Service

Enables IIS 7 Web servers to be File Transfer Protocol (FTP) servers.

svchost.exe

Manual

IISADMIN

IIS Admin Service

For IIS 6.0 metabase configuration compatibility

inetinfo.exe

Automatic

MSFTPSVC

FTP Publishing Service 6

Enables IIS 6 Web servers to be File Transfer Protocol (FTP) servers.

inetinfo.exe

Manual

W3SVC

World Wide Web Publishing Service

Provides Web connectivity and administration through IIS Manager

svchost.exe

Automatic

WAS

Windows Process Activation Service

Provides process activation, resource and health management services for message-activated applications.

svchost.exe

Manual

WMSVC

Web Management Service

Enables remote management of a Web server.

wmsvc.exe

Manual

To troubleshoot and manage services you can use the Services snap-in to the Microsoft Management Console. The MMC Services snap-in has feature for:

  • Monitoring the status of services.
  • Starting, stopping, pausing and resuming, or disabling services.
  • Viewing service properties and dependencies.
  • Setting up recovery actions to deal with service failures.

https://blogs.iis.net/tomwoolums/the-services-behind-internet-information-services-7-0

Leave a comment »

Javascript/JQuery/json/

  1. Get size of json object
 type="text/javascript">

  var myObject = {'name':'Kasun', 'address':'columbo','age': '29'}

  var count = Object.keys(myObject).length;

  console.log(count);

2. Trying to pass in a boolean C# variable to a javascript variable and set it to true

myjavascript( <%= MyBooleanVariableInCSharp.ToString().ToLower() %> );

You may also want to try:

isFollowing: '@(Model.IsFollowing)' === '@true'

and an ever better way is to use:

isFollowing: @Json.Encode(Model.IsFollowing)

	
Leave a comment »

The following exception was thrown: Access to the path denied. Exception details: System.UnauthorizedAccessException: Access to the path

According to File.Delete Method…

An UnauthorizedAccessException means one of 4 things:

  1. The caller does not have the required permission.
  2. The file is an executable file that is in use.
  3. Path is a directory.
  4. Path specified a read-only file.

Other answers:

Try setting the access permissions to “Full control” for the .Net user from where you are reading/saving the files. You need to find out from the application pool for the website what is the identity it is running under (by default this is Application Pool Identity) and grant that the correct permissions.

 

Leave a comment »

Azure Scheduler 102 – Creating a Job

What is a Job Collection?

Simple Definition: Job Collection is a Collection of jobs that runs in a particular region.

A job collection contains a group of jobs, and maintains settings, quotas and throttles that are shared by jobs within the collection. A job collection is created by a subscription owner, and groups jobs together based on usage or application boundaries. It’s constrained to one region. It also allows the enforcement of quotas to constrain the usage of all jobs in that collection; the quotas include MaxJobs and MaxRecurrence.

What is a Job?

Simple Definition: a Task to be completed in a given time.

A job defines a single recurrent action, with simple or complex strategies for execution. Actions may include HTTP requests or storage queue requests.

 

How to create Scheduler Job?


 

Step 1: create a job collection


Note: this will create a standard job collection. If you need to change it to free plan (which allows only 5 jobs maximum) use the Scale configuration tab.

 

Step 2: Now you can choose the action type

  • Invoking a Web Service over HTTP/s

    OR

  • Post a message to a Windows Azure Storage Queue

 

 

 Selecting Action Type:


Invoking a Web Service over HTTP or HTTS will enable to choose http methods.


 

Post a message to a Windows Azure Storage Queue will enable inputs to enter storage and queue access details.


 

You can use existing Azure Resources as well.


 

Step 3: selecting schedule

You can run as a one time job by

  • Running it immediately by selecting “Now”

Or

  • In a specific time


 

OR you can create a recurring job


 

The job status can be monitored via the portal


The queue message will be created in the queue in the specified schedule

Following is a job with a message viewed using storage explorer.


 

Creating a Scheduler may fail!

Creating the scheduler collection may fail if the queue name is not provided properly.

NOTE: “Queue name must be 3-63 characters in length may contain lower-case alphanumeric characters and dashes.”

< Back to Inroduciton

 

Leave a comment »