Daily Archives: March 18, 2012

Strange Windows Error

Here’s a strange Windows Error.
A file and folder can’t have the same name.

Note: The folder name must include the extension of the file name for the error message to appear.

Larry Battle

I love to program, and discover new tech. Check out my stackoverflow and github accounts.

More Posts - Website

Follow Me:
Twitter

js2coffee.org helps your learn coffeescript faster

coffeescript icon
coffeescript icon

Coffee-script is a smoking hot simple language that converts 100% into Javascript code. Coffee-script allows you to spend more time focusing on the algorithm rather than the syntax.
js2coffee.org is an awesome website that converts your Coffee-script to Javascript and vice versa on the fly. So you can learn Coffee-script faster.
Example:
Let’s convert my Random Number Generator code from a previous post to Coffee-script.

// Javascript version
var getRandomNum = function( i, decLen ){
	return (Math.random() * (i||1) ).toFixed(decLen);
};

# My Coffee-script version
getRandomNum = ( i=1, decLen ) -> (Math.random()*i).toFixed(decLen)

# js2coffee.org Coffee-script verison
getRandomNum = (i, decLen) ->
	(Math.random() * (i or 1)).toFixed decLen

Awesome huh?

Check out a demo of Coffeescript here.

I’ll like to leave you with a HTML5 Coffee-script presentation.

Cheers.

Larry Battle

I love to program, and discover new tech. Check out my stackoverflow and github accounts.

More Posts - Website

Follow Me:
Twitter

Siebel eScript headaches.


Here are a few problems that I’ve encountered while spending a week programming in Siebel eScript 7.8.

  1. Siebel eScript is ECMAScript compliant.
    ECMAScript is the standard implementation of JavaScript as defined by the ECMA-262 standard.
    Beginning with Siebel Business Applications version 7.8, the script engine supports ECMAScript Edition 4.
    You can opt to use the updated functionality of this engine, including the Siebel ScriptAssist tool, or you can opt to leave this updated functionality inactive.
    http://docs.oracle.com/cd/B31104_02/books/eScript/eScript_JSLOverview.html

    Here’s a link to ECMAScript Version 4.0. proposed draft.
    Example code for ES4.

    interface I { function f() } 
    interface J { function g(n) } 
    class C implements I, J { 
    	function f() { return "foo" } 
    	function g(n) { return n+2 } 
    }


    It should be noted that most major web browsers abandoned ES4 due it the complexity of feature implementations.
    So even if your scripts pass jshint.com and jslint.com 100%, and works on all major browsers you still have the possibility of your code throwing an during execution.
    Siebel eScript says it’s ECMA-262 compliant but I’ve found a few bugs in the engine that require some work around.

  2. Developing a simple way to unit test your code is essential.
    Here’s a easy way to add test function to your library.

    function logThis( name, result ){
    	// Log this values to a Property Set Object that get's converted to XML.
    	AddParameterPS( logObjs.Outputs, name, result, "logThis");
    }
    function testThis( name, func ){
    	try{
    		logThis( "Passed: "+ name, func() );
    	}
    	catch(e){
    		logThis( "Failed: "+ name, e );
    	}
    }


    Test example

    function runTest(Input, Output){
     
    	testThis( "Test strict equivalence support", function(){
    		return "1" !== 1;
    	});
    	// This will fail since Siebel doesn't support the apply and call Object function calls.
    	testThis( "Test isArray using call", function(){
    		// Siebel eScript: FAIL, Browser: Pass
    		function isArray( arr ){
    			return Object.prototype.toString.call( obj ) == "[Object Array]";
    		}
    	});
    	testThis( "Test isArray using instanceof", function(){
    		// Siebel eScript: Pass, Browser: Pass
    		function isArray( arr ){
    			return arr instanceof Array;
    		}
    	});
    }

  3. Siebel Business Applications in high-interactivity mode requires an ActiveX plugin, which forces you to use Internet Explorer on Windows.
  4. Siebel eScript has errors with it’s engine and it’s hard to debug eScripts for run-time business services.
    Here’s a strange bug in Siebel eScript.
    You can’t create return objects when they are generated from a function attached to an object.
    Example Code:

    	var x = {};
    	x.getObj = function( a, b ){
    		var obj = function(){
    			this.x = a;
    			this.y = b;
    		};
    		return new obj();
    	};
    	var getObj = function( a, b ){
    		var obj = function(){
    			this.x = a;
    			this.y = b;
    		};
    		return new obj();
    	};
    	var arr = [];
    	arr.push( getObj() );	// successful
    	arr.push( x.getObj() );	// Run-time Error.

  5. Siebel eScript engine is pretty damn slow. So avoid writing these two performance killers.
    1: Wrapping all your code within a closure.
    2: Defining an object inside closure with the same name as an object in the outer scope.
    Example:

    	var x = (function(){
    		var x = {
    			a:1
    		};
    		return x;
    	}());

Siebel eScript Reference from Oracle.com:
eScript Lanague Reference (2004 edition)

Larry Battle

I love to program, and discover new tech. Check out my stackoverflow and github accounts.

More Posts - Website

Follow Me:
Twitter

Simple fix for MSI Windows Installer Error

Here’s a quick post over how to install applications that encounter the Windows Installer Error.


Error Message:

Windows Installer
This installation package could not be opened.
Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer package.

Alternative Solutions not presented in the video.
1) Avoid msi files and go for an alternative file format to install your application.
2) Install the application using the hidden Administrator account.
Here’s a Guide
3) Reinstall Windows on your computer.
4) Re-download the file from a different website.
5) System Restore to a period where the problem didn’t exist.
6) Extract the content of the MSI file and run the executable from there.
Extract MSI contents.batch

REM Extracts the filename.msi file to C:\extracted_files
msiexec /a filename.msi /qb TARGETDIR=C:\extracted_files

Larry Battle

I love to program, and discover new tech. Check out my stackoverflow and github accounts.

More Posts - Website

Follow Me:
Twitter