Low Level Virtual Machine (LLVM)

October 6th, 2010 No comments

The Low Level Virtual Machine (LLVM) is a compiler infrastructure, written in C++, which is designed for compile-time, link-time, run-time, and “idle-time” optimization of programs written in arbitrary programming languages. Originally implemented for C/C++, the language-independent design (and the success) of LLVM has since spawned a wide variety of front ends, including Objective-C, Fortran, Ada, Haskell, Java bytecode, Python, Ruby, ActionScript, GLSL, and others.

LLVM can provide the middle layers of a complete compiler system, taking intermediate form (IF) code from a compiler and outputting an optimized IF that can then be converted and linked into machine-dependent assembler code for a target platform. LLVM can accept the IF from the GCC toolchain, allowing it to be used with a wide array of existing compilers written for that project.

LLVM can also generate relocatable machine code at compile-time or link-time or even binary machine code at run-time.

LLVM supports a language-independent instruction set and type system. Each instruction is in static single assignment form (SSA), meaning that each variable (called a typed register) is assigned once and is frozen. This helps simplify the analysis of dependencies among variables. LLVM allows code to be compiled statically, as it is under the traditional GCC system, or left for late-compiling from the IF to machine code in a just-in-time compiler (JIT) in a fashion similar to Java. The type system consists of basic types such as integers or floats and five derived types: pointers, arrays, vectors, structures, and functions. A type construct in a concrete language can be represented by combining these basic types in LLVM. For example, a class in C++ can be represented by a combination of structures, functions and arrays of function pointers.

Additional links:

Ubuntu Tweak

October 4th, 2010 No comments

Ubuntu Tweak is an application to config Ubuntu easier for everyone. It provides many useful desktop and system options that the default desktop environment doesn’t provide.

As a Ubuntu user, you always get excited when you see something new in Ubuntu world. You play with new applications, new themes, new applets… After playing with them, you may find something break the desktop, and you don’t know how to recover to the original style.

That’s what the Desktop Recovery will help you.

Desktop Recovery is the tool integrated into Ubuntu Tweak to help people safely tweak with desktop settings, and never worry about how to go back.

It has three basic actions:

  • Backup: backup the current settings, keep as many as backups you want;
  • Recover: recover to the backup;
  • Reset: even you don’t have any backup, you can also reset to the default settings;

And what items does Desktop Recovery can backup? Here’s it is:

  • GNOME Desktop settings: Panel, Themes, Background;
  • Application settings which use GConf: gedit, Compiz, Empathy, Nautilus… You know, almost every desktop applications;
  • System components: Input method (ibus), network-manager, proxy…

You can see, Desktop Recovery covers almost everything of desktop/applications.

One thing You MUST know: it will only operate with the setting, not the files related with the setting. E.G. It will backup the setting about the background name, but not the real background file.

Install Ubuntu Tweak in ubuntu

Open the terminal and run the following commands

sudo add-apt-repository ppa:tualatrix/ppa
sudo apt-get update
sudo apt-get install ubuntu-tweak

ubuntugeek.com

How to remove the old kernel versions from ubuntu using ubuntu tweak

  1. Select “Package Cleaner” on the left and “Clean Kernel” from the right panel.
  2. Press the “Unlock” button at the lower right, enter your password.
  3. Select from the displayed list the kernel images and headers you wish to remove. The kernel in use is not listed.
  4. Press the “Cleanup” button at the lower right to remove the selected kernel images and headers.

ubuntugeek.com

Real-time operating system

October 3rd, 2010 No comments

A real-time operating system (RTOS) is an operating system (OS) intended for real-time applications. Such operating systems serve application requests nearly real-time. A real-time operating system offers programmers more control over process priorities. An application’s process priority level may exceed that of a system process. Real-time operating systems minimize critical sections of system code, so that the application’s interruption is nearly critical.

A key characteristic of a real-time OS is the level of its consistency concerning the amount of time it takes to accept and complete an application’s task; the variability is jitter. A hard real-time operating system has less jitter than a soft real-time operating system. The chief design goal is not high throughput, but rather a guarantee of a soft or hard performance category. A real-time OS that can usually or generally meet a deadline is a soft real-time OS, but if it can meet a deadline deterministically it is a hard real-time OS.

Wiki

Currently the best known, most widely deployed, real-time operating systems are:

See the list of real-time operating systems for a comprehensive list.

Additional RTOS:

Tags:

Oscar Wilde

October 2nd, 2010 No comments

“I am not young enough to know everything.”

Oscar Wilde
Irish dramatist, novelist, & poet (1854 – 1900)

The Quotations Page

Tags:

Tom Wujec: Build a tower, build a team

September 27th, 2010 Comments off

Tom Wujec presents some surprisingly deep research into the “marshmallow problem” — a simple team-building exercise that involves dry spaghetti, one yard of tape and a marshmallow. Who can build the tallest tower with these ingredients? And why does a surprising group always beat the average?

Tags: , , ,

Dan Pink on the surprising science of motivation

September 27th, 2010 Comments off

