Update the Nintex workflow to multiple lists and libraries in a SharePoint site

Special thanks to Vadim Tabakman.
 It is a special requirement. Nintex workflows are very  helpful in some scenarios to achieve things in simple and easy way. I got a requirement that I have to implement a workflow which needs to be used in many document libraries and list. As we know the SharePoint limitation, we can not apply the workflow for the content type. So, the only way we can do is adding workflow to each and every library needed. This is difficult, but I believe this is the only way we have to proceed. The big problem here is, when we have the requirement to change the workflow according to new changes then the problem starts. We have to change it in each and every library or list where workflow is deployed. This is very difficult in real time. So, we need some other way which we have to do automation. I am googling for the solution and luckily I found a wonderful solution here.

I will explain you very detail what "Vadim Tabakman" solution is.
He has created a document library and custom list which are used to add or update the custom nintex workflow in all libraries and lists.

 Lists Used:
  1. Master List of Workflows [Document library]
  2. Workflow to List Map [Generic List] [Columns: Workflow Name [Title field renamed to Workflow Name], Destination Workflow Name, List Name]
Master List of Workflows: This is the main library which is holding the Nintex workflow files which we have to add to all document libraries [.NWF file]. And according to his solution, he has provided the nwf file which runs and updates the uploaded nwf file to the libraries. So, for removing confusion I will explain you clearly what we need to do.
  1. We have to upload the actual custom NWF file which you have created to the document library. Which is the file we have to add or update all document libraries in the site.
  2. To update all document libraries we need another workflow. So, according to his solution there is a NWF file named "Update Workflows" he written and which does that job for us.
Workflow to List Map: This is the generic custom SharePoint list which holds the records of what workflow to be added to which library or list and what name we have to give for the workflow. SharePoint also has another limitation that the workflow names should not be same across the site. So, we have to use different names for each workflow.
Workflow Name field should be same as, the name you are uploading to the Master List of Workflows.

I believe you understood what we are doing and why the need of two lists.

So, now download the UpdateWorkflows.nwf file from his site and add this to the Master List of Workflows library. And upload the original custom nintex workflow you have developed to the library. Once you are done please add all entries in the Workflow to List Map list. Now, go back to library and select the workflow which one you want to add to all libraries and manually fire the update workflow.

That's it. Once you run it, the update workflow will add the custom nintex workflow to all list and libraries you have mentioned in the Workflow to List Map list.

Note: You have to change the user and password in the update workflows nwf file.

Hope this will be a big help as it helped me alot. So, use it and make your life easy. Read More...

Replace single quote with two quotes in XSLT

I know most of the people will not need it as very rare this requirement comes and because of it we have to waste hours and hours. In net there are plenty of articles, posts says about how to do replace in XSLT. But, most of them has some requirements like the replace() built in method needs XSLT 2.0 version, or some thing something.... But, if you need simple replace method regardless of the version you have, then you are at right place. There are lot of custom functions written on this already. But, no one of them works for the requirement I have. That is replacing the single quote with two quotes in XSLT. 

The main requirement here is, I am more of SharePoint guy, I use infopath forms for collecting data from users and save them to backend[database]. In the process of it, I have comments fields in the form. There are chances that user may enter single quotes['] in their comments. But, while saving them to the database, the single quote ['] giving problems. Everyone knows that this is the basic problem. So, I have to replace single quote with two single quotes so that the problem will go away.

Complete XSLT file for replacing a string with some other string:
<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
  <html>
  <body>Replace Single Quote with two single quotes
<br />
Original string: Praveen's World
<br />
Replaced String: 
<xsl:variable name="sq">'</xsl:variable>
<xsl:variable name="tsq">''</xsl:variable>
<xsl:variable name="orgString">Praveen's World</xsl:variable>
<xsl:variable name="replacedString">
    <xsl:call-template name="replace_single_quote">
      <xsl:with-param name="string" select="$orgString" />
            <xsl:with-param name="find" select="$sq" />
            <xsl:with-param name="replace" select="$tsq" />
    </xsl:call-template>
  </xsl:variable>
