Archive for the ‘Troubleshooting’ Category

h1

Why cron does not run cron.hourly/daily/weekly/monthly scripts?

June 28, 2009

Your scripts in /etc/cron.hourly/, /etc/cron.daily/, /etc/cron.weekly/, or /etc/cron.monthly/ do not run?
Read the rest of this entry ?

h1

Cannot switch resolution in Ubuntu

June 17, 2009

About a month ago I upgraded my work computer’s Ubuntu from 8.10 to 9.04. All worked just fine (though not as fast as a clear installation of 9.04 as I have on home computer – bit of clean up needed), until yesterday, when Ubuntu suddenly switched to 1024×768 resolution, and didn’t want to move to any higher resolution.

Read the rest of this entry ?

h1

HowTo: “mod_mime_magic: invalid type 0 in mconvert()” error

February 17, 2009

If you’re getting the “mod_mime_magic: invalid type 0 in mconvert()” error in your error log of Apache (or any other http server), it’s most probably due to fault in mime-magic’s configuration.

Read the rest of this entry ?

h1

Windows XP under VirtualBox

January 8, 2009

I’ll be updating this post with stuff about common problems with running WinXP under VirtualBox (with Linux – in my case Ubuntu 8.10 Intrepid Ibex – as host).
Read the rest of this entry ?

h1

How to change line height in NetBeans’ editor

December 26, 2008

After changing font size in editor in NetBeans 6.5, the line height (line spacing) all of a sudden grew to about 2 “normal lines”, and didn’t change back even when I returned to the original font size.

The only work-around I found was to edit manually the editor’s configuration file (since this option is not available via GUI).
The file org-netbeans-modules-editor-settings-CustomPreferences.xml can be found in ~/.netbeans/6.5/config/Editors/Preferences (on Windows, it’s in {install_dir}\ide10\config\Modules ). If it’s not there, change any editor settings in NetBeans IDE, and it’ll create it.

Open this file in your favourite text editor, and add the following code right before the last line (right before the </editor-preferences> tag):

<entry javaType="java.lang.Float" name="line-height-correction" xml:space="preserve">
    <value><![CDATA[0.7]]></value>
</entry>

And that’s it! Restart the NetBeans IDE, and all should look much better. Happy coding!

Another solution, thanks to Mark :

  1. Install sun-java6-jdk
  2. Uninstall open-jdk
  3. Reinstall NetBeans
h1

Small guide to casting in C++

September 8, 2008

If you only want a guide to casting in C++, skip to the end of the article. If you want also a bit of technicalities for a better understanding of casting in C++, skip to the one but last section. If you want also a bit of my mind, read the article whole.

Read the rest of this entry ?

h1

How to Open Console Window in a Win32 Application

August 29, 2008

When you create a basic main()-based application, you get the console window implicitly; but a typical WinMain()-based application does not open a console window – you have to allocate the console and to connect the I/O streams yourself.

Yet, this is not a thing you find described in manuals. Fortunately, it’s simple to do, and the code presented here can be used as-is in all your projects.
Read the rest of this entry ?

h1

Simple Doxygen templates

July 29, 2008

This is a follow-up to previous tutorial, Simple guide to basic Doxygen usage.

Here are few simple templates that you might use for documenting your source; easiest use is with e.g. Visual Assist X, or any other tool that allows you to add predefined templates to your source code. I use these template with VAX and shortcut set to “/*!”, with short descriptive names, thus I don’t need to remember many shortcuts and have all at reach of 3 key-clicks. :D

And we finish off with a small list of simple tips.
Read the rest of this entry ?

h1

Simple guide to basic Doxygen usage

July 20, 2008

Make sure to also check out part 2 of this tutorial, “Simple Doxygen templates” for many useful templates and tips.

This is a simple guide to basic use of Doxygen-compliant commenting of source code. The guide is written from my point – C/C++ – but it’s valid for all supported languages, except of Python. See Doxygen documentation for use for Python. Doxygen is very flexible when it comes to the form of how the documentation is written, the layout presented here is simply my preference.

Read the rest of this entry ?

h1

“nafxcw.lib” error LNK2005 and “identifier ‘THIS_FILE’” error C2061

June 1, 2008

I guess you also here and there stumble upon these errors while programming with MFC. Yet the approprite MSDN-KB articles are not very explicite about what to do.

So, here’s what typically works for me.

“nafxcw.lib” error LNK2005

If you get lots of LNK2005 errors like this:

nafxcwd.lib(afxmem.obj) : error LNK2005:
    "void * __cdecl operator new(unsigned int)"(??2@YAPAXI@Z)
    already defined in LIBCMTD.lib(new.obj)

nafxcwd.lib(afxmem.obj) : error LNK2005:
    "void __cdecl operator delete(void *)"(??3@YAXPAX@Z)
    already defined in LIBCMTD.lib(dbgnew.obj)

nafxcwd.lib(afxmem.obj) : error LNK2005:
    "void * __cdecl operator new(unsigned int,int,char const *,int)"
    (??2@YAPAXIHPBDH@Z) already defined in LIBCMTD.lib(dbgnew.obj)

mfcs40d.lib(dllmodul.obj): error LNK2005:
    _DllMain@12 already defined in MSVCRTD.LIB (dllmain.obj)

mfcs42d.lib(dllmodul.obj): error LNK2005:
    _DllMain@12 already defined in msvcrtd.lib (dllmain.obj)

make sure all your source (.cpp) files contain the #include "stdafx.h" as the first include in the file.

This error also appears when there is conflict in the way how CRT and MFC library are linked (static / shared), so if these errors appear after you have changed the way any of those is linked, check if you did it for both.

“identifier ‘THIS_FILE’” error C2061

If you got C2061 errors like

c:\program files\msvs6\vc98\include\new(35) :
    error C2061: syntax error : identifier 'THIS_FILE'
c:\program files\msvs6\vc98\include\new(35) :
    error C2091: function returns function
c:\program files\msvs6\vc98\include\new(35) :
    error C2809: 'operator new' has no formal parameters
c:\program files\msvs6\vc98\include\new(36) :
    error C2061: syntax error : identifier 'THIS_FILE'
c:\program files\msvs6\vc98\include\new(37) :
    error C2091: function returns function
c:\program files\msvs6\vc98\include\new(37) :
    error C2556: 'void *(__cdecl *__cdecl operator
    new(void))(unsigned int,const struct std::nothrow_t &)' :
    overloaded function differs only by return type from
    'void *(__cdecl *__cdecl operator new(void))(unsigned int)'
        c:\program files\msvs6\vc98\include\new(35) :
            see declaration of 'new'
c:\program files\msvs6\vc98\include\new(42) :
    error C2809: 'operator new' has no formal parameters
c:\program files\msvs6\vc98\include\new(42) :
    error C2065: '_P' : undeclared identifier

make sure all your #include’s occure ahead of the

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

section in the source files; esp. the headers you created, and that are not generated/created by VS.