(sys-info 7)
:)
nobody talking here, so quite. :(
Search found 107 matches
- Tue Sep 13, 2016 11:36 am
- Forum: newLISP in the real world
- Topic: how to know the current process id?
- Replies: 3
- Views: 4759
- Tue Sep 06, 2016 8:52 am
- Forum: newLISP in the real world
- Topic: how to know the current process id?
- Replies: 3
- Views: 4759
how to know the current process id?
I want to output current process id, save it as a file, the file content is all arguments of this process. e.g.
I have a test.lsp file, when running it with -a=b -c=d
I want to save a process id file: 16754,
cat 16754, I will see
-a=b -c=d
I have a test.lsp file, when running it with -a=b -c=d
I want to save a process id file: 16754,
cat 16754, I will see
-a=b -c=d
- Wed Aug 10, 2016 12:11 pm
- Forum: newLISP in the real world
- Topic: bug:post-url gets timeout when running long time
- Replies: 0
- Views: 6030
bug:post-url gets timeout when running long time
recently, I observed my newlisp app reports timeout error when post message to rest server. We have a few different rest servers. The status of servers are fine when getting timeout error in newlisp. If I stop the newlisp process and restart it, all get back to work fine. My friend who is using newl...
- Mon Aug 08, 2016 4:00 pm
- Forum: newLISP in the real world
- Topic: send one message, but child process gets many
- Replies: 2
- Views: 3919
Re: send one message, but child process gets many
Thanks, ralph. After replace until with if, it works. (define (child-process) (setq ppid (sys-info 6)) ; get parent pid (setq cur-pid (sys-info 7)) (while true (if (receive ppid msg) (begin ;; get new message from queue (append-file (string cur-pid ".log") (string msg "\n")) ) (begin ;; get nothing ...
- Sun Aug 07, 2016 1:29 pm
- Forum: newLISP in the real world
- Topic: send one message, but child process gets many
- Replies: 2
- Views: 3919
send one message, but child process gets many
Hi, I am using cilk api, one parent process sends one message to 5 child processes. But each child process receives the message many times. Why? Following is my code: (load "args.lsp") (parse-args) (setq process-number (int (ArgsTree "--process-number"))) (define (child-process) (setq ppid (sys-info...
- Tue Jul 05, 2016 1:50 pm
- Forum: newLISP in the real world
- Topic: logistic regression
- Replies: 0
- Views: 5827
logistic regression
I am in one project that using logistic regression to predict phone number from fraud. The engineers in my team are using python(maybe c++ later) library for logistic regression to do machine learning. I wonder how to implement this in newlisp, any basic functions from newlisp can be used in this ca...
- Thu Jun 30, 2016 7:38 am
- Forum: newLISP in the real world
- Topic: sort in v10.7.0
- Replies: 2
- Views: 4206
Re: [bug]sort in v10.7.0
Thanks. It's my bad. I use wrong variable files, but should be file-list.
There is no bug in sort function. My bug.
There is no bug in sort function. My bug.
- Wed Jun 29, 2016 9:26 am
- Forum: newLISP in the real world
- Topic: sort in v10.7.0
- Replies: 2
- Views: 4206
sort in v10.7.0
1 description I want to find oldest files when free space is not enough and delete them until free space is enough. Thus I find all files under one folder tree recursively and sort them by modified time. 2 code 2.1 find all files and save them into one list called file-list (define (add-file-list f)...
- Fri Apr 10, 2015 4:26 am
- Forum: newLISP in the real world
- Topic: url encode support
- Replies: 2
- Views: 2698
url encode support
I want to use get-url to call one REST API, but the URL path of this REST API contains some Chiness words, like this: http://localhost/wind_tunnel/clusters/跟踪系统/hosts when using browser, this url will be encoded by browser automatically: http://localhost/wind_tunnel/clusters/%E8%B7%9F%E8%B8%AA%E7%B3...
- Mon Feb 02, 2015 5:33 am
- Forum: newLISP in the real world
- Topic: want exponential smoothing way to do time series prediction
- Replies: 1
- Views: 2500
want exponential smoothing way to do time series prediction
In newlisp, I don't know use wich method or module to implement this?
Need your help.
Need your help.
- Sat Dec 13, 2014 5:50 pm
- Forum: newLISP in the real world
- Topic: how to return a reference in function
- Replies: 1
- Views: 2419
how to return a reference in function
Hi, I got some DAG code from rickyboy. In these code, I can get a node object from dag(I renamed it to Graph now) object, Graph and Node are FOOP object classes. Then I try to modify this node, but find it's just a copy. ;; @syntax (Graph:get-node node-name) ;; @description ;; <p>If you want to get ...
- Wed Dec 10, 2014 7:03 am
- Forum: newLISP in the real world
- Topic: Can I create a DAG in newlisp
- Replies: 4
- Views: 4404
Re: Can I create a DAG in newlisp
Thank yuu, johu. Your example is simple enough to understand.
Thank you rickyboy, you are so fast, I will learn your code carefully.
Thank you rickyboy, you are so fast, I will learn your code carefully.
- Tue Dec 09, 2014 5:59 am
- Forum: newLISP in the real world
- Topic: Can I create a DAG in newlisp
- Replies: 4
- Views: 4404
Can I create a DAG in newlisp
Hi, My task is to create a directed acyclic graph, I want to implement it using list. Can any one make an example for me? My simple case looks like: [img]1.png[/img] A and B are start nodes. Each node has properities, each edge has properties too. E, G and F are end nodes. I also need a way to find ...
- Mon Dec 08, 2014 5:38 pm
- Forum: newLISP in the real world
- Topic: How to pass a newlisp string to C function as uint8_t* arg
- Replies: 1
- Views: 2480
How to pass a newlisp string to C function as uint8_t* arg
The existing C function is: bson_t * bson_new_from_json (const uint8_t* data, ssize_t len, bson_error_t *error); I import it in newlisp: (import bson-lib "bson_new_from_json" "void*" "void*" "unsigned int" "void*") ;; I also tried to use char* instead ;; (import bson-lib "bson_new_from_json" "void*"...
- Mon Dec 08, 2014 5:31 pm
- Forum: newLISP in the real world
- Topic: How to pass NULL argument to C function
- Replies: 3
- Views: 3307
Re: How to pass NULL argument to C function
Thanks. I know to pass 0 as NULL argument now and how to use variadic function.
I still have some questions when developing mongodb.lsp based on mongodb c driver.
Will ask them in other threads.
I still have some questions when developing mongodb.lsp based on mongodb c driver.
Will ask them in other threads.
- Sun Dec 07, 2014 3:56 pm
- Forum: newLISP in the real world
- Topic: How to pass NULL argument to C function
- Replies: 3
- Views: 3307
How to pass NULL argument to C function
Hi, I want to pass a NULL argument to one C function. The C function looks like so: #define BCON_NEW(...) \ bcon_new (NULL, __VA_ARGS__, NULL) In newlisp , I write: (set 'bson-lib "/usr/local/lib/libbson-1.0.so") ;; @Import bson_t * bcon_new (void *unused,...) BSON_GNUC_NULL_TERMINATED; (import bson...
- Mon Oct 27, 2014 2:22 pm
- Forum: newLISP in the real world
- Topic: how to get exit status of last command
- Replies: 4
- Views: 4038
Re: how to get exit status of last command
Not sure if its convenient enough, but (! ..) returns the process status, and prints sub process output. So, you might discard that on the command, and do: (! "hdfs dfs -test -e /user/chenshu > /dev/null 2>&1") That only gives the return status. Thanks. But your way cannot be applied to all cases. ...
- Mon Oct 27, 2014 2:14 pm
- Forum: newLISP in the real world
- Topic: how to get exit status of last command
- Replies: 4
- Views: 4038
Re: how to get exit status of last command
I find an easy way to let exec return the correct status of command,
I wrote a newlisp script file for testing:
The output is:
x: ("0")
I wrote a newlisp script file for testing:
Code: Select all
#!/usr/bin/newlisp
(set 'x (exec "hdfs dfs -test -d /user/chenshu;echo $?"))
(println "x: " x)
(exit)
x: ("0")
- Mon Oct 27, 2014 2:01 am
- Forum: newLISP in the real world
- Topic: how to get exit status of last command
- Replies: 4
- Views: 4038
how to get exit status of last command
Hi, In bash, using echo $? to get the last command's exit status. But how to get it in newlisp? e.g. In bash, I get 0, it means the /user/chenshu folder exists in HDFS hdfs dfs -test -e /user/chenshu echo $? 0 In newlisp, I have to get it using following way: > (exec "hdfs dfs -test -e /user/chenshu...
- Sun Sep 07, 2014 2:58 pm
- Forum: newLISP in the real world
- Topic: delete non-empty folder
- Replies: 4
- Views: 3539
Re: delete non-empty folder
You are right. Thank you. :)
- Sun Sep 07, 2014 6:18 am
- Forum: newLISP in the real world
- Topic: delete non-empty folder
- Replies: 4
- Views: 3539
Re: delete non-empty folder
.. has been excluded. All file name ended with . will be excluded. dean@dean-Latitude-3330:~/Downloads$ mkdir -p x/x2/x3; touch x/x2/x3/z;touch x/x2/m;touch x/.sss; touch x/a.x; dean@dean-Latitude-3330:~/Downloads$ ll x total 20 drwxrwxr-x 3 dean dean 4096 Sep 7 14:16 ./ drwxr-xr-x 14 dean dean 1228...
- Sat Sep 06, 2014 7:15 am
- Forum: newLISP in the real world
- Topic: delete non-empty folder
- Replies: 4
- Views: 3539
delete non-empty folder
Because remove-dir only deletes empty folder, in real word, it cannot offer many help. For the most part, we need to delete a non-empty folder. I wrote delete-dir function for solving this. But want to ask Lutz, why don't you offer this kind of features? (define (make-sure-folder-path-end-of-slash d...
- Tue Jul 29, 2014 3:05 am
- Forum: Whither newLISP?
- Topic: newlisp to get mysql table command lead to messy code
- Replies: 7
- Views: 13002
Re: newlisp to get mysql table command lead to messy code
I fixed this problem. Just execute the following commands in newlisp before querying data from mysql table. (MySQL:query "SET character_set_client = utf8;") true (MySQL:query "SET character_set_connection = utf8;") true (MySQL:query "SET character_set_results = utf8;") Then check it: > (MySQL:query ...
- Sat May 24, 2014 5:23 am
- Forum: newLISP in the real world
- Topic: C library interfaces
- Replies: 1
- Views: 2078
Re: C library interfaces
Agree, that tool will make my life easier.
Hope Lutz will support this later.
Hope Lutz will support this later.
- Sat May 24, 2014 5:16 am
- Forum: newLISP in the real world
- Topic: Don't know how to pass a pointer of structure to C function
- Replies: 4
- Views: 3189
Re: Don't know how to pass a pointer of structure to C funct
Thanks for your advice. I tried a few minutes today. Get some progress with more questions. In my mongo.lsp file: (context 'Mongo) (set 'files '( "/usr/local/lib/libmongoc-1.0.so")) (set 'library (files (or (find true (map file? files)) (throw-error "cannot find libmongoc library")))) (import "/usr/...