<xsl:value-of select="$replacedString"/>
  </body>
  </html>
</xsl:template>
<xsl:template name="replace_single_quote">
    <xsl:param name="string" select="''"/>
    <xsl:param name="find" select="''"/>
    <xsl:param name="replace" select="''"/>
    <xsl:choose>
        <xsl:when test="contains($string,$find)">
            <xsl:value-of select="concat(substring-before($string,$find),$replace)"/>
            <xsl:call-template name="replace_single_quote">
                <xsl:with-param name="string" select="substring-after($string,$find)"/>
                <xsl:with-param name="find" select="$find"/>
                <xsl:with-param name="replace" select="$replace"/>
            </xsl:call-template>
        </xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="$string"/>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>
</xsl:stylesheet>

For testing purpose, you can use the online XSLT editor from W3schools.
On the right side editor, remove all the code and copy, paste the above XSLT. And now, click on the button "Edit and Click Me >>". You will see the XSLT working.
But, you may confuse by seeing above code that I have given complete document to you. Everyone is not really good at XSLT as it is being used by very less people. So, I will try to describe it clearly for better understanding.

Declaring variables and calling the replace method:
<xsl:variable name="sq">'</xsl:variable>
<xsl:variable name="tsq">''</xsl:variable>
<xsl:variable name="orgString">Praveen's World</xsl:variable>
<xsl:variable name="replacedString">
    <xsl:call-template name="replace_single_quote">
      <xsl:with-param name="string" select="$orgString" />
            <xsl:with-param name="find" select="$sq" />
            <xsl:with-param name="replace" select="$tsq" />
    </xsl:call-template>
  </xsl:variable>
<xsl:value-of select="$replacedString"/>

Here is the simple explanation:
We have declared 4 variables as described below.
  1. sq - single quote - I have assigned single quote to it.
  2. tsq - two single quotes - I have assigned two single quotes to it.
  3. orgString - original string to replace.
  4. replacedString - The final output string.
  5. Finally, after the replace logic called and executed, I am printing the replaced string at last line mentioned above.
  6. If you observe, the variable "replacedString" I have assigned the return value of the template/function named "replace_single_quote". I am calling it with call-template tag and it will call the template and returns some value. 
The template "replace_single_quote" is what the actual function which takes three parameters.
  1. Original string
  2. string to find.
  3. string to replace.
The template returns the replaced string if any found.
Note: You can pass whatever string you want in place of the sq [find] and tsq[replace] variables.

I hope you understood it well and it solved your problem. Read More...

Enterprise programming ppt's

                     Hi, Now i am posting the PPT's for the ENTERPRISE PROGRAMMING subject of ANU (NAGARJUNA UNIVERSITY). Which broadly covers the concepts of  J2EE Web Services: XML SOAP WSDL UDDI WS-I JAX-RPC JAXR OF COURSE JAVAEE. The topics covered in this ppt's are described below



UNIT-1



J2EE INTRODUCTION, JAX (JAVA API FOR XML) INCLUDES DOM AND SAX PARSERS



UNIT-2



JAVA SERVLETS, JSP'S (JAVA SERVER PAGES) AND EJB'S (SESSION AND ENTITY)



UNIT-3



JAVA MAIL API, JAVA MESSAGE SYSTEM (JMS), JNDI(JAVA NAMING AND DIRECTORY INTERFACE)



UNIT-4



SOAP (SIMPLE OBJECT ACCESS PROTOCOL)

UDDI ( UNIVERSAL DESCRIPTION, DISCOVERY AND INTEGRATION)

EBXML (ELECTRONIC BUSINESS XML)

JAXR (JAVA API FOR XML REGISTRIES )

WSDL (WEB SERVICES DESCRIPTION LANGUAGE )





TO DOWNLOAD THIS PPTS I AM PROVIDING TWO DOWNLOADING RESOURCES ziddu.com and mediafire.com





IN ZIDDU.COM



UNIT-1



http://www.ziddu.com/download/11836008/j2ee_intro.ppt.html



