Playground, Knowledge base, HowTo's

Hardware Architecture

Bit and Byte Ordering (Endianness and LSB/MSB)

Test for byte order

      %begin c++% int main() { union { __u32 my_int; __u8 my_bytes[4]; } et ;

      et.my_int = 0x0a0b0c0d; if(et.my_bytes[0] == 0x0a ) { printf( "I'm on a big-endian system\n" ); } else { printf( "I'm on a little-endian system\n" ); } return 0; } %end%
-- PeterZumbruch - 15 Apr 2009

C/C++

Coding Rules

Have a look at the coding rules of HADES.

C: static deklarations

Pointer, calloc, malloc, realloc, free

Make / GnuMake

string replacement

AutoIt

small little projects

switch 2 displays

  • problem: laptop: Windows XP, I need to switch often between single screen mode - only display activated - to 2 activated screens where the second one is the extension.
  • to do so, (german version of XP)
    1. I have to right-click on the empty desktop
    2. select "Eigenschaften"
    3. select the 5th tab
    4. select in the drop-down list the second monitor
    5. check/uncheck Windows Desktop erweitern
    6. click o.k.
  • the attached script does the same with one click !
%begin numbered:10 elisp% ; AutoIt Version: 3.0 ; Language: English ; Platform: Win9x/NT ; Author: Peter Zumbruch P.Zumbruch@gsi.de ; ; switch from 1 to 2 screen modus

Local Const $windowTitle = "Eigenschaften von Anzeige" Local Const $desktopCommand = "control.exe desk.cpl,@0,4"

; If open close sending a "close" request to the window AutoItSetOption("WinTitleMatchMode", 4) ; Get the handle of a notepad window that contains "this one" $handle = WinGetHandle($windowTitle) If NOT @error Then ; If open close sending a "close" request to the window WinClose($windowTitle) EndIf

; Run the desktop properties Run($desktopCommand)

; Wait for the window become active - it is titled $windowTitle WinWaitActive($windowTitle)

Send("!A") ; Alt+A, change to listbox of different displays Send("2") ; 2 , select second display Send("!W") ; Alt+W , check/uncheck erweiterter Bildschirm ControlClick($windowTitle,"",1) ; OK Button

; Finished! %end%

WMI

  • ... is:
    • Windows Management Instrumentation (WMI) is a set of extensions to the Windows Driver Model that provides an operating system interface through which instrumented components can provide information and notification. WMI is Microsoft's implementation of the Web-Based Enterprise Management (WBEM) Standard from the Distributed Management Task Force (DMTF). (Wikipedia)
    • WMI allows scripting languages like VBScript to manage Microsoft Windows personal computers and servers, both locally and remotely. WMI is preinstalled in Windows Server 2003, Windows XP, Windows Me, and Windows 2000. (Wikipedia)
    • Microsoft also provides a command line interface to WMI called Windows Management Instrumentation Command-line (WMIC). (Wikipedia)
  • Wikipedia:

VBS

Linux/Debian/Sarge

Problems

ssh access

  • Problem: Cannot Access to my machine from outside via ssh
    • only root is allowed to login
  • Solution ??? :
    • view /etc/security/access.conf
      • (may help) add a new line containing your username, but might be overwritten by cfengine
    • entry to cfengine ???

java

  • Problem:
    auf meiner Maschine erhalte ich eine Fehlermeldung beim Startversuch, der mich auf das angehaengte log-file verweist. Auf lxi001 startet das Programm ohne Probleme.
%begin java% > ------------------------------------------------------------------------
> SESSION Wed Sep 20 16:08:04 GMT+02:00 2006 ------------------------------------
> ENTRY org.eclipse.core.launcher 4 0 2006-09-20 16:08:04.592
> MESSAGE Exception launching the Eclipse Platform:
> STACK
> java.lang.ClassNotFoundException: org.eclipse.core.runtime.adaptor.EclipseStarter not found in org.eclipse.core.launcher.Main$StartupClassLoader{urls=[file:/usr/local/eclipse/eclipse-3.2/plugins/org.eclipse.osgi_3.2.0.v20060601.jar], parent=null}
> at java.net.URLClassLoader.findClass (URLClassLoader.java:841)
> at java.lang.ClassLoader.loadClass (ClassLoader.java:344)
> at java.lang.ClassLoader.loadClass (ClassLoader.java:295)
> at org.eclipse.core.launcher.Main.invokeFramework (Main.java:333)
> at org.eclipse.core.launcher.Main.basicRun (Main.java:280)
> at org.eclipse.core.launcher.Main.run (Main.java:977)
> at org.eclipse.core.launcher.Main.main (Main.java:952)
> at java.lang.reflect.Method.invoke0 (Method.java)
> at java.lang.reflect.Method.invoke (Method.java:255)
> at kaffe.jar.ExecJarName.main (ExecJarName.java:67)
> at kaffe.jar.ExecJar.main (ExecJar.java:75)
>
%end%

  • Lösung:
    nach langem Suchen - /etc/alternatives/java wies auf /usr/lib/kaffe/bin/java - ich (K.Miers) habe ein anderes Java-Paket installiert (sun-j2sdk1.5) und lasse /etc/alternatives/java darauf verweisen (/usr/lib/j2sdk1.5-sun/bin/java) - jetzt scheint eclipse zu starten.

