How to run dissect in J? - j

I have J9.02 installed in Debian-based OS. I try to run dissect but it fails:
load 'debug/dissect'
dissect '10 + i. 3 3'
value error
|value error: wd
| wd DISSECT
|value error: wd
| wd'timer 0'
Any hints how to fix it?
Thanks!

Dissect requires a gui front end. You need to run it from Jqt and it sounds like you are in jconsole.

Related

How to end the CQL shell?

I am learning Cassandra right now.The problem is here
[cqlsh 5.0.1 | Cassandra 3.11.1 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
cqlsh> q
... quit
... HELP
... !
... EXIT
...
... quit
... !
... EXIT
...
How can I quit the shell?
try
<control-c>exit<enter>
Yeah, what's happening above, is that cqlsh thinks that you're entering a multi-line command:
aploetz#cqlsh> q
... quit
... EXIT
... exit
... ;
Bad Request: line 1:0 no viable alternative at input 'q'
aploetz#cqlsh>
Note that when I provide a semi colon (;) it gets me back to the cqlsh command prompt. Then exit will work fine (even without a semicolon).
aploetz#cqlsh> exit
$
Official page also writes the exit command...
I just registred for this answer)
I find in docs, use command EXIT for it)
Just uppercase

how to set a node to sleep in ns2

I just want to set a node to sleep in ns-2 and i have searched in protocols and i found a lot of objects and functions about sleep but i couldn't use them in other protocols to set a node to sleep.
when i use them i get Segmentation fault or Floating point and i know what these errors mean but i can't find a way to solve them.
Like when i use sleep() function from SMAC.
I have searched in google and after a week i still didn't find any solution...!
could you guys please help me here...?
"Sleep" is when a node is turned idle, I guess.
There are some examples in ns-2.3x/tcl/ex/ with "set idle_time_".
You can find the line numbers for "set idle_time_" with :
$ cd ns-2.3x/tcl/ex/
$ grep -Rin idle_time *
The simulation examples are ( grep will also list a lot of config files.tcl ) :
realaudio/ramodel.tcl
sat-aloha.tcl
srm-session.tcl
srm.tcl
tcpsrm.tcl ( Edit line 130 to e.g.: exec tclsh8.6 ./namfilter.tcl out.nam )
( Copy namfilter.tcl to ex/ from nam-1.1x/bin/.)
test-rcvr.tcl
test-tbf.tcl
tg.tcl
wpan/{ wpan_demo1.tcl, wpan_demo2.tcl ....... wpan_demo5.tcl }
xcp/2statemarkovB.tcl (xcp-tcp.tcl must be run beforehand to create the required xcp0.tr)
Please try running the files. → → Some have really good nam and xgraph visualizations.

Lubuntu: Using .sh script as a keybind, code works, executing script gives errors

This is my first ever post on stackoverflow, hope I don't break any rules. I'm a complete Linux newbie (installed Lubuntu 14.04 64bit last night) so be duly warned.
In short, I'm trying to get my laptop touchpad toggle to work (Fn+F3 on my Inspiron5110). I have a bash script:
#!/bin/bash
if [ $(synclient -l | grep TouchpadOff | awk '{print $3}') == 1 ] ; then
synclient touchpadoff=0;
else
synclient touchpadoff=1;
fi
I got it from http://crunchbang.org/forums/viewtopic.php?id=10996 . If I paste the script code in the terminal and execute it, it works (touchpad goes on/off). However, I want to bind it to a key so in my lubuntu-rc.xml I've added the following:
<!-- disable touchpad -->
<keybind key="XF86TouchpadToggle">
<action name="Execute">
<command>/usr/local/bin/touchpad.sh</command>
</action>
</keybind>
When I press the necessary key combo however I get "Failure to execute child process "/usr/local/bin/touchpad.sh" (No such file or directory)". However I can see in this directory, both in the file manager and when I use ls in the terminal that the file is there:
/usr/local/bin$ ls -l
total 4
-rwxrwxr-x 1 paspaldzhiev paspaldzhiev 145 юни 2 22:54 touchpad.sh
I used chmod +x touchpad.sh to make it executable.
Now, where this gets even more confusing:
If I use bash /usr/local/bin/touchpad.sh I get:
paspaldzhiev#areuexperienced:/usr/local/bin$ bash touchpad.sh
touchpad.sh: line 6: syntax error near unexpected token `fi'
touchpad.sh: line 6: `fi'
Though as I've said above I know for a fact that the code works if I just paste it in the terminal.
Further, if I use ./touchpad.sh I get :
paspaldzhiev#areuexperienced:/usr/local/bin$ ./touchpad.sh
bash: ./touchpad.sh: /bin/bash^M: bad interpreter: No such file or directory
Just to note that I'm not very sure what the difference between bash touchpad.sh and ./touchpad.sh is in terms of execution, it's just that my more Linux-savvy friends told me to try these :D.
In any case, I have no idea how to proceed henceforth, could anyone please shed a light on what I'm doing wrong?
Thank you very much!
The ^M in your last error msg is your big hint ; -). Somehow you have used a windows editor, file transfer or something. Try dos2unix touchpad.sh. It will remove all the CR (^M) chars from end of lines. It should work then. Good luck. – shellter
There is no need for script, since there is no need for if instruction.
Place this piece of code in your lubuntu-rc.xml
<keybind key="XF86TouchpadToggle">
<action name="Execute">
<command>synclient TouchpadOff=$((1-$(synclient | grep TouchpadOff | awk '{print $3}')))</command>
</action>
</keybind>