http://www.ziddu.com/download/11836023/J2eeIntro.ppt.html



http://www.ziddu.com/download/11836027/XMLProcessing.ppt.html



http://www.ziddu.com/download/11836032/xml-parsing.ppt.html





UNIT-2





http://www.ziddu.com/download/11836063/Servlets.ppt.html



http://www.ziddu.com/download/11836067/jsp_presentation.ppt.html



http://www.ziddu.com/download/11836069/Introduction To EJB.ppt.html





UNIT-3





http://www.ziddu.com/download/11836081/jms.ppt.html



http://www.ziddu.com/download/11836084/JAVA MESSAGE SERVICE 03.ppt.html



http://www.ziddu.com/download/11836086/javamail.ppt.html



http://www.ziddu.com/download/11836089/java mail api raj.ppt.html



http://www.ziddu.com/download/11836093/jndi 03.ppt.html





UNIT-4



http://www.ziddu.com/download/11836119/SOAP 03.ppt.html



http://www.ziddu.com/download/11836120/UDDI 03.ppt.html

 

http://www.ziddu.com/download/11836114/EB-XML03.ppt.html



http://www.ziddu.com/download/11836105/JAXR 03.ppt.html



http://www.ziddu.com/download/11836121/WSDL 03.ppt.html



IF YOU WANT TO DOWNLOAD ALL AT ONE LINK:

http://www.ziddu.com/download/11836913/EP_MATERIALS_PPTS.rar.html





IN MEDIAFIRE.COM



UNIT-1



http://www.mediafire.com/file/chyno4bmvly5zdr/j2ee_intro.ppt



http://www.mediafire.com/file/f58pj12yzpz48xz/J2eeIntro.ppt



http://www.mediafire.com/file/shibn7gdejjj6ln/xml-parsing.ppt



http://www.mediafire.com/file/4dgoir5x95zinba/XMLProcessing.ppt





UNIT-2



http://www.mediafire.com/file/sj12q9n6s492w77/Servlets.ppt



http://www.mediafire.com/file/4gme995bd4tpl6u/jsp_presentation.ppt



http://www.mediafire.com/file/7q4x3g4v2b2nxva/Introduction%20To%20%20EJB.ppt



UNIT-3



http://www.mediafire.com/file/j5duaz7yi2czpyo/java%20mail%20api%20raj.ppt



http://www.mediafire.com/file/yv7ywobf4tbtv6o/JAVA%20MESSAGE%20SERVICE%2003.ppt



http://www.mediafire.com/file/8tzz9mhw6pzccjz/javamail.ppt



http://www.mediafire.com/file/gj37cl07gm34gx8/jndi%2003.ppt



http://www.mediafire.com/file/85azkw5oo10qzfv/jms.ppt





UNIT-4



http://www.mediafire.com/file/c7d8h3hrnv437nb/SOAP%2003.ppt



http://www.mediafire.com/file/of80hqh4289tz36/UDDI%2003.ppt



http://www.mediafire.com/file/h5h9xuifh447nnt/EB-XML03.ppt



http://www.mediafire.com/file/ac8u9cg6t0y4b2r/JAXR%2003.ppt



http://www.mediafire.com/file/3in5rimsddd2mh3/WSDL%2003.ppt





IF YOU WANT TO DOWNLOAD ALL AT ONE LINK:

http://www.mediafire.com/file/mbjh9p1w215r9sa/EP_MATERIALS_PPTS.rar







AND I WILL GIVE MORE JAVA RESOURCES SOON, ANY QUERY POST IN COMMENTS OF THIS POST

Head First Java, 2nd Edition Read More...

The Man Cold...

Has your man ever had a "man cold?"  You know...the kind of sickness that has them on the couch moaning your name to wipe their fevered brow...  (Fevered being anything that registers above that 98.6 human temperature.)

I was shown this video and its probably one of the funniest things I've seen in awhile....

Read More...

Randomness...

I got this from a friend on Facebook and parts of it made me laugh outloud...other parts had me shaking my head and saying, Yep...that is SO true...  I found it amusing enough to actually pass on via my blog...

