Image Image Image Image Image
Scroll to Top

To Top

Johannes' Blog

30

Aug
2012

inNoSQL

vonJohannes Hoppe

NoSQL Bootcamp – Fazit

On 30, Aug 2012 | inNoSQL | vonJohannes Hoppe

Fazit: Ein aufmerksame Teilnehmer und ausgiebig NoSQL. Mir hat der Tag sehr viel Spaß gemacht!
Wie versprochen sind hier die Folien (alles in einem Set) sowie die Übungsdaten und die Lösungen zu den Aufgaben.


Hier sind die Trainingsdaten zu den Aufgaben auf Slide 90 und 92. Folgende Queries sind eine von mehreren Lösungen:

// 1. Find all scores less than 65. 
use training
db.scores.find( { score: { $lt: 65 }} );
 
// 2. Find the lowest quiz score. Find the highest quiz score. 
use training
db.scores.find({}).sort({score: -1}).limit(1);
db.scores.find({}).sort({score: 1}).limit(1);
 
// 3. Write a query to find all digg stories where the view count is greater than 1000. 
use digg
db.stories.find({ "shorturl.view_count" : { $gt : 1000 }}).count();
db.stories.find({ "shorturl.view_count" : { $gt : 1000 }});
 
// 4. Query for all digg stories whose media type is either 'news' or 'images' and where the topic name is 'Comedy’.
use digg
db.stories.find({'topic.name' : 'Comedy', media: { $in : ['news', 'images']}}).count();
db.stories.find({'topic.name' : 'Comedy', media: { $in : ['news', 'images']}});
 
// 5. Find all digg stories where the topic name is 'Television' or the media type is 'videos'. Skip the first 5 results, and limit the result set to 10.
db.stories.find({$or : [ {'topic.name' : 'Television' } , { media: 'videos' } ] }).skip(5).limit(10);
 
// 1.  Set the proper 'grade' a
db.scores.update({'score': {"$gte": 90}}, {'$set': {grade: "A"}}, false, true);
db.scores.update({'score': {"$gte": 80, $lte: 90}}, {'$set': {grade: "B"}}, false, true);
 
// 2.  You're being nice
db.scores.update(
	{'score': {"$lte": 60}, 'name' : 'exam'}, 
	{'$inc': {score: 10}},
	false, true);

Tags | , ,

16

Aug
2012

inNoSQL

vonJohannes Hoppe

Introducing Mongo2Go

On 16, Aug 2012 | inNoSQL | vonJohannes Hoppe

Mongo2Go is a manged wrapper around the latest MongoDB binaries. It targets .NET 3.5. and should work in later versions, too.
Currently the Nuget package contains the executables of mongodmongoimport and mongoexport v2.2.0-rc1 (32bit).

Mongo2Go has two use cases:

  1. Providing multiple, temporary and isolated MongoDB databases for unit tests (or to be precise: integration tests)
  2. Providing a quick to set up MongoDB database for a local developer environment

Tags | ,

05

Aug
2012

inNoSQL

vonJohannes Hoppe

NoSQL Bootcamp – ICH WILL DEINEN ARSCH IN WOLFSBURG SEHEN!

On 05, Aug 2012 | inNoSQL | vonJohannes Hoppe

 

Die DNUG Braunschweig und ich veranstalten ein Bootcamp zum Thema NoSQL. Und du bist dabei!

Datum: 29.08.2012 / 0-100
Ort: Operational Services GmbH & Co. KG, T-Systems-Gebäude, Alessandro-Volta-Str. 11, 38440 Wolfsburg 

Beschreibung:
Eine große Anzahl an neuartigen Datenbank-Systemen drängt auf den Markt. Lerne jetzt das Rüstzeug kennen, um mit .NET erfolgreich hochskalierende Lösungen für die Cloud zu entwickeln.
Das Bootcamp führt in die Theorie ein und stellt die NoSQL-Datenbanksysteme Redis, RavenDB und MongoDB vor. Im Fokus steht die Open-Source Datenbank MongoDB. Der Workshop beinhaltet Übungsaufgaben und ein umfassendes ASP.NET MVC Beispielprojekt, welche allen Teilnehmern zur Verfügung gestellt wird.

