NASA’s 10 rules for developing safety-critical code

1: Restrict all code to very simple control flow constructs. Do not use GOTO statements, setjmp or longjmp constructs, or direct or indirect recursion.

2: All loops must have a fixed upper bound. It must be trivially possible for a checking tool to statically prove that a preset upper bound on the number of iterations of a loop cannot be exceeded. If the loop-bound cannot be proven statically, the rule is considered violated.

3: Do not use dynamic memory allocation after initialization.

4: No function should be longer than what can be printed on a single sheet of paper (in a standard reference format with one line per statement and one line per declaration.) Typically, this means no more than about 60 lines of code per function.

5: The assertion density of the code should average a minimum of two assertions per function. Assertions must always be side effect-free and should be defined as Boolean tests.

6: Data objects must be declared at the smallest possible level of scope.

7: Each calling function must check non-void function return values, and the validity of parameters must be checked inside each function.

8: Preprocessor use must be limited to the inclusion of header files and simple macro definitions. Token pasting, variable argument lists (ellipses), and recursive macro calls are not allowed.

9: The use of pointers should be restricted. Specifically, no more than one level of dereferencing is allowed. Pointer dereference operations may not be hidden in macro definitions or inside typedef declarations. Function pointers are not permitted.

10: All code must be compiled, from the first day of development, with all compiler warnings enabled at the compiler’s most pedantic setting. All code must compile with these setting without any warnings. All code must be checked daily with at least one—but preferably more than one—state-of-the-art static source code analyzer, and should pass the analyses with zero warnings.

Advertisements

ScreenShots

A screenshot, screen capture (or screen-cap), screen dump,screengrab is an image taken by the computer user to record the visible items displayed on the monitor, television, or another visual output device. Usually, this is a digital image using the operating system or software running on the computer, but it can also be a capture made by a camera or a device intercepting the video output of the display.

 

1. PicPick

PicPick, all-in-one design tool for everyone

A full-featured screen capture tool, Intuitive image editor, color picker, color palette, pixel-ruler, protractor, crosshair, whiteboard and more.

User friendly and full of features for creating your image, Suitable for software developers, graphic designers and home users.

Please note that free version may only be used for personal use in non-commercial environments.

2. GreenShot

Greenshot is a light-weight screenshot software tool for Windows with the following key features:

  • Quickly create screenshots of a selected region, window or fullscreen; you can even capture complete (scrolling) web pages from Internet Explorer.
  • Easily annotate, highlight or obfuscate parts of the screenshot.
  • Export the screenshot in various ways: save to file, send to printer, copy to clipboard, attach to e-mail, send Office programs or upload to photo sites like Flickr or Picasa, and others.
  • …and a lot more options simplyfying creation of and work with screenshots every day.

Greenshot is free and open source.

Also See

Browsing Source Code with OpenGrok

“A wicked fast source browser”

