Posts mit dem Label Tools werden angezeigt. Alle Posts anzeigen
Posts mit dem Label Tools werden angezeigt. Alle Posts anzeigen

Sonntag, 12. August 2012

Using GIT on a QNap server with Windows clients

Because I am using now a long time my Qnap server as home server in meantime for media streaming and as NAS file storage system, I tried now to use it as source control server for my personal projects too. My requirement was to have a source control system also for my IOS projects and Windows Visual Studio projects. So my decision was to use GIT.

Because it was a little bit tricky to install, here are my installation steps:

Installing GIT for Windows

Download and install Git for Windows at
http://msysgit.github.com/

Also you need PuTTY for the ssh connection to remote control the Qnap system.

PuTTY-Connection

# ipkg install git
# ipkg install gitosis

Check the passwd file at the Qnap system if the Gitosis user is created and the
home directory for the user exists. If not, create the user with the Qnap Web interface.

Maybe you have to login the user (no password)
at the web file system interface of Qnap to create the home directory.

 

GITBASH

1.$ cd ~/.ssh // move to dir where keys are normally stored
2.$ ls // list contents of .ssh directory
3.id_rsa id_rsa.pub known_hosts public.ppk
4.// here you can see I have an existing pair of msys keys
5.$ mkdir key_backup // make a directory to move old keys
6.$ cp id_rsa* key_backup // copy keys to key_backup dir
7.$ rm id_rsa* // remove original keys

Generate public and private key pair at the windows client and transfer it to the
Qnap system. Then you can do the git administration from this client.

1.$ ssh-keygen -t rsa -C "youremail@address.com"
2.Generating public/private rsa key pair.
3.Enter file in which to save the key (/c/documents/<user>/ssh/id_rsa):
4.Enter passphrase (empty for no passphrase):
5.Enter same passphrase again:
6.Your identification has been saved in /c/documents/<user>/ssh/id_rsa.
7.Your public key has been saved in /c/documents/<user>/ssh/id_rsa.pub.
8.The key fingerprint is:
9.e8:ae:60:8f:38:c2:98:1d:6d:84:60:8c:9e:dd:47:81 youremail@address.com

copy public Key to your Qnap host:

scp ~/.ssh/id_rsa.pub admin@<host>:/tmp/

 

PuTTY-Connection

Generate ECDSA Key if it not exists in /opt/etc/openssh:

/share/MD0_DATA/.qpkg/Optware/bin/ssh-keygen -t ecdsa -f /opt/etc/openssh/ssh_host_ecdsa_key -N ''

Init Gitosis with the public key of your administration windows client:

sudo -H -u gitosis /opt/bin/gitosis-init < /tmp/id_rsa.pub

the following folders should be genarted in the referenced home directory of the gitosis user (see passwd file)
'/share/HDA_DATA/gitosis/gitsosis'
'/share/HDA_DATA/gitosis/repositories'
-> here gitosis-admin.git
/share/HDA_DATA/gitosis/.ssh/authorized_keys

change access rights:

chmod 755 /share/HDA_DATA/gitosis/repositories/gitosis-admin.git/hooks/post-update

Change standard port of the Qnap SSH over Web interface

change port from 22 to 2201 for SSH. You have to change the remote control SSH session to the new port. The port 22 is now used by Gitosis with Openssh.

Install OpenSSH

# ipkg install openssh openssh-sftp-server

You can configure OpenSSH with the file '/opt/etc/openssh/sshd_config' (note: not ssh_config!).
After you have made your changes, you need to reload the daemon configuration:

# /opt/etc/init.d/S40sshd reload

I changed this value of my sshd_config:

Protocol 2
AllowUsers gitosis <--- make gitosis the only user authorized
PermitRootLogin no
UsePrivilegeSeparation no
PermitUserEnvironment yes <--- load user environment (home directory)

Subsystem sftp /opt/libexec/sftp-server

# /opt/etc/init.d/S40sshd start
or
# /opt/etc/init.d/S40sshd restart

GITBASH


# git clone gitosis@host:gitosis-admin.git

Maybe you have to delete the known_hosts file in ~/.ssh at the windows client

Further informations: http://wiki.qnap.com/wiki/Gitosis

Sonntag, 17. April 2011

Android apps with C#

Developing Android apps with C# and.NET technologies?

