ERROR:9:42: Syntax error: Operator expected prolog - linux

So, I am trying to create a microworld for my prolog assignment and whenever I try to consult the .pl file it gives me a bunch of errors which are basically all the same as they start with ""ERROR:softwares_and_hardwares.pl:9:42: Syntax error: Operator expected"" and in the next line, the same ones with the numbers changed. Can someone help me figure out the error? Please and thank you. Below here is the knowledge base KB code of the following.
% File: softwares_and_hardwares.pl
% Line: casualling differentiating on various types of software and hardwares of the computers.
% ------------------------------------------------------------------------------------
% Predicates based on facts and knowledge ...
% ------------------------------------------------------------------------------------
% software(sfname(S),typeofsf(T),Accesstosrc(A),licensefee(L) :: S is the name of the software where T is determined as which type of software and A as if it the sources is accessible to everyone and L is license fee (if any)
software(sfname(MacOS),typeofsf(Operating System software),Accesstosrc(No-its Proprietory Software),licensefee(paid-when buying the PC)).
software(sfname(Linux),typeofsf(Operating System software),Accesstosrc(Yes-its open-source Software),licensefee(free-easily available on internet)).
software(sfname(Avast Security),typeofsf(Security Application software),Accesstosrc(No-its Proprietory Software),licensefee(paid-subsicrption due after every certain period of time)).
software(sfname(Mozilla Firefox),typeofsf(Web Application software),Accesstosrc(Yes-its open-source Software),licensefee(free-easily downloadable from the internet)).
% hardware(hdname(H),typeofhd(D),hdtype(P)) :: H is the name of the hardware used in the computers where D is deteremined as which type of hardware and P as if the hardware is an external or internal type of device.
hardware(hdname(Printer),typeofhd(Output Device),hdtype(external)).
hardware(hdname(RAM-Random Access Memory),typeofhd(Internal component),hdtype(internal drive)).
hardware(hdname(Keyboard),typeofhd(Input Device),hdtype(external)).
hardware(hdname(PCI-Peripheral Component Interconnect aka USB ports),typeofhd(Input Device),hdtype(Internal)).
% Predicates based on Rules (indirectly on the above stated commands)...
% ------------------------------------------------------------------------------------
% Rules for listing softwares and hardwares and Computer-components
%------------------------------------------
% softwares :: all those items listed are softwares
softwares :- software(Name,_,_,_), write(Name), nl, fail.
softwares.
% hardwares :: all those items listed are hardwares
hardwares :- hardware(Name,_,_), write(Name), nl, fail.
hardwares.
% computer-components :: all those items listed are computer-components
computer-components :- softwares, hardwares.
% Rules for finding special components of the computer
%------------------------------------------
% Keyboard(Name) :: Name is a external hardware
Keyboard(Name) :- hardware(Name,_,hdtype(external)).
% Linux(Name) :: Name is a operating system software.
Linux(Name) :- software(Name,typeofsf(Operating System software),_,_).
% Mozilla Firefox(Name) :: Name is a web application software
Mozilla Firefox(Name) :- software(Name,typeofsf(Web Application software),_,_).
% Printer(Name) :: Name is a output device
Printer(Name) :- hardware(Name,typeofhd(output device),_).
% MacOS(Name) :: Name is a opertaing system software
MacOS(Name) :- software(Name,typeofsf(Operating System software),_,_).
% RAM-Random Access Memory(Name) :: Name is a internal component.
RAM-Random Access Memory(Name) :- hardware(Name,typeofhd(Internal component),_).
% Avast Security(Name) :: Name is a security application software
Avast Security(Name) :- software(Name,typeofsf(Security Application software),_,_).
% PCI-Peripheral Component Interconnect aka USB ports(Name) :: Name is a internal hardware.
PCI-Peripheral Component Interconnect aka USB ports(Name) :- hardware(Name,_,hdtype(internal).
%------------------------------------------```

On line 8 (the first code line after the comments) you have this
Operating System software
No-its Proprietory Software
paid-when buying the PC
This is not Prolog code. I can imagine that you miss single/double quotes around each of these "things".

Related

How to run program using angr after loading with the elfcore backend?

I am attempting to write a python script using the angr binary analysis library (http://angr.io/). I have written code that successfully loads a core dump of the process I want to play with by using the ElfCore back end (http://angr.io/api-doc/cle.html#cle.backends.elf.elfcore.ELFCore) passed to the project constructor, doing something like the following:
ap = angr.Project("corefile", main_opts={'backend': 'elfcore'})
What I am wondering is, how do I now "run" the program forward from the state (registers and memory) which was defined by the core dump? For example, when I attempted to create a SimState using the above project:
ss = angr.sim_state.SimState(project=ap)
ss.regs.rip
I got back that rip was uninitialized (which it was certainly initialized in the core dump/at the point when the core dump was generated).
Thanks in advance for any help!
Alright! I figured this out. Being a total angr n00b® this may not be the best way of doing this, but since nobody offered a better way this is what I came up with.
First...
ap = angr.Project("corefile", main_opts={'backend': 'elfcore'}, rebase_granularity=0x1000)
ss = angr.factory.AngrObjectFactory(ap).blank_state()
the rebase_granularity was needed because my core file had the stack mapped high in the address range and angr refuses to map things above your main binary (my core file in this case).
From inspecting the angr source (and playing at a Python terminal) I found out that at this point, the above state will have memory all mapped out the way the core file defined it to be, but the registers are not defined appropriately yet. Therefore I needed to proceed to:
# Get the elfcore_object
elfcore_object = None
for o in ap.loader.all_objects:
if type(o) == cle.backends.elf.elfcore.ELFCore:
elfcore_object = o
break
if elfcore_object is None:
error
# Set the reg values from the elfcore_object to the sim state, realizing that not all
# of the registers will be supported (particularly some segment registers)
for regval in elfcore_object.initial_register_values():
try:
setattr(ss.regs, regval[0], regval[1])
except Exception:
warn
# get a simgr
simgr = ap.factory.simgr(ss)
Now, I was able to run forward from here using the state defined by the core dump as my starting point...
for ins in ap.factory.block(simgr.active[0].addr).capstone.insns:
print(ins)
simgr.step()
...repeat

How to read Characteristic Descriptor

I am in the process of interfacing with a BLE server and the first attempt is to view the response from Service 0x1818 - Characterstic 0x2A65 and to find out what Cycling Power Features are supported as per this link
https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.cycling_power_feature.xml
What I get is this
[134,3,1,0]
I have read the documentation about 30 times and still cant figure out how to translate that into something useful.
How do I parse that response and map it to features to determine what is support by the BLE service/server?
The link you've sent says that the field 'Cycling Power Feature' is 32-bit, and is given LSB-first. So, your 4-bytes should be converted to binary like this (starting with MSB first):
'd0 → 'b0000_0000
'd1 → 'b0000_0001
'd3 → 'b0000_0011
'd134 → 'b1000_0110
Together you get (bits 31..0): 'b00000000_00000001_00000011_10000110
In the link, go over the meaning of each bit field, and see if it is True or False. For example:
bit 0, value: 0 → "Pedal Power Balance Supported" is False
bit 1, value: 1 → "Accumulated Torque Supported" is True
and so on.

Zebra RFD8500 : How to use read in ZETI

I have a Zebra RFD8500 here and I connected to it via the terminal. I am trying to use the ZETI command read to access epc's, but it does not read anything.
But if I use the ZETI command inventory it finds all the tags around.
Anyone knows how to use the read command properly? Also is there some kind of filter per default on?
I am using the developer example on page 174 Link to PDF
Not sure if you solved this problem, but I couldn't find anything else via Google. I had the same problem with using read in ZETI (Zebra RFD8500). The Zebra tech support told me that to use access operations like read and write, you have to turn off dynamic power (which I think is on by default).
Unfortunately, I am not using the iOS API/SDK (writing a custom one for another device), but here's the gist of what you'd be doing:
Turn off dynamic power
Do an inventory
Read some memory bank, like the EPC bank. Optionally, you can also specify access criteria to single out a tag.
To test how this worked in ZETI, I screened into the RFD8500 (on my Mac, doing ls /dev/tty.RFD* lists several ttys, I chose the one ending in "-R"):
screen /dev/tty.RFD8500{long number}-R
Then I issued these commands:
dp .disable
in
rd
Commands:
dp = setdynamicpower
in = inventory
rd = read
After issuing "rd", you should be able to see the user memory banks (the default bank for the "rd" command).

How to check the available free space in Haxe?

I don't find a way to check the free space available in a device using Haxe, Openfl, Lime or another library.
I would like to avoid download data that will exceed the size recommended for an app in each device.
What do you do to check that?
Try creating a file of that size! Then either delete it or reopen and write (not append) over its contents.
I don't know whether all platforms Haxe supports will work fine with this trick, but this algorithm is reported to work in many places and languages (I personally tested it in Ruby and saw the same suggestion for C++/.NET). To check whether X bytes of disk space are available:
open a new file for writing
seek X-1 bytes from the beginning
write a byte of data (whatever you want, 0, 42...)
close the file (probably unrelated to the task at hand, but don't forget to do that anyway)
If there's insufficient disk space, you'll likely get an exception at some point in this algorithm. You'll have to find out what errors to expect and process them properly.
Using ihx I've found this is working and requires nothing but Haxe Standard Library:
haxe interactive shell v0.3.4
type "help" for help
>> import sys.io.*;
>> var f = File.write('loca', true)
sys.io.FileOutput : { __f => #abstract }
>> f.seek(39999, FileSeek.SeekBegin)
Void : null
>> f.writeByte(0)
Void : null
>> f.close()
Void : null
After these manipulations, I had a file named loca of exactly 40000 bytes in my working directory.
By the way, be careful when doing things like these in ihx since it re-runs the entire session with the last entered line appended each time.
Ongoing experimentation:
However, when there's insufficient disk space, it may not fail with errors. In this case you'll have to check the real size with sys.FileSystem.stat(path).size. And don't forget to delete the file if there's not enough space.

TCL (thermal control language) [printer protocol] references

I'm working on supporting of the TCL (thermal control protocol, stupid name, its a printer protocol of futurelogic) but i cannot find resources about this protocol, how it is, how it works, nothing, on theirs site i only found this mention http://www.futurelogic-inc.com/trademarks.aspx
any one had worked with it? does any one knows where can i find the data sheet?
The protocol is documented on their website http://www.futurelogic-inc.com/support/downloads/
If you are targetting the PSA66ST model it supports a number of protocols TCL, which is quite nice for delivering templated tickets and, line printing using the Epson ESC/P protocol.
This is all explained in the protocol document.
Oops, these links are incorrect and only correspond to marketing brochures. You will need to contact Futurelogic for the protocol documents. Probably also need to sign an NDA. Anyway, the information may guide you some more.
From what I can gather, it seems the FutureLogic thermal printers do not support general printing, but only printing using predefined templates stored in the printer's firmware. The basic command structure is a caret ^ followed by a one or two character command code, with arguments delimited using a pipe |, and the command ended with another caret ^. I've been able to reverse-engineer a few commands:
^S^ - Printer status
^Se^ - Extended printer status
^C|x|^ - Clear. Known arguments:
a - all
j - jam
^P|x|y0|...|yn|^ - Print fields y0 through yn using template x.
Data areas are defined in the firmware using a similar command format, command ^D|x|y0|...|yn|^, and templates are defined from data areas using command ^T|z|x0|...|xn|^.

Resources