Agenda 

1,5h – Vortrag: Einführung NoSQL mit Redis, MongoDB und RavenDB
2,5h – MongoDB Übungsaufgaben mit der JavaScript-Shell und .NET/C#
2h – Vortrag mit Diskussion & Übungsaufgaben: Schemadesign
1h – MongoDB auf Azure, Ausblick Hadoop auf Azure

Voraussetzungen
Laptop mit Visual Studio 2010 (Express)
Grundkenntnisse in .NET und ASP.NET MVC

Veranstaltungsort:
Operational Services GmbH & Co. KG

T-Systems-Gebäude
Alessandro-Volta-Str. 11
38440 Wolfsburg

Anmeldung:
Die Anmeldung erfolgt in dem du einfach eine E-Mail an [email protected] schickst.
Es gibt 25 Plätze. Das Bootcamp ist kostenlos.

Tags | , ,

10

Mai
2012

inNoSQL

vonJohannes Hoppe

NoSQL bei der .NET Developer Conference (DDC) – Slides & Download

On 10, Mai 2012 | inNoSQL | vonJohannes Hoppe

1: Vortrag: NoSQL in .NET – mit Redis und MongoDB
Der Vortrag führt in die Theorie ein, stellt die beiden NoSQL-Datenbanksysteme Redis und MongoDB näher vor und gibt Praxisbeispiele. Ich präsentiere die beiden Systeme live an einem ASP.NET MVC Beispielprojekt, welches allen Teilnehmern zur Verfügung gestellt wird.

2. Vortrag: NoSQL – Dokumente und Relationen
Eine dokumentenbasierte NoSQL-Datenbank wie MongoDB hat nicht nur eine andere API zur Abfrage der Daten. Die tiefergehende Neuerung ist eine grundlegende andere Art die Daten abzuspeichern. Der Vortrag konzentriert sich auf Schema-Design und bekannten Patterns für Dokumenten-basierte Datenbanken.


 

Tags | , , ,

08

Mai
2012

inNoSQL

vonJohannes Hoppe

.NET User Group Karlsruhe – 2x NoSQL mit .NET

On 08, Mai 2012 | inNoSQL | vonJohannes Hoppe

Update:
Es war ein sehr angenehmer Abend. Ich danke dem aufmerksamen und auch beharrlichen Publikum für das positive Feedback und die interessanten Diskussionen! Hier sind ein paar Fotos und das Slidedeck.


Die Demo Anwendung findet ihr auf http://webnote.codeplex.com.

Original:


Für die baldige DDC habe ich mein Folienset zum Themenkomplex NoSQL komplett überarbeitet.
Die Generalprobe wird mein Vortrag bei der .NET User Group Karlsruhe sein, wo ich beide Vorträge in zwei kurzen & knackigen Stunden präsentieren werde. Ich freue mich auf euer Kommen!

xCutting – AOP bei der .NET User Group Niederrhein – Video, Slides & Download

On 12, Apr 2012 | inAOP, Clean Code Developer | vonJohannes Hoppe

Johannes Hoppe spricht von seiner Sicht über Clean-Code und die Grenzen von objektorientierter Programmierung bei der .NET User Group Niederrhein. Anhand praktischer Bespiele zeigt er, wie man mit dem AOP-Framework Postsharp elegante Modularisierungsansätze erhält. Der Vortrag richtet sich an interessierte Einsteiger in das Thema Aspektorientierte Programmierung (AOP) mit .NET.

Alle relevanten Code-Fragmente sind weiter unten aufgelistet!

  1. ActionResult Edit
  2. MyConvertExeption
  3. LogTimeAspect
  4. SimpleCacheBaseAspect