What sounds strange is now possible with Mono for Android 1.0 (short: Monodroid), recently published by Novell. With Monodroid you can develop applications for Android-Smamtphones with Visual Studio 2010. Mono 1.0 is thereby fully integrated in Visual Studio 2010.  The corresponding APIs for the Dalvik engine have been adjusted for C#, also the JIT compiler is fully usable. In addition, the use of F# and IronJS and partly also IronPython and Ironruby with Monodroid should be possible.

Sonntag, 18. April 2010

Facts of the week 18.04.2010

Diese Woche gibt es einiges zu berichten über die am Dienstag erschienen Version von Visual Studio 2010, dem neuen Resharper 5.0 und natürlich meinem Lieblingsthema dem am Freitag veröffentlichten Version 4 von Silverlight mit den dazugehörigen Tools für Visual Studio 2010 sowie den WCF RIA Services.

Visual Studio 2010

Erster Eindruck: Huch alles Lila, ist ja auch dieses Jahr eine Modefarbe. Sogar die Microsoft-Mitarbeiter tragen auf den Raodshows Lila.

Von der Oberfläche auf dem ersten Blick natürlich wieder einmal gewöhnungsbedürftig, wie bei allen neuen Sachen. Besonders schön finde ich die echte Unterstützung von mehreren Monitoren. Die Multi-Edit-Funktion ist auch nicht schlecht, gerade wenn man wieder mal mehrere Namespaces umbenennen muss.

=> Nächste Woche mehr……

Resharper 5.0

Ein Tool was ich bisher immer unterschätzt habe, aber diese Woche hat mich die Version 5.0 überzeugt. Resharper 5.0 bietet jetzt nicht nur die üblichen Codierungserleichterungen, wie “}” automatisch setzen, sondern hat zwei Features, die für sich genommen schon den Einsatz von Resharper 5.0 rechtfertigen.

Pattern Catalog unter Tools: Pattern für Suchen und Ersetzen

Jeder Entwickler hat so eine Marotten, die er immer wieder falsch macht. Bei mir ist dies z.B. die Abfrage eines Leerstrings. Neige immer dazu if (myString==””) zu kodieren, anstatt die saubere Variante string.IsNullOrEmpty($value$) zu verwenden. Für diese Unsauberkeiten kann man jetzt unter Tools im Resharper 5.0 Pattern anlegen, die einem dann der Resharper wie die anderen Regeln automatisch meldet. Klasse Sache!

Lokalisierung einfach gemacht

Eine der größten Verbrechen ist es, wenn man eine mehrsprachige Anwendung entwickeln will und die Standard-Resource-Files nutzen muß. Hier ist man nämlich normalerweise im Entwicklungsprozess gezwungen zwischen Designer bzw. Code-Editor und Resourcen-Dateinen hin un her zu springen. Das kostet unheimlich Zeit. Doch mit Resharper 5.0 ist damit nun endlich Schluß. Hier kann man einfach über einer Zeichenkette (grüner Schlingel  drunter) die rechte Maustaste drücken und dann im Kontextmenü die entsprechende Funktion aufrufen. Ressource-File aussuchen, fertig. Resharper 5.0 trägt dann die Zeichenkette mit einem generierten Key ins Ressource-File ein und setzt die Verweise darauf im Coding richtig. Das funktioniert sogar bei DataAnnotations (z.B. Fehlermeldungen bei Validierungen).

WCF RIA Services

Bei den WCF RIA Services für .NET 4.0 und Visual Studio 2010 hat sich einiges getan. Wie mittlerweile üblich bei Microsoft Produkten, wurden zum Releasetermin alle Namespaces und Assemblies überarbeitet, so dass sich vielfältige Änderungen ergeben. Darüber hinaus sind auch einige Methoden bzw. Properties weggefallen oder wurden an andere Objekte “gehängt”.

Eine Übersicht über alle Änderungen gibt es in meinem Blog  Changes of WCF RIA Services for Visual Studio 2010 | .NET - Red zone : Best practices and latest stuff. Die Informationen stammen aus einem entsprechenden Word-Dokument von Microsoft.

Montag, 22. Februar 2010

Microsofts Concurrency Coordination Runtime (CCR) - Asynchron und doch zusammen

