Blogs

Drupal 7 fields: Convert Float to Decimal

drupal logo

When using postgresql, indexes and fields properties are dropped with the deletion of the field. One way to change the type of a fields is to copy the data to a temporary storeage and move it back into aa newly created field with the desired type.

We can do this at the database level with db change but our approach is to go with drupal fields module functions.

Drupal 7 render field form in tpl

drupal logo

<?php
module_load_include('inc', 'node', 'node.pages');
$node_form = new stdClass;
$node_form->type = 'bid';
$node_form->language = LANGUAGE_NONE;
$form = drupal_get_form('bid_node_form', $node_form);
//file_put_contents('/tmp/log',print_r($form,true));
?>

<?php print render($form['field_offer_price_amount']);?>
<?php print render($form['field_offer_price_currency']);?>
<?php print render($form['field_provider']);?>
<?php print render($form['field_shipping_cost']);?>

The absence of padding printf formats on the TI MSP430 development board explained

The issue

When developing a project within Code Composer Studio 6.1 for the MSP430F2274, one will notice the absence of padding format "%02d". It may be slightly annoying when the application is driven towards formatted user input and output.

The cause

This occurs because of the default CCS 6.1 compiler settings which include a really stripped version of the printf library.

The solution

In order to have access to the full printf library, one has to set the compiler settings

Subscribe to RSS - blogs

Startup Growth Lite is a free theme, contributed to the Drupal Community by More than Themes.