Salomé-tmf

Source code:
http://cvs.forge.objectweb.org/cgi-bin/viewcvs.cgi/*checkout*/salome-tmf/

DOS - Take screenshots forever

@ECHO OFF

REM ******************************************************************************
REM Description: This script will take screenshots every 10 seconds forever.
REM              Screenshots are saved into sc_[Date]_[Time].png.
REM              It requires NirCmd.exe(http://www.nirsoft.net/utils/nircmd.html)
REM Author: Xuan Ngo
REM ******************************************************************************
 
 
:Loop
 
SET Unique=%date%_%time%
SET Unique=%Unique:/=.%
SET Unique=%Unique::=.%
SET Unique=%Unique: =%
SET Unique=%Unique:Mon=%

Drupal - Debugging tips

<?php
  // Display the structure of object or arrays in Drupal's message area.
  drupal_set_message('<pre>'. print_r($array_or_object_var, TRUE) .'</pre>');
  drupal_set_message('<pre>'. print_r($node, TRUE) .'</pre>');
 
  // get_defined_vars() returns all variables available.
  // Use this with caution, it could output a huge chunk of codes that your browser can't handle.
  //  My browser crashed when I used it in _preprocess(&$vars, $hook).
  drupal_set_message('<pre>'. print_r(get_defined_vars(), TRUE) .'</pre>');
?>

Varia - jQuery Corner

http://www.malsup.com/jquery/corner/
http://drupal.org/project/rounded_corners

http://www.parkerfox.co.uk/labs/cornerz

Varia - CSS one-pixel table border

<html>
  <head>
    <title>1-pixel table border</title>
    <style type="text/css">
      table, td
      {
          border-color: #600;
          border-style: solid;
      }
 
      table
      {
          border-width: 0 0 1px 1px;
          border-spacing: 0;
          border-collapse: collapse;
      }
 
      td
      {
          margin: 0;
          padding: 4px;
          border-width: 1px 1px 0 0;
          background-color: #FFC;
      }
    </style>
  </head>
 
  <body>
    <table>
    <tr>
        <td>Cell 1</td>

DocBook - Adding <?lb?> processing instruction as line break

FO customization:

<xsl:template match="processing-instruction('lb')">
  <fo:block/>
</xsl:template> 

HTML customization:

<xsl:template match="processing-instruction('lb')">
  <br />
</xsl:template> 

DocBook - Tags that are good to know

literallayout
A block of text in which line breaks and white space are to be reproduced faithfully.

Java - Read and write Excel file using Apache POI

/**
 * Example showing how to read and write Excel file(i.e *.xls or *.xlsx).
 * JAR files needed:
 *  poi-3.6-20091214.jar
 *  poi-ooxml-3.6-20091214.jar
 * If you only need to handle Excel 2007 OOXML (.xlsx) file format, then you can use XSSF* classes.
 * If you only need to handle Excel '97(-2007) file format, then you can use HSSF* classes.
 * @author Xuan Ngo
 */
import java.io.FileOutputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
 
import org.apache.poi.ss.usermodel.Sheet;

Drupal - Add a link through the template.tpl.php

function phptemplate_preprocess_node(&$vars)
{
  /*
   * Add Read More... link on teaser only.
   */
  if($vars['teaser'])
  {
    // Get all links currently available on the node.
    $links = $vars['node']->links;
 
    // Add read_more link to $links
    $links['read_more'] = array(
                              'title' => t('Read More...'),
                              'href' => 'node/'.$vars['node']->nid,
                              'attributes' => array('title' => t('Show the full page')),
                            );
 

Drupal - Get alias or system path

l() function converts automatically system path in alias where available.

Syndicate content