Archive

Posts Tagged ‘Javascript’

Jetbrains WebStorm IDE

January 3, 2011 Leave a comment

I bought myself a copy of this product over Christmas as I decided to learn Javascript and JQuery. I really, really like this product, esp on the Mac. It has nice completion support in html , javascript and jquery and is really configurable. It is designed for the developer / designer that wants to stay away from the visual tooling and just get into the code. This is how I wish Visual Studio was for the web , without all the funky drag and drop stuff.

I have not used the source control functions yet but will get an instance of git working with it and blog about that next.

I really recommend this product. Great work guys.

Also it is very consistent with PyCarm and Rubymine as I believe they all use the same engine so really easy to switch from platform to platfrom. Thus Thumbs Up again.

 

Blair

 

Telerik RadComboBox and ModalPopupExtender Issues

June 9, 2010 Leave a comment

If you have issues with this combination and the dropdown not being visible you need to increase the ZIndex of the Dropdown.

<telerik:RadComboBox ID="ddlApprovalGroup" runat="server"  ZIndex="10000000"/>

Hope this Helps.

Blair..

Javascript Arrays

May 10, 2010 Leave a comment

So here is how to arrays in Javascript. I have not gone into depth on all the array methods in this post like the last on C Sharp. I am going to check out the functions provided by JQuery in terms of providing foreach and the like.

I do like how arrays in JS are dynamic and you can add elements to the end.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>Examples 2</title>
    <script type="text/javascript">

        function addElementToArray(farray,value){ // Arrays are passed by reference
            farray[farray.length] = value;
        }

        function printLastItem(farray){
            document.writeln(farray[farray.length - 1]);
        }
        var items1 = new Array(10); // Declare array with 10 elements
        var items2 = []; // Create empty array with zero element equal to undefined

        // Add elements to the arrays and then print them to the browser
        for(i = 0; i < 10; i++){
            items1[i] = i;
            items2[i] = i;
        }

        for(j = 0; j < items1.length; j++){
            document.writeln('items1 value at position ' + j + ' is ' + items1[j] + '<br/>');
        }

        for(k = 0; k < items2.length; k++){
            document.writeln('items2 value at position ' + k + ' is ' + items1[k] + '<br/>');
        }

        addElementToArray(items1,'test1');
        printLastItem(items1);
        addElementToArray(items1,'test2');
        printLastItem(items1);
        
    </script>
</head>
<body>

</body>
</html>

Blair…

CSharp Arrays

May 10, 2010 Leave a comment

This follows on from my last post. This code was created as a snippet using the framework posted before and highlights pretty much most of the stuff you can do with arrays in .NET.

I am also going to start comparing Javascript arrays to .NET arrays as I am currently learning / educating myself with Javascript.

using System;
namespace CSharpInDepth
{
	public class ArrayExamples : IRunnable
	{
		public ArrayExamples()
		{
		}
		
		public void RunExamples ()
		{
			Console.WriteLine ("Examples of declaring and using arrays");
			
			int[] values1 = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
			
			Console.WriteLine ("Printing array numbers");
			Array.ForEach (values1, x => Console.WriteLine ("Value: {0}", x));
			
			Console.WriteLine ("Number of dimensions: {0}", values1.Rank);
			Console.WriteLine ("Number of elements: ", values1.Length);
			
			Console.WriteLine ("Reversing array");
			Array.Reverse (values1);
			Console.WriteLine ("Printing array numbers");
			Array.ForEach (values1, x => Console.WriteLine ("Value: {0}", x));
			
			Console.WriteLine ("Sorting the elements");
			Array.Sort (values1);
			Console.WriteLine ("Printing array numbers");
			Array.ForEach (values1, x => Console.WriteLine ("Value: {0}", x));
			
			Console.WriteLine("Number 10 exists in the array is: {0}",Array.Exists<int>(values1, x => x == 10));
			int value = Array.Find<int>(values1, x => x.Equals(10));
			Console.WriteLine("The item found in the array matching the predicate is: {0}", value);
			
			Console.WriteLine("Finding the number 10 in the array");
			int index = Array.BinarySearch(values1,10);
			Console.WriteLine("Found at index position: {0}",index);
			
			int[,] values2 = new[,]{{1,2,3,4,5},{6,7,8,9,10}};
			Console.WriteLine("Values 2 rank is: {0}", values2.Rank);
			Console.WriteLine("Dimension 1: {0}", values2.GetLength(0));
			Console.WriteLine("Dimension 2: {0}", values2.GetLength(1));
			
			int[] values3 = new int[values1.Length - 1]; // Declare array reference for copying
			Array.Copy(values1,values3,values1.Length - 1);
			Console.WriteLine ("Printing new array numbers");
			Array.ForEach (values1, x => Console.WriteLine ("Value: {0}", x));
			
			Console.WriteLine("Clearing the array");
			Array.Clear(values1,0,values1.Length);
			Console.WriteLine("Count of the items in the array after clearing is: {0}", values1.Length);
			Console.WriteLine ("Printing cleared array numbers");
			Array.ForEach (values1, x => Console.WriteLine ("Value: {0}", x));
			
			
		}
	}
}

Blair….

Learning… I mean Embracing Javascript

May 10, 2010 Leave a comment

Well this is a little interesting for me. Well when I first started programming with PHP back in the early 2000’s i really hated Javascript. and since Ajax had not come into play we use to do everything server side where possible. Then came Ajax which I got my first taste in 2007 with ASP.NET Ajax using update panels. Now everyone expects fairly rich UI’s and trying to do them in ASP.NET is really horrible especially when update panels run the whole page request from start to finish.

Also now my feelings towards Javascript are starting to change. I guess not opinions but ignorance is probably better. I have take the plunge and actually decided to learn Javascript. Now we have frameworks like JQuery we can complain about the DOM and the like we should embrace it as the functional programming language that it is.

I am using WebStorm from Jetbrains which has goot code completion so VS 2010 is not the only one out there that can claim this now.

Well the journey will be a long one but why I am doing this since I can hack my way through using UpdatePanels. Well I am a huge fan of ASP.NET MVC and am keen to update my skills so thus the plunge begins.

Blair..

First ASP.NET MVC jQuery Experience

March 30, 2010 Leave a comment

Well here I am with a quick update on my own personal experience while getting ASP.NET MVC playing with jQuery. Well honestly I found it quite hard to start off with as I have no MVC or jQuery experience and I am also no Javascript expert.

What I will say is no I have done it I feels sooo much better than Web Forms as there is not some huge Page Request life cycle I have to remember and make sure I put things in the right places. It also feels much simpler and I can design clean objects and create place .NET classes with out the stupid Visual Studio design tools getting in my way

jQuery is a really nice framework it make selecting a working with elements really easy and I sure after reading a few books and watching videos this will all become much simpler.

Blair…

Categories: Development Tags: , , , , ,

MS CRM 4 Hide or Show Section

February 26, 2010 Leave a comment

Hop this helps someone

function OnCrmPageLoad()   
{   
  //Hide the Second Section in the first Tab   
  ToggleSection( 0 , 1 , "none" /* "inline" */);   
}   
  
// Tabs and Section Collections are zero based   
function ToggleSection( tabIndex , sectionIndex , displayType )   
{   
  var sec = document.getElementById( "tab" + tabIndex );   
  sec.childNodes[0].rows[ sectionIndex ].style.display = displayType;   
}   

Blair…

Categories: Development Tags: , ,