CVS — Concurrent Versions System

Since it became to large this section is sourced out to its own topic Knowledge base CVS.
-- PeterZumbruch - 10 Jun 2008

CSS - Control System Studio

Default Display & Dynamic Faceplate

  1. Add/Extract this to your SDS project directory
    • zip file: common.zip: Extract to SDS of your workspace of CSS
  2. Change in Preferences → CSS Applications → Display → Default Display
    • Default Display to: SDS//common/alarmModifier.css-sds
    • Alias to: chan
  3. copy SDS/common/DynFaceplate/Script Rule (to be copied to SDS Script Rules)/dynamicDisplayTypeSDScommon.css-sdss into SDS Script Rules project

Now you get for (m)any EPICS variable(s) via the context menu (right click) CSS → Open in Display an default display

-- PeterZumbruch - 15 Jan 2009

TSM

(Re)Start TSM Scheduler

Problem: Missing DAILY_INCR backup

Missing DAILY_INCR backup
The scheduled backup of node XXXXXX (LINUXTSM1) did not take place on 04/03/09.
Probable reason: The dsmc schedule command was not running on local host LXDV18.
Please restart dsmc schedule.

Solution: restart

  • login as root
  • cd /etc/init.d
    ./tsm-ba start
    ./tsm-ba restart
    ./tsm-ba status
-- PeterZumbruch - 03 Apr 2009

Twiki

RENDERLIST

  ". epics [ -Options ] [ <version> ]"
   
  1. optional: ". <before script>"
   
  2. ". <loginScript>"
  (<loginScript> : "<epicsHome>/<epicsDirPrefix><version>/myepicslogin.sh")
   
  2.1. optional: ". <other local scripts>"
   
  2.2. ". <epicsHome>/<epicsDirPrefix><version>/epicslogin.sh"
  ( epicslogin.sh : usually a (soft) link to ${MY_ALL_EPICS_TOP_DIR}/bin or even to ${GSI_EPICS_INSTALLATIONS_TOP_DIR}/bin )
   
  ". $EPICS_HOME/base-<version>/Site.profile"
   
  2.3. optional: ". <other local scripts, e.g. setting of PATHs, init of cross-compilers>"
   
  3. optional: ". <after script>"

  one
  one.b
  one.b.x
  continue
  one.b.y
  Tim
  Mico


Inter-wikis

-- PeterZumbruch - 23 May 2016
InterWikis says that there is the possibility to include external wikis by aliases, also INCLUDE?

CPAN:

Foswiki:About/WebHome

Warning
This site does not allow %INCLUDE% of URLs

-- PeterZumbruch - 23 May 2016

EPICS

Test Setup "Temperatures & Co."

For testing features of EPICS I use 2-3 HadControl boards connected to temperature sensors

Start IOCs on HadControl

Using screen and konsole do the following:
  • open new konsole with a special profile (This should open three single session listening to session etrax048)
    $> konsole --profile etrax46-48
  • define in each session a variable myetrax:
    $> myetrax=<Etrax Name>
  • now switch back to the session etrax048
  • use screen to telnet
    $> screen -S IOC.${myetrax} telnet ${myetrax}
  • Enter <Name> & <Password>
  • Change to iocBoot directory:
    $> cd /home/hadaq/EPICS/epics_apps/HadControlTemperatureAndThreshold/iocBoot/iocHadControlTemperatureAndThreshold_linux-cris_v10
  • Start IOC:
    $> ./st_linux-cris_v10.cmd
  • Leave screen session by typing ^a d (CTRL+A D)
  • Leave konsole sessions
    $> exit

    Compact

    konsole --profile etrax46-48

    myetrax=<Etrax Namer>
    screen -S IOC.${myetrax} telnet ${myetrax}
    • Enter <Name> & <Password>

    cd /home/hadaq/EPICS/epics_apps/HadControlTemperatureAndThreshold/iocBoot/iocHadControlTemperatureAndThreshold_linux-cris_v10 &&
    ./st_linux-cris_v10.cmd
    • Leave screen session by typing ^a d (CTRL+A D)

    exit

Start Channel Archiver Engine

