The Linux Page

C++

Programming language based on the C language adding object features to the language.

no talloc stackframe at ../source3/param/loadparm.c:4864, leaking memory

As I upgrade to 14.04, I started seeing this error in my console:

no talloc stackframe at ../source3/param/loadparm.c:4864, leaking memory

Quite cryptic if you ask me, but the "leaking memory" did sound bad.

The error would in particular appear when I used sudo for whatever reason, for example:

sudo iptables -L -nvx

So... something to do with sudo?

I found the answer on the Ubuntu forum. The solution is to turn off a feature of samba. Run the samba setup tool in your console:

sudo pam-auth-update

That opens a curses window in your console. You should then see an option ...

The for() in C, C++, Java, PHP, JavaScript...

As I am working on my as2js compiler, I stumble on a couple of problems with the for() loop parsing because of the in keyword. That made me think and the for() statement was actually a very funny one. Yes! You can actually write something like this and it compiles:

int zero;
for(3;2;1) zero;

As you can see, all 3 entries in the for() statement are valid expressions and therefore the compiler can compile that code. This creates a loop that runs forever, similar to:

for(;;) zero;

but much less clear to read, obviously.

Now that's food for thought, isn't it?

In JavaScript, you ...

#PCDATA and DTDs

If you are like me and write DTDs to check your XML files to make sure you don't have too many mistakes in them, then you probably have had this problem before.

The #PCDATA has a very special behavior and it is really restrained as follow:

  • #PCDATA must appear at the start
  • #PCDATA must be repeated from zero to infinity, so only * work with it
  • #PCDATA cannot be used with sub-groups (things between parenthesis)

Something like this:

<!ELEMENT Z (P | (#PCDATA | A | B | C)* | Q)+>

does not work because you use + and #PCDATA is within a sub-group.

What you need ...

Debug and/or Release specific command line option in cmake

Today I ran in a problem with cmake which was to very simply select /MT instead of /MD for a small set of projects. The problem is that so far this feature was at least on a per directory basis. Since the exact same directory is used to build the dynamic (DLL) and static (.lib) libraries, having two directories is not exactly an option here.

set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT" )
set ( CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT" )
set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_RELEASE} /MTd" )
set ( CMAKE_C_FLAGS_DEBUG ...

Very Sleepy CPU Profiler written in C/C++

When running a process under MS-Windows, it is at times rather difficult to find a problem caused by some slowness in your code, especially when it is not expected to be slow.and you do not get any kind of feedback from your software outside of the slowness itself.

When that happens a good way to find the problem is to use a profiler. Under MS-Windows, you have quite a few choices, but in most cases I've seen rather complicated solutions. Today I was told to check in Very Sleepy which I downloaded very quickly, installed very quickly, and ran very quickly., Also it did not give me the ...

Compose Key under Linux Keyboard

Under X-Windows, I use the QWERTY keyboard because I'm so used to it. But once in a while I want to write something with an accent or a special character. To do that I use the compose key. In my case the compose key is the Caps Lock key. So I push the Caps Lock once, and then two other keys to get the character I want. For example, the c with a cedilla is c with a comma: ç.

The following is the content of the Compose file available on Linux Ubuntu (/usr/share/X11/locale/en_US.UTF-8/Compose):

# UTF-8 (Unicode) compose sequence
# by David.Monniaux
#

# Part 1 - Manual ...

Changing the Time format in your Thunderbird on Unity (Ubuntu 12.04)

That took me forever because I could not find the place where my Unity icons where to edit them in order to add the necessary LC_TIME definition. This being said, it's relatively easy except that you have no real control over the exact formt, only the locale.

So...

I created a file named starter under my thunderbird folder, if you don't have such (because you're using the stock version of thunderbird) then you may want to create a bin folder as in:

mkdir ~/bin

The starter file is just a text file with a shell script like this:

#!/bin/sh
LC_TIME=en_DK.utf8
export ...

not enough actual parameters for macro min() or max()

As I was porting wpkg to Windows so it would compile under Microsoft IDE version 10, I ran in a problem with variables named min and max. Windows wanted to see them as the min(a,b) and max(a,b) macros.

That started happening when I included Windows.h which I needed for handling files (CreateFileA, CloseHandle, etc.).

Since these are macros, i.e. defined with #define ..., they take priority over anything in your C++ code (since that's handled with your preprocessor.)

One way to get rid of them is to undefine those macros after the #include, something like this:

#include ...

Distributed compilation with Linux C++

I really want to try that feature! I have been using Incredibuild on MS-Windows and it can make a software compile 5 to 6 times faster. (i.e a software normally compiling in 1h compiles in 10 minutes!)

Under Linux some people worked on the C compiler front end to move the process to other machines as required. This is called distcc (i.e instead of using cc to compile, now you use distcc). This front end has a list of all the C compiler machines and uses them whenever possible.)

From what I can see on the front page, the setup should be a breeze (yeah... I know) and it does not even require ...

jQuery and hidden IFRAME bug

In the last 3 days I've been working on a new page and ran in some strange problem. There was an error in the console but things seemed to otherwise work just fine so I ignored it (since it wasn't in my own code...)

That error was an unhandled jQuery error which resulted in "let's stop the JavaScript at once." This meant all the page initialization failed (or did not occur.) The code was there otherwise. What give?!

The script in question was loaded from a hidden IFRAME, something like this:

  <div style="display: none;">
    <iframe ...
Syndicate content Syndicate content

SMS From Me Logo

SMS From Me

To automatically start one on one conversations with your online leads.

     

   

Terms of Site Index

Find the page/content you are looking for with our index.