2011-10-10 16:01:48
Write a XML file by using Perl
$AutoRunKeywordsComments_Log = "qweak_daq_conf.xml"; my @automode_xml_tags = qw (QWEAKDAQ STATUS STARTKEYWORDS ENDKEYWORDS COMMENTS); use XML::Writer; my $output; open($output, '>', $AutoRunKeywordsComments_Log) or die "Unable to open output file: $!"; my $writer = new XML::Writer(OUTPUT => $output); $writer->xmlDecl(); $writer->startTag($automode_xml_tags[0]); $writer->characters("\n"); $writer->startTag($automode_xml_tags[1]); $writer->characters("auto"); $writer->endTag($automode_xml_tags[1]); $writer->characters("\n"); $writer->startTag($automode_xml_tags[2]); $writer->characters("Automode 1"); $writer->endTag($automode_xml_tags[2]); $writer->characters("\n"); $writer->startTag($automode_xml_tags[3]); $writer->characters("Automode 2"); $writer->endTag($automode_xml_tags[3]); $writer->characters("\n"); $writer->startTag($automode_xml_tags[4]); $writer->characters("This is the automode run log"); $writer->endTag($automode_xml_tags[4]); $writer->characters("\n"); $writer->endTag($automode_xml_tags[0]); $writer->end(); close $output;So the output is
auto Automode 1 Automode 2 This is the automode run log
Read a XML file by using Perl
use XML::Simple; my $ref = XMLin($AutoRunKeywordsComments_Log); $AutoHClog_Status = $ref->{"$automode_xml_tags[1]"}; $AutoHClog_StartKeywords = $ref->{"$automode_xml_tags[2]"}; $AutoHClog_EndKeywords = $ref->{"$automode_xml_tags[3]"}; $AutoHClog_Comments = $ref->{"$automode_xml_tags[4]"};
Read a XML file by using Bash
rdom () { local IFS=\> ; read -d \< E C ;} automode_xml=qweak_daq_conf.xml while rdom; do if [[ $E = STATUS ]]; then automode_status=$C elif [[ $E = STARTKEYWORDS ]]; then automode_start_keywords=$C elif [[ $E = ENDKEYWORDS ]]; then automode_end_keywords=$C elif [[ $E = COMMENTS ]]; then automode_comments=$C fi done < $automode_xml echo "---- Automode DAQ Status Settings" echo "Auto Qweak DAQ status : $automode_status" echo "Start Keywords : $automode_start_keywords" echo "End Keywords : $automode_end_keywords" echo "Comments : $automode_comments"The rdom function is from a refererence
Read a XML file by using Tcl
Need the tDOM package.load /lib/tdom0.8.3/libtdom0.8.3.so proc read_autolog_xml {} { global automode_status global automode_start_keywords global automode_end_keywords global automode_comments set autolog_xml qweak_daq_conf.xml set xmlfile [open $autolog_xml] set XML [read $xmlfile] close $xmlfile set doc [dom parse $XML] set root [$doc documentElement] set automode_status_node [$root selectNodes /QWEAKDAQ/STATUS/text()] set automode_start_keywords_node [$root selectNodes /QWEAKDAQ/STARTKEYWORDS/text()] set automode_end_keywords_node [$root selectNodes /QWEAKDAQ/ENDKEYWORDS/text()] set automode_comments_node [$root selectNodes /QWEAKDAQ/COMMENTS/text()] set automode_status [$automode_status_node data] set automode_start_keywords [$automode_start_keywords_node data] set automode_end_keywords [$automode_end_keywords_node data] set automode_comments [$automode_comments_node data] puts "Status : $automode_status" puts "Start Keywords : $automode_start_keywords" puts "End Keywords : $automode_end_keywords" puts " Comments : $automode_comments" }
2011-02-15 23:31:57
Linus says: "C++ is a horrible language"
C++ is a horrible language. It's made more horrible by the fact that a
lot of substandard programmers use it, to the point where it's much
much easier to generate total and utter crap with it. Quite frankly,
even if the choice of C were to do nothing but keep the C++ programmers out, that in itself would be a huge reason to use C.
Linus
I am so glad, someone has the same feeling which I have now.
2010-12-06 13:54:14
git commands
git pull git add /file/ or /directory/ git rm -rf /directory/ git commit -a git rm -r packages/ed/ git diff ../file/ git pull git push git push --force
2010-08-12 18:15:00
JLab Scientific Computing system.
copy a coda file into a /cache/mss/hallc/qweak/raw directory by using JLab Scientific Computing System.http://scicomp.jlab.org$ jcache -g hallc /mss/hallc/qweak/raw/ts_2crate_5084.dat.0
copy a coda file into a local direcotyr at level 2 machine/site/bin/jgetremote /mss/hallc/qweak/raw/track_noR1_7916.dat.0 ~/scratch/data/.
check the job status on http://scicomp.jlab.org
2010-06-07 11:54:03
taskSpawn in VxWorks
int taskSpawn
(
char * name, /* name of new task (stored at pStackBase) */
int priority, /* priority of new task */
int options, /* task option word */
int stackSize, /* size (bytes) of stack needed plus name */
FUNCPTR entryPt, /* entry point of new task */
int arg1, /* 1st of 10 req'd task args to pass to func */
int arg2,
int arg3,
int arg4,
int arg5,
int arg6,
int arg7,
int arg8,
int arg9,
int arg10
)
taskSpawn ("ROC", name of ROC task
200, priority
8, task option ??
250000, size of stack
coda_roc, entry point of new task
"", 1st arg
"-session", 2nd arg (-session)
"cdaq", 3rd arg ("session name")
"-objects", 4th arg (-objects")
"ROC11 ROC" 5th arg of coda_roc (ROC11 ROC)
)
2010-06-07 11:00:16
Ethernet Connection in Hall C for Qweak
* Twenty-four Ethernet connections for Qweak
doghouse ---- T20 Rack ---- PANEL A ---- Fiber Optic Slot(FOS)
cable # Patch Panel HC01Z04 Netgear or hallc-cat2950
1 1 1 FOS 6
2 2 2 FOS 16
3 3 3 FOS 10
4 4 4 FOS 17
5 5 5 FOS 18
6 6 6 FOS 19
7 7 7 FOS 20
8 8 8 FOS 5
9-15 9-15 9-15 1-7 (Netgear switch)
16-24 16-24 16-24 available ports on
hallc-cat2950 (cisco)
* Detailed use of T20 Rack Patch Panel #
FOS
1 -------- Reserved (Boot Power Strip for ROC9)
2 -------- Reserved (Boot Power Strip for ROC10)
3 -------- hcreboot13 (Boot Power Strip for others)
4 -------- hctsv11 (portserver)
5 -------- IOC for Hall Probe (hctsv11 2002)
6 -------- qwvme9 (CPU of ROC9) (hctsv11 2008)
7 -------- qwvme10 (CPU of ROC10) (hctsv11 2007)
8 -------- qwvme11 (CPU of ROC11) (hctsv11 2006)
Netgear
9 -------- qwvme9mon (ROC9 crate Power Monitor)
10 -------- qwvme10mon (ROC10 crate Power Monitor)
11-15 Reserved (connected to the doghouse)
Cisco
16 -------- qwscannerctrl (scanner controller unit)
17-22 Reserved (not connected)
23 -------- a Netgear 4port switch (doghouse, temp?)
24 -------- region 3 rotator controller