Pages

Sunday, February 12, 2012

JSP code samples

// declaring variables , and methods
<%!
int lastProjectID=-1;
public String getStyle(long currentProjectID){
    return "class=alternative";
}
// printing in html

<% out.write( String.format("%s",project.getSubProjectName())); %>//with semicolone

or

<% =String.format("%s",project.getSubProjectName())) %>//without semicolone

Thursday, January 26, 2012

Windows shells

List all env variables

set > C:\env_list.txt

using env variable
echo %windir%


power shell command
Get-ChildItem Env:  
 

Java dev tools and installations

Tomcat Appache installation
  1.  Install Tomcat apache from http://tomcat.apache.org/download-60.cgi
  2. Add Env variables
    1. CATALINA_HOME = C:\apache-tomcat-6.0.35   Mandatory
    2. JAVA_HOME=C:\Program Files (x86)\Java\jdk1.6.0_30
    3. JRE_Home=C:\Program Files (x86)\Java\jre6
    4.  
      add this section 
       
      C:\apache-tomcat-6.0.35\conf\tomcat-users.xml

       

      so you can access manager area



      Running Java class from Jar file 

      java -classpath MyFirstProject.jar clic.det.nsw.samples.sample1.MyFirstClass

      Monday, January 23, 2012

      SharePoint Code

      // SharePoint Object Model

      SPContext ctx = SPContext.Current;
      SPSite site = ctx.Site;
      SPWeb web = site.RootWeb;
      foreach (var list in web.Lists)
          {
              writer.Write(list.Title + "
      ");
          }

       Guid siteId = ctx.Site.ID; //another way  of retrieving web content

       SPSite site = new SPSite(siteId);
       SPWeb web = site.RootWeb;


      Monday, January 16, 2012

      Sharepoint PowerShell commands

      $web=Get-SPWeb http://sharepoint"
      $list=$web.Lists["Candidates"]
      $list.AllowDeletion=$true;
      $list.Update()
      $list.Delete()

      -----
      List members of any object 

      $objects=Get-Process
      $object=Get-Process "process name"
      $object | member





      $subweb=$web.webs["subweb"]

      -----------------
      site manager
      http://sharepoint/_layouts/Sitemanager.aspx

      copy  content from web site to others




      windows updates can delete SharePoint configurations, and all in _layout
      ----------------------

      Edit public URLs in sharepoint
      in Central Administration


      -------------------------------------------




      SharePoint Content Deployment Wizard


      http://spdeploymentwizard.codeplex.com/

      ------------------------------------------------------
      using the client API to query the SharePoint objects

       ClientContext remoteCtx = null;
      remoteCtx = new ClientContext(siteUrl);
      Web remoteWeb = remoteCtx.Web;
      remoteCtx.Load(remoteWeb);

      //
      //always use load the remoteCtx.ExecuteQuery() as batch execute
      // like
      // remoteCtx.Load(remoteWeb.Lists);
      //    remoteCtx.Load(otehr objects);
      ///  remoteCtx.ExecuteQuery()


      remoteCtx.ExecuteQuery();
      Console.WriteLine(" Success!");
      Console.Write("Press any key to exit...");
      Console.ReadLine();

      Monday, January 9, 2012

      Excel formulas

       Parsing dir command
      "14/04/2011  01:31 PM   
                HTML Help Workshop"

      =RIGHT(A8,LEN( A8)-FIND("
      ",A8)-4)

      will produce
      "HTML Help Workshop"