Friday, December 31, 2010

'Hello world' application in C with static library

I will show how to create 'Hello world' application in C, which will use static library.

Firstly, you must create header file for the library. In this file all functions will be declared.

mylib.h
extern void printhw();

Next, you must create source file and implement functions declared in the header file.

mylib.c
#include<stdio.h>
#include"mylib.h"

void printhw()
{
 printf("Hello world!\n");
}

Then compile your library.

gcc -c mylib.c

After compiling the library you must create an application which would use it.

main.c
#include<stdio.h>
#include"mylib.h"

int main()
{
 printhw();

 return 0;
}

Compile your application.

gcc -c main.c

Finally, make and run application.

gcc -o app main.o mylib.o
./app

You must get this result:

Hello world!

Tuesday, December 28, 2010

Group files in visual studio file explorer

Open the *.csproj file in a text editor. Find the following element:

<Compile Include="MVP\IMyView.cs" />
<Compile Include="MVP\IMyViewPresenter.cs" />
<Compile Include="MVP\MyOperation.cs" />

and edit it as follows:

<Compile Include="MVP\IMyView.cs" />
<Compile Include="MVP\IMyViewPresenter.cs">
   <DependentUpon>IMyView.cs</DependentUpon>
</Compile>
<Compile Include="MVP\MyOperation.cs" >
   <DependentUpon>IMyView.cs</DependentUpon>
</Compile>

The result is:

Friday, December 24, 2010

Initialize Git central repository

To create and initialize git repository on the server you must complete a few steps.

Create repository and a new group then add all the relevant users to that group and give the group ownership of the repository.

To init git repository on the server you must execute this command:

git init --bare --shared example.git

The shared option sets permissions on the everything in the repository to group writers.

Wednesday, December 22, 2010

Open command prompt in current folder

If you want to open command prompt in the current folder hold down shift and press the right mouse onto the folder. In Context menu will appear new menu item Open Command Window Here.



P.S. Works only on Vista and Windows 7 operating systems.

Tuesday, December 21, 2010

Guidelines in Visual Studio 2010

To enable guidelines in Visual Studio 2010 you must complete a few steps:

  • Install an Editor Guidelines tool. You can download it from here.
  • Run regedit.exe and select the key in register editor:      HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\Text Edit
  • Add string (REG_SZ) value called Guides and change its data to RGB(139,0,0) 120




Saturday, December 18, 2010

UMLet

UMLet - a free UML tool with a simple user interface. It lets you draw UML sketch diagrams. You can download it from here.


To read more about uml as sketch you can visit Martin Fowler's website and read the post.