1. I think part of a best friend's job should be to immediately clear your computer history if you die.


2. Nothing sucks more than that moment during an argument when you realize you're wrong.

3. I totally take back all those times I didn't want to nap when I was younger.

4. There is dire need for a sarcasm font.

5. How the heck are you supposed to fold a fitted sheet?

6. Was learning cursive really necessary?

7. Mapquest really needs to start their directions on # 5. I'm pretty sure I know how to get out of my neighborhood.

8. Obituaries would be a lot more interesting if they told you how the person died.

9. I can't remember the last time I wasn't at least kind of tired.

10. Bad decisions make good stories.

11. You never know when it will strike, but there comes a moment at work when you know that you just aren't going to do anything productive for the rest of the day.

12. Can we all just agree to ignore whatever comes after Blue Ray? I don't want to have to restart my collection...again.

13. I'm always slightly terrified when I exit out of Word and it asks me if I want to save any changes to my ten-page technical report that I swear I did not make any changes to.

14. "Do not machine wash or tumble dry" means I will never wash this - ever.

15. I hate when I just miss a call by the last ring (Hello? Hello?) but when I immediately call back, it rings nine times and goes to voice mail. What did you do after I didn't answer? Drop the phone and run away?

16. I hate leaving my house confident and looking good and then not seeing anyone of importance the entire day. What a waste.

17. I keep some people's phone numbers in my phone just so I know not to answer when they call.

18. I think the freezer deserves a light as well.

19. I disagree with Kay Jewelers. I would bet on any given Friday or Saturday night more kisses begin with Coors Light than Kay.

20. I wish Google Maps had an "Avoid White Trash" routing option.

21. Sometimes, I'll watch a movie that I watched when I was younger and suddenly realize I had no idea what the heck was going on when I first saw it.

22. I would rather try to carry 10 over-loaded plastic bags in each hand than take 2 trips to bring my groceries in.

23. The only time I look forward to a red light is when I'm trying to finish a text.

24. I have a hard time deciphering the fine line between boredom and hunger.

25. How many times is it appropriate to say "What?" before you just nod and smile because you still didn't hear or understand a word they said?

26. I love the sense of camaraderie when an entire line of cars team up to prevent a jerk from cutting in at the front. Stay strong, brothers and sisters!

27. Shirts get dirty. Underwear gets dirty. Pants? Pants never get dirty, and you can wear them forever.

28. Is it just me or do high school kids get dumber & dumber every year?


29. There's no worse feeling than that millisecond you're sure you are going to die after leaning your chair back a little too far.

30. Sometimes I'll look down at my watch 3 consecutive times and still not know what time it is.

31. Even under ideal conditions people have trouble locating their car keys in a pocket, finding their cell phone, and Pinning the Tail on the Donkey - but I'd bet everyone can find and push the snooze button from 3 feet away, in about 1.7 seconds, eyes closed, first time, every time! Read More...

This session has exceeded the amount of allowable resources - Infopath form error

If you are working with infopath forms and your form is really big [I mean, having lot of controls and with so many actions] then you should get this error at some point. Most of the developers did not get it as it will come very rarely.

Error details:
"This session has exceeded the amount of allowable resources."

Event Viewer details:

Event Type:      Error
Event Source: Office SharePoint Server
Event Category: Forms Services Runtime
Event ID: 5737
Description:
Number of form actions 208, has exceeded 200, the maximum allowable value 
per request. This value is configurable and can be changed by the administrator.
So, when we see the log description, it is saying that the form actions is beyond the SharePoint default form actions allowed. SharePoint by default allows 200 form actions per postback of a form. But, here the form I have used is using more than 200. My case it is 208. So, it will not allow to save or submit the form and throw the above error.

