Wednesday, January 07, 2009
 VB Code
Minimize


        ''' -----------------------------------------------------------------------------
        ''' 
        ''' CheckVersion determines whether the App is synchronized with the DB
        ''' 
        ''' 
        ''' 
        ''' 
        '''     [cnurse]    2/17/2005   created
        ''' 
        ''' -----------------------------------------------------------------------------
        Private Sub CheckVersion()
            Dim Server As HttpServerUtility = HttpContext.Current.Server
            Dim Request As HttpRequest = HttpContext.Current.Request
            Dim Response As HttpResponse = HttpContext.Current.Response

            Dim AutoUpgrade As Boolean
            If Config.GetSetting("AutoUpgrade") Is Nothing Then
                AutoUpgrade = True
            Else
                AutoUpgrade = Boolean.Parse(Config.GetSetting("AutoUpgrade"))
            End If

            Dim UseWizard As Boolean
            If Config.GetSetting("UseInstallWizard") Is Nothing Then
                UseWizard = True
            Else
                UseWizard = Boolean.Parse(Config.GetSetting("UseInstallWizard"))
            End If

            'Determine the Upgrade status and redirect to Install.aspx
            Select Case GetUpgradeStatus()
                Case Globals.UpgradeStatus.Install
                    If AutoUpgrade Then
                        If UseWizard Then
                            Response.Redirect("~/Install/InstallWizard.aspx")
                        Else
                            Response.Redirect("~/Install/Install.aspx?mode=install")
                        End If
                    Else
                        CreateUnderConstructionPage()
                        Response.Redirect("~/Install/UnderConstruction.htm")
                    End If
                Case Globals.UpgradeStatus.Upgrade
                    If AutoUpgrade Then
                        Response.Redirect("~/Install/Install.aspx?mode=upgrade")
                    Else
                        CreateUnderConstructionPage()
                        Response.Redirect("~/Install/UnderConstruction.htm")
                    End If
                Case Globals.UpgradeStatus.Error
                    CreateUnderConstructionPage()
                    Response.Redirect("~/Install/UnderConstruction.htm")
            End Select
        End Sub

 

 C# Code
Minimize

/* 
extracted from "Introducing Generics in the CLR"  
(http://msdn.microsoft.com/msdnmag/issues/03/09/NET/) 
*/ 
 
using System; 
 
// Definition of a node type for creating a linked list 
class Node { 
   Object  m_data; 
   Node    m_next; 
 
   public Node(Object data, Node next) { 
      m_data = data; 
      m_next = next; 
   } 
 
   // Access the data for the node 
   public Object Data { 
      get { return m_data; }  
   } 
 
   // Access the next node 
   public Node Next { 
      get { return m_next; }  
   } 
 
   // Get a string representation of the node 
   public override String ToString() { 
      return m_data.ToString(); 
   }             
} 
 
// Code that uses the node type 
class App { 
   public static void Main() { 
 
      // Create a linked list of integers 
      Node head = new Node(5, null); 
      head = new Node(10, head); 
      head = new Node(15, head); 
 
      // Sum-up integers by traversing linked list 
      Int32 sum = 0; 
      for (Node current = head; current != null; 
         current = current.Next) { 
         sum += (Int32) current.Data; 
      }       
 
      // Output sum 
      Console.WriteLine("Sum of nodes = {0}", sum);       
   } 
} 

 Javascript Code
Minimize

//this script enables any element on the page to have a toolbar associated.
//the RegisterToolBar method is used on the server-side to do the association.

function __dnn_toolbarHandler(sToolBarId, sCtlId, sNsPrefix, fHandler, sEvt, sHideEvt)
{
	var sStatus = dnn.dom.scriptStatus('dnn.controls.dnntoolbar.js');
	if (sStatus == 'complete')
	{
		var oTB = new dnn.controls.DNNToolBar(sCtlId);
		dnn.controls.controls[sToolBarId] = oTB;
		var oCtl = $(sCtlId);
		oTB.loadDefinition(sToolBarId, sNsPrefix, oCtl, oCtl.parentNode, oCtl, fHandler);
		dnn.dom.addSafeHandler(oCtl, sEvt, oTB, 'show');
		dnn.dom.addSafeHandler(oCtl, sHideEvt, oTB, 'beginHide');
		oTB.show();
	}
	else if (sStatus == '')	//not loaded
		dnn.dom.loadScript(dnn.dom.getScriptPath() + 'dnn.controls.dnntoolbar.js', '', function () {});
}

 

 XHTML || XML
