Blog
How to customize the macOS About Panel in SwiftUI
In this post, we’ll take a look at how to customize the macOS about panel for a SwiftUI app, to let us show custom content.
How to customize the macOS menu bar in SwiftUI
In this post, we’ll take a look at how to customize the macOS menu bar for a SwiftUI app, using SwiftUI tools like CommandMenu
and CommandGroup
.
SwiftUIKit 4.0 changes
I am about to create a new major version of SwiftUIKit. This version will remove no longer needed things, bump the deployment targets and merge the library with SwiftKit.
Reflections on failing to reach out
My last month has been all about wrapping up and releasing a brand new major version of KeyboardKit. It’s been a very fun project…that unfortunately has failed to deliver on all the work that went into it.
Dismiss keyboard when return is pressed in a multiline SwiftUI TextField
While a single line TextField
will automatically dismiss the keyboard when you press return, the same is not true for multiline text fields. Lets take a look at how to fix this.
Enabling drag reordering in SwiftUI lazy grids and stacks
While SwiftUI’s List
component allows users to drag to reorder items within the list, the LazyVGrid
, LazyHGrid
, LazyVStack
and LazyHStack
components currently lack this functionality. Let’s take a look at how to implement it from scratch.
Cleaner grid initialization in SwiftUI
SwiftUI’s LazyVGrid
and LazyHGrid
are great for creating powerful and flexible grids, but I always struggle with how to define columns when creating them. I’ve therefore created some extensions to make this easier. Let’s take a look.
SwiftUI menu gets incorrect separator line in list
If you’ved added a Menu
with an icon Label
to a List
, you may have noticed that the separator line behaves unlike other items, and starts below the icon instead of the title. Let’s find a way to fix this.
Store Codable types in AppStorage
SwiftUI keeps evolving, but there are still some things that we have to write custom code for. Today, let’s see how we can extend Codable
to make it possible to persist it in AppStorage
and SceneStorage
.
Lunchrrrrr 2.1 is out
Lunchrrrrr has been rewritten for iOS 16. It has an updated and cleaner UI, as well as an improved card drag responsiveness.
SwiftUIKit 3.4 is out
SwiftUIKit 3.4 is out, with new color and color picker tools, new list components, an optional binding and new view styles.
SwiftUI Prefers Semantics
SwiftUI receives amazing updates every year. If you however have to support old OS versions, you may be unable to use the new tools for some years, or jump through hoops to make it work. In this post, let’s look at a semantic approach to use new, non-critical features in apps that targets old OS versions.
DeckKit Updates
DeckKit 0.7 is out, with a new shuffle animation that makes shuffling a deck very enjoyable. Let’s take a look at what’s new in this minor update.
SwiftUIKit Updates
SwiftUIKit 3.3 is out! It has some nice additions and changes, like more tools for using Codable
with AppStorage
and new list utils. Let’s take a look at what’s new in this minor update.
Vision Pro - so many questions
Apple Vision Pro is finally unveiled! As a surprise to no one, it looks absolutely spectacular. However, for every rumor and question that were addressed today, new ones arised, leaving me very confused.
RichTextKit updates
After a long time away from the project, I finally had some time to revisit RichTextKit and add some new features, like indentation support and grouped controls.
Creating a bordered button group
The same way SwiftUI buttons can be given a .bordered
button style to apply a nice, round border, you can use ControlGroup
to group several buttons together in a bordered group. Let’s look at how.
Extending DocumentGroup for iOS
DocumentGroup
-based apps make it easy to edit documents and store them on device and in the cloud. However, these apps are currently very limited when it comes to customization. Let’s look at how we can extend them.
Undimmed presentation detents updates
In early 2022, I wrote an article about how to bring undimmed presentation detents to SwiftUI sheets. Since then, the original code has been improved many times and behaves a lot better than it did then.
An App Group roller coaster ride
I’ve been struggling with a very random bug when using an App Group to sync data between an app and its keyboard extension. The reason turned out to be a horrible combination of human error and Xcode.
Deep Dish Swift - Day 3
Deep Dish Swift flew by and suggendly, the third and final day was here…way to soon. I’m impressed by the scale of this first edition of Deep Dish Swift, and really hope there will be a second installment next year. Let’s see what Day 3 had in store.
Deep Dish Swift - Day 2
Deep Dish Swift Day 1 was one afternoon filled with amazing talks and getting the chance to meet many nice people from the community, ending with a deep dish pizza feast at Giordano’s. Let’s get Day 2 going.
Deep Dish Swift - Day 1
2023 flew by and Deep Dish Swift suddenly happened! This is a summary of the first indie dev focused day. Since the talks are not recorded, reach out to the speakers and invite them to your conference to get more people to hear the great stories they have to tell.
Group and sort Swift collections like a pro
Swift provides powerful ways to group and sort collections. Let’s take a look at some ways to do this and how to change the sort logic a bit.
Sort git tags like a pro
If you like me use semver (semantic versioning) and have projects with a gazillion version tags, it’s nice to be able sort the tags in various ways. Let’s see how to sort Git tags like a pro.
Handling status bar color scheme and visibility in SwiftUI
As we’ve previously looked at how to implement offset tracking as well as stretchable and sticky headers for SwiftUI scroll views, let’s look at how to handle status bar tint and visibility.
Adding a stretchable and sticky header to a SwiftUI ScrollView
As we’ve previously looked at how to implement offset tracking and stretchable headers for SwiftUI scroll views, let’s combine them to implement a scroll view header that stretches out when you pull down and sticks to the navigation bar as you scroll.
Adding a stretchable header to a SwiftUI ScrollView
Many iOS apps have screens where the header view stretches out when you pull down the screen. It’s a commonly used and loved component, so it’s strange that it’s not natively available in UIKit or SwiftUI. In this post, let’s look at how to implement such a header view in SwiftUI.
Adding scroll offset tracking to a SwiftUI ScrollView
The SwiftUI ScrollView
is currently quite limited, and for instance doesn’t let us detect the current scroll offset. In this post, let’s look at how to add offset tracking, which we’ll then use to build fun things.
Mimicking the iOS system notification in SwiftUI
In this post, I’ll show how you can use the SystemNotificaton open-source library to mimic iOS system notifications in your SwiftUI apps.
DocumentGroup double back button fix
If you are building DocumentGroup
-based apps in SwiftUI, you may have noticed that apps that worked fine in Xcode 15 now show two back buttons when being built with Xcode 16.
Applying complex gestures to a SwiftUI view
As we saw in last week’s post, complex gestures in a SwiftUI ScrollView
is complicated, since they can block the scrolling. However, if we don’t have a scroll view, things become a lot easier. Let’s take a look at a version of the button that we created last week, that uses a single gesture.
Using complex gestures in a SwiftUI ScrollView
SwiftUI gestures are complicated, since they can block ScrollView
gestures and cause scrolling to stop working. I’ve found a way to implement rich view gestures in a way that doesn’t block the scrolling.
Introducing LicenseKit
When building closed-source software, you must not only protect your source code, but must protect the binaries themselves as well, so that you can distribute them without having to worry that they are used by people who shouldn’t access them. One way to do this is with software licenses.
Rewriting Wally for iOS 16 and SwiftUI 4
I’m about to release a brand new version of Wally, which was the first app I ever made for iOS 10+ years ago. Wally 4 has been rewritten for iOS 16 and iPadOS 16 using SwiftUI 4. This post will go through some of the things involved in this major rewrite.
AI-based image generation with DALL·E, Stable Diffusion and Promptbase
I’m a bit late to this AI-based image party, but just wanted to write down some thoughts about DALL·E 2, Stable Diffusion and the new ecosystems of services that follow in their footsteps, such as PromptBase.
Adding slugification and style-based tags to SwiftUI
As I’m rewriting an old app from scratch, I’m adding a bunch of features to it. One such feature is content tagging. For reusability, I’ve put all tag-specific logic in a new library called TagKit. Let’s take a look!
Extended vacation times
As the Swedish summer keeps on delivering, I’m struggling to combine enjoying life with my family and friends with full-time work, open-source projects, a big app rewrite and this blog.
Getting started with the SwiftUI NavigationSplitView
SwiftUI 4 adds a new NavigationSplitView
component that simplifies creating rich sidebar-based experiences on iPad and macOS, while automatically scaling down to a NavigationStackView
(also new) on iPhone. It’s a powerful component that however can be a bit tricky to get started with, so let’s take a look at how to use it and some ways to style it.
Conditionally searchable SwiftUI views
SwiftUI 3 added the searchable
view modifier, which makes it possible to add a search field to any view. In this post, let’s take a look at how to make this (and any other) modifier conditional.
Removing the iOS home indicator in SwiftUI
In SwiftUI 4 and iOS 16, you will finally be able to hide the home indicator on iPhone and iPad devices that don’t have a home button, without resorting to UIKit hacks. Let’s see how.
Vacation times ahead
As the Swedish summer keeps delivering sun, heat and happiness to this otherwise dark and cold part of the world, I’m going on vacation and will be back in August.
Multi-platform image resizing
In this post, let’s take a quick look at how to resize images in UIKit and AppKit. The result will work on iOS, macOS, tvOS and watchOS and lets us resize images with the same APIs regardless of platform.
Using QuickLook in SwiftUI
SwiftUI is growing with every new release, but there are still old treasures to be found in various Apple frameworks, that aren’t part of the core SwiftUI library. One example is MapView
in MapKit, another is the amazing quickLookPreview
view modifier in the QuickLook framework. Let’s take a quick look.
Introducing StoreKitPlus
In this post, let’s take a look at StoreKitPlus, which adds extra functionality for working with StoreKit 2 and aims to make it much easier to use StoreKit in SwiftUI.
Backporting the SwiftUI 4 ImageRenderer to iOS 13
SwiftUI 4 introduces a new ImageRenderer
that can be used to render any SwiftUI view as an image in iOS 16, macOS 13, tvOS 16 and watchOS 9. Let’s look at how to backport it to iOS 13.
Undimmed presentation detents in SwiftUI
SwiftUI 4 adds a bunch of great features, such as custom sized sheets. However, these sheets will always dim the underlying view, even when they use a smaller size. Let’s look at how to fix this.
Using the SwiftUI 4 ImageRenderer
SwiftUI 4 introduces a new ImageRenderer
that can be used to render any SwiftUI view as an image in iOS 16, macOS 13, tvOS 16 and watchOS 9. Let’s take a quick look at how it works.
SF Symbols 4 variable colors
SF Symbols is an amazing iconography library, that is designed to integrate seamlessly with the various Apple platforms. SF Symbols 4 adds even more features to these symbols, where variable colors will let you communicate values with your symbols. Let’s take a look!
Custom sheet sizes in SwiftUI
WWDC’22 introduced a bunch of amazing additions to SwiftUI, many of which will render many 3rd party libraries obsolete. One such addition is SwiftUI’s upcoming support for custom sheet sizes.
Building a rich text editor for UIKit, AppKit and SwiftUI
In this article, we’ll look at how to build a rich text editor for UIKit, AppKit and SwiftUI. We’ll extend native types to extend the foundation support for rich text, add new types to bridge the different platforms and make sure that we have a basic, working foundation that we can expand in future posts.
SwiftUI scrolling finally works in tvOS 16
To all of you who have struggled with SwiftUI and slow scrolling on tvOS - happy news! With Xcode 14, SwiftUI 4 and tvOS 16, scrolling finally seems to become super smooth.
A better way to extend types
In this post, we’ll take a quick look at a better way to extend types in Swift, to make the extensions more versatile and discoverable.
Getting images from the AppKit pasteboard
In this post, we’ll take a quick look at how we can fetch images from the AppKit NSPasteboard
, which lacks a lot of functionality compared to the UIKit UIPasteboard
.
Making Swift package assets work in SwiftUI previews
In this post, we’ll take a look at how we can get colors, images and other assets that are defined in Swift packages to work in external SwiftUI previews, such as in an app.
Slugify a string
In this post, we’ll take a quick look at how to slugify a string in Swift, which is nice if you want to generate tags, web urls etc.
How to detect SwiftUI preview mode
In this post, we’ll take a quick look at how to determine if code is running as a SwiftUI preview or not.
Generating a random color in SwiftUI
In this post, we’ll take a quick look at how to generate a random color in SwiftUI, using the nice random api:s provided in Swift.
Creating a custom environment key for safe area insets
In this post, we’ll take a look at how to create a custom SwiftUI environment key that lets us get the safe area insets for the current scene.
Using the isEnabled environment value in iOS 14
SwiftUI is amazing, but has a history of seriously buggy behavior. Even if you follow the documentation and your code compiles, you must still verify that it actually works if you target older iOS versions. As an example, let’s take a look at using the isEnabled
environment value with custom button styles.
How to fix 'linking against a dylib which is not safe for use in application extensions' warning
Swift packages is an easy and powerful tool for separating your code into modules. However, Xcode currently shows a linking against a dylib which is not safe for use in application extensions
warning when linking targets and packages in certain ways, even though a package is safe for use in application extensions. Let’s look at how we can fix this warning.
Presenting a SwiftUI view from DocumentGroup
The SwiftUI DocumentGroup
makes it super-easy to create document-based apps. However, the api:s are currently very limited, which means that even the most basic things are hard to achieve. In this post, let’s take a quick look at how we can present custom SwiftUI views as modals from a DocumentGroup
.
Creating a property wrapper to persist Codable types
In this post, we’ll take a quick look at how to create a property wrapper that can be used with Codable
, that automatically persists its value in UserDefaults
and updates SwiftUI when its value changes.
Schedule GitHub Pages rebuild with GitHub Actions
In this post, let’s take a look at how to schedule a website with GitHub Actions, so that we can create future content that is automatically published at the intended publish date.
Building a document scanner in SwiftUI
In this post, let’s take a quick look at how to we can extend SwiftUI with a document scanner, that uses the device camera to scan documents in iOS.
Creating hex-based colors in UIKit, AppKit and SwiftUI
In this post, let’s take a quick look at how to we can extend the UIKit, AppKit and SwiftUI colors with hex-based initializers that accept strings (e.g. "#abcdef"
) and numeric values (e.g. 0xabcdef
).
A flexible way to handle async errors in SwiftUI
In this post, let’s take a look at how to handle async errors in a flexible and scalable way in SwiftUI. We’ll cover both completion block- and async/await-based use cases.
Linking DocC to package named types
In this post, let’s take a quick look at how to link DocC to types that have the same name as the target they belong to.
Extending local authentication with async support
In this post, let’s take a look at how to extend the LocalAuthentication
framework with an async
way to perform local authentication.
Building multi-platform documentation with DocC
DocC is an amazing tool for writing and generating documentation for Swift-based projects. This post will discuss how to generate multi-platform documentation with DocC, using Terminal scripts and Fastlane.
Bringing platform-specific types together in SwiftUI
SwiftUI’s amazing multi-platform support makes it easy to develop apps for iOS, macOS, tvOS and watchOS. But how do you handle types that differ between platforms? Let’s take a look.
Building a WebView for iOS and macOS in SwiftUI
SwiftUI currently has no WebView, which means that we have to create it for ourselves. Let’s see how we can easily build a multi-platform web view for iOS, iPadOS and macOS.
M1 Swift Package and XCFramework Problems
I absolutely love my brand new 14” M1 MacBook Pro, but there are architectural problems when working with Swift packages and XCFramework builds. In this post, I’ll describe some problems…and solutions.
Going open-source
In this post, I’ll discuss my experiences of working on various open-source projects, some of the steps and processes involved as well as some learnings.
Building the KeyboardKit app
In this post, I’ll discuss the development of my new KeyboardKit app for iOS and iPadOS. I’ll go through my original vision, the actual outcome as well as a bunch of findings, problems etc.
Git tags cheat sheet
In this post, I’ll list a couple of git commands that I found useful when cleaning up an unstructured git tag history. The post is primarily meant for future reference, but if you find it useful, that’s great.
Distributing closed-source frameworks with SPM
In this post, we’ll look at how to distribute closed-source XCFrameworks-based products with the Swift Package Manager (SPM). The post goes through project setup, package distribution and how to solve some problems along the way.
Making Xcode and SPM trust a private SSH server
In this post, let’s look at a solution to the the server ssh fingerprint failed to verify
error that may bite you when you add an SPM dependency to an app from a private server over SSH.
Mocking with MockingKit
In this post, I’ll demonstrate how to use MockingKit to create dynamic mocks of protocols and classes, that let you record and inspect function calls in your unit tests, register conditional returns, etc.
Building a video streaming app for iOS in SwiftUI
This is a follow-up post to this previous blog post, where I discussed my experiences with building a video streaming app for tvOS, using SwiftUI. This post will discuss how I ported the app to iOS.
Building a video streaming app for tvOS in SwiftUI
In this post, I’ll discuss how I built a movie-streaming app for tvOS in SwiftUI, for the Swedish streaming service Cineasterna, which lets people stream videos using their public library card.
An easier way to manage full screen covers in SwiftUI
In this post, we’ll look at an easier way to manage full screen covers in SwiftUI, in a way that lets us reuse functionality, reduce state management and present many different covers with the same modifier.
Validate Localized Resources
In this post, we’ll look at a way to validate app localizations and integrate it into Fastlane and any CI tools and processes that you may have in place.
Swift Semantics
In this post, we’ll look at various ways to improve readability and writeability of Swift code by introducing extensions to Swift’s native types.
An easier way to manage alerts in SwiftUI
In this post, we’ll look at an easier way to manage alerts in SwiftUI, in a way that lets us reuse functionality, reduce state management and present many different alerts with the same modifier.
An easier way to manage sheets in SwiftUI
In this post, we’ll look at an easier way to manage sheets in SwiftUI, in a way that lets us reuse functionality, reduce state management and present many different sheets with the same modifier.
Uniquely identify the current device
In this post, we’ll look at how to uniquely identify the current device. We’ll also look at different ways of persisting the unique identifier to make it available even if the app is uninstalled.
Using the iOS keychain to persist data
In this post, we’ll look at how to read from and write to the keychain on iOS devices. We’ll look at a great library for this and how we can make it more abstract.
Url encode strings
In this post, we’ll look at how to url encode strings. We’ll then create an extension that let’s us do this easier and with less code.
Case-sensitive String replace operations
In this post, we’ll discuss how to replace all occurences of a string within another string. We’ll then create an extension that allows for easier case-sensitive replacements.
Case-sensitive String contains checks
In this post, we’ll look at how to check if a string contains another string. We’ll then create an extension that allows for easier case-insensitive checks.
Base64 encode and decode strings
In this post, we’ll discuss how to Base64 encode and decode strings in Swift. We’ll also create a couple of extensions to make this easier to use and more readable.
Numeric string representations
In this post, we’ll create string representations of numeric types in Swift and extend these types with convenience functionality to make them easier to use.
Extending the Swift Result type
In this post, we’ll extend Result
with extensions that make using it easier in certain situations.
Delay and chain operations with DispatchQueue
In this post, we’ll look at how DispatchQueue
can be used to delay and chain operations. We’ll also extend it with convenient functions that simplify these tasks.
Comparing dates in Swift
In this post, we’ll extend Date
with functions that let us compare dates with clean, readable code.
Modify dates in Swift
In this post, we’ll extend Date
with functions that let us add and remove seconds, minutes, hours and days to a date.
IoC and dependency injection - the basics
In this post, we’ll look at the basics of Inversion of Control (IoC) and Dependency Injection and how to reduce coupling within your codebase.
Perform biometric authentication with FaceID or TouchID
In this post, we’ll look at how to perform local biometric user authentication with FaceID or TouchID on Apple’s various platforms, using the LocalAuthentication
framework.
Bind view geometry data to bindable properties
SwiftUI is great for building declarative user interfaces. However, it’s still young and lacks many common things. In this post, we’ll look at a way to read geometry information from any view in a view hierarchy.
Building an Apple Watch app in SwiftUI
SwiftUI and Combine makes it easy to build apps for watchOS. However, if the app is part of a larger system, you may have to adjust your architecture. In this post, we’ll take a look at the work involved in building a SwiftUI/Combine-based app for Apple Watch.
How to use view controller delegation in SwiftUI
Presenting UIKit view controllers in SwiftUI is simple, but things become more complicated when they communicate through delegation. In this post, we’ll look at a way to solve this.
Create an SPM Package for SwiftUI
In this post, we’ll create a package for the Swift Package Manager. The result will be a package that adds more gestures to SwiftUI.
SPM .gitignore excludes Xcode projects
When you create Swift Packages with swift package init
, the generated .gitignore will exclude all Xcode projects by default. This will cause problems if you later add an Xcode project to your package.
App Store submission fails with Carthage and SPM
If you use swift package generate-xcodeproj
to generate an Xcode project for a SPM package, App Store will reject any apps that adds this library with Carthage. This post will show you how to make App Store submission work.
Generic Swift protocols
For years, I’ve been struggling with combining generics and protocols in Swift. In this post, I’ll describe how I finally made sense of it all.
Constrain Swift extensions with protocols
I love Swift’s type system and its extension model, but you have to use it with care. In this short post, I discuss how to keep your extensions from being exposed everywhere.
git grep
This is a short note to self about how to use git grep
instead of grep
to find all occurrences of a certain text in all files within a root folder.
Using structs like enums
Swift enum
and struct
are two powerful tools. In this post, I’ll discuss how you typically use them and how to use structs like enums when you need more flexibility.
Coordinating async operations
Swift is an amazing language, but currently lacks good support for coordinating async operations in a sophisticated way. In this post, I will look at existing libraries for solving this, then discuss a lightweight alternative that uses a couple of simple protocols and implementations.
iPad Pro production setup
In this post, I’ll write about my process to find a more productive and flexible setup for my various sites, projects, blog etc. I’ll descibe how I moved away from my old hosting provider and Wordpress and found a setup that lets me create content on my iPad Pro.
Alamofire + AlamofireObjectMapper
This is an updated version of a talk I gave at CocoaHeads Sthlm in 2017, on how to use Alamofire to communcate with an api, AlamofireObjectMapper to map responses, the Alamofire RequestRetrier
to automatically retry failing requests and the RequestAdapter
to adapt all requests. I also demonstrated how to use Realm to seamlessly add offline support, using the decorator pattern.
Simplify enum testing with CaseIterative
In this post, I will show how to reduce the amount of code you have to type when
testing enums, by using the new CaseIterable
protocol.
Automate setting up Xcode
In this post, I will show how to automate setting up Xcode using Homebrew
and
Fastlane
in a way that is easy to extend if you need to automate more later on.
SwiftyDropbox crashes in Swift 4.2
After installing Xcode 10 yesterday, I started migrating some libraries to Swift
4.2. While most migrations were painless, one failed, since it depends on
SwiftyDropbox
which doesn’t support Swift 4.2.
Automate setting up macOS
In this post, I’ll describe how to automate setting up a new Mac with a terminal script that will install system software and applications, configure the computer etc. This lets you setup a new Mac in minutes.
Codable magic
I have finally started replacing all NSCoding
objects in my code with the new Codable
protocol. This article covers things that I’ve learned along the way.
Protocol array extensions not working
In a project that I’m currently working on, I want to redesign how we extend protocol-based domain models. However, what first looked east turned into a Swift nightmare, with problems that I’m still struggling with.
Closure-based gesture recognizers
In my previous post, I wrote about how I don’t like iOS delegates and target/selectors and how I prefer to use closures. Let’s see how we can use closures with gesture recognizers, to make things nicer.
Ditching RxSwift
After hearing so many good things about RxSwift, I decided to use it in an app of mine. However, after struggling with it for months, I still haven’t found a nice setup and have now decided to ditch it.
A Swift Playgrounds Evening
Tonight, I finally sat down with my oldest daughter Cornelia, to play with Swift Playgrounds and try to teach her a bit about programming.
Using iPad Pro with Working Copy
In this post, I will write about my experience using Working Copy on my iPad Pro, adding a blog post to a Jekyll-powered blog, then pushing the result to GitHub.
Add placeholder support to UITextView
This post will show you how to apply the UITextField
placeholder behavior to a
UITextView
, which natively lacks this support.
Swift 3 + Alamofire + AlamofireObjectMapper + Realm
This is a summary of my talk at CocoaHeads Sthlm, April 3 2017, where I talked about using Alamofire, AlamofireObjectMapper and Realm to talk to an api, map its responses, retry and adapt requests and then use Realm to create offline support layer by persisting data locally.
HoloLens, Microsoft, VR and Apple
I’m really looking forward to an event at tretton17 next week, where Jimmy Engström will demonstrate the awesome Microsoft Hololens.
Problems with Quick, Nimble and CocoaPods
When creating Swift libraries, I use Quick for tests and Nimble for assertions. They are great tools that really speed up writing tests. However, they don’t always play well with CocoaPods.
git autocompletion in OS X Terminal
After procrastinating for too long, I finally spent a minute to setup git autocomplete in the Terminal. The original discussion on this topic is found here.
New year, new habits
I finally made it! After years and years of “I really should”, I have finally managed to abandon my old hosting provider, move all my sites to GitHub and start with some nice new habits for the new year.
UIImageView is pixelated after applying an async image
In an iOS project that I’m currently working on, I load images asynchronously into an
UIImageView
. Although the images are properly fetched, they are pixelated once they
are added to the image view.
Reset Xcode load plugin bundles warning
Today, I accidentally clicked “Skip Bundles” instead of “Load Bundles” when I started Xcode after adding new plugins. This cause Xcode to not load the plugins on subsequent launches. How can we fix this?
.NET Core notes to self
I have been playing around with .NET Core since the early betas, but since I do so with rather long times in between, things break each time I pick up from where I left it. Here are some notes to self.
Ionic 2 - Build Configuration-Specific Settings
In an Ionic 2 app that I’m building for iOS and Android, I want to use different application settings for different build configurations. Let’s see how this can be achieved in Ionic 2.
Upgrade .NET Core RC to 1.0
With the release of Visual Studio Code 1.0, I upgraded .NET Core to the latest version. However, the older version wasn’t properly replaced, which did cause Visual Studio Code to behave quite strange.
Reload DNX whenever a file changes
I’m currently developing a console app in .NET Core on my Mac. It’s a rather nice experience, although I miss a lot of stuff from Visual Studio, e.g. build triggers. Let’s make DNX reload whenever a file changes.
Setup DNX in macOS
After so much waiting, so many “I’ll do this first”, so much app coding etc. etc. (yep, I blame my family as well), I finally managed to start playing around with DNX and ASP.NET 5.
Update the title of an MKAnnotation
I’m building a map app where users can save personalized content and present it
with custom pins, icons, colors etc. I therefore need to update how an MKAnnotation
is presented and its title.
ASP.NET and WebApi attributes with StructureMap
After some time away from .NET, ASP.NET and WebApi, I’m having a great time when setting up a new WebApi solution for a project at work.
sudo is required for all Ionic and Cordova commands
I’m currently building my very first app with Ionic Framework. So far, Ionic is
fast to setup and performs well, but I just ran into a problem that forces me to
use sudo
for all Ionic and Cordova commands.
Xcode 6.3.1 - Code object is not signed at all
After upgrading to Xcode 6.3.1, I get an error that says ERROR ITMS-90035:
"Invalid Signature. Code object is not signed at all"
. Let’s look at what
this is and how to fix it.
Swift return statements and line breaks
I’m currently porting some iOS games from Objective-C to Swift. While doing this, I stumbled upon something interesting in how Swift handles return statements and new lines.
Dependency injection and IoC in iOS and Swift
Inversion of Control and Dependency Injection are hot topics in the .NET world. They are however rare in the iOS community, despite being powerful tools. Let’s look at a way to setup IoC in iOS.
Using Swift protocols in Objective-C
I’m currently creating two new games for iOS. One is made in Swift and SpriteKit, while the other is made in Objective-C and UIKit. To share logic, I need to use Swift protocols in my Objective-C code.
Using Crittercism for iOS crash reporting
In this post, let’s look at how to use Crittercism to let your iOS or Android users report bugs and provide you with automated crash reports.
Mouse scroll sensitivity in Parallels Desktop
I use Parallels Desktop to run Windows from a dedicated OS X partition. It works great overall, but one thing that I have had problems with, is that the mouse scroll sensitivity is too sensitive in Windows. Let’s see how to fix this in Parallels.
Matthew McCollough - The third wave of artfulness in code
Oh, my GOD, I wasn’t prepared for this! Matthew McCollough from GitHub made my day with this amazing Øredev 2013 keynote, leaving me tumbled in the hotel lobby for a good while afterwards.
Denise Jacobs - The Creativity (R)Evolution
The creativity evangelist Denise Jacobs coaches people in the tech field through creativity. In her Øredev 2013 keynote, she talked about creativity, betterness and habits.
Siren Hofvander - Being Secure on a Mobile Platform
This great Øredev 2013 session focused on how to be secure on a mobile platform, with a bunch of great examples and concrete demos.
Shay Friedman - 30 NuGet packages in 50 minutes
This Øredev 2013 session was a masterpiece, where Shay Friedman blasted through 30 NuGet packages in 50 minutes.
David Planella - Ubuntu, A Powerful, New Force in Mobile
This Øredev 2013 session was all about the new Ubuntu Mobile platform, which I’m very excited over, despite not being a Linux or Ubuntu guy. It looks very promising.
Jimmy Nilsson & Jon Gyllensward - Less is more! When it comes to art and software
This Øredev 2013 session was a case study from Sirius International Jon Gyllenswärd and Jimmy Nilsson from factor 10 talked about a two year long change process they managed together.
Woody Zuill - Mob Programming, A Whole Team Approach
This Øredev 2013 session focused on mob programming, where the entire team works together on implementing changes and new features.
Björn Granvik - Distributed Teams
This Øredev 2013 session was interesting and required a lot of attention, which made it hard for me to sum it up properly. However, I will do my best.
Christian Horsdal - Layers Considered Harmful
In this Øredev 2013 session, Christian Horsdal talked about layers, careful to distinguish between layers (logical) and tiers (physical).
Scaling mobile at Spotify
This is a sum-up of a talk I attended at Øredev 2013, where Mattias Björnheden and Per Eckerdal from Spotify talked about how Spotify scaled their mobile teams.
Anna Beatrice Scott - tekhnasthai
This is a sum-up of a talk I attended at Øredev 2013. This year, I will create a separate post for each session, instead of having multiple sessions in each post.
Automate with Automator
A really useful tool that is never top of mind for me when automating a workflow, is the native OS X application Automator.
Bashing the Bash Syntax
This post is dedicated to complaining about the Bash syntax from a n00b perspective. It’s just a rant. Don’t take it too seriously.
Memory leak in iOS when mixing ARC and non-ARC code
In an iOS app of mine, I had a situation where the app shut down after taking a couple of photos. The crash reports suggested a memory leak, but I had a hard time reproducing it. Turns out the leak was caused by mixing ARC and non-ARC code.
Hide the default Objective-C initializer
Languages like Java and C# let you override and hide the default constructors of a class, to ensure that developers can only create valid instances of it. Let’s take a look at how to do the same in Objective-C.
Auto-increment Build Number in Xcode
When releasing new version of my iOS apps, I used to manually update the build number. However, a better approach is to have Xcode do it automatically. Let’s take a look at how to do it.
Android Activity Lifecycle Car Analogy
In most application frameworks, classes have a certain lifecycle that may be used to do customizations at the proper time. Let’s look at the Android activity lifecycle as compared to being a car.
Remove Android Activity Title and Icon
My getting-to-know-and-to-love Android journey continues, and has now come to themes. This morning, I have been learning how to use themes to customize the action bar and remove its icon and title.
Android Assets for Various Screen densities
Android devices come in a great deal of different flavors when compared to iPhone devices. They can be slow, fast, crappy, great, low-res and ultra-hd. To best honor the device running your app, you should provide assets for various screen densities.
Android Fullscreen Activity
The best way for me to get my act together when learning new things, is to write about it as early as possible. This way, I can return to my earlier posts and verify that I knew nothing once, and that I hopefully have learned a few thing along the way. Today, I thought that I should honor this strategy, by publishing a simple base class that can be used for fullscreen Android activities.
Run Lint in Android Studio
As I have just started learning Android, I was happy to see that linting is such an integral part of the Android development process. Let’s see how to set it up in Android Studio.
Android Glossary
I’m currently getting started with Android development, which means that I have a lot of new stuff to memorize. It’s so obvious that the biggest challenge with learning a new language is not the syntax itself, but the tools and conventions. Let’s look at some acronyms that are worth remembering.
Enable USB Debugging on Android Devices
I’m currently getting started with Android Development. Today, let’s take a look at how to enable USB debugging on Android devices, which I had some problems with.
Windows 8 Activation Fail
Unlike Apple’s outstanding OS X onboarding experience, Microsoft really have to step up the Windows onboarding. When you charge a lot of money for people to use your OS and require them to activate it, the activation must work. Sadly, it doesn’t.
Multiple SSH Files
When working with git, I use a single SSH key pair, which I use for e.g. GitHub. Today, though, I had to add a second key pair to be able to clone another remote repository.
UIViewController Custom Back Button Problem
If you want your apps to have their own identity, you should put time into adjusting its appearance, such as fonts and iconography. One thing that may be tricky, though, is to replace the default back button with a custom one. It should be simple, but I just can’t get it to work in one app.
New legal label in MKMapView
I’m using Google Maps in a couple of iOS apps. Or, at least I was before Apple replaced Google Maps with their own engine. So, now I guess I use Apple Maps. And Apple Maps adds an annoying little label.
Perform web.config transforms on build
In a current project, we are auto-creating deploy packages of an ASP.NET MVC web site, using Team City. When we do, we need to perform web.config transformations to ensure that a properly configured file ends up in the deployed package.
Entity Framework Code First with auto migrations on AppHarbor...and more
I’m working on an iOS app that is powered by an ASP.NET MVC 4 backend that uses Entity Framework Code First with auto migrations and runs on App Harbor. We also have a web site that is used to present more information. This is how we put it all together.
Natural Scrolling in Windows 8
In OS X Lion, Apple introduced natural scrolling
. It means that when you scroll,
the scrollable content will move around like it was a sheet of paper you pressed
and dragged around with your finger.
Git not found in Mountain Lion
I recently updated OS X Lion to OS X Mountain Lion on all my personal computers. The installation was smooth, but afterwards some things did not work as expected. For instance, git was no longer found.
Oredev 2012 - Day 3
My third and final day at Øredev 2012 offered some really nice talks, as well as a really crappy one.
Oredev 2012 - Day 2
My second day at Øredev 2012 was amazing! When it was over, I had to sit down and take it all in. There were so many great talks, and I still had to skip many that I wanted to see.
Activating Windows 8
Inspired by Øredev and all the great sessions, I finally installed Windows 8. I decided to upgrade my Windows 7 installation, and found the installation quick and painless….and the activation a nightmare.
Øredev 2012 - Day 1
I am happy to once again attend Øredev in Malmö, Sweden. Three days with great speakers and nice friends is just what is needed in the dark, Swedish November.
iOS Bounce Animation
I have an app with a main menu, where users can swipe horizontally through a set of icons that take the user to certain parts of the app. When an icon is tapped, it bounces, plays a sound and takes the user to that particular part of the app. Let’s see how the bounce animation was made.
iOS Localization
This post will show you how to localize your iOS apps, so they can be translated to several languages. I’ll will describe how to translate plain text and how to create localized versions of your storyboards.
CLGeocoder fails silently
I’m currently developing a location-based app for iPad and iPhone, that will allow users to store locations and use custom icons and colors for the pins.
Xcode - Disable ARC for individual files
I am building an app that uses ARC (Automatic Reference Counting), which means I from now on will not have to handle memory management as actively as I have done before. There are still things you have to consider when using ARC, but it makes memory management a lot easier and less tedious.
JSON in iOS
I’m currently creating an iOS app that will share data using JSON. Working with JSON is trivial in iOS 5, since there’s now a great, native JSON serializer and deserializer.
Retrive Core Data objects with case-insensitive comparison
I’m currently building an iOS app that uses core data for data persistency. It works great, but as I started retrieving entities by name, I noticed that they arrived in a strange order:
DevSum 2012 - Day 2 Summary
This is a short summary of the second day of the DevSum 2012 conference in Stockholm, Sweden.
DevSum 2012 - Day 1 Summary
This is a short summary of the first day of the DevSum 2012 conference in Stockholm, Sweden.
Posting source code on a WordPress hosted blog
At the time of writing, this code-oriented blog was hosted on Wordpress. Since I post a lot of code, I wanted the blog to have nice syntax highlighting. This is how you do it on Wordpress.
Adding photos to the iPhone simulator
I’m currently building an iOS app that will make use of the device camera. It works well, but since I’m also running this app on the simulator, I want to be able to select pictures from the photo library as well.
Dependency Injection gone too far?
I am currently working with a new version of a hobby console application project of mine. The app will execute certain actions depending on the input arguments.
Use Phantom/Boo to build, test and publish to NuGet and GitHub
When building open-source, I used to handle the release process manually. Since each release involves executing unit tests, bundling, zipping and uploading to GitHub and NuGet, creating new git tags etc. the process was time consuming and error-prone. Since a release involved so many steps, I also released new versions quite seldom. Not good - automated build scrips to the rescue!
Øredev 2011 in the rear-view mirror – Part 6
This is the final part of my Øredev 2011 summary. It covers the last three talks that I attended and concludes my visit to Øredev.
Øredev 2011 in the rear-view mirror – Part 5
This is the fifth part of my sum-up of Øredev 2011. These sum-ups waere supposed to be rather short, but have grown out of proportions. I will try to keep it down.
Øredev 2011 in the rear-view mirror – Part 4
This is the fourth part of my Øredev 2011 summary. It has taken quite a long time to get this finished, so I will write a bit less about each session and refer to external resources instead.
Various NDepend learnings
I’ve been using NDepend to analyze the latest version of my NExtra library. The code is overall good, but the code analysis highlights some interesting design flaws that I should fix in the next version.
Øredev 2011 in the rear-view mirror – Part 3
This is the third part of my sum-up of Øredev 2011, which took place in Malmö, Sweden.
Øredev 2011 in the rear-view mirror – Part 2
This is the second part of my sum-up of Øredev 2011, which took place in Malmö, Sweden.
Øredev 2011 in the rear-view mirror – Part 1
Two weeks ago, I attended to the Øredev Developer Conference in Malmo, Sweden. I was there from Wednesday to Friday and it was truely inspiring. In this summary, I will write about sessions I attended, sessions I missed and a few sessions I heard a lot of good stuff about.
Where do I put the logic?
I could use some advice regarding a project that I’m currently working on, where people can sign up and join various groups (did I hear “Facebook is already doing that”?). I’m now torn on some implementation details and would love some discussions regarding where to put certain pieces of logic.
Am I writing bad tests?
To grow as a developer, there’s nothing better than to invite others to criticize your potential flaws. This post will expose my shortcomings as a unit test loving developer. Enjoy!
Tweaking NDepend CQL rules
After learning on how to automate and schedule NDepend to run for several .NET solutions at once and starting to use NDepend more regularly, the power of CQL has grown on me.
Scheduling NDepend for a set of solutions
In a project of mine, I use NDepend to continuously run a scheduled code analysis on a bunch of solutions that make up a large part of the software infrastructure of a major Swedish company.
Grabbing the latest version number from a GitHub repository
I currently have several GitHub repositories, where some also have a gh-pages
branch with a public web site for each project. On these pages, I want to show
and link to the latest version.
Getting PEAR and PHPUnit to work with MAMP
When I recently decided to start re-creating a php project of mine from scratch,
I decided to replace SimpleTest
with PHPUnit
and PHPCover
.
TeamCity 6.5.1 does not play well with NServiceBus
I am currently moving some projects from an old TeamCity 5.1.2 server to a brand new 6.5.1 server. Everything has been going great, until I tried moving a project that uses NServiceBus.
EditorBlockFor HTML helper
In ASP.NET MVC, Microsoft has done a nice job with creating various HTML helpers
that can be used in a form, e.g. LabelFor
, EditorFor
, ValidationMessageFor
.
Let’s see how we can make our own.
Clone a .NET solution in no time
When working with .NET, I sometimes find myself wanting to just clone a solution instead of setting everything up from scratch over and over again.
Print screen in BootCamp using an Apple keyboard
I have started to boot up Windows directly from my BootCamp partition on my iMac instead of running it under VMWare Fusion. This way, I don’t have to share resources with the OS X partition, which is nice for gaming, programming etc. There are however some rough edges.
Visual Studio and WPF applies basic Windows 7 theme
Each time I open a WPF project in Visual Studio (2010) and open a XAML file, my computer switches from the semi-transparent theme to Windows 7 Basic.
Open file with the keyboard in OS X
Although I love OS X, I am still new to it and a Windows user by habit. As such, the unintuitive and secret clubesque keyboard shortcuts are not one of my most favorite parts with using OS X.
NUnit BadImageFormatException
In a project of mine, NUnit suddenly started to warn that something’s wrong with the assembly. Turns out that accidentally disabling architectures is a bad thing.
How I solved my slow iMac with a constantly working hard-drive
A couple of days ago, I blogged about solving a frustrating problem that made my iMac dead slow. At the time of writing, I wasn’t sure if I had actually solved the problem. I can now say that I have.
Slow iMac about to be fixed?
I have been having big problems with my iMac 27″ (4GB RAM) that runs Windows 7 on a Boot Camp Partition (using VMWare Fusion). It is basically the same setup as I have on my MacBook Pro (which has 8GB RAM), with the minor difference that the MBP is fast as lightning and the iMac is slow as HELL!
Localizing a WPF application with resource files
This post will show you how to localize a WPF application that consists of a main application as well as several separate DLL projects that provides it with general user controls, model classes etc.
Running Facebook authentication on localhost
I have started building an ASP.NET MVC3 site that will use the Facebook API to create and authorize users. It’s really easy to setup, although running it on localhost requires some configuration.
Embed Git Bash into Visual Studio
I have started to use git in my .NET projects. It works really well, but I’m having problems with integrating it in Visual Studio. Turns out there’s a way to add a Git Bash window to Visual Studio.
WPF WTF
My personal WPF WTF list has grown steadily since I started to work with WPF. In my opinion, WPF is filled with bad naming conventions and inconsistencies. Here are some examples.
Custom ASP.NET validation attributes
ASP.NET validation attributes is a great way of making it easy to validate C# properties in different ways, client and server side. Let’s look at how we can create our own validation attributes.
Hide the close button of a WPF window
In a WPF application that I’m currently working on, I have to hide the close button of a progress window to prevent users from closing it manually. Turns out that it’s complicated, but perfectly doable.
WampServer URL rewriting problem
I have a hobby project that works great on MAMP, but that doesn’t run so good on WampServer, which seems to handle url rewriting differently. The fix turned out to be easier than expected.
Calculate geo distance and bearing in C#
I’m currently building a gps-based web application that lets mobile devices post their positions to the app, which then replies with nearby items of interest. To do this this, the backend has to be able to calculate the distance between two geo coordinates. Here’s how to to do this in C#.
Trying out Plupload"
The team behind Tiny MCE has created a great file upload component called
Plupload
. It supports several runtimes – from jQuery-based uploads in HTML 4/5
to Flash, Silverlight, Gears etc.
Automatically convert HTML5 to HTML4
I love HTML5, although it will take time for many browsers to support HTML5. Until they do, our code must be supported by older browsers as well. What if I told you that there’s a way to write HTML5 today, and automatically have it convert to HTML4 whenever needed?
Spotify background playback problem on iOS
Sometimes, Spotify stops being able to play music on iOS when it’s sent to the background. Whenever this happens, you may have to free up memory by removing some background apps.
Flush the Visual Studio Template Cache
I recently created a project template that uses the Spark view engine instead of the default Web Forms view engine. However, it didn’t show up in the project template list. Time for a template cache flush.
Adding Spark to ASP.NET MVC 2
I finally got some time to look at the Spark View Engine. Since the Razor View Engine will be shipped with ASP.NET MVC 3, I decided to give Spark a try first.
ImageGen Cache Problem
I am looking to use Umbraco ImageGen in a project that I’m currently working on. People who have used it really seem to like it, so I look forward to try it out. However, I did run into a cache problem.
Make Combres work with ASP.NET
After having problems with SquishIt when bundling JavaScript, I have decided to give Combres a try. However, while SquishIt works right out of the box, Combres must be configured quite a bit.
HTML5 localstorage
I have spent some time experimenting with the new HTML 5 localStorage
feature,
which is a new feature that simplifies storing data in the browser using JavaScript.
Moving ViewState to the bottom of the page
ViewState
is ASP.NET’s way of simulating state in the otherwise state-less web
environment. It’s a cool technology, that is however easy to misuse.
PHP magic quotes
About a year ago, I had problems when sending data to a php page, using AJAX. To
be able to unpack the data, I had to use stripslashes
. Since it seemed to work,
I was happy…until the world exploded.
Getting started with git and GitHub
As some of my hobby projects are coming together, I have meant to move them from Google Code to GitHub for quite some time. Tonight, I decided to give it a try and say hello to git and GitHub.
NuPack - a quick walkthrough
NuPack is a free, open source, developer-focused package manager for .NET. It looks absolutely awesome, so I downloaded it and gave it a try. Let’s have a look at how to use it.
onSelectRow fix for jqGrid
I love the jqGrid jQuery plugin. If you haven’t
tried it, I think you should. However, the onSelectRow
event doesn’t work that
well. Let’s fix it.
Getting started with NDepend 3
After some time, I have finally got my thumb out and added an NDepend project to one of my hobby project solution, to get some analyzing done. Let’s have a look!
Animation disables font in Internet Explorer
Yesterday, I built a simple demo page to demonstrate how easy it is to get fonts.com Web Fonts up and running. However, as I did, I noticed that Internet Explorer disables custom fonts during animations.
Fonts.com web fonts
The time has finally come to throw Arial and Verdana into the trash (Helvetica can stay for a while), as Monotype, Linotype and ITC (and others) have teamed up to develop a really cool service - web fonts!
Bundle JavaScript and CSS files with full file paths
I have looked at the great php-based css and JavaScript bundling approach that is presented at rakaz.nl. The approach in that post works great, but has a small drawback.
Getting the name of the current controller and action in ASP.NET MVC
I’ve been trying to find out how to get the name of the current controller and action in ASP.NET MVC. If you’re curious on how to do it, do read on.
Getting familiar with PHP 5.3.2
Since I’m just pretending to be a PHP developer, I only just now started to use PHP 5.3.2. The reason for this is that I just installed Aptana Studio 2, which comes with PHP 5.3.2 installed.
Make div container adjust to floating children elements
Today, my collegue Johan showed me a css fix for a problem that happens when a div container has nested, floating divs.
DataAnnotations and MetadataType fails in unit tests
This post describes how to solve the problem that model validation will not work for ASP.NET MVC 2 when testing a model that uses DataAnnotations and MetadataType to describe for its validation.
ConstraintException is thrown when posting empty data for non-nullable properties
I am working with model validation in .NET, Entity Framework 4, DataAnnotations
and
partial classes with MetadataType
connections and now have a problem where exceptions
are thrown when posting empty data for non-nullable properties.
jQuery, MooTools, object inheritance and JSON
I use both MooTools and jQuery in various projects. As I now have started moving more towards jQuery, I only use MooTools for its nice type and json capabilities. Let’s look at how to implement this in jQuery.
/ in URL query makes CSS @import and file paths fail
I am currently implementing css file bundling with virtual paths in php and am facing a problem, where slashes in the url query make file imports fail.
Bundle CSS files with relative file paths
I’m currently working on a css bundler, where aim to bundle files from different folders into a single file. This post describes how I had to replace content bundling with import bundling.
Hide successful tests in QUnit
I am using QUnit as TDD framework for my JavaScript development. It’s not as nice as NUnit is for .NET or SimpleTest for PHP, but it’s really easy to get started with.
Visual NUnit 2010
I have a license for R# at work. It’s a really nice utility that saves me a lot of time. Besides providing a lot of shortcuts and extensions to Visual Studio, it also integrates NUnit in a convenient way.
Find the shortest path in a grid in XNA
I’m currently playing around with a board game engine in XNA, where players can play missions that take place on a tile-based board. I’m now working on using the A* algorithm to find paths between tiles.
Generate a game board map from a bitmap
I’m currently developing an adventure board game in XNA, where players can play missions that take place on a board that is made up of square tiles. It’s a lot like the amazing, old board game Hero Quest. In this post, I’ll describe how my custom-made game engine generates a board from a bitmap.
A* implementation for XNA
I have recently been playing around with the XNA game framework that can be used to develop games for the Xbox 360. It’s fun, but different from the code I usually write. For instance, I’m currently trying to implement the A* pathfinding algorithm in C# for a board game that I’m working on.
Using shared libraries in iOS
After a couple of evenings, my first (really simple) iPhone app is taking shape. However, I’m currently struggling with reusing functionality across apps.
NSUserDefaults
As I’ve started to look into iOS development, I have created a test app with a tab view and four views (the $$$s are not far away). I now want to store data without a database. Can this be done?
XOT-Uzg TV Streaming on your Xbox
I recently picked up my old, black Xbox from the basement, where it has lived in solitude since I bought my Nintendo Wii. Since it is old and much has happened with the video game indistry since it came out, I don’t game on my XBOX anymore. Let’s look at some media server fun you can have with it instead.
MagSafe toggles green/orange (part 2)
I have some strange updates regarding the greeen/orange blinking MagSafe I wrote about yesterday, where the LED on the MagSafe toggles green/orange, even when the battery is fully loaded.
MagSafe toggles green/orange
In my last entry, I wrote about the many problems that I’ve had with my MacBook. In this post, let’s have a look at the green/orange MagSafe disco light.
MacBook swollen battery
I have previously written about my numerous problems with my new, white MacBook, which I purchased in August 2007. As icing on the case the battery has now swollen.
Load all assets in a folder in XNA
I have started looking at XNA and am currently working with assets in a small game. This post show how to load all assets in a folder, which is convenient for smaller games where resources isn’t as critical.
Doxygen - A brief tutorial
I’m using Doxygen to generate a web-based documentation for various .NET projects. This short post will show you how to configure Doxygen to achieve this.
Show all files in Finder
This post will show you how to easily show all hidden files in Finder, both with a Terminal script and a keyboard shortcut.
Auto-eject external drives when Macbook goes to sleep
Edit Aug. 28, 2010 SleepWatcher
has been changed since I wrote this post
and now differs from the information found in the link below. This approach does
still work, though, as does the modified script.
Easily paginate collections in C#
This post looks at how to easily paginate collections in C#, which can be easily achieved with two very basic extensions.
Use special characters in ModelState error message
I’ve been trying to use special characters (like « and ») to model
errors that I add to ModelState
. This post shows you how to do it.
JSON serialization in C#
From time to time, I forget where various classes in the .NET framework are defined. For my future self and those of you who also struggle, here’s a short tutorial on how to get JSON working in C#.
Using Moq with NUnit
As I continue to work with unit tests, I have noticed that some of my development patterns have started to change…for the better.
Using themes in ASP.NET MVC
I have finally started creating my first web site with ASP.NET MVC. After looking through the nice start examples, I noticed that .css files were manually included in the master page. Let’s have a look at how to use ASP.NET themes instead.
Find all classes that inherit a certain class
In a typed language, it can be handy to retrieve all types that inherit a certain base class. Let’s have a look at how to do this.
Get the week number of a date in C#
This post was written in 2009. Although the core logic hasn’t changed since then, the implementation has. For the lastest implementation, check out NExtra on GitHub.
Generate HTML documentation from C# comments
When developing .NET applications, XML comments is a good way of documenting the code. These comments can then be used to generate HTML documentation. Let’s have a look at how to do this.
Make URL rewriting in IIS 7 work like in IIS 6
I’ve had a lot of problems with getting URL rewriting to work with Windows Vista and IIS 7. Compared to IIS 6, virtual paths in IIS 7 don’t allow extensions like .js, .css, which is problematic if you have shared files in virtual paths.
jQuery Flash MP3 player download error
I am currently having problems with the Single MP3 Player with the jQuery Flash plugin, which fails to download files in other folders.
Identifying the project root in PHP
I currently have problems with identifying the project root in a PHP project. The problem applies to PHP, but the discussion is general and applies to the other languages and environments as well.
My first thoughts on TDD
After an interesting conference talk on Test and Behavior Driven Development (TDD & BDD), I have now started using NUnit to write unit tests in C#. Here are some initial thoughts from a TDD n00b.
json_encode works bad with UTF8
I have had some serious problems with UTF8 and PHP’s built-in JSON functionality. After solving it, I realized that it was not even an UTF-8 issue, but a JSON one.
Twitter vs Jaiku
I’ve been trying out Twitter and Jaiku for a while now. Since both provide more or less the same set of features, I have evaluated which I think will best fit my needs going forward.
Automatically convert media links with jQuery
This post will show you how to automatically convert media links with jQuery, for instance audio links to a Flash-based audio player.
DataGridView SelectionChanged event behaves strange
In this post, we’ll look at how the DataGridView
SelectionChanged
event can
behave strange and how to fix it if it does.
IIS 7 does not allow ports on Windows Vista
After clean installing Windows Vista, Visual Studio 2005 and Visual Studio 2008 on my work computer, I started having problems with using dynamic ports with ASP.NET.
Windows Vista, Visual Studio 2008 and IIS7
After upgrading to Windows Vista, I’ve had many problems with running Visual Studio 2008 and IIS 7 on it. This blog post discusses some problems and how to solve them.
Internet Explorer document.body.appendChild(...) problem
On my spare time, I develop a PHP web application on OS X and thus test my sites in Firefox, Safari and Opera on a daily basis. More seldom, I also verify that it works in Internet Explorer. Or doesn’t.
Avoid empty img src values
In this post, we’ll discuss how empty image src values can ruin the performance of your web site, and how you can to solve it.