Freitag, 26. Oktober 2012

Windows Phone 8 is coming

On Monday October 29th the time of waiting for the new Windows 8 Phone is over. The presentation of Windows Phone 8 will be in San Francisco. You can tune in the live webcast here. I hope they will show us what everyone is expecting – a new awesome release of Windows Phone fitting to Windows 8 with the new Windows RT surface tablets.

Montag, 10. September 2012

Nokia Lumia 820–Windows Phone 8

Here the specs for the new Nokia Lumia 820 smartphone running with Windows Phone 8.

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

Samstag, 30. Juni 2012

Empty Guid

Some times I need a empty Guid. The first purpose of this blog entry is therefore to find my empty guid quicker .-)

If you want to create a empty Guid with .NET in C# there are two ways:

Guid myGuid = new Guid();

This creates the exact same empty Guid ( 00000000-0000-0000-0000-000000000000 ) as:

Guid myGuid = Guid.Empty;

Sonntag, 19. Februar 2012

ASP.NET MVC 4 Beta veröffentlicht

Letztes Jahr zur Build wurde die neue Version des ASP.NET MVC Frameworks in der Version 4 angekündigt und ein Developer Preview veröffentlicht. Jetzt steht die Beta-Version von  ASP.NET MVC 4 unter ASP.NET zum Download bereit. Gegenüber dem Developer Preview sind einige wichtigen Punkte hinzugenommen und insbesondere die Unterstützung der Entwicklung von mobilen Applikationen wurde ausgebaut.
Die wichtigsten Neuerungen gegenüber dem Developer Preview sind:

ASP.NET Web API

Mit der ASP.NET Web API steht ein Framework zur Verfügung, um mit den bekannten Paradigmen von ASP.NET MVC mit beliebigen Web Services auf einfache Art und Weise zu kommunizieren. Dazu bietet die ASP.NET Web API ein einfaches Programmiermodell, um HTTP Requests und Responses direkt zu manipulieren und gegen ein streng typisiertes Datenmodell (domains) zu binden. Des weiteren unterstützt die ASP.NET Web API Routing, wie man dies von ASP.NET MVC
gewohnt ist. Ein weiteres schönes Feature ist die Verwendbarkeit von IQueryable<T> als Return-Type, die es ermöglicht auf die Services mit normaler OData Syntax zuzugreifen.
 
Weitere Infos zur ASP.NET web API sind hier zu finden.

Verbesserungen für die Razor Engine

Die Razor Engine versteht jetzt die “~”-Syntax für Verlinkungen (Z.B. <script> src=”~/Scripts/Site.js” />) und unterstützt bedingtes Attribut Rendering. So wird z.B. die Angabe der Style Class im Ausdruck <div class=”@myClass”>Inhalt</div> bei myClass=null auch nicht mehr gerendert.
 

NuGet Integration in MVC-Projekte

Das ASP.NET MVC 4 Projekt-Template bietet jetzt die Verwendung des NuGet Package Restore Features. Aktiviert man diese Option in der Solution werden nicht mehr die Binaries der NuGet Packages in ein Source Control System übernommen, sondern im Build Prozess wird geprüft, ob alle Packages in der entsprechenden Version gemäß der packages.config vorhanden sind und dann ggf. heruntergeladen.
 

Templates für mobile Applikationen

Das neue Projekt-Template für mobile Applikationen basiert auf dem Open Source Framwork jQuery Mobile und enthält bereits die Referenzen auf die KnockOut und Modernizer JavaScript Bibliotheken, die durch NuGet Packages in der aktuellen Version zur Verfügung gestellt werden. Insgesamt merkt man, das viel in der aktuellen Beta-Version von ASP.NET MVC zur Unterstützung der Entwicklung von mobilen Applikationen getan wurde.
 
Mittels der neuen Display Modes können darüber hinaus gemischte Web-Seiten für konventionelle Webseiten und touch-basierte Applikationen entwickelt werden.Legt man beispielsweise in einem Shared View-Folder die Datei _MyPartial.cshtml und _MyPartial.mobile.cshtml ab, wird beim Aufruf über einen mobilen Browser automatisch die mobile Version aufgerufen. Über die DisplayModeProvider-Klasse können sogar noch eigene Display Modes in Abhängigkeit vom UserAgent z.B. für das iPad definiert werden.
 

Fazit

Insgesamt bietet die Beta-Version von ASP.NET MVC 4 wieder sehr viele Bereicherungen, die es uns noch leichter macht mittels des bewährten MVC Pattern unter Ausnutzung der einfachen Razor-Engine traditionelle aber auch touch-basierte Web-Applikationen für den Anwender bereitzustellen.

Weiterführende Links

 

Sonntag, 16. Oktober 2011

Windows Phone 7: Issue with Textblock and Textbox rendering

There is an issue with Silverlight for Windows Phone if you try to show a Textblock or Textbox with a lot of text. In my current Windows Phone 7 project with have a listbox with comments and with large text sizes (above 3300 in our test cases) we have the effect that the space for the text is rendered but not all characters.

The result looks like this:

 image

This happens if the surrounding container object (for example Grid or Stackpanel) has a defined width and the Textbox or Textblock has the VerticalAlignment set to “Stretch”.

The XAML definition looks like this:

   1:  <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
   2:              <ListBox x:Name="MainListBox" Margin="0,0,-12,0" ItemsSource="{Binding Items}" SelectionChanged="MainListBox_SelectionChanged">
   3:                  <ListBox.ItemTemplate>
   4:                      <DataTemplate>
   5:                        <StackPanel Margin="0,0,0,17" Width="432" >
   6:                            <TextBlock Text="{Binding LineOne}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
   7:                            <TextBlock Text="{Binding LineTwo}" TextWrapping="Wrap" 
   8:                                       VerticalAlignment="Stretch"
   9:                                       Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>
  10:                        </StackPanel>
  11:                      </DataTemplate>
  12:                  </ListBox.ItemTemplate>
  13:              </ListBox>
  14:   </Grid>

The workaround for this problem is to truncate the text after 3300 characters or don’t use a fix width for the container of the Textbox or Textblock element.

The behaviour is the same in Windows Phone 7.0 and Windows Phone 7.1 projects.

Samstag, 15. Oktober 2011

Windows Phone 7–Mango süßsauer

Windows Phone Mango

 

Mein neuster Artikel in der Mobile Technology ist seit Freitag an den Kiosken erhältlich. Entgegen des Arbeitstitels “Mango süßsauer” geht es hier nicht um asiatische Kochspezialitäten, sondern um eine kurze Darstellung der neusten Features für  Entwickler bei Nutzung der Windows Phone Developer Tools 7.1 für die Entwicklung von “Mango”-Apps. Süßsauer deshalb, weil nicht nur die Neuerungen beschrieben werden, sondern auch ein Auge auf noch Ausbaufähiges zur Windows Phone Entwicklung gelegt wird.