Using again screen to start the archiver engine:
  • by typing ...
    screen -S ChannelArchiver

    %begin bash% curableMissingLibs="libxerces-c.so"

    which ArchiveEngine || . epics

    echo "checking for missing libraries:" if [ -x $(which ArchiveEngine) ] then missingLibs=$(ldd $(which ArchiveEngine) | grep -w "=> not found") if [ 0 -ne ${#missingLibs} ] then missingLibs=${missingLibs//' => not found'/} missingLibs=$(echo $missingLibs | sed -e 's/^ //g') if [ ${curableMissingLibs} == ${missingLibs:0:${#curableMissingLibs}} ] then EPICS_PROGRAMS=${EPICS_PROGRAMS:?'EPICS_PROGRAMS not defined!'}

    echo $LD_LIBRARY_PATH | grep -q $EPICS_PROGRAMS/lib if [ 0 -eq $? ] then echo "$EPICS_PROGRAMS/lib" already contained in LD_LIBRARY_PATH, no automatic cure possible false else if [ -f "$EPICS_PROGRAMS/lib/${missingLibs}" ] then echo $LD_LIBRARY_PATH | grep -v -q $EPICS_PROGRAMS/lib && export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}\:}$EPICS_PROGRAMS/lib else echo "missing library \`$missingLibs\' not contained in \`$EPICS_PROGRAMS/lib\'" false fi fi fi fi if [ $? -eq 0 ] then clear echo 'start ChannelArchiver' echo dataPoolBase=/misc/zumbruch/playground/EPICS/ChannelArchiver/data poolDir=etrax047-048 logDirBase=/s/zumbruch/ChannelArchiver logFile=Index.log indexFile=Index description="Temperature Sensors" engineDir=/misc/zumbruch/playground/EPICS/ChannelArchiver/Temperature/Etrax47-48/Scripts/../Engine

    mkdir -p ${dataPoolBase}/${poolDir} # pool mkdir -p ${logDirBase}/${poolDir} # log cd ${dataPoolBase}/${poolDir} && ArchiveEngine -log ${logDirBase}/${poolDir}/${logFile} -description "${description}" ${engineDir}/engineconfig.xml ${dataPoolBase}/${poolDir}/${indexFile} &

    echo report "tail ${logDirBase}/${poolDir}/${logFile}": sleep 1; echo -n "."; sleep 1; echo -n "."; sleep 1; echo -n "."; sleep 1; echo -n "."; sleep 1; echo -n "."; echo -n "."; tail --lines=15 ${logDirBase}/${poolDir}/${logFile} fi fi %end%
  • Leave screen session by typing ^a d (CTRL+A D)
  • Leave konsole sessions
    $> exit

Start Standalone Archive Data Server

Using again screen to start the archiver engine:
  • by typing ...
    screen -S StandAloneDataServer

    %begin bash% curableMissingLibs="libxerces-c.so"

    which ArchiveDataServerStandalone || . epics

    echo "checking for missing libraries:" if [ -x $(which ArchiveDataServerStandalone) ] then missingLibs=$(ldd $(which ArchiveDataServerStandalone) | grep -w "=> not found") if [ 0 -ne ${#missingLibs} ] then missingLibs=${missingLibs//' => not found'/} missingLibs=$(echo $missingLibs | sed -e 's/^ //g') if [ ${curableMissingLibs} == ${missingLibs:0:${#curableMissingLibs}} ] then EPICS_PROGRAMS=${EPICS_PROGRAMS:?'EPICS_PROGRAMS not defined!'}

    echo $LD_LIBRARY_PATH | grep -q $EPICS_PROGRAMS/lib if [ 0 -eq $? ] then echo "$EPICS_PROGRAMS/lib" already contained in LD_LIBRARY_PATH, no automatic cure possible false else if [ -f "$EPICS_PROGRAMS/lib/${missingLibs}" ] then echo $LD_LIBRARY_PATH | grep -v -q $EPICS_PROGRAMS/lib && export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}\:}$EPICS_PROGRAMS/lib else echo "missing library \`$missingLibs\' not contained in \`$EPICS_PROGRAMS/lib\'" false fi fi fi fi if [ $? -eq 0 ] then clear echo 'start standAloneServer' echo dataPoolBase=/misc/zumbruch/playground/EPICS/ChannelArchiver/data poolDir=etrax047-048 indexFile=Index standaloneServerDir=/misc/zumbruch/playground/EPICS/ChannelArchiver/Temperature/Etrax47-48/StandAloneServer

    ArchiveDataServerStandalone ${standaloneServerDir}/abyss.conf ${dataPoolBase}/${poolDir}/${indexFile} fi fi %end%
  • Leave screen session by typing ^a d (CTRL+A D)
  • Leave konsole sessions
    $> exit
-- PeterZumbruch - 02 Apr 2009

-- PeterZumbruch - 18 May 2009
Topic attachments
I Attachment Action Size Date Who Comment
common.zipzip common.zip manage 32.8 K 2009-01-15 - 18:46 PeterZumbruch Extract to SDS of your workspace of CSS
switch2displays.au3au3 switch2displays.au3 manage 1.1 K 2006-08-24 - 12:34 PeterZumbruch Auto IT script file "switch 2 displays.au3"
switch2displays.exeexe switch2displays.exe manage 179.6 K 2006-08-24 - 12:35 PeterZumbruch compiled Auto IT script file "switch 2 displays.exe
Topic revision: r29 - 2016-05-23, PeterZumbruch
 
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding GSI Wiki? Send feedback
Imprint (in German)
Privacy Policy (in German)