Category Archives: Beruf

Alles was meinen Beruf und dessen Inhalte betrifft.

Zwei Festplatten-Partitionen unter Windows Server 2008 mit Bordmitteln zu einer verbinden

Es gibt diverse käuflich zu erwerbende Tools, mit denen Ihr viele schöne Schnickschnack-Sachen mit Festplatten-Partitionen machen könnt.

Wenn Ihr ganz einfach zwei Partitionen zu einer zusammen fassen wollt, dann könnt Ihr das auch mit Bordmitteln von Windows Server 2008 oder neuer machen.

Achtung, die Daten auf der zweiten Partition gehen dabei verloren, also vorher Sicherheitskopie erstellen!

Vorgehen

Um die zweite Partition zu löschen, könnt Ihr so wie hier beschrieben vorgehen:

  1. Disk-Management-MMC-Snap-in starten.
  2. Zweite Partition rechtsklicken und “Delete Volume” auswählen.
  3. Zweite Partition nochmals rechtsklicken und “Delete Partition” auswählen.
  4. Erste/primäre Partition rechtsklicken und “Expand Partition” auswählen.

Das war’s. So einfach geht das.

Fehlermeldung “CS0103: Der Name ‘ViewBag’ ist im aktuellen Kontext nicht vorhanden” bei ASP.NET MVC 4 lösen

Heute habe ich bei einem neu deployten Projekt mit ASP.NET 4.5 und MVC 4 folgende Fehlermeldung erhalten:

CS0103: Der Name ‘ViewBag’ ist im aktuellen Kontext nicht vorhanden CS0103: The name ‘ViewBag’ does not exist in the current context

Lokal lief alles, auf dem Produktivserver kam die Fehlermeldung. Ich habe lange gesucht, bis ich die funktionierende Lösung gefunden habe.

Lösung

Die Lösung war im Endeffekt, dass es zwei Web.Config-Dateien gibt:

Diese im Views-Ordner hat bei mir gefehlt. Sobald ich diese hinzugefügt und entsprechend gefüllt hatte, hat alles funktioniert.

Alle Sichten in einer Microsoft-SQL-Server-Datenbank aktualisieren

Um alle Views in einem Rutsch zu aktualisieren, hilft folgender Code:

DECLARE @view AS VARCHAR(255);

DECLARE views_cursor CURSOR FOR 
    SELECT TABLE_SCHEMA + '.' +TABLE_NAME FROM INFORMATION_SCHEMA.TABLES 
    WHERE TABLE_TYPE = 'VIEW' 
    AND OBJECTPROPERTY(OBJECT_ID(TABLE_NAME), 'IsMsShipped') = 0 
    ORDER BY TABLE_SCHEMA,TABLE_NAME 

OPEN views_cursor 

FETCH NEXT FROM views_cursor 
INTO @view 

WHILE (@@FETCH_STATUS <> -1) 
BEGIN
    BEGIN TRY
        EXEC sp_refreshview @view;
        PRINT @view;
    END TRY
    BEGIN CATCH
        PRINT 'Error during refreshing view "' + @view + '".';
    END CATCH;

    FETCH NEXT FROM views_cursor 
    INTO @view 
END 

CLOSE views_cursor; 
DEALLOCATE views_cursor;

Funktioniert wunderbar.

In der Praxis z.B. hilfreich, wenn in den zugrunde liegenden Tabellen Spalten hinzugekommen sind oder entfernt wurden.

CryptographicException bei Verwendung von Oracle.ManagedDataAccess lösen

Gestern hatte ein Kollege beim Aufsetzen einer Website ASP.NET MVC 4 auf einem IIS unter Windows Server 2008 R2 eine Fehlermeldung:

