Forçar a instalação de extensões do FireFox

No peopleware estão as indicações para enganar o FireFox quando este não deixa instalar um add-on por incompatibilidade de versões:

Na barra de endereços, escreva about:config e Enter. Serão apresentadas todas as configurações internas do Firefox.
Clique com o botão direito na lista, seleccione New (Novo), e clique em String;
Na janela que abre, escreva app.extensions.version;
No valor para a nova string, coloque 1.0;
Reinicie o Firefox 1.5, e active todas as extensões desativadas;
Reinicie o Firefox 1.5 novamente para activar as extensões.

Depois das extensões passarem a funcionar é necessário apagar a string que criamos no processo, para que o sistema de actualizações das extensões funcione.

Deixe um comentário

Filed under Mozilla Firefox, Software, Tips & Trick

How to get GCC version on compile time

 Retirado daqui:

The common predefined macros are GNU C extensions. They are available with the same meanings regardless of the machine or operating system on which you are using GNU C. Their names all start with double underscores.

__GNUC__
__GNUC_MINOR__
__GNUC_PATCHLEVEL__
These macros are defined by all GNU compilers that use the C preprocessor: C, C++, and Objective-C. Their values are the major version, minor version, and patch level of the compiler, as integer constants. For example, GCC 3.2.1 will define __GNUC__ to 3, __GNUC_MINOR__ to 2, and __GNUC_PATCHLEVEL__ to 1. They are defined only when the entire compiler is in use; if you invoke the preprocessor directly, they are not defined.__GNUC_PATCHLEVEL__ is new to GCC 3.0; it is also present in the widely-used development snapshots leading up to 3.0 (which identify themselves as GCC 2.96 or 2.97, depending on which snapshot you have).

If all you need to know is whether or not your program is being compiled by GCC, you can simply test __GNUC__. If you need to write code which depends on a specific version, you must be more careful. Each time the minor version is increased, the patch level is reset to zero; each time the major version is increased (which happens rarely), the minor version and patch level are reset. If you wish to use the predefined macros directly in the conditional, you will need to write it like this:

/* Test for GCC > 3.2.0 */
          #if __GNUC__ > 3 || \
              (__GNUC__ == 3 && (__GNUC_MINOR__ > 2 || \
                                 (__GNUC_MINOR__ == 2 && \
                                  __GNUC_PATCHLEVEL__ > 0))

Another approach is to use the predefined macros to calculate a single number, then compare that against a threshold:

#define GCC_VERSION (__GNUC__ * 10000 \
                               + __GNUC_MINOR__ * 100 \
                               + __GNUC_PATCHLEVEL__)
          ...
          /* Test for GCC > 3.2.0 */
          #if GCC_VERSION > 30200

Many people find this form easier to understand.

__GNUG__
The GNU C++ compiler defines this. Testing it is equivalent to testing (__GNUC__ && __cplusplus).
__STRICT_ANSI__
GCC defines this macro if and only if the -ansi switch, or a -std switch specifying strict conformance to some version of ISO C, was specified when GCC was invoked. It is defined to `1′. This macro exists primarily to direct GNU libc’s header files to restrict their definitions to the minimal set found in the 1989 C standard.
__BASE_FILE__
This macro expands to the name of the main input file, in the form of a C string constant. This is the source file that was specified on the command line of the preprocessor or C compiler.
__INCLUDE_LEVEL__
This macro expands to a decimal integer constant that represents the depth of nesting in include files. The value of this macro is incremented on every `#include’ directive and decremented at the end of every included file. It starts out at 0, it’s value within the base file specified on the command line.
__ELF__
This macro is defined if the target uses the ELF object format.
__VERSION__
This macro expands to a string constant which describes the version of the compiler in use. You should not rely on its contents having any particular form, but it can be counted on to contain at least the release number.
__OPTIMIZE__
__OPTIMIZE_SIZE__
__NO_INLINE__
These macros describe the compilation mode. __OPTIMIZE__ is defined in all optimizing compilations. __OPTIMIZE_SIZE__ is defined if the compiler is optimizing for size, not speed. __NO_INLINE__ is defined if no functions will be inlined into their callers (when not optimizing, or when inlining has been specifically disabled by -fno-inline).These macros cause certain GNU header files to provide optimized definitions, using macros or inline functions, of system library functions. You should not use these macros in any way unless you make sure that programs will execute with the same effect whether or not they are defined. If they are defined, their value is 1.
__CHAR_UNSIGNED__
GCC defines this macro if and only if the data type char is unsigned on the target machine. It exists to cause the standard header file limits.h to work correctly. You should not use this macro yourself; instead, refer to the standard macros defined in limits.h.
__WCHAR_UNSIGNED__
Like __CHAR_UNSIGNED__, this macro is defined if and only if the data type wchar_t is unsigned and the front-end is in C++ mode.
__REGISTER_PREFIX__
This macro expands to a single token (not a string constant) which is the prefix applied to CPU register names in assembly language for this target. You can use it to write assembly that is usable in multiple environments. For example, in the m68k-aout environment it expands to nothing, but in the m68k-coff environment it expands to a single `%’.
__USER_LABEL_PREFIX__
This macro expands to a single token which is the prefix applied to user labels (symbols visible to C code) in assembly. For example, in the m68k-aout environment it expands to an `_’, but in the m68k-coff environment it expands to nothing.This macro will have the correct definition even if -f(no-)underscores is in use, but it will not be correct if target-specific options that adjust this prefix are used (e.g. the OSF/rose -mno-underscores option).
__SIZE_TYPE__
__PTRDIFF_TYPE__
__WCHAR_TYPE__
__WINT_TYPE__
These macros are defined to the correct underlying types for the size_t, ptrdiff_t, wchar_t, and wint_t typedefs, respectively. They exist to make the standard header files stddef.h and wchar.h work correctly. You should not use these macros directly; instead, include the appropriate headers and use the typedefs.
__CHAR_BIT__
Defined to the number of bits used in the representation of the char data type. It exists to make the standard header given numerical limits work correctly. You should not use this macro directly; instead, include the appropriate headers.
__SCHAR_MAX__
__WCHAR_MAX__
__SHRT_MAX__
__INT_MAX__
__LONG_MAX__
__LONG_LONG_MAX__
Defined to the maximum value of the signed char, wchar_t, signed short, signed int, signed long, and signed long long types respectively. They exist to make the standard header given numerical limits work correctly. You should not use these macros directly; instead, include the appropriate headers.
__USING_SJLJ_EXCEPTIONS__
This macro is defined, with value 1, if the compiler uses the old mechanism based on setjmp and longjmp for exception handling.
__NEXT_RUNTIME__
This macro is defined, with value 1, if (and only if) the NeXT runtime (as in -fnext-runtime) is in use for Objective-C. If the GNU runtime is used, this macro is not defined, so that you can use this macro to determine which runtime (NeXT or GNU) is being used.
__LP64__
_LP64
These macros are defined, with value 1, if (and only if) the compilation is for a target where long int and pointer both use 64-bits and int uses 32-bit.