Minimize

<dotnetnuke version="3.0" type="Module">
  <folders>
    <folder>
      <name>Jquery.CodeHighlighter</name>
      <friendlyname>Jquery.CodeHighlighter</friendlyname>
      <foldername>Jquery.CodeHighlighter</foldername>
      <modulename>Jquery.CodeHighlighter</modulename>
      <description>Jquery.CodeHighlighter Highlight VB,C++, C#, CSS, Delphi, Java, JavaScript, LotusScript, MySQL, PHP, and XHTML 
</description>
      <version>01.00.00</version>
      <businesscontrollerclass>
      </businesscontrollerclass>
      <modules>
        <module>
          <friendlyname>Jquery.CodeHighlighter</friendlyname>
          <cachetime>0</cachetime>
          <controls>
            <control>
              <src>DesktopModules/JQuery.Codehighlighter/CodeHighlighter.ascx</src>
              <type>View</type>
            </control>
          </controls>
        </module>
      </modules>
      <files>
        <file>
          <name>Itellu.Modules.JQuery.CodeHighlighter.dll</name>
        </file>
        <file>
          <name>Itellu.Javascript.dll</name>
        </file>
        <file>
          <name>CodeHighlighter.ascx</name>
        </file>
      </files>
    </folder>
  </folders>
</dotnetnuke>
 MySql Code
Minimize

/*  
extracted from "Advanced MySQL user variable techniques"  
(http://www.xaprb.com/blog/2006/12/15/advanced-mysql-user-variable-techniques/) 
*/ 
 
CREATE TABLE fruits ( 
  `type` varchar(10) NOT NULL, 
  variety varchar(20) NOT NULL, 
  price decimal(5,2) NOT NULL default 0, 
  PRIMARY KEY  (`type`,variety) 
) ENGINE=MyISAM DEFAULT CHARSET=latin1; 
 
insert into fruits(`type`, variety, price) values 
('apple',  'gala',       2.79), 
('apple',  'fuji',       0.24), 
('apple',  'limbertwig', 2.87), 
('orange', 'valencia',   3.59), 
('orange', 'navel',      9.36), 
('pear',   'bradford',   6.05), 
('pear',   'bartlett',   2.14), 
('cherry', 'bing',       2.55), 
('cherry', 'chelan',     6.33); 
 
 
set @num := 0, @type := ''; 
 
select `type`, variety, price, @num 
from fruits 
where 2 >= greatest( 
   @num := if(@type = `type`, @num + 1, 1), 
   least(0, length(@type := `type`))); 
 Java Code
Minimize

/* 
extracted from "Reference Objects and Garbage Collection"  
(http://java.sun.com/developer/technicalArticles/ALT/RefObj/index.html) 
*/ 
 
import java.awt.Graphics; 
import java.awt.Image; 
import java.applet.Applet; 
import java.lang.ref.SoftReference; 
 
public class DisplayImage extends Applet { 
 
        SoftReference sr = null; 
 
        public void init() { 
            System.out.println("Initializing"); 
        } 
 
        public void paint(Graphics g) { 
            Image im = ( 
              sr == null) ? null : (Image)( 
              sr.get()); 
            if (im == null) { 
                System.out.println( 
                "Fetching image"); 
                im = getImage(getCodeBase(), 
                   "truck1.gif"); 
                sr = new SoftReference(im); 
           } 
           System.out.println("Painting"); 
           g.drawImage(im, 25, 25, this); 
           im = null;   
        /* Clear the strong reference to the image */ 
        } 
 
        public void start() { 
            System.out.println("Starting"); 
        } 
 
        public void stop() { 
            System.out.println("Stopping"); 
        } 
 
} 

 PHP Code
Minimize

##################################################################

