Niagara Ax: How to programmatically get a module version

Here’s the code snippet to programmatically get a module’s version.

Sys.getRegistry().getModule("moduleName")
.getVendorVersion().toString();

Or if your class has a TYPE field

Sys.getRegistry().getModule(TYPE.getModule().getModuleName())
.getVendorVersion().toString();

This returns the vendorVersion value written in the module’s build.xml as shown below.

<module
	bajaVersion="3.4"
	description="Niagara Ax Module"
	edition="j2se-5.0"
	name="NiagaraModule"
	preferredSymbol="nm"
	vendor="Tridium Inc"
	vendorVersion="1.3.1"
>

Disclaimer: Niagara Ax tips in this website are sourced from the Open Niagara Ax online community http://www.niagara-central.com/ . A forum where you can ask and resolve Niagara framework related queries.

Niagara Ax: How to increase workbench client request timeout

When a Niagara workbench is connected to a remote supervisor, chances are there when client makes a request to the server, requests will be timed out after 1 minute or 60 seconds, because the server was taking more than 60 seconds to service the request.

Although Tridium will not encourage this, but we can increase the time out for clients in certain known scenarios. The file to be changed is %NIAGARA_HOME%/lib/system.properties

#UnComment the line below and provide a new value instead of 60000
niagara.fox.requestTimeout=60000

Disclaimer: Niagara Ax tips in this website are sourced from the Open Niagara Ax online community http://www.niagara-central.com/ . A forum where you can ask and resolve Niagara framework related queries.

Niagara Ax : Copy a BComponent to a bog file.

In Niagara Ax, a bog file is nothing but a zipped xml. Whenever we need to serialize a BComponent as a file in the station files structure, we can use the below code to achieve the same.

/**
 Copy a BComponent to a bogFile
 @param comp : The source component
 @param bogFile : The bogfile to be persisted to.
*/
 public static void copyComponentToBog(BComponent comp,BIFile bogFile) throws IOException {
      BogEncoder bogencoder = new  BogEncoder(bogFile.getOutputStream());
      bogencoder.setZipped(true);
      bogencoder.encodeDocument(comp);
      bogencoder.close();
    }

Vice-verse, to decode or convert a bog file to a component you can use BodDecoder class as shown below.

    /**
     * Decode a bog file and return its BComponent object.
     * @param sourceFile : The source bog file
     * @return BComponent
     * @throws Exception
     */
    public static BComponent bogFileToComponent(BIFile sourceFile throws Exception {
      BogDecoder bogDec = null;
      try{
          BogDecoder bogDec = new BogDecoder(file);
          BComponent component = ((BComponent)(bogDec.decodeDocument()));

         }finally{
          if(null != bogDec){
           bogDec.close();
          }
         }
      return component;
    }

Disclaimer: Niagara Ax tips in this website are sourced from the Open Niagara Ax online community http://www.niagara-central.com/ . A forum where you can ask and resolve Niagara framework related queries.

Ubuntu 12.04 : Fix for Adobe Flash crashing while playing videos

When adobe stopped support for its flash player in linux, it was not just bad news, it was a terrible news as the version then had some serious bugs. One of the common one being the people in the youtube or flash videos appearing in blue color. The blue tint was making everyone in the video like a navi from the movie Avatar.

Another common problem is seeing the flash player crashing in browsers, both firefox and chrome. One solution is provided below.

Make sure you take a backup of the file below before attempting an edit so you can revert to it, incase something fails.

$sudo vi /etc/adobe/mms.cfg

#remove the first line and the file should have only the line as shown below. 
OverrideGPUValidation=true

Now close the browser(s) and test the flash link again. It should not be crashing as often it was earlier at the least.

Source

WordPress.org: How to add new posts to different pages ?

Well, am sorry I do not have a solution for this problem yet. I am posting this here, because if any of your good self lands up here looking for a similar solution and has solved it later on, please please kindly drop a link or line or two regarding the solution .

What I need is basically this. In my wordpress blog, whenever I create a new post, i should have the option to make it appear in a different page from my home page, say http://ajopaul.com/random. Hence the posts will be separated into pages. So home page will have only those posts meant to be in home.

Please do help me find a tip for this. In case I find one, I shall definitely post one here.