How can I perform some commands on Intersystem cache from shellscript?

I want to perform some commands on Intersystem cache from shell script. One solution which I know is through making a config file but the problem is I dont know how to use config file through shell script. Is there any other solution for this...
for example what I have to run on cache is
csession instancename
zn "area"
area>D ^%RI
Device:some/device/path
Next: It should take enter
This can be accomplished from a Linux shell, simply keep a log of the commands you need to perform and then put them into a script. Here's an example of logging into Cache and writing "Hello world" -- note that this also assumes you need to authenticate.
echo -e "username\npassword\nW \"Hello world\"\nH\n" | csession instance
Note that every command you would have run manually is in there and separated by "\n", this is the character that represents the "Enter" key.
It is possible (for some operating systems) to run the Cache terminal in batch mode. For example:
echo: off
wait for:Username
send: SYS<CR>
wait for:Password
send: XXX<CR>
echo: on
logfile: Somepath\myFile.log
send: ZN "AREA"
wait for:AREA>
send: D ^%RI
wait for:Device:
send: some/device/path
wait for:Next:
send: <CR>
This is documented in the Intersystems cache terminal documentation, especially the using terminal in batch mode section and the terminal scripts section.
This is a very old question .. as I came across the same thing and so with a little R&D I found a work around to this problem. Which is very cool and simple.
Let's say I have this file (can be with any extension with each command in separate line)
myScript.scr
zn "%SYS"
for e="a","b","c" { w e,! }
So passing it to cache terminal in case of UNIX is using csession with linux PIPE (|) operator
cat myScript.scr | csession {instance_name}
Eg.
cat myScript.scr | csession CACHE
output
a
b
c
Note:
• Don't separate a command in multiple lines else `csession` will through <SYNTAX> error. (See how I wrote the *for* loop)
• Extra knowledge - Intersystem Ensemble supports *Cache Terminal Batch Mode* in Windows case... While in linux there is no cterm to take the scripts..
• But linux gives you a work around to do this ;).
Hope this helps you guys!! cheers :D

How to nest a variable inside a variable?

I have a scenario in which I need to execute the below statement.
air sandbox run $AI_PLAN/Sam_22.plan
For the above command AI should be fetched from a command.
> echo $PREFIX
AI
I tried the below ways
air sandbox run $`echo $PREFIX`_PLAN/Sam_22.plan
returned error : File not found
dollar_prefix=$`echo $PREFIX`
air sandbox run ${dollar_prefix}_PLAN/Sam_22.plan
returned error : File not found
Please let me know where am I going wrong in the above coding.
You're going to need to eval something:
PREFIX=AI
AI_PLAN=some_directory
eval directory=\$${PREFIX}_PLAN
air sandbox run $directory/Sam_22.plan
try using command substitution:
$(command ...)_PLAN
Lets suppose the program make_prefix is in your path. Then:
> make_prefix
AI
> echo $(make_prefix)
AI
> echo $(make_prefix)_PLAN
AI_PLAN
It unclear what you actually want to have happen, but I can guess that you probably want something like
air sandbox ${${PREFIX}_PLAN}/Sam_22.plan
This will take the value of the variable PREFIX (AI in your case?) and append a _PLAN, and use THAT as the name of a variable to fetch

Resources