Oldschool CMD: deleting all files of a type with exceptions

Just some oldschool trickery: using the command prompt in windows (even works in dos! 🙂 ) it’s very easy to delete all the files of a certain type except those having a specifc name I wan’t to keep. Imagine I need to recursively delete all the jpg files in a folder and subfolders, except those named “folder.jpg”. The following command does this:

del /s dir *.jpg  /s | find /i /v "folder.jpg"

Why I put this on my blog? Because I might need it for future reference 😀

A clickable Windows Phone slider

The default behavior of the Windows Phone Slides control doens’t allow a user to click on the slider where the value should be set to. Instead, tapping anywhere on the slider will simply result in the slider incrementing by it’s default or given incrementsetting.

Following small piece of code shows how to have the wanted behavior by responding to the Tap- event of the Slider (named mySlider in the following codepiece).

        private void UIElement_OnTap(object sender, GestureEventArgs e)
        {
           if (mySlider.Orientation == System.Windows.Controls.Orientation.Horizontal)
            {
                var pos = e.GetPosition(mySlider).X;
                var width = mySlider.ActualWidth;
                mySlider.Value = (pos/width)*mySlider.Maximum;
            }
            else
            {
                var pos = e.GetPosition(mySlider).Y;
                var height = mySlider.ActualHeight;
                mySlider.Value =(1- (pos / height) )* mySlider.Maximum;
            }
        }

Bookreview: “Masters of Doom”

51jZGrnagjL._SL160_Last weekend I devoured Masters of Doom: How Two Guys Created an Empire and Transformed Pop Culture , a book by David Kushner. The book delivers bigtime. Even though the story about game developers pur-sang John Carmarck and John Romero is pretty well known to many avid gamers, the author still is able to tell a gripping story. Basically we follow the lives of “the two Johns” and how they created some of the most important games in recent gaming history: Commander Keen, Wolfenstein, Doom and Quake.

What makes this book so good is the very fast pacing and the focus on the people behind the game. From the start it’s very clear that the two Johns are very , very different people. However, that didn’t stop them from making some of the best games ever, together. Equally important is that the scope is wide enough and not only focussed on mr Carmack and  mr. Romero. Instead, all the ‘side-characters’ are given enough time, and credit, in the book to show that in the end the id software games were the result of great teamwork.

What I especially liked from the book is the fact that the author is able to keep a certain level of serenity when talking about how the great cooporation between the two johns came to a halt…and changed in what some might call a mud-throwing fest. Where other authors might delve deeply in these sad parts in their lives and focus on the not-so relevant cursing and (verbal) fights, David Kushners still is able to show the good side of it all making his text all the more important.

If there’s one, small, drawback of this book it’s the lack of technical details. Ofcourse, this was never the focus, but still, certain aspects could’ve been fleshed out a bit more to satiate my inner developer (for example why Romero cringed when discovering how the Quake 2 engine was written which would results in many months of rewriting Daikatana to use this new engine).

When reading the book I continuously felt pangs of jealousy , thinking how great it must’ve been to be part of id software while they were making pc history.  If there’s one conclusion to be made from this book it’s that indie developers should never give up and even nowadays, with big publisher  and software companies everywhere, there’s still room for a handful of focused and able game developers.

I can’t recommend this book enough. Go and have a read, you won’t regret it!

A powerpoint .pptx to Latex .tex convertor tool

A colleague of mine is making some very nice Latex-based presentations, including a dynamically generated section-overview on each slide. Since all my current slidedecks are made in Powerpoint I started working on a small tool that converts .pptx to .tex latex files. (make note: this tool won’t work with oldschool .ppt files!)

Clipboard01
The tool is far from done. But the basic functionality is there. Currently the tool converts a .pptx file to a  .tex and keeps the following slide information:

  • All titles
  • All text/bulletitems
    • Including identation
  • All section headers
  • Option to include hidden slides
  • All images
    • Each image is extracted and save as a separate file

I’m using the Open XML SDK 2.0 which allows more easy parsing of .pptx using C#. More info on how the tool was made might show up here some day.
Other features that I’d like to include is the ability to export the notes (shouldn’t be a problem) and some simple text formatting information (bit harder).

You can download the sourcecode on github: https://github.com/timdams/Pptx2Tex

Adding a search contract to the Windows 8 Calibre frontend

In this post I will show how simple it is to add a search contract to a Windows 8 Store app. This contract allows the user to search within your application from anywhere in Windows 8 using the search charm.  We will use my Calibre frontend app to show this. Check this video to see the raw action of what we are making.

What we are building: the search in action after querying for books with "brown" in the authorname.

What we are building: the search in action after querying for books with “brown” in the authorname.

This is the second post of my quest on writing a Windows 8 Store app for Calibre. The previous post can be found here. Read more of this post

Writing a Calibre frontend for Windows8/WinRT using ‘SQLite for WinRT’

While developing a Windows Store frontend application for the Calibre ebookmanager, I’m hitting several bumps along the road. In this post I’ll explain some of the bumps and how I’ve tried to tackle them.

Basically they can be summarized as follows:

  • How to access a Sqlite database in a WinRT application
  • Circumvent file access limitation of SQLIte for WinRT
  • Load cover files of each book
  • Create incremental-loading Gridview using ISupportIncrementalLoading

Calibre is a great open source and free to use ebookmanager. It allows me to manage my ever-growing ebook-library and it supports lots of ebook-filetypes, including the ability to convert between the types.

My goal is to write a simple Windows Store application that acts as a frontend for the Calibre database. It will show my library in a visual appealing manner (aka TDPFAM, “The-design-principle-formerly-known-as-Metro”) and allow the user to rapidly query his database from anywhere in windows. At least that’s the idea. We’ll see where we end up (check here for a little video demonstrating the application I’m building).

Future follow ups on this project might be found here on the Calibre developer forum.

Early alpha of Calibre frontend, simply demonstration what can be done (check out the youtube movie). Note the layout that is based on one of the existing VS2012 WinRT project setup.

The original Calibre program

With this post I hope others get triggered to create their own Calibre frontend, because, knowing myself, I’ll get bored of the project pretty soon once I have to tackle the UI/UX stuff …which I don’t like.
Read more of this post

A WP7 databound graph control

For a project we are working on, we needed a simple (and free) WP7 graph usercontrol. The data which the usercontrol visualizes needs to be databound and each time new data arrives, the graph should update itself on-the-fly .In the following tutorial we’ll show how to create such a control from scratch (make note that normally this should also work in Silverlight or WPF projects).

A demo-solution of this tutorial can be downloaded here.

Read more of this post