Powerbuilder 11.5 Run command in Win7 64bit - 64-bit

I have been developing an application which uses thermal
printers to print receipts.
Until now the following code (PB 11.5) was working as a
charm:
Environment env
GetEnvironment(env)
ls_port= 'LPT1'
ls_command = 'COPY ' + ls_tempfile + ' ' + ls_port
Choose Case env.OSType
Case windows!
ls_command = 'command.com /c ' + ls_command
Case windowsnt!
ls_command = 'cmd.exe /c "' + ls_command + '"'
Case else
ls_command = 'cmd.exe /c "' + ls_command + '"'
End Choose
li_cmd = Run(ls_command,Minimized!)
I have just deployed my application to a big customer with
Win7 64bit PCs and the command does not fire! I cannot print
at all!
I am in an awkard (to say the least) situation.
Can you help me?

Well, the problem was not in the PB Run statement but in a Net Use that I had done. Net Use in LPTx, COMx in Win7 64bit has tons of issues concerning privileges, user rights etc. Even the Print Directly to Printer option inside Printer Properties causes rights issues!! Oh God...

Related

Is there any way to configure emulator in Android Studio?

I am doing a project about Android forensics where I need to dump data from android devices so I am using emulator from android studio. using android version 8.1.0. I am following a repo from github here's the link;https://github.com/mspreitz/ADEL
In order to dump file the prerequisite is to add configuration in the xml folder sub directory named https://github.com/mspreitz/ADEL/blob/master/xml/phone_configs.xml
But I cant find any way to configure the emulator...
if anyone could enlighten me will appreciate a lot I have successfully ran the scripts but unable to dump database.the scripts runs ..the code to run '' python adel.py -d emulator-5554'''. I have tried it already but the problem here is the script is unable to dump database for instance: calendar data, contacts data, call logs though I have created these databases and stored it on the emulator when the scripts run it shows
" Calendar database doesn't exist"
" Contacts database doesn't exist"
" database doesn't exist" " mms/sms database doesn't exist"
The code for dumping the contacts database is given :
if float(os_version) < 2.0:
contactsdb_name = "contacts.db"
else:
contactsdb_name = "contacts2.db"
try:
contactsdb = subprocess.Popen(['adb', 'pull', '/data/data/com.android.providers.contacts/databases/' + contactsdb_name, backup_dir], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
contactsdb.wait()
_adel_log.log(contactsdb_name + " -> " +
contactsdb.communicate(0)[1].split("(")[1].split(
")")[0] + " -> " + hashlib.sha256(backup_dir +
"/contacts2.db").hexdigest(), 3)
hash_value.write(contactsdb_name + " -> " + hashlib.sha256(
backup_dir + "/" + contactsdb_name).hexdigest() + " \n")
except:
_adel_log.log( "dumpDBs: ----> contacts
database doesn't exist!", 2)
https://github.com/mspreitz/ADEL/blob/master/_dumpFiles.py this is the link of the full script.
If you config the device as
<phone device="emulator" model="sdk" os_version="8">
<smartphone_information>
...
</phone>
you should be able to use the emulator.
Otherwise post the specific error you are receiving.

Windows print to default thermal printer

I'm developing a program to a shop. The program needs to print the receipt of the order using a termal printer.
I discovered that the printer follows the ESC/POS standard and I found out that there is a package that helps me having an interface with the printer caled python-esc/pos. However, to print throught a USB connected printer, I need to know the Vendor ID and Product ID. I've discovered a way to find this for all the connected printers on the sistem using the following code:
import usb
def is_printer(dev):
if dev.bDeviceClass == 7:
return True
for cfg in dev:
if usb.util.find_descriptor(cfg, bInterfaceClass=7) is not None:
return True
for printer in usb.core.find(find_all=True, custom_match = is_printer):
print('Decimal VendorID=' + str(printer.idVendor) + ' & ProductID=' + str(printer.idProduct) + '\n')
print('Hexadecimal VendorID=' + hex(printer.idVendor) + ' & ProductID=' + hex(printer.idProduct) + '\n\n')
However, I discovered that my client has multiple printers connected to his system. I want to be able to always print to the default printer. I would appreciate any help doing that since there are not many docs about default termal printers and all that
Edit: I should clarify that I do not have a thermal printer with me, so I'm working on the dark here, just hoping that it works in his hands.

Want to run several db.query() method in parallel without getting any error

I am using Node JS . I am a beginner. I use OrientJS to connect orientdb from Node JS. I want to run several db.query() method in parallel. This queries are formed by reading a large text file using line-by-line module.
For example,
var queryForGeoUpdate = 'update (' +
'\nselect from (' +
"\n select expand(outE('GeoAgentSummary')) " +
'\n from Agent ' +
'\n where name = "' + name + '" and number = \'' + number + "' and type = '" + type + "'" +
"\n) where in.name = '" + Geo + "'" +
'\n) increment _' + FiscalYear + ' = ' + TMSSalesAllocatedBookingsNet + 'f, _' +
FiscalPeriodID + ' = ' + TMSSalesAllocatedBookingsNet +
'f, _' + FiscalQuarterID + ' = ' + TMSSalesAllocatedBookingsNet + 'f'
// console.log(queryForGeoUpdate)
db.query(queryForGeoUpdate) // query and db call for Country ends here
like db.query(queryForGeoUpdate) there are seven queries like db.query(queryForRegionUpdate) and so on...
if I run it asynchronously "process out of memory occurrs". If I run it synchronously it takes too much time. How can I solve it within very less time..
Any help is appreciated..
I am not familiar with the DB you are using. If you are sure the DB works "correctly" and the calls you make are correct (e.g. if there isn't a way to make you queries much smaller) you could try running with:
node --max_old_space_size="memmory in MB, try something large like 8192" app.js
It seems rather strange that a DB query would run out of memory thought... I always assumed queries are, generally speaking,a lot more CPU intensive and require relatively little memory.
For these sort of large queries you might also try spawning separate processes:
https://nodejs.org/api/child_process.html

DateTime bug between local machine and remote server - using JodaTime(java 1.8)

I have some code running fine locally but i am getting an error when i run it remotely.
I am unable to debug remotely obviously - but from the error I know it has to with some DateTime Logic (belongs to my code).
I am looking for a comprehensive way to find what's different between my machine and this remote server - and that could affect DateTime logic.
I know Locale - 1/ is there a way to know what is affected by Locale?
2/ Any other local settings that could be different between a local machine and a server?
Thanks
I looked at the FirstDayOfWeek and MinimaldaysinFirstWeek
when I run the following code:
Calendar c1 = new GregorianCalendar();
System.out.println(Locale.getDefault() + ": " + c1.getFirstDayOfWeek() + " " + c1.getMinimalDaysInFirstWeek());
Locale.setDefault(Locale.getDefault());
Calendar c = new GregorianCalendar();
System.out.println(Locale.getDefault() + ": " + c.getFirstDayOfWeek() + " " + c.getMinimalDaysInFirstWeek());
I got the following output.... It makes no sense...
en_US: 2 4
en_US: 1 1

How to prevent exposing truecrypt arguments?

I have a script that mounts a truecrypt volume and the password is given as an argument. Any user on the system may issue the command ps -aux | grep truecrypt which will reveal the password to the encrypted volume. Moreover, by traversing the proc directory, again the password can be revealed. I have root access to my machine, but I am sure that changing the permissions of the ps command and the proc directory will brake functionality in other parts of the system. On one hand I want to mount the volumes automatically without requiring user interaction, on the other hand, compromising the password of the truecrypt volume is out of the question. I might be able to find some acceptable solution using expect but before doing so I wanted to ask if anybody has a better idea?
I used pexpect to solve my problem in a python script, equivalent shell scripts should look similar conceptually
Instead of
mntMyDir = '/mnt/' + myDir
os.system('truecrypt ' + mntMyDir + '.tc ' + mntMyDir + ' --password=' + myPassword + ' --keyfiles= --protect-hidden=no')
os.chdir(mntMyDir + '/tree')
I used
mntMyDir = '/mnt/' + myDir
truecryptCmd = 'truecrypt ' + mntMyDir + '.tc ' + mntMyDir + ' --keyfiles= --protect-hidden=no'
child = pexpect.spawn(truecryptCmd)
child.expect('Enter password for ' + mntMyDir + '.tc: ')
child.sendline(myPassword)
child.wait()
os.chdir(mntMyDir + '/tree')

Resources