Thursday, September 6, 2007

ActionScript and Flash

I'm looking to get into ActionScript and Flash. Does anyone know of any useful resources?

Tuesday, June 26, 2007

Animations in JavaScript

Today, professional designers use Flash to create dazzling animations. In the glory days before AJAX was in vogue and when animated gifs were the "cause célèbre" of avant garde Photoshop gurus, we had JavaScript.

There are two methods of interest here: setInterval () and clearInterval().

Presumably, we would need to play the frames of a sequence in a loop. We would call
setInterval() like this:

var Interval = setInterval ("MultiSelect()", 500);


By saving a reference to the current interval, we can pause the animation with clearInterval().

clearInterval (Interval);



Refer your friends to this blog:
http://programmingcentral.blogspot.com

Friday, June 8, 2007

Help Authoring suite

I have looked into help authoring suites for some time. Of course, there is the well known RoboHelp (http://www.adobe.com/products/robohelp/) and the free Win Help tool that comes with Visual Studio.

Are there any suites that provide descent features with a descent price?


Refer your friends to this blog:
http://programingcentral.blogspot.com/

.NET UI Suite

I have been looking for a .NET UI suite for some time. Some people suggested Infragistics. For me, I have found the package from DevExpress to be the best one of all. I am particularly impressed by the printing components. Those of you who struggled with printing in Visual Studio 2003 understand the importance of an easy-to-use printing suite. Although GDI+ is beautiful in theory, it does take some getting use to.

There are some many cool things about this suite. I don't know where to start. Most impressive is their implementation of the Office 2007 interface. Not only is it faithful to the appearance and implementation details of the ribbon, the performance is superb. This product will definitely add years to your peace of mind.

Check it out at http://www.devexpress.com/


Refer your friends to this blog:
http://programmingcentral.blogspot.com/

Tuesday, June 5, 2007

An excellent JavaScript tree

Implementing a JavaScript tree is one of those really vexing challenges. Some implementations limit your ability to nest nodes deep into the tree or are awkward in other ways.

I think this is the best solution I've seen so far.

http://www.destroydrop.com/javascripts/tree/


Refer your friends to this blog:
http://programmingcentral.blogspot.com/

Friday, June 1, 2007

Pass variables by reference in ASP

Ah! Passing variables by reference. One of those interesting nuggets not often adequately explained by textbooks or professors. Obviously, it is possible with VB.NET and VB 6 when the keyword "ByRef" is used to qualify a parameter.

Remember that incoherent explanation regarding "stacks" and "heaps"? Well, neither do I.

I had to figure it out on my own. I imagine it this way. Let's assume we're going to a department store. When we enter, we check in our bags. The kind person at the counter then hands us a ticket number corresponding to the compartment where our bags are placed. The ticket is a "reference" to our bags and the square compartment can be likened to "memory".

If we were to lose our "reference" to our bags, i.e., lose our ticket, the kind person at the counter, overcome by a sense of glee, would keep our bags for himself.

When we return the ticket, the kind person at the counter looks for a compartment that matches the label on the ticket and returns our bags (Hopefully with everything still in it)

In any event, here's my solution:

<%

Dim var1, var2

MyRoutine var1, var2

Response.Write ("Values are : " & var1 & " and " & var2)

%>

<%

Sub MyRoutine(v1, v2)

v1 = "Variable 1"

v2 = "Variable 2"

End Sub

%>


Refer your friends to this blog:
http://programmingcentral.blogspot.com/

Thursday, May 31, 2007

How to prevent right-click with JavaScript

I have searched the web for this solution. I dont' remember where I found it but here is. This code disables right-click through JavaScript. Place it in the "head" section of your web page. The code works with Internet Explorer and Firefox.

<script language="javascript">

var isNS = (navigator.appName == "Netscape") ? 1 : 0;

if(navigator.appName == "Netscape")

document.captureEvents(Event.MOUSEDOWNEvent.MOUSEUP);

function mischandler( )
{ return false; }

function mousehandler(e)

{

var myevent = (isNS) ? e : event;

var eventbutton = (isNS) ? myevent.which : myevent.button;

if((eventbutton==2)(eventbutton==3))
return false;

}

document.oncontextmenu = mischandler;

document.onmousedown = mousehandler;
document.onmouseup = mousehandler;

</script>



Refer your friends to this blog:
http://programmingcentral.blogspot.com/

Prevent browser F5 refresh

Few things are more annoying than needing to prevent your web site's visitors from refreshing a page resulting from a form "post".

This solution works with Internet Explorer. Simply place this code in the "head" section of your page.

<script language=javascript>
document.onkeydown = function(){
if(window.event && window.event.keyCode == 116)
{ // Capture and remap F5
window.event.keyCode = 505;
}
if(window.event && window.event.keyCode == 505)
{ // New action for F5
return false;
// Must return false or the browser will refresh anyway
}
}
</script>
Refer your friends to this blog:
http://programmingcentral.blogspot.com/

Wednesday, May 30, 2007

How to loop through HTML Forms collection and validate control values

I have often wondered how to validate form controls that were dynamically generated from a server-side script. Here's my solution in JavaScript:

for (j=0; j<document.theform.elements.length; j++)
if ( document.theForm.elements[j].type == "text" )
{
//Perform validation when the control's type is text
}

if ( document.theForm.elements[j].type == "checkbox" )
{
//Perform validation when the control's type is checkbox
}

if ( isNaN (document.theForm.elements[j].value) )
{
//Perform validation if the control's value property does not evaluate to a number
}

if ( Number (document.theForm.elements[j].value) < 0 )
{
//Perform validation if the control's value property evaluates to a number less than 0
}
}

Refer your friends to this blog:
http://programmingcentral.blogspot.com/

Tuesday, May 29, 2007

How to become a blog author

Programming Central welcomes contributions from all programmers. If you would like to become an author, leave a comment besides any of our posts.

Refer your friends to this blog:
http://programmingcentral.blogspot.com/

Thursday, May 24, 2007

Printing the contents of a IFrame whose content changes dynamically

One of the problems that vexed me recently was how to print

the contents of an IFrame when the content changes dynamically.


  1. Here is my solution:

    Declare a DIV area in the body of the HTML document with an ID attribute value of
    "IFrameArea".

    Declare a JavaScript function that dynamically assigns an IFrame as the innerHTML
    property of the DIV. Note that the dimensions of the IFrame are small. This
    has the effect of making it invisible.


function PrintIFrame(SRC)

{
var URL;

URL = (SRC).toString();

document.getElementById('IFrameArea').innerHTML = "<iframe src='"

+ URL + "' height='1' width='1' frameborder='0' ID='MyIFrame' name='MyIFrame'>
</iframe>"

}



  1. The document that is loaded in the IFrame should have an “onLoad” event
    handler declared
    1. onLoad="javascript:PrintDocument()"
      delcared in the "Body" tab
  2. The document that is loaded in the IFrame should have a a function to perform
    the printing


function SetupToPrint()

{
parent.frames.PrintCounter.focus();
window.print();
}

Refer your friends to this blog:

http://programmingcentral.blogspot.com/

Tuesday, May 22, 2007

Welcome Everyone

Programming Central is a place for programmers to meet and share their ideas.

Instead of spending hours trying to solve those "difficult" programming problems, stop by and see what your fellow community members think.

We encourage everyone to post questions and answers. Share your hard-earned insights to help make this a thriving community.

All languages and platforms are welcome: .NET, Java, web languages (HTML, JavaScript, VB Script, DHTML, AJAX), and open-source languages.

Welcome to Programming Central!

Refer your friends to this blog:
http://programmingcentral.blogspot.com/