Hier sind alle Code-Fragmente aus dem Video:

ActionResult Edit

[HandleError(ExceptionType = typeof(MyException))]
[AcceptVerbs(HttpVerbs.Post)]
[MyConvertExeption]
public ActionResult Edit(Note noteToEdit, int[] newCategories)
{
    NoteWithCategories changedNote = this.WebNoteService.Update(noteToEdit, newCategories);
    return View(changedNote);
}


MyConvertExeption

using PostSharp.Aspects;
 
[Serializable]
public class MyConvertExeption : OnExceptionAspect
{
    public override void OnException(MethodExecutionArgs args)
    {
        throw new MyException("Fehler", args.Exception);
    }
}

LogTimeAspect

namespace PostsharpAspects.Logging
{
    using System;
    using System.Diagnostics;
    using System.Reflection;
 
    using NLog;
 
    using PostSharp.Aspects;
    using PostSharp.Aspects.Dependencies;
 
    [Serializable]
    [ProvideAspectRole(StandardRoles.PerformanceInstrumentation)]
    [AspectRoleDependency(AspectDependencyAction.Order, AspectDependencyPosition.After, StandardRoles.Caching)]
    [AspectRoleDependency(AspectDependencyAction.Order, AspectDependencyPosition.After, StandardRoles.ExceptionHandling)]
    [AspectRoleDependency(AspectDependencyAction.Commute, StandardRoles.PerformanceInstrumentation)]
    public class LogTimeAspect : OnMethodBoundaryAspect
    {
        private const int SlowTotalMilliseconds = 250;
 
        private static readonly Logger Logger = LogManager.GetLogger("LogTimeAspect");
        private static readonly Stopwatch Stopwatch = new Stopwatch();
        private string instanceName;
 
        static LogTimeAspect()
        {
            Stopwatch.Start();
        }
 
        /// <summary>
        /// Method executed at build time.
        /// </summary>
        public override void CompileTimeInitialize(MethodBase method, AspectInfo aspectInfo)
        {
            this.instanceName = method.DeclaringType.FullName + "." + method.Name;
        }
 
        /// <summary>
        /// Saves the time method start
        /// </summary>
        [DebuggerStepThrough]
        public override void OnEntry(MethodExecutionArgs args)
        {
            args.MethodExecutionTag = Stopwatch.ElapsedTicks;
        }
 
        /// <summary>
        /// Stops the time on method end
        /// </summary>
        [DebuggerStepThrough]
        public override void OnExit(MethodExecutionArgs args)
        {
            long timeInTicks = Stopwatch.ElapsedTicks - (long)args.MethodExecutionTag;
            double totalMilliseconds = TimeSpan.FromTicks(timeInTicks).TotalMilliseconds;
 
            if (totalMilliseconds > SlowTotalMilliseconds)
            {
                Logger.Trace(String.Format("{0}ms\t- {1}", totalMilliseconds, this.instanceName));
            }
 
            base.OnExit(args);
        }
    }
}

SimpleCacheBaseAspect

namespace PostsharpAspects.Caching
{
    using System;
    using System.Reflection;
    using System.Text;
 
    using PostSharp.Aspects;
 
    using PostsharpAspects.Caching.CacheImplementation;
 
    [Serializable]
    public class SimpleCacheBaseAspect : OnMethodBoundaryAspect
    {
        protected ICache Cache { get; set; }
 
        public override void CompileTimeInitialize(MethodBase method, AspectInfo aspectInfo)
        {
            string prefix = method.DeclaringType.ToString();
            this.Cache = new Cache(prefix);
        }
 
        public override void OnEntry(MethodExecutionArgs args)
        {
            string cacheKey = GenerateCacheKey(args);
            object value = this.Cache.Get(cacheKey);
 
            if (value == null)
            {
                args.MethodExecutionTag = cacheKey;
                return;
            }
 
            args.ReturnValue = value;
            args.FlowBehavior = FlowBehavior.Return;
        }
 
