the fact of real shit

JavaScript class encaptulation

My favorite JavaScript class structure –

(function(exports) {
	"use strict";
	var mySuperDupparClassOfSHKR=function(pValue){
	var myPrivateValue;
	this.setValue=function(pValue){
		myPrivateValue=pValue;
		return this;
	};
	var __construct = function(that, pValue) {
		return that.setValue(pValue);
		}(this, pValue);
	};
	exports.SuperDupparClass = {
		create : function(pValue) {
			if(typeof pValue==='undefined') throw 'please provide a value, unable to continue...';
			return new mySuperDupparClassOfSHKR(pValue);
		},
	};
})(this);

Usage as follows –

var myObj;
jQuery(document).ready(function($) {
	try{
		myObj=SuperDupparClass.create('any value');
	}catch(e){
		alert('ERR: '+e);
	}
});

 

Posted in javascript, study, webdevelopmentTagged , , ,

Prepare USB printer for print through DOS based program like FoxPro

DOS based applications like FoxPro doesn’t detect an USB printer. One way of directing output to USB is by using “net use” at command line

We will use a little trick to work out. We fist share our printer with a share name within 8 digit name. Cause DOS didn’t support more then 8 characters. Then we will use above command. But we need to ensure that we will use text print only.

Now follow these instructions…

  • Share your USB printer and give its name at printer share name
  • Open the printer properties, select ADVANCE tab select “Print Processor” select TEXT and save the change
  • Now use “net use” command
    e.g. NET USE LPT1 \\<computer name>\<printer share name> /persistent:yes

At the command prompt type “DIR >PRN” this must give you print from USB printer, then try printing from your application.

That’s all folk. Now you can write a small batch file to active the printer every time before you go to FoxPro or any other DOS program

Posted in foxpro, windowsTagged , , , , , ,