»

How to remove the Help preferences page?

, , , — mab — 12:27 pm Janeiro 23, 2012

Add the following to your application’s WorkbenchAdvisor to remove the “Help” preference page:

@Override
public void postStartup() {
    PreferenceManager pm = PlatformUI.getWorkbench().getPreferenceManager( );
    pm.remove( "org.eclipse.help.ui.browsersPreferencePage" );
}

How to remove Restore Defaults and Apply buttons from preferences page?

, , , , — mab — 5:03 pm Janeiro 16, 2012

PreferencePage.noDefaultAndApplyButton();

How to install the GCC from sources?

, , — mab — 6:19 pm Dezembro 30, 2011
  1. Had to install the following prerequisites, while using a Ubuntu box. Some might have already been installed. Check the list of prerequisites.
  2.   $> sudo apt-get install libmpc-dev libgmp3-dev libmpfr-dev
    
  3. Select a mirror and download the required version through http://gcc.gnu.org/releases.html.
      $> wget http://mirrors-us.seosue.com/gcc/releases/gcc-4.6.2/gcc-4.6.2.tar.gz
    

    Extract the downloaded package archive into a temporary source directory (SRC_DIR).

  4. Prepare the object directory (OBJ_DIR) and configure the build. Consider setting the PREFIX_DIR (e.g. /opt/gcc-4.6.2) in configure conmmand.
  5.   $> mkdir $OBJ_DIR
      $> cd $OBJ_DIR
      $> $SRC_DIR/configure --prefix=$PREFIX_DIR --enable-languages=c,c++,fortran
          --disable-bootstrap --disable-multilib
    
  6. Compile
  7.   $> make
    
  8. Install
  9.   $> make install
    

How to toggle Firefox Bookmarks Toolbar?

, , , — mab — 2:57 pm Dezembro 28, 2011

The following works with Firefox 9.0.1 (installed in a Ubuntu Linux PC):

  1. Install keyconfig extension, available at mozillazine foruns.
  2. Go to Tools -> Keyconfig…, add a new key binding for (Ctrl+Alt+B) named “Bookmarks Toolbar”
  3. Setup the key binding code to
    var E=document.getElementById('PersonalToolbar');
    if(E.collapsed){E.removeAttribute('collapsed')}
    else{E.setAttribute('collapsed',true)}
    
  4. Restart firefox.

[no title]

, , — mab — 2:07 pm Dezembro 27, 2011

Summer Memories

, , , , — mab — 6:12 pm Dezembro 23, 2011

How to access system time in YYYY-MM-DDThh-mm-ssZ.xxx?

, , , — mab — 12:45 pm Dezembro 15, 2011

std::string systime_getPrecise()
{
  static std::string final("YYYY-MM-DDThh:mm:ssZ.xxx");

  timeval  tTimeValue;
  if ( gettimeofday( &tTimeValue, NULL) ) {
    return "";
  }

  std::string format("%Y-%m-%dT%H:%M:%SZ");

  size_t buffer_size = final.size() + 1;
  char *buffer = new char[buffer_size];

  // Format the time
  struct tm *ts = localtime(&tTimeValue.tv_sec);
  strftime(buffer, buffer_size, format.c_str(), ts);

  std::string result(buffer);
  delete [] buffer;
  return result + "." + convertToString(tTimeValue.tv_usec).substr(0, 3);
}

How to access system time in YYYY-MM-DDThh-mm-ssZ?

, , — mab — 11:48 am

std::string systime_get()
{
  // define format YYYY-MM-DDThh:mm:ssZ, for buffer size calculation (could be done by hand, obviously)
  static std::string final("YYYY-MM-DDThh:mm:ssZ");

  std::string format("%04d-%02d-%02dT%02d:%02d:%02dZ");

  char *buffer = new char[final.size() + 1];

  // Date and Time variables initialization
  time_t t = time(0);
  struct tm* lt = localtime(&t);

  sprintf(buffer, format.c_str(), lt->tm_year + 1900,
                                  lt->tm_mon + 1,
                                  lt->tm_mday,
                                  lt->tm_hour,
                                  lt->tm_min,
                                  lt->tm_sec );

  std::string result(buffer);
  delete [] buffer;
  return result;
};

How to solve the svn checksum mismatch issue?

, , — mab — 3:40 pm Dezembro 14, 2011

The issue is reported by svn with the folliwng error message:

svn: Checksum mismatch while updating '/path/to/.svn/text-base/foobar.svn-base'; expected: '8d3574d8e02d0a176bc708760f3a258c', actual: '9a5842d3b088ed2b7757fcc743fb4eb1'

To solve this issue, you must edit the entries file in the .svn folder. Look for something like the following:

.
.
.
^L
foobar
file

2007-08-22T12:26:44.000000Z
5e1bdc7a206840b14c984e95c9c95c39
2007-08-21T22:28:44.968799Z
410
hans
^L
anotherfile
.
.
.

Remove the section related to file (from line 4 to 12). Then delete the actual file (remember to store changes if necessary) and update from repository.

How to compare directory contents?

, , — mab — 1:31 pm Dezembro 12, 2011
  diff -qr directory1 directory

-q to activate quiet mode; don’t show file differences, only list of different files
-r to go into subdirectories recursively

página seguinte »
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2012 [Divagações Diárias] | powered by WordPress with Barecity