Featured
Posted by
Sebastian Gross on Juni 10th, 2015.
When you’ve used twitter bootstrap to kickstart your html, you surely have visited the bootstrap homepage at some point. When you did you should have noticed the side menu which is always displaying your current position on the (very long) page. This menu is powered by the scrollspy and affix plugin also offered by twitter bootstrap. It’s fairly easy to integrate this menu in your own project, which I did lately. The problem At some point my menu got too long and that caused two problems for the user: first, the currently highlighted menu item was not visible anymore and second, it was not possible for the user to scroll […]
Featured
Posted by
Sebastian Gross on März 23rd, 2015.
Introduction On a website project at work i had to implement a feature that allowed the user to download one or more messages as a zip file. When i started, i really was shocked how complicated it is to zip or unzip a String in java. If you glance over to csharp the whole zip-thing looks easy as pie: Those wrapper classes from System.IO make it really easy to create and read archives. After a bit of trial and error i was able to create some easy to use java methods which do the same. So for you (and for me as a future reference), here’s the code. Zipping / […]
Featured
Posted by
Sebastian Gross on Februar 26th, 2015.
Introduction Open Auth is everywhere, maybe you even read my article on how to retrieve calendar events from your google calendar using open auth. In this article i would like to show you a simple way to create an open auth login for your asp.net mvc website. Basically you can just open up visual studio and create a new asp.net mvc project and select individual user as the authentication template. Visual studio will now create a new project template for you with working examples for Google, Facebook and Microsoft open auth login. But as you’ll quickly notice this is a very complex example which is only good for authentication, so […]
Featured
Posted by
Sebastian Gross on Oktober 30th, 2014.
Introduction Calendars are fun and every big player on the market (Google, Microsoft, Yahoo, you name it) provides its own implementation of one, usually for free. And it’s even more fun to integrate those calendars into your own apps and services. Lucky for us, all major calendar providers offer pretty good support and well documented APIs for us to use in our apps. In this post you will see how easy it is to set up a simple application that uses the google calendar API to access calendar events. API Setup Whenever you want to use a third party API ,you need to register your application as a client in […]
Featured
Posted by
Sebastian Gross on Januar 30th, 2014.
Spring offers you a lot of possibilities when it comes to configuration. But sometimes this billions of possibilities can be a real pita! Reacently i had to connect a Spring MVC application to a LDAP authentication server and since the webapp allready run on spring security i decided to keep it that way an use the LdapAuthenticationProvider offered by spring. When your project is simple enough so you can use the default configurations offered by spring the complete working LDAP configuration can be as simple as this: It’s as simple as that. Unfortunately our webapp doesn’t get the roles from the LDAP, it’s only used to authenticate the user, the roles […]
Featured
Posted by
Sebastian Gross on September 6th, 2013.
Als ich vor einer Weile die Anforderung bekam eine Prüfung für IBANs zu implementieren habe ich gedacht ich bin im 10 Minuten fertig, das Internet ist groß, stimmts? Google ist nur einen Klick entfernt, oder? Nun ja, nach den ersten Suchvorgängen habe ich den einen oder anderen Beitrag gefunden der einen mehr oder weniger brauchbaren IBAN Validator verlinkt. Doch die Validierung einer IBAN ist im Grunde der einfache Teil, das etwas schwierigere Vorhaben ist aber die Strukturelle Prüfung einer IBAN. Dazu kann man zwar einige Web-Tools finden, die das bei bedarf erledigen, aber eine ordentliche Library sucht man dafür vergeblich. (Zumindest habe ich nichts gefunden was mir wirklich gefallen hat). […]
Featured
Posted by
Sebastian Gross on Januar 29th, 2013.
Wenn ihr ASP.NET MVC ab Version 3 schon mal benutzt habt dann wird euch die Razor ViwEngine kein Fremdword mehr sein. Oft kommt man aber gar nicht drauf, dass man diese praktische Templating-Engine auch außerhalb von MVC benutzen kann. So kann man dieses Feature super gebrauchen wenn die App E-Mails versenden soll und man größere E-Mail Templates nutzen will. Das Schöne an der Razor Engine ist, dass man diese sehr einfach integrieren kann und der Code sehr verständlich und sauber bleibt. Die Installation erfolgt hier wie so oft sehr einfach über NuGet: Jetzt ist man im Grunde schon fertig und kann sofort loslegen. Starten wir mit dem Model, das die […]
Featured
Posted by
Sebastian Gross on November 2nd, 2012.
Maven ist ein sehr mächtiges und praktisches Werkzeug, aber manchmal ist das vordefinierte Verhalten etwas nervig. Glücklicherweise kann man so ziemlich alles über Parameter beeinflussen. Test-Fehler ingnorieren Oft will man alle Testfälle eines Projekts ausführen um einen Überblick zu erhalten, Maven bricht per Default aber nach dem ersten Testfehler ab, dieses Verhalten kann man Maven ganz leicht über diesen Parameter abgewöhnen: mvn test -Dmaven.test.failure.ignore=true Wenn man will kann man dieses Verhalten auch für ein Projekt vorschreiben, sodass es bei jedem Testdurchlauf so bleibt. Dazu definiert man folgendes Plugin: Tests beim install überspringen Standardmäßig führt Maven beim install auch alle Tests aus und bricht bei dem ersten nicht bestandenen Test den install […]
Featured
Posted by
Sebastian Gross on Oktober 8th, 2012.
Dieses „Problem“ müsste eigentlich jeder kennen der schon mein eine Webseite mit mehreren Bereichen erstellt hat. Wie kann ich den Menüpunkt der aktuell angezeigten Seite hervorheben? Hier gibt es viele Ansätze. Ich hatte schon Seiten, die die CSS Klassen ins HTML hardcoden, irgendwelche anderen Schandtaten betreiben oder nicht wirklich schöne If-Abfragen um die Menüpunkte legen. Hier muss man natürlich noch bedenken, dass ein entsprechender ViewBag-Eintrag namens „activeMenu“ in jeder Action gesetzt werden muss. urgs Ich möchte diese ganze Logik nicht in den Views haben. Daher habe ich eine kleine ExtensionMethot für den HtmlHelper geschrieben. Diese Extension generiert für mich die Menülinks und prüft beim Generieren des Links ob das Ziel des […]
Featured
Posted by
Sebastian Gross on August 6th, 2012.
Das Entity Framework Code First ist ein feine Sache wenn man keine Lust auf SQL hat und diese lästigen CRUD Funktionen für die Datenbank jemand anders machen lassen will. Besonders zu Beginn eines Projekts ist es super bequem den DropCreateDatabaseAlways-Initialisierer zu benutzen, der einem bei jeder Modeländerung eine frische und an das neue Model aktuelle Datenbank generiert. Doch irgendwann läuft die Applikation und man hat diverse Testdaten gespeichert die man nicht verlieren will, oder die App wurde nun schon installiert und ein Update steht bevor – was nun? Natürlich kann man die Datenbank nicht mehr einfach neu erstellen mit DropCreateDatabaseAlways da dann auch alle Daten verloren gehen. Man muss die Datenbank aktualisieren, […]