{OpenGrok is a fast and usable source code search and cross reference engine. It helps you search, cross-reference and navigate your source tree. It can understand various program file formats and version control histories like Mercurial, Git, SCCS, RCS, CVS, Subversion, Teamware, ClearCase, Perforce, Monotone and Bazaar. In other words it lets you grok (profoundly understand) source code and is developed in the open, hence the name OpenGrok. It is written in Java. OpenGrok is an open source project and is distributed under CDDL. OpenGrok uses software libraries from Apache Software Foundation.

Steps to get OpenGrok on Ubuntu and Browsing your source code

1. Install Java and TomCat 7

  • $sudo apt-get install default-jdk tomcat7

In case old version of tomcat is installed, check and uninstall before installing Tomcat 7

  • $dpkg --get-selections | grep tomcat
  • $sudo apt-get purge tomcat*

2. Check the details about tomcat

  • $cd /usr/share/tomcat7/bin/
  • $./catalina.sh

Output

    Using CATALINA_BASE: /usr/share/tomcat7
    Using CATALINA_HOME: /usr/share/tomcat7
    Using CATALINA_TMPDIR: /usr/share/tomcat7/temp
    Using JRE_HOME: /usr
    Using CLASSPATH: /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar

3. Adding export vars
Edit your ~/.bashrc and include using the directory pointed by CATALINA_BASE include the following vars:
export CATALINA_HOME=/usr/share/tomcat7/
export OPENGROK_TOMCAT_BASE=$CATALINA_HOME

4. Run the tomcat and check if it is working:

  • $sudo /etc/init.d/tomcat7

Done!!! installed!!!! Check if it is running now!!! Using your favorite browser type in the web address: http://localhost:8080/
If ok you should see a web page with message “It works!”

    5. Install C tags

    • sudo apt-get install exuberant-ctags

    6. Installing OpenGrok

    • Download opengrok-0.11.1.tar.gz from java.net/projects
    • unpack into /tools
      $sudo mkdir /tools
      $sudo cd /tools
      $sudo tar –xvzf ~/opengrok-0.11.1.tar.gz
      $sudo chmod 777 –Rv /tools
    • Creating OpenGrok working directories
      $sudo mkdir -p /var/opengrok/src
      $sudo mkdir -p /var/opengrok/data
      $sudo mkdir -p /var/opengrok/etc
      $sudo chmod 777 –Rv /var
    • Deploying Opengrok
      /tools/opengrok-0.11.1/bin$sudo ./OpenGrok deploy
      Alternatively, copy OpenGrok all into Tomcat’s webapp folder
      $sudo cp /tools/opengrok-0.11.1/lib/source.war /var/lib/tomcat7/webapps
    • Checking OpenGrok – Visit http://localhost:8080/source/

    7. Specifying Source folder

    • $sudo cd /var/opengrok/src
    • $sudo ln -s /home/<username>/src_base/ src_base

    8. Indexing your source code

    • $sudo /tools/opengrok-0.11.1/bin/OpenGrok index
      Alternatively, You can invoke with path containing your source code.
    • $sudo /tools/opengrok-0.11.1/bin/OpenGrok index /home/<username>/src_base/

    9. Visit http://localhost:8080/source/ and start browsing your code!!

    ANTLR

    ANTLR, ANother Tool for Language Recognition, is a language tool that provides a framework for constructing recognizers, interpreters, compilers, and translators from grammatical descriptions containing actions in a variety of target languages. ANTLR provides excellent support for tree construction, tree walking, translation, error recovery, and error reporting. There are currently about 5,000 ANTLR source downloads a month.

     

    Interesting places

    Dingbats

    A dingbat is an ornament, character or spacer used in typesetting, sometimes more formally known as a printer’s ornament or printer’s character. The term continues to be used in the computer industry to describe fonts that have symbols and shapes in the positions designated for alphabetical or numeric characters.

    Dingbat Fonts

    Also see

     

     

    Automation and Boost your Productivity

    1. AutoHotKey

    Fast scriptable desktop automation with hotkeys
    Creating your own apps and macros has never been easier

    AutoHotkey is a free, open-source macro-creation and automation software utility that allows users to automate repetitive tasks in Microsoft Windows. Any application user interface can be modified by AutoHotkey (for example, overriding the default Windows control key commands with their Emacs equivalents). It is driven by a custom scripting language that is aimed specifically at providing keyboard shortcuts or hotkeys.

     

    2. SmartGUI Creator for AutoHotKey

    SmartGUI Creator is an easy point-n-click GUI (user interface) creator!. You just draw a user interface the way you like and a script will be generated where you can input code deciding what happens when a certain button is pressed etc.
    http://www.autohotkey.com/board/topic/738-smartgui-creator/

    3. AutoIt

    AutoIt is a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting. It uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks in a way not possible or reliable with other languages (e.g. VBScript and SendKeys). AutoIt is also very small, self-contained and will run on all versions of Windows out-of-the-box with no annoying “runtimes” required!
    https://www.autoitscript.com/