Solution:
To resolve this error, increase the form actions in configuring infopath services section as shown below.
  1. Go to Central Administration of the SharePoint server.
  2. Click on Application Management.
  3. In the section "Infopath Forms Services", select Configure Infopath Forms Services.
  4. In the Number of Actions per Postback enter the value of what even viewer shown[In this example 208] or enter some max value around 250 or 300 depends on your requirement.
  5. There are chances that the error may retain same even after we increase the number of actions per postback. The second thing we have to increase is the value of "Maximum size of form session state" to 8192. By default it is 4092, by increasing it to 8192 the error should go away.  

 Please let me know, if you have any problems or questions. Hope this will solve the problem. Read More...

GridView and export to excel

This is very simple to implement in ASP.NET. But, there are possibilities to get problems in exporting to excel from grid view. When you bind data to gridview and write some logic to export to excel then it will not be enough. We have to check or write some additional logic which will help us to solve the problems. Below is the explanation for all problems we may get in the complete process along with detailed solution.

You may encounter below errors when you try to implement the export to excel for gridview.
1. Control of type "GridView" must be placed inside of the form tag with runat="server"
This is very well known error to ASP.NET developers and by seeing it, we think that the control is not inside the form with runat server. But this is not correct. This error will come even if we put the GridView inside form with runat server. The reason is, in the export to excel logic we are calling RenderControl() method of GridView. So, to render it without any issues we have to override the "VerifyRenderingInServerForm" in our code.  Below is the syntax of the event. Add this to the c# code in code behind file. Remember this event is a Page event means this method you should place in ASPX page. If you are using user control to implement this export to excel logic then below are the ways to go.
1. If your user control is using by less than 3-4 pages then go to each and every page and add this event to the page.
2. If your user control is using by more than 5 pages then the best solution is to create a base page [Which inherits from System.Web.UI.Page class] and all your ASPX pages should inherit from this base page.

public override void VerifyRenderingInServerForm(Control control)
{
//Confirms that an HtmlForm control is rendered for the specified ASP.NET
//server control at run time.
}
Now, after we added the event to page, the error will go away for sure.

2. Even when you add the above code/event to the page, this is not enough if you have the paging, sorting enabled on gridview. If you enable paging or sorting then you encounter the below error.

"RegisterForEventValidation can only be called during Render();"

This error is coming because we are doing paging and sorting. If no paging or sorting enabled this error will not come. To resolve this error, please follow below steps.
1. In your export to excel button click event, first disable the paging, sorting on gridview and do data bind.
2. Call export to excel logic.
3. Re-enable paging, sorting on gridview and databind.
Below is the logic we have to use in export to excel button click event.
gvReport.AllowPaging = false;
gvReport.AllowSorting = false;
gvReport.DataBind();
ExportToExcel();//Method to use export to excel.
gvReport.AllowPaging = true;
gvReport.AllowSorting = false;
gvReport.DataBind();
Now, you are clear with all errors and the logic will export all data in gridview to excel.
FYI, I am placing a sample of ExportToExcel() functionality here.
private void ExportToExcel()
{
Response.Clear();
Response.AddHeader("content-disposition", string.Format("attachment;filename=excel_report.xls"));
Response.Charset = "";

// Response.Cache.SetCacheability(HttpCacheability.NoCache);

Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
gvReport.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
}
Note: gvReport is the gridview control name in my example. And there are lot of posts in internet guide you incorrect to resolve the above error. For example, they will say set EnableEventValidation="false" in the <%@ Page directive Or disable validation in web.config level to resolve the error. Please do not set it.

Hope this helps to solve all problems you are facing.
Read More...

An application that access CORBA service using JIDL





Aim: Write an CORBA application using JAVA IDL
Required programs:
  • IDL file(interface) for simple HelloWorld

  • A Server class

  • A Client class

Hello.idl
module HelloApp
{
  interface Hello
  {
  string sayHello();
  oneway void shutdown();
  };
};
Implementing the Server (HelloServer.java)
HelloServer.java


import HelloApp.*;
import org.omg.CosNaming.*;
import org.omg.CosNaming.NamingContextPackage.*;
import org.omg.CORBA.*;
import org.omg.PortableServer.*;
import org.omg.PortableServer.POA;


import java.util.Properties;