Deixe um comentário

Filed under C++, GCC, GNU, Tips & Trick

Updates do Windows e reboots

Será que ninguém para as bandas de Redmond percebe que, após um update que requeira um reboot, se o utilizador diz que não quer fazer o reboot e que o pretende fazer mais tarde, não adianta nada e é contra producente fazer aparecer um pop-up a cada cinco minutos para se fazer o reboot.
Hoje aconteceu-me isso quando estava a fazer uma tarefa que exigia muita concentração. Com as interrupçoes a produtividade foi para o tecto e o PC quase saiu pela janela!

Deixe um comentário

Filed under Microsoft, Windows

Remover branches “fechados”

Does it make sense to svn rm an old branch after it’s merged back to the
trunk, or not? I’m thinking about doing that so only active branches are
present in my project’s branches/ directory. Of course the old branch
would still be available if you knew the revision before it was deleted.
Or I could make an branches/attic directory and move it under there. Has
any best practice been developed in this area yet?

The Subversion developers tend to do that in our own repository. It’s
nice to be able to see what branches are actually in use just by looking
at the branches/ directory in HEAD, and as you say, you can always go
back to the old versions if you so desire.

Retirado de http://subversion.tigris.org/servlets/ReadMsg?list=users&msgNo=681

Deixe um comentário

Filed under Linux, Subversion, Tips & Trick

Activar Core Dumps

Quando, em Linux, uma aplicação crasha com um Segment violation e não gera core files para serem analizados, têm de ser executados os seguintes comandos antes de lançar a aplicação (e no mesmo terminal em que a aplicação vai ser executada):

$ ulimit -c unlimited
$ ulimit -H -c unlimited

O primeiro remove o “soft limit” para o tamanho dos coredumps, que por defeito é 0 = desactivado. O segundo remove o “hard limit” para o tamanho dos coredumps, que por defeito é já é unlimited.

Estas configurações podem também ser definidas no ficheiro /etc/security/limits.conf, mas só funcionam para aplicações que utilizem módulos PAM (o que não é o caso da bash).

Para aplicar estes valores a de cada vez que se inicia uma sessão, os comandos acima devem ser adicionados ao ficheiro ~/.bashrc de cada utilizador.

Para aplicar esta opção a todos os utilizadores, os comandos devem ser acrescentados ao ficheiro /etc/bashrc.

No caso dos serviços, deve ser alterado o script de arranque de forma a incluir os comandos imediatamente antes de lançar o serviço.

Deixe um comentário

Filed under Linux, Programação, Software, Tecnologia, Tips & Trick

Acesso a Oracle 10g com cliente 8i usando Pro*C

Para aceder a uma BD Oracle 10g usando um cliente 8i usando Pro*C, é preciso passar a flag prefetch=0 ao pré-compilador de Pro*C. O pré-compilador a usar é o da versão do cliente que se vai usar, ie, da versão 8i.

Deixe um comentário

Filed under Bases de Dados, C++, Oracle

Mini DVD para DVD (5 ou 9)

Comprei recentemente uma câmara de filmar cujo suporte de gravação é um mini DVD de 8 cm. Vou usar mini DVD-RW para fazer as gravações e, para os reutilizar, vou querer passar as gravações para DVDs de tamanho normal (12 cm).
Como fazer isso? Basta seguir as instruções de um destes foruns:

Deixe um comentário

Filed under DVD, Tecnologia, Tips & Trick