Wenn man mit asynchronen Tasks arbeitet, steht man oft vor dem Problem, das man diese zwar asynchron aufrufen möchte, aber dennoch im Haupttask auf das Ergebnis der losgelaufenen Prozesse warten möchte.

Einen Ansatz, wie dies mit WCF-Mitteln zu lösen ist, liefern uns in der Dotnetpro 3/2010 die Autoren Tobias Richling et al. in folgendem Artikel. Einen alternativen Ansatz unter Verwendung des Kommunikationsframework Xcoordination Application Space zeigt uns Ralf Westphal in seinem Beitrag One Man Think Tank Gedanken: Asynchronizität. Das Xcoordination Application Space (AppSpace)-Framwork ist eine Open Source Komponente, die bei CodePlex liegt und die Verteilung von Anwendungen erlaubt, die mit Microsofts Concurrency Coordination Runtime (CCR) arbeiten.

Ein einfaches Beispiel für einen Worker-Prozess (in mehreren Threads) sieht dann so aus:

   1: using System;
   2: using System.Threading;
   3: using Microsoft.Ccr.Core;
   4: using XcoAppSpaces.Core;
   5:  
   6: namespace MainDemo
   7: {
   8:     class Demo01SimpleWorker
   9:     {
  10:         public static void Main()
  11:         {
  12:             Console.WriteLine("Xco Application Space - Simple Worker Demo / Running on thread {0} / [Enter] to finish", Thread.CurrentThread.GetHashCode());
  13:  
  14:             using (XcoAppSpace space = new XcoAppSpace())
  15:             {
  16:                 // Start a worker locally. Using the call the worker is registered in the AppSpace instance
  17:                 // and listed as active. It´s now ready to received messages through its contract instance.
  18:                 // Workers are singletons.
  19:                 space.RunWorker<PWorker, MyWorker>();
  20:  
  21:                 PWorker w = space.Resolve<PWorker>();
  22:                 w.Post(1);
  23:                 w.Post("hello");
  24:                 w.Post(2);
  25:                 w.Post("world!");
  26:  
  27:                 // Without stopping here the process would terminate before the work
  28:                 // in the background has been finished.
  29:                 Console.ReadLine();
  30:             }
  31:  
  32:             Console.ForegroundColor = ConsoleColor.Green;
  33:             Console.WriteLine("Done! Some output has been generated.");
  34:         }
  35:  
  36:  
  37:         internal class PWorker : PortSet<int, string>{}
  38:  
  39:         // Workers need to implement a CCR Port or PortSet as its contract
  40:         internal class MyWorker : PWorker
  41:         {
  42:             // Mark methods to process contract messages with an Xco App Space attribute
  43:             // to have them automatically wired to a contract port.
  44:             [XcoConcurrent]
  45:             void ProcessInt(int msg)
  46:             {
  47:                 Console.WriteLine("  Received int {0} on thread {1}", msg, Thread.CurrentThread.GetHashCode());
  48:             }
  49:  
  50:             [XcoConcurrent]
  51:             void ProcessString(string msg)
  52:             {
  53:                 Console.WriteLine("  Received string '{0}' on thread {1}", msg, Thread.CurrentThread.GetHashCode());
  54:             }
  55:         }
  56:     }
  57: }

Mittwoch, 17. Februar 2010

XAML Powertoys: Do you speak XAML?

Für alle die kein akzentfreies XAML (Extensible Application Markup Language) sprechen und auch nicht zu den Notepad-Puristen gehören, benötigen entweder Expression Blend oder ein adäquates Tool, um das UI-Design für eine Silverlight- oder WPF-Anwendung zu erstellen.
Diese Tool könnte das Visual Studio Plugin XAML PowerToys sein, welches einem einiges an Tipparbeit erspart und mittels einer Oberfläche die Erstellung von XAML Fragmenten erlaubt. So kann man z.B. über die Business Form eine Tabellenstruktur (=Raster) für seine UI-Elemente festlegen und diese dann mit den Controls befüllen.
Die PowerToys erkennen dabei, ob eine Silverlight- oder WPF-Applikation erstellt wird und generieren die entsprechenden XAML Statements.

Montag, 1. Februar 2010

Windows Azure Storage Explorer

Um den Inhalt des Storage anzeigen zu lassen, zum Beispiel zu Testzwecken, kann man den Windows Azure Storage Explorer von Codeplex verwenden.