// # +-----------------------------------------------------------+
// # | Function for escaping and trimming form data.
// # +-----------------------------------------------------------+

	function dbReady($data) 
	{ 
		if (ini_get('magic_quotes_gpc')) 
		{
			$data = stripslashes($data);
		}
		
		return mysql_real_escape_string(trim($data));
	}

##################################################################
 C++ Code
Minimize

/* 
extracted from "Templates"  
(http://www.cplusplus.com/doc/tutorial/templates.html) 
*/ 
 
// sequence template 
#include  
using namespace std; 
 
template  
class mysequence { 
    T memblock [N]; 
  public: 
    void setmember (int x, T value); 
    T getmember (int x); 
}; 
 
template  
void mysequence::setmember (int x, T value) { 
  memblock[x]=value; 
} 
 
template  
T mysequence::getmember (int x) { 
  return memblock[x]; 
} 
 
int main () { 
  mysequence  myints; 
  mysequence  myfloats; 
  myints.setmember (0,100); 
  myfloats.setmember (3,3.1416); 
  cout << myints.getmember(0) << '\n'; 
  cout << myfloats.getmember(3) << '\n'; 
  return 0; 
} 
 Lotusscript Code
Minimize

%REM 
extracted from "OLE constants"  
(http://www.mondotondo.com/aercolino/noteslog/?p=18) 
%END REM 
 
'Install tlbinf32.dll:  
  
Option Public  
Option Declare  
  
Use "RegistryAccess"  
  
Sub Initialize  
%INCLUDE "error_handling"  
  
    Dim tli As Variant  
    On Error Resume Next  
    Set tli = CreateObject( "TLI.TLIApplication" )  
    On Error Goto HandleError  
    If Err = 0 Then  
        Set tli = Nothing  
        Exit Sub  
    End If  
  
    Dim instalar As String  
    instalar = "tlbinf32.dll"  
  
    Dim s As New NotesSession  
    Dim db As NotesDatabase  
    Set db = s.CurrentDatabase  
  
    Dim d As notesdocument  
    Set d = GetHelpAboutDocument( db, instalar )  
    If d Is Nothing Then  
        Msgbox "The library " & instalar & " has not been installed" & Chr( 10 ) _  
        & "The library could not be found in the database" & Chr( 10 ) _  
        & "Please notify your admin"  
        Exit Sub  
    End If  
  
    Dim systemRoot As String  
    systemRoot = RegQueryValue( "HKEY_LOCAL_MACHINE", "SOFTWAREMicrosoftWindows NTCurrentVersion", "SystemRoot" )  
  
    Dim path As String  
    path = systemRoot & "system32" & instalar  
  
    Call ExtractAttachment( d, instalar, path )  
    If Dir( path ) = "" Then  
        Msgbox "The library " & instalar & " has not been installed" & Chr( 10 ) _  
        & "The library could not be put in the folder " & path & Chr( 10 ) _  
        & "Please notify your admin"  
        Exit Sub  
    End If  
  
    If Shell( "regsvr32 /s " & instalar ) <> 33 Then  
        Msgbox "The library " & instalar & " has not been installed" & Chr( 10 ) _  
        & "The library could not be registered" & Chr( 10 ) _  
        & "Please notify your admin"  
        Exit Sub  
    End If  
  
    Msgbox "The library " & instalar & " has been installed"  
  
    ' HKEY_CLASSES_ROOTCLSID{8B217746-717D-11CE-AB5B-D41203C10000}InprocServer32  
  
End Sub  
  
Function GetHelpAboutDocument( db As NotesDatabase, filename As String ) As NotesDocument  
%INCLUDE "error_handling"  
  
    Dim nc As NotesNoteCollection  
    Set nc = db.CreateNoteCollection( False )  
    nc.SelectHelpAbout = True  
    Call nc.BuildCollection  
    Dim nid As String  
    nid = nc.GetFirstNoteId  
  
    If nid <> "" Then  
        Set GetHelpAboutDocument = db.GetDocumentByID( nid )  
    Else  
        Set GetHelpAboutDocument = Nothing  
    End If  
End Function  
  

 

Welcome to dnn modules zcenter!

 

Copyright 2007 by My Website