        public override void OnSuccess(MethodExecutionArgs args)
        {
            string cacheKey = (string)args.MethodExecutionTag;
            this.Cache.Insert(cacheKey, args.ReturnValue);
        }
 
        protected static string GenerateCacheKey(MethodExecutionArgs args)
        {
            StringBuilder stringBuilder = new StringBuilder();
 
            for (int i = 0; i < args.Arguments.Count; i++)
            {
                if (i > 0)
                {
                    stringBuilder.Append("|");
                }
 
                stringBuilder.AppendFormat(
                    "{0}_{1}",
                    args.Method.GetParameters()[i].Name,
                    args.Arguments.GetArgument(i) ?? "null");
            }
 
            return stringBuilder.ToString();
        }
    }
}

Tags | ,

07

Apr
2012

inAOP

vonJohannes Hoppe

Vortrag zu AOP bei der .NET User Group Niederrhein

On 07, Apr 2012 | inAOP | vonJohannes Hoppe

Als Entwickler sind wir täglich bemüht hochwertigen und sauberen Code zu produzieren. Für viele Probleme kennen wir bewährte Patterns und Vorgehensweisen. Doch manche Belange – wie etwa Logging, Exception Handling, Validierung oder Caching – liegen schnell unsauber verstreut im gesamten Projekt herum.

Bei dem Treffen der .NET Usergroup Niederrhein spreche ich von meiner Sicht über Clean-Code und die Grenzen von objektorientierter Programmierung. Anhand praktischer Bespiele zeige ich, wie man mit dem AOP-Framework Postsharp elegante Modularisierungsansätze erhält.

Der Vortrag richtet sich an interessierte Einsteiger in das Thema AOP mit .NET.
Sofern bereits Postsharp auf dem Laptop installiert ist, können alle Beispiele Anhand der ASP.NET MVC Demo-Applikation WebNoteAOP nachvollzogen werden.

Tags | , ,

19

Mrz
2012

inNode.js
NoSQL

vonJohannes Hoppe

Getting started with Node.js and MongoDB on MS Azure – Slides and VIDEO

On 19, Mrz 2012 | inNode.js, NoSQL | vonJohannes Hoppe

Johannes at MongoDB Berlin 2012

It was a  great pleasure to attend the MongoDB workshops and to speak at the conference about Node.js and MongoDB on MS Azure. Here are my slides and the recorded Video:


Tags | , , ,

19

Mrz
2012

inNode.js
NoSQL

vonJohannes Hoppe

Introducing SolarTournament

On 19, Mrz 2012 | inNode.js, NoSQL | vonJohannes Hoppe

For my latest talk I have prepared a node.js demo project, called „SolarTournament“. It demonstrates a bunch of technologies.
But first of all: Let’s have some fun and enter the live multiplayer tournament!

Don’t get confused: At the moment you can’t destroy other players spaceships, only asteroids. It’s simply not implemented. Or in other words: Nobody gets harmed! ;-)

Screenshot

This is demo code

The game is based on Node.js and uses the express web development framework, the Jade template engine, the Stylus CSS engine, Socket.IO for WebSocket communication and last but not least MongoDB – for storing the highscore. (this feature is not online at the moment)

Tags | , , ,

31

Jan
2012

inNoSQL

vonJohannes Hoppe

VSone 2012 – Slides and Demo code (NoSQL in .NET mit RavenDB und MongoDB)

On 31, Jan 2012 | inNoSQL | vonJohannes Hoppe

I’m happy! This is was a really full conference room.  Many thanks for coming and participating. I enjoyed the talks before and after the presentation. It’s great to hear that more and more people are evaluating NoSQL databases. As promised: Here are the slides and the demo code! (sorry, in German only) Don’t forget to install WebNoteNoSQL (which is coded in English, of course).


Tags | ,