class HelloImpl extends HelloPOA{
  private ORB orb;


  public void setORB(ORB orb_val){
    orb = orb_val;
  }
 
  public String sayHello(){
    return "\nHello world !!\n";
  }
 
  public void shutdown(){
    orb.shutdown(false);
  }
}


public class HelloServer{


  public static void main(String args[]){
    try{
      // create and initialize the ORB
      ORB orb = ORB.init(args, null);


      // Get reference to rootpoa & activate the POAManager
      POA rootpoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
      rootpoa.the_POAManager().activate();


      // create servant and register it with the ORB
      HelloImpl helloImpl = new HelloImpl();
      helloImpl.setORB(orb);


      // create a tie, with servant being the delegate.
      HelloPOATie tie = new HelloPOATie(helloImpl, rootpoa);


      // obtain the objectRef for the tie
      // this step also implicitly activates the
      // the object
      Hello href = tie._this(orb);
           
      // get the root naming context
      org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
     
      // Use NamingContextExt which is part of the Interoperable
      // Naming Service specification.
      NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);


      // bind the Object Reference in Naming
      String name = "Hello";
      NameComponent path[] = ncRef.to_name( name );
      ncRef.rebind(path, href);


      System.out.println("HelloServer ready and waiting ...");


      // wait for invocations from clients
      orb.run();
      }
     
    catch (Exception e){
      System.err.println("ERROR: " + e);
      e.printStackTrace(System.out);
    }
   
    System.out.println("HelloServer Exiting ...");
       
  }
}


HelloClient.java




import HelloApp.*;
import org.omg.CosNaming.*;
import org.omg.CosNaming.NamingContextPackage.*;
import org.omg.CORBA.*;


public class HelloClient{


  public static void main(String args[]){
 
    try{
      // create and initialize the ORB
      ORB orb = ORB.init(args, null);


      // get the root naming context
      org.omg.CORBA.Object objRef =
          orb.resolve_initial_references("NameService");
         
      // Use NamingContextExt instead of NamingContext. This is
      // part of the Interoperable naming Service. 
      NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);


      // resolve the Object Reference in Naming
      String name = "Hello";
      Hello helloImpl = HelloHelper.narrow(ncRef.resolve_str(name));


      System.out.println("Obtained a handle on server object: " + helloImpl);
      System.out.println(helloImpl.sayHello());
      helloImpl.shutdown();
      }
     
    catch (Exception e) {
      System.out.println("ERROR : " + e) ;
      e.printStackTrace(System.out);
    }
  }
}












To run this client-server application on your development machine:
  1. Change to the directory that contains the file Hello.idl.

  2. Run the IDL-to-Java compiler, idlj, twice on the IDL file to create stubs and skeletons. This step assumes that you have included the path to the java/bin directory in your path.

3.    idlj -fall  Hello.idl
4.    idlj -fallTie Hello.idl
    • It generates



    • HelloPOA.java

    • _HelloStub.java

    • Hello.java

    • HelloHelper.java

    • HelloHolder.java

    • HelloOperations.java



  1. Compile the .java files, including the stubs and skeletons (which are in the directory HelloApp). This step assumes the java/bin directory is included in your path.



6.     javac *.java HelloApp/*.java


  1. Start orbd.

  start orbd -ORBInitialPort 1050 -ORBInitialHost localhost
  1. Start the Hello server.

start java HelloServer -ORBInitialPort 1050 -ORBInitialHost localhost
  1. Run the client application:

 java HelloClient -ORBInitialPort 1050 -ORBInitialHost localhost


output:


Obtained a handle on server object: IOR:000000000000001749444c3a48656c6c6f417070
2f48656c6c6f3a312e300000000000010000000000000082000102000000000a3132372e302e302e
3100055a00000031afabcb00000000203a12163f00000001000000000000000100000008526f6f74
504f4100000000080000000100000000140000000000000200000001000000200000000000010001
00000002050100010001002000010109000000010001010000000026000000020002


Hello world !!
Read More...
Related Posts with Thumbnails
GiF Pictures, Images and Photos