Career analyst Dan Pink examines the puzzle of motivation, starting with a fact that social scientists know but most managers don’t: Traditional rewards aren’t always as effective as we think. Listen for illuminating stories — and maybe, a way forward.

Autonomy, mastery and purpose.

Results Only Work Environment (ROWE).

Standard Template Library (STL) lectures

September 10th, 2010 No comments

In the following series, learn all about STL from the great Stephan T. Lavavej, Microsoft’s keeper of the STL cloth (this means he manages the partnership with the owners of STL and Microsoft, including, of course, bug fixes and enhancements to the STL that ships as part of Visual C++).

  • Part 1 (sequence containers)
  • Part 2 (associative containers)
  • Part 3 (smart pointers)
  • Part 4 (an extended example of using the STL to solve Nurikabe puzzles)
  • etc

Alexander A. Stepanov

September 6th, 2010 No comments

Alexander Alexandrovich Stepanov (Russian: Александр Александрович Степанов) (born November 16, 1950 in Moscow) is the primary designer and implementer of the C++ Standard Template Library [1], which he started to develop around 1992 while employed at HP Labs. He had earlier been working for Bell Labs close to Andrew Koenig and tried to convince Bjarne Stroustrup to introduce something like Ada Generics in C++.

Лекция «Наибольшая общая мера последние 2500 лет» (часть 1 и часть 2)
Слайды: англ и рус.

Лекция «Преобразования и их орбиты» (часть 1 и часть 2)

Elements of Programming – (November 3, 2010) Speakers Alexander Stepanov and Paul McJones give a presentation on the book titled “Elements of Programming”. They explain why they wrote and attempt to explain their book. They describe programming as a mathematical discipline and that it is extremely useful and should not be overlooked.

Stepanov’s homepage

Vigenere Cipher Algorithm (Delphi Implementation)

August 30th, 2010 Comments off

Here’s the Vigenere crypto algorithm as suggested by Allan:

function Vigenere(Src, Key : string; Encrypt : boolean) : string;
const
  OrdMinChar : integer = Ord('A');
  OrdMaxChar : integer = Ord('Z');
  IncludeChars : set of char = ['A'..'Z'];
var
  CharRangeCount, i, j, KeyLen, KeyInc, SrcOrd, CryptOrd : integer;
  SrcA : string;
begin
  CharRangeCount := OrdMaxChar - OrdMinChar + 1;
  KeyLen := Length(Key);
  SetLength(SrcA, Length(Src));
  If Encrypt then
  begin
    // transfer only included characters to SrcA for encryption
    j := 1;
    for i := 1 to Length(Src) do
    begin
      if (Src[i] in IncludeChars) then
      begin
        SrcA[j] := Src[i];
        inc(j);
      end;
    end;
    SetLength(SrcA, j - 1);
  end;
  SetLength(Result, Length(SrcA));
  if Encrypt then
  begin
    // Encrypt to Result
    for i := 1 to Length(SrcA) do
    begin
      SrcOrd := Ord(Src[i]) - OrdMinChar;
      KeyInc := Ord(Key[((i - 1 ) mod KeyLen)+ 1]) - OrdMinChar;
      CryptOrd := ((SrcOrd + KeyInc) mod CharRangeCount) + OrdMinChar;
      Result[i] := Char(CryptOrd);
    end;
  end;
  else
  begin
    // Decrypt to Result
    for i := 1 to Length(SrcA) do
    begin
      SrcOrd := Ord(Src[i]) - OrdMinChar;
      KeyInc := Ord(Key[((i - 1 ) mod KeyLen)+ 1]) - OrdMinChar;
      CryptOrd := ((SrcOrd - KeyInc + CharRangeCount)
                   mod CharRangeCount) + OrdMinChar;
      // KeyInc may be larger than SrcOrd
      Result[i] := Char(CryptOrd);
    end;
  end;
end;

Saving Window Size State

August 30th, 2010 No comments
class MainWindow : public QMainWindow
{
 Q_OBJECT;
public:
 MainWindow(QWidget *parent = 0) : QMainWindow(parent)
 {
   QSettings settings;
   restoreGeometry(settings.value("mainWindowGeometry").toByteArray());
   // create docs, toolbars, etc...
   restoreState(settings.value("mainWindowState").toByteArray());
 }

 void closeEvent(QCloseEvent *event)
 {
   QSettings settings;
   settings.setValue("mainWindowGeometry", saveGeometry());
   settings.setValue("mainWindowState", saveState());
 }
};

int main(int argc, char *argv[])
{
 QApplication a(argc, argv);
 QCoreApplication::setOrganizationDomain("OrgDomain");
 QCoreApplication::setOrganizationName("OrgName");
 QCoreApplication::setApplicationName("AppName");
 QCoreApplication::setApplicationVersion("1.0.0");

 MainWindow w;
 w.show();

 return a.exec();
}

The above code will save and restore window position, size, toolbar visibility, toolbar docking area, dock states, locations and sizes. It saves using QSettings which will store your settings in a platform correct way.

Source