2013-07-08

Solved: svchost.exe high CPU and memory

A few days ago one of the svchost.exe processes on my machine (Win7 64) started exhibiting this annoying behavior: it will start with about 30 to 40 megabytes of memory, which stays roughly constant for a while, but then later it begins bloating, slowly but surely, possibly at a slightly exponential rate, until a few hours later it is taking up so many gigabytes that I cannot work on my computer anymore. So, I have to stop what I am doing, save everything, and restart the computer, only to have to go through the same ordeal a few hours later.

On at least two occasions I have witnessed this happening along with unreasonably high CPU utilization, up to a full CPU core.

Obviously, this started happening after I installed or tweaked something, but I did not notice the precise point in time that it started happening, and my machine is a busy machine, so I had no suspects to name.

I looked around the interwebz for a solution, but to no avail.  People give some good troubleshooting hints, but nobody seems to have an actual solution.

The svchost.exe process which causes the problem contains the following services:


2013-07-07

A monstrous Visual Studio 2010 intellisense bug

I had this happening on my development machine, (I use C# on VS2010) so I went over to The Code Project and asked if anyone else could reproduce it, and sure enough, it has been confirmed.
Steps to reproduce:

Create a new project, make it a C# console application, use all default settings. Open the generated Program.cs file and replace its contents with the following:

namespace ConsoleApplication1
{
    public class ParameterAttribute: System.Attribute
    {
    }

    class Program
    {
        [Parameter( name:"foo" )]
        int Field1;

        static void Main( string[] args )
        {
        }
    }
}



I know, there is an error in the code; please bear with me:


2013-06-07

Vintage stuff from my days of 320x200-pixel 256-color VGA

Techniques demonstrated:

  • Ultra-fast font rendering
  • Ultra-fast bitmap scaling
  • Ultra-fast bitmap rotation
  • Projection of 3D structures to 2D for rendering
  • Invisible surface detection
  • Ultra-fast rendering of lines and polygons directly into video RAM
  • Gouraud shading
  • Ultra-fast dithering
  • A voxel rendering experiment
  • A tiled floor rendering experiment

Summary (just give me the TL;DR)

A collection of very short YouTube videos of graphics demos that I did all by myself at home for fun back in the mid-nineties (when I was in my twenties) rendering pixels directly into the video RAM of the 320x200-pixel, 256-color palette VGA without the use of any libraries. Everything is in C or C++ with the crucial routines written in 80386 assembly, in some cases generating machine code on the fly.

2013-06-05

A few samples of my work on Darkfall Online

The development of a game like Darkfall Online in a country like Greece was a rather unlikely thing to happen, so I consider myself very lucky that it happened and that I was part of it.  Here is the wikipedia page for the game: https://en.wikipedia.org/wiki/Darkfall

The funding came from a Greek-Libyan family which has made enough money out of oil-related construction to be able to afford the luxury of investing on something fun, rather than on something with a high ROI, or even a guaranteed ROI. Thus Razorwax, a promising team of Norwegians some of whom were already published in the gaming industry, was brought to Greece to build Darkfall.  I was the first Greek programmer hired, and I worked primarily on the GUI of the game. I stayed with the company for about a year after the game was released.

Me at Aventurine, in 2004. Click to enlarge.
What follows is a rough diagram of the design of the GUI that I built for Darkfall: The graphics engine (written by a colleague in C++) provided me with just two asynchronous primitives, one for drawing textures, and one for drawing text. The layer we called middleware (written by another colleague, also in C++) provided me with the functionality of the "GetTextExtents" Win32 GDI function, and with an interface to the browser window (encapsulated instances of Microsoft Internet Explorer.) 

2013-05-30

Vintage: my work on FESPA for Windows (Visual C++ and MFC)

This post shows some screen captures demonstrating work that I did on a Computer-Aided Civil Engineering application called "FESPA for Windows" back in 1996-1998 while working at SENA Ltd. on behalf of "LH Logismiki".

"FESPA for Windows" is now called "Master". SENA Ltd. does not exist anymore, but LH Logismiki does, and their website can be found here: http://www.lhlogismiki.gr/.  I took these screen captures from their web site, and apparently the modules that I built for them back in 1998 have not changed much, 15 years later. Even most of the icons that I designed for them are still the same.

3DV on black background #1. Click to enlarge.
The above is a screen capture of the "3DV" module, designed and written entirely by me. It is from the early black-background days, before we were told to switch to white background to "make it look more like Microsoft Word".  3DV can pan the structure up, down, right and left, zoom it in and out, and rotate it in any way the user likes. Using data produced by the finite-element analysis module, it can also show the distortions that the building undergoes due to static loads, or in the event of an earthquake. It can even animate the distortion of the whole building. (Pretty fancy stuff!) 

2013-05-27

Screen Capture (Screenshot) under Android 4

The TL;DR version of this post:

Depress as simultaneously as possible, and keep holding down for about a second, both the home button and the power button.

The order in which the buttons are depressed does not matter, but simultaneity matters: from the moment that one of the buttons has been depressed, there is an extremely small window of time, perhaps as small as one tenth of a second, within which the other button must also be depressed, or else no scweesho fo joo!

You will know that you have managed to take a screenshot when your phone will emit an oh-so-vintage camera shutter sound, a bright white frame will momentarily appear along the borders of the screen, and a "picture" icon will take seat in the notification area.

The oh-how-much-I-love-writing version of the post:

2013-05-12

A pristine Windows Registry

The following files were exported from a pristine installation of Windows 7 Ultimate x64 living inside a virtual machine created by VMware Player.  So, they represent a default (clean) copy of the registry of that windows system before installing any software on it.  (Well, except for VMware Tools.)


Here is the .ZIP file containing all the .REG files. (9.5 MB)

IMPORTANT NOTICE: The location of these files may change in the future, but the location of this blog post will not, so if you want to provide links, please make sure to link to this post, not to the actual .reg files.

Explanation:

For reference purposes, I needed to get my hands on a default (clean) copy of the registry of Windows. I could not find anything on the interwebz, so I had to load Windows into a virtual machine and extract the registry from it.  I figured that this may be useful to many people out there, so I have posted the results of my labor.

2013-05-07

Microsoft Visual Studio 2012 (up until update 2) is lame!

If I knew there are no macros in VS2012 I would have saved myself the trouble of upgrading from Windows XP to Windows 7 and reinstalling all my stuff from scratch. The all caps menu is fixable; the awful colors are fixable; the dreadful icons I can live with; the rest of the god-awful ugliness I can live with; but the macros? I cannot work without macros! So, I am reverting to VS2010 and sticking to it for now.

Aside from that, the operating system upgrade means that I am now 64-bit!  Going up in life!  C-:=

2013-05-04

tattoodavie's woes

This is so funny I had to share it.

Somewhere in some troubleshooting forum (it does not matter where) a certain technical issue is being discussed (it does not matter what) and user 'tattoodavie' leaves the following comment:
i have the same problem but i have windows 7 ultimate 7600 installed on an asus X83Vb-X2 notebook, but i also have another problem... i cant get into the bios and set the clock, change the settings... nothing...its password protected. it was my ex-girlfriends, she bought the laptop, but gave it to me for me for my birthday, turns out it came from a pawn shop, which one i will never know, seeing as how we cant talk to eachother any more (court order) i have no clue how i can clear the password. I have had it for some time now, and have grown too attached to it to. i just installed windows 7 and the new NVIDIA 182 driver for its GeForce 9300m GS 512mb graphix card. and now every time i restart this thing it sets the time and date back to 12/05/2008. I assume thats the date it was built. any ideas what the he** is going on?
Okay, it is from here: social.technet.microsoft.comWindows 7 64 bit and Asus P5Q BIOS issue

2013-03-27

My notes on "Clean Code" by Robert C. Martin

These are my notes on the book "Clean Code" by Robert C. Martin from Prentice Hall.



I am in agreement with almost everything that this book says; the following notes are either quotes from the book which I found especially interesting and/or especially well written, or they point out issues that I disagree with, or errata which objectively need correction. If some point from the book is not mentioned below, then I agree with it.

2013-02-21

C# Blooper №14: Weird / annoying interface method visibility rules.


Before reading any further, please read the disclaimer.

As it turns out, an explicit interface method implementation in C# must be tied to the base-most interface to which it belongs; it cannot be tied to a descendant interface.

namespace Test14
{
    class Test
    {
        interface A
        {
            void F();
        }

        interface B: A
        {
        }

        class C: B
        {
            void A.F() //OK
            {
            }

            void B.F() //error CS0539: 'B.F' in explicit interface declaration is not a member of interface
            {
            }
        }
    }
}

Well, sorry, but... it is.

-

2013-02-05

C# Blooper №13: Stack and Queue do not implement ICollection


Before reading any further, please read the disclaimer.

This is a blooper of the Common Language Runtime (CLR), not of the language itself: Stack<T> and Queue<T> derive from ICollection, but not from ICollection<T>, so they do not support the Remove( T ) method! Why, oh why?

-

2013-01-25

C# Blooper №12: 'Where' constraints not included in method signatures


Before reading any further, please read the disclaimer.

When writing generic methods in C#, it is possible to use the 'where' keyword to specify constraints to the types that the generic parameters can take. Unfortunately, these constraints cannot be used for resolving overloaded methods. Case in point:

namespace Test12
{
    class Test
    {
        public static bool Equals<T>( T a, T b ) where T: class
        {
            return object.Equals( a, b );
        }

        public static bool Equals<T>( T a, T b ) where T: struct //error CS0111: Type 'Test' already defines a member called 'Equals' with the same parameter types
        {
            return a.Equals( b );
        }
    }
}

-

2013-01-14

C# Blooper №11: Zero to Enum conversion weirdness


Before reading any further, please read the disclaimer.

When you assign an enum to int, you have to cast it. That's good. When you assign an int to enum, you also have to cast it. That's also good. But if you assign zero to an enum, you don't have to cast it! Go figure.

namespace Test11
{
    class Test
    {
        public enum myenum
        {
            a, b, c
        }

        void test_myenum( myenum f, int i )
        {
            i = (int)myenum.a; //need to cast; that's good.
            f = (myenum)5; //need to cast; that's still good.
            f = 0; //wtf? no need to cast?
        }
    }
}

-

2013-01-08

C# Blooper №10: Switch statements are not properly formatted.


Before reading any further, please read the disclaimer.

This is rather a Microsoft Visual Studio blooper than a Microsoft C# blooper: When formatting source code, Visual Studio offers an "indent case contents" option, but you will only find it useful if you happen to have a crooked notion as to how switch statements should be formatted. The one and only normal form of formatting switch statements is not supported.

namespace Test10
{
    class Test
    {
        void statement() { }

        void test( int a )
        {
            /* with "indent case contents" option selected: */
            switch( a )
            {
                case 42:
                    /* this is not properly indented */
                    {
                        statement();
                        break;
                    }
                default:
                    /* this is properly indented */
                    statement();
                    break;
            }

            /* with "indent case contents" option deselected: */
            switch( a )
            {
                case 42:
                /* this is properly indented */
                {
                    statement();
                    break;
                }
                default:
                /* this is not properly indented */
                statement();
                break;
            }

            /* the normal way of indenting cannot be achieved: */
            switch( a )
            {
                case 42:
                {
                    statement();
                    break;
                }
                default:
                    statement();
                    break;
            }
        }
    }
}

I know, you might disagree that my way of formatting switch statements is in any way 'normal'. So, in your case, let us agree on this: my way of formatting switch statements, whether you like it or not, is in perfect accordance to the way I format the rest of my code; and since Visual Studio allows me to precisely describe my coding style, it should also allow for a switch statement style that matches the rest of my code.

-

2013-01-07

C# Blooper №9: Annoying case statement fall-through rules.


Before reading any further, please read the disclaimer.

Overall, C# takes an approach which is far more friendly to novice programmers than its predecessors, C and C++ were. For example, in the case of switch statements, C# does not allow the old, error-prone style of C and C++ where you could simply fall through from one case statement to the following one; instead, at the end of each case statement C# requires either a break statement, or a goto statement to explicitly jump to another label. That's all very nice and dandy, except for one thing: C# requires a break or goto even at the last case statement of a switch statement!

namespace Test9
{
    class Test
    {
        void statement() { }

        void wtf_is_it_with_falling_through_the_last_case_label( int a )
        {
            switch( a )
            {
                case 42:
                    statement();
                    break;
                default:
                    statement();
                    break; //Need this 'break' or else: CS0163: Control cannot fall through from one case label ('default:') to another
            }
        }
    }
}

I mean, seriously, WTF?

-

2013-01-04

C# Blooper №8: No warnings for conditions that are always true/false


Before reading any further, please read the disclaimer.

The Microsoft C# compiler does not issue 'condition is always true' and 'condition is always false' warnings. Perhaps these warnings are not particularly meaningful in Java, which lacks conditional compilation directives, and therefore if( true ) and if( false ) are the only means of achieving conditional compilation; but in C#, which has special conditional compilation directives, conditions which are always true or always false are invariably so by mistake; therefore, these warnings would indeed be meaningful, and useful.

namespace Test8
{
    class Test
    {
        void statement() { }

        void test()
        {
            if( true ) //no warning about 'condition is always true'.
                statement();

            while( false ) //no warning about 'condition is always false', even though the compiler obviously knows what's going on, since the following warning is issued:
                statement(); //warning CS0162: Unreachable code detected 
        }
    } 
}


For more information see Why the Microsoft C# compiler lacks many useful warnings.

-

C# Blooper №7: No warnings about unused private methods.


Before reading any further, please read the disclaimer.

If you have a private method which is never used, you will not be given a warning about it by the Microsoft C# compiler. This means that your app will likely get shipped with unnecessary chunks of code in it, some of them possibly containing string litterals that were never meant to make it out of the development environment, or even requiring libraries to be linked which were never meant to be required on the field.

namespace Test7
{
    class Test
    {
        private void unused() //no warning about unused private method.
        {
        }
    }
}

For more information see Why the Microsoft C# compiler lacks many useful warnings.

-