[CryptographicException: Unbekannter Fehler -1073741766.]
   System.Security.Cryptography.ProtectedData.Protect(Byte[] userData, Byte[] optionalEntropy, DataProtectionScope scope) +504
   Oracle.ManagedDataAccess.Client.ConnectionString.Secure() +493
   OracleInternal.ConnectionPool.PoolManager`3.Initialize(ConnectionString cs) +1760
   OracleInternal.ConnectionPool.OraclePoolManager.Initialize(ConnectionString cs) +21
   OracleInternal.ConnectionPool.OracleConnectionDispenser`3.GetPM(ConnectionString cs, PM conPM, ConnectionString pmCS, Byte[] securedPassword, Byte[] securedProxyPassword, Boolean& bAuthenticated, Boolean& newPM) +296
   OracleInternal.ConnectionPool.OracleConnectionDispenser`3.Get(ConnectionString cs, PM conPM, ConnectionString pmCS, Byte[] securedPassword, Byte[] securedProxyPassword) +1576
   Oracle.ManagedDataAccess.Client.OracleConnection.Open() +3756
   OracleInternal.EntityFramework.EFOracleProviderServices.GetDbProviderManifestToken(DbConnection connection) +274
   System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +91

[ProviderIncompatibleException: Der Anbieter hat keine ProviderManifestToken-Zeichenfolge zurückgegeben.]
   System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +10947809
   System.Data.Entity.ModelConfiguration.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +48

[ProviderIncompatibleException: An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct.]
   System.Data.Entity.ModelConfiguration.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +242
   System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) +82
   System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) +88
   System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input) +248
   System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +524
   System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +26
   System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +71
   System.Data.Entity.Internal.Linq.InternalSet`1.GetEnumerator() +21
   System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +446
   System.Linq.Enumerable.ToList(IEnumerable`1 source) +80

Zunächst war es eine Herausforderung, statt den “normalen” Oracle.DataAccess-Klassen die Oracle.ManagedDataAccess-Klassen zum Laufen zu bringen. Hier haben uns zwei Artikel geholfen:

Wir haben dann zum Lösen des eigentlichen Fehlers lange rumgesucht, viel ausprobiert und schließlich beim Weblog-Artikel “SOLVED: Windows Identity Foundation – “The system cannot find the file specified”” fündig geworden.

Die Lösung bestand dann schlicht darin, im Anwendungspool (App Pool) für die Anwendung die Option “Benutzerprofil laden” auf “True” zu stellen:

IIS App Pool - Benutzerprofil laden

Danach lief alles wie gewünscht.

How to solve “An app on your PC needs the following Windows feature: .NET Framework 3.5 (includes .NET 2.0 and 3.0)” on Windows 8

Are you a software developer and ever got this message when testing your .NET 2.0 WinForms application on Windows 8?

An app on your PC needs the following Windows feature: .NET Framework 3.5 (includes .NET 2.0 and 3.0)

An app on your PC needs the following Windows feature: .NET Framework 3.5 (includes .NET 2.0 and 3.0)

Even though your application would run on .NET 4, too?

Here is my story on why this happended to me and how to solve.

Why this happens

When you run a .NET application, Windows 8 seems to check whether the required .NET Framework is available. If it is not available, the above message is being displayed.

How to solve it

Windows 8 cannot know whether your application, compiled for .NET 2, also runs on .NET 4. It has the following knowledge:

  • The .NET Framework you compiled your application for
  • The processor bitness you compiled your application for (i.e. “x86″ or “Any CPU”)

If you want Windows 8 to be aware of anything other, you have to tell. To change the .NET Framework version, I created a configuration file with the same name as the application, in the same folder.

E.g. if your application is “my-app.exe”, your configuration file has to be “my-app.exe.config”. I use the following content of the file:

<?xml version="1.0"?>
<configuration>
    <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v2.0.50727"/>
        <supportedRuntime version="v4.0"/>
    </startup>
</configuration>

I.e. you have to tell the supported runtime.

This is sometimes not enough, though. In my scenario, I had the application compiled as “Any CPU” and configured for V2.0.50727 and v4.0 but still the above Windows message appeared.

My mistake was that on the test system, I only had a 32 bit V2.0.50727, not 64-bit, although the Windows itself was 64-bit. (I don’t know whether a 64-bit version of the .NET Framework exists at all)

So to solve this, I re-compiled the application to “x86″ and then, everything worked perfectly.

(Please correct me if any of my technical assumptions above are wrong)

Fax-/Scan-/Kopiergerät Lexmark X642e zu verschenken

+++ UPDATE +++ DRUCKER IST INZWISCHEN VERGEBEN +++ UPDATE +++

In der Firma haben wir unsere Multifunktions-Schnickschnack-Kopiereinheit Lexmark X642e ausgetauscht, weil der Einzug manchmal hängt und der Scanner eine schwarze Linie gemacht hat.

Falls Ihr Interesse an einer ansonsten voll funktionsfähigen Maschine habt, so könnt Ihr sie kostenlos gegen Selbstabholung hier in Göppingen, Manfred-Wörner-Straße 115, haben.

Das Teil hat sogar ein Touch-Display und einen Webserver zum Konfigurieren, Netzwerkanschluss und so weiter.

Impressionen

lexmark-x642e-01

lexmark-x642e-02

Interesse?

Schreibt mir eine E-Mail-Nachricht an uwe.keim@zeta-software.de!

+++ UPDATE +++ DRUCKER IST INZWISCHEN VERGEBEN +++ UPDATE +++

Große Dateien unter Windows und Apple OS X erstellen

Zum Testen meines Tools Zeta Uploader brauche ich immer wieder mal sehr große Dateien. Um diese zu erzeugen (mit leerem Inhalt), gibt es eingebaute Befehle ins Betriebssystem.

Unter Windows

Verwendet auf der Befehlszeile:

fsutil file createnew <filename> <length>

Damit wird dann eine Datei in der gewünschten Größe (in Bytes) angelegt. Tipp von Stack Overflow.

Unter Mac OS X

Verwendet im Terminal den Befehl:

mkfile <length> <filename>

Beispielsweise könnt Ihr “10240m” für die Länge angeben um eine 10-GB-Datei zu erstellen. Tipp auch von Stack Overflow.