Monday, 26 January 2009

Nokia: Internet through WIFI

http://www.dotsis.com/mobile_phone/archive/index.php/t-87441.html

http://www.microsoft.com/windowsxp/using/networking/expert/bowman_02april08.mspx

Saturday, 24 January 2009

Installing TinyOS-2.x in Ubuntu intrepid (8.10)

Thank to
http://nmlaxaman.blogspot.com/2009/01/installing-tinyos-2x-in-ubuntu-intrepid.html

To Install java on your intrepid use the following command:

sudo apt-get install sun-java5-jre sun-java5-jdk sun-java5-plugin

To verify that the correct version of Java is installed the following command can be used:
java -version

This command will print the current version of java that is active. Should there be more than one version of Java be installed on the operating system, the following command can be used to list the available java versions:

update-java-alternatives -l

This command list all the available Java runtime environments on the Ubuntu system. To change from one version to another, the following command can be used:

sudo update-java-alternatives -s < JRE version >

Mostly 'JRE version' needs to be one of the folder name under /usr/lib/jvm/

Once java is installed sucessfully the follow the points below.

1) add bellow repository to your /etc/apt/sources.list. Though it is for hardy, it is working for intrepid also

deb http://tinyos.stanford.edu/tinyos/dists/ubuntu hardy main

2) with following commands you can update the apt-cache and search the required packages thin you can install the required version and all.

apt-get update
apt-cache search tinyos
apt-get install tinyos-2.1.0

3) then install python development package (headers)

apt-get install python-dev

4) Edit /opt/tinyos-2.1.0/tinyos.sh and change the CLASSPATH env-variable as bellow

CLASSPATH=$CLASSPATH:$TOSROOT/support/sdk/java/tinyos.jar:.

4) Import /opt/tinyos-
2.1.0/tinyos.sh in your .bashrc; include bellow code snippet to ~/.bashrc

if [ -f /opt/tinyos-
2.1.0/tinyos.sh ] ; then
. /opt/tinyos-
2.1.0/tinyos.sh
fi

5) Now execut bash again or restart the terminal and chech your enviorenment with bellow command. It will check the enviorenment and report you the status. (Ignore the WORNING returned due to graphvis version)

tos-check-env

6) Lets compile the first application

cd $TOSROOT/apps/Blink
make micaz

for simulator

make micaz sim

Monday, 12 January 2009

Making a calendar of upcoming events in drupal


** Minor modification of ( http://drupal.org/node/326061 ) ** Thanks to
fhsm.

Install below mentioned modules under /sites/default/modules

  • CCK
  • Views
  • Calendar
  • Date
Step 1:

Go to Administer › Content management › Content types > add content type

The following settings are largely a matter of site needs and personal preference:
Under “Submission form settings”
Title = “Event”
Body = “Details”

Under “Work flow settings”
Decide to best fit your site. It is worth considering unchecking “Promoted to front page” if you expect to have numerous small events posted.

Under “Comment settings”
Make decisions which are appropriate for your site.

Save your new event content type.

Step 2:

From the content type screen (Administer › Content management) select manage fields next to your new content type.

Add a new field

Label = “Event Date and Time”
Field name = “event_datetime”
Type = “Datetime”
Widget type = “text field with custom input format”

Save your newly created event date/time field.


Step 3:

Create your first event
Create content > Group Event
Fill out the form for your event and save it.


Step 4:

Configure your calendar view

Administer > Site building > Views

This is where the hurt started for me 6 hours ago...

Enable the Default Node view: calendar (Calendar)
Clone the default view

View name = “calendar”
View description = “Calendar of group events”

Nextshould take you to the views edit screen

Down the right side you'll see all the different types of calendar (page, block etc) just work with the default view to start (it should be where you are by default).

In the Arguments panel
Click Date: Date (node.changed)
Near the bottom of the page under Date field(s):

uncheck = Node: Update date
check Content: Event Date and Time (field_event_datetime value)

Click Update

This set the start time of your event instead of the node update time as the argument for the view.

Click Add ... for Fields, and select the following:

Content: Event Date and Time (field_event_datetime value) Default
Content: Event Date and Time (field_event_datetime value2) Default

(remove) the default item "Node: Published"

On the Filters panel click the “+” logo to add a new filter
Check = Node: Type
Click add
On the following screen
Leave operator = “Is one of” and check = Events to limit your calendar to only the event content type.

Click Update

On the Sort criteria click the “+” to add a new criteria

Check = Content: Event Date and Time (field_event_datetime value)

click Add

Save it all by clicking Save


























Wednesday, 7 January 2009

Export and restore MySQL

phpMyAdmin can be used to export or backup MySQL databases easily. However, if the database size is very big, it probably won’t be a good idea. phpMyAdmin allows users to save database dump as file or display on screen, which involves exporting SQL statements from the server, and transmitting the data across slower network connection or Internet to user’s computer. This process slow the exporting process, increase database locking time and thus MySQL unavailability, slow the server and may simply crash the Apache HTTPD server if too many incoming web connections hogging the system’s resources.

The better way to backup and export MySQL database is by doing the task locally on the server, so that the tables’ data can be instantly dumped on the local disk without delay. Thus export speed will be faster and reduce the time MySQL database or table is locked for accessing. This tutorial is the guide on how to backup (export) and restore (import) MySQL database(s) on the database server itself by using the mysqldump and mysql utilities. There are basically two methods to backup MySQL, one is by copying all table files (*.frm, *.MYD, and *.MYI files) or by using mysqlhotcopy utility, but it only works for MyISAM tables. Below tutorial will concentrate on mysqldump which works for both MyISAM and InnoDB tables.

How to Export or Backup or Dump A MySQL Database

To export a MySQL database into a dump file, simply type the following command syntax in the shell. You can use Telnet or SSH to remotely login to the machine if you don’t have access to the physical box.

mysqldump -u username -ppassword database_name > dump.sql

Replace username with a valid MySQL user ID, password with the valid password for the user (IMPORTANT: no space after -p and the password, else mysqldump will prompt you for password yet will treat the password as database name, so the backup will fail) and database_name with the actual name of the database you want to export. Finally, you can put whatever name you like for the output SQL dump file, here been dump.sql.

The while data, tables, structures and database of database_name will be backed up into a SQL text file named dump.sql with the above command.

How to Export A MySQL Database Structures Only

If you no longer need the data inside the database’s tables (unlikely), simply add –no-data switch to export only the tables’ structures. For example, the syntax is:

mysqldump -u username -ppassword –no-data database_name > dump.sql

How to Backup Only Data of a MySQL Database

If you only want the data to be backed up, use –no-create-info option. With this setting, the dump will not re-create the database, tables, fields, and other structures when importing. Use this only if you pretty sure that you have a duplicate databases with same structure, where you only need to refresh the data.

mysqldump -u username -ppassword –no-create-info database_name > dump.sql

How to Dump Several MySQL Databases into Text File

–databases option allows you to specify more than 1 database. Example syntax:

mysqldump -u username -ppassword –databases db_name1 [db_name2 ...] > dump.sql

How to Dump All Databases in MySQL Server

To dump all databases, use the –all-databases option, and no databases’ name need to be specified anymore.

mysqldump -u username -ppassword –all-databases > dump.sql

How to Online Backup InnoDB Tables

Backup the database inevitable cause MySQL server unavailable to applications because when exporting, all tables acquired a global read lock using FLUSH TABLES WITH READ LOCK at the beginning of the dump until finish. So although READ statements can proceed, all INSERT, UPDATE and DELETE statements will have to queue due to locked tables, as if MySQL is down or stalled. If you’re using InnoDB, –single-transaction is the way to minimize this locking time duration to almost non-existent as if performing an online backup. It works by reading the binary log coordinates as soon as the lock has been acquired, and lock is then immediately released.

Syntax:

mysqldump -u username -ppassword –all-databases –single-transaction > dump.sql

How to Restore and Import MySQL Database

You can restore from phpMyAdmin, using Import tab. For faster way, upload the dump file to the MySQL server, and use the following command to import the databases back into the MySQL server.

mysql -u username -ppassword database_name < dump.sql

The import and export of MySQL database not only is important to recover the data when disaster strikes, but also provides an easy way to migrate or move to another server, such as when switching web hosting providers. However, do note that one common problem - character set encoding. Newer release of mysqldump uses UTF8 as its default charset if nothing is specified, while older versions (older than 4.1 typically) use Latin1 as default characterset. If you database charset is Latin1 and dump in UTF8 collation, the data may ends up become simply rubbish, garbled, or unreadable (frequently happen with Wordpress blog). If this case, use –default-character-set=charset_name option to specify the character set or convert the database to UTF8.

Sunday, 28 December 2008

Intresting modules in Drupal



ACL module

It is an API for other modules to create lists of users and give them access to nodes.

Sub modules to be installed for enabling its capability:
  • Content Access (uses ACL to provide by-user access control, if it's installed)

Content Construction Kit (CCK)

It allows you to add custom fields to nodes using a web browser. CCK builds on that ability by allowing you to add custom fields to that content. If you use the Views module, CCK also makes all your custom fields available in any View.

CCK is actually a group of modules. The primary module is called 'Content' and it is required in order to use any other CCK modules. The tarball includes a few other modules, which comprise the 'Core CCK' modules. They include:

  • Text
  • Number
  • Nodereference
  • Userreference
  • Optionwidgets
  • Fieldgroup

Views

You need Views if:
  • You like the default front page view, but you find you want to sort it differently.
  • You like the default taxonomy/term view, but you find you want to sort it differently; for example, alphabetically.
  • You use /tracker, but you want to restrict it to posts of a certain type.
  • You like the idea of the 'article' module, but it doesn't display articles the way you like.
  • You want a way to display a block with the 5 most recent posts of some particular type.
  • You want to provide 'unread forum posts'.
  • You want a monthly archive similar to the typical Movable Type/Wordpress archives that displays a link to the in the form of "Month, YYYY (X)" where X is the number of posts that month, and displays them in a block. The links lead to a simple list of posts for that month.

Views can do a lot more than that, but those are some of the obvious uses of Views.

Pathauto

The Pathauto module automatically generates path aliases for various kinds of content (nodes, categories, users) without requiring the user to manually specify the path alias.

Better Select

Better Select module overrides all multiselect HTML elements in Drupal and replaces them with checkboxes, in an auto-scrolling div so they don't take up much room on the page.

Automated Logout

This module provides a site administrator the ability to log users out after a specified time of inactivity. It is highly customizable and includes "site policies" by role to enforce logout.

Chat Room

This module enables chat rooms to be set up on Drupal sites. No additional software is required. Chat Room uses AJAX to update chats without page reloads. Chat rooms are nodes that provide access to chats and chat archives. This module does not support pop-up windows or invitations.

Porter-Stemmer

This module implements the Porter-Stemmer algorithm to improve English-language searching with the Drupal built-in search.module.

It reduces each word in the index to its basic root or stem (e.g. 'blogging' to 'blog') so that variations on a word ('blogs', 'blogger', 'blogging', 'blog') are considered equivalent when searching. This generally results in more relevant results.

Google Custom Search Engine

Google Custom Search Engine (CSE) is an embedded search engine that can be used to search any set of one or more sites. No Google API key is required. More info at http://www.google.com/coop/cse/

After installing this module, configure it by entering Google's alphanumeric ID for your CSE. Once you have granted permission for one or more roles to search the Google CSE, the search page can be found at search/google, and a search block can also be enabled.

Due to Google and Drupal both making use of "q", this module requires that clean URLs be enabled.

Features available only in the Drupal 6 version:

In addition to the CSE functionality, SiteSearch on one or more domains or URL paths can optionally be configured. Radio buttons allow users to search on either the SiteSearch or the CSE, and searches can default to either option.

The "Google CSE search" module is an optional glue module that integrates Google CSE with Drupal's core Search API. After enabling this module, search queries will be logged by the Search module and users can click between available search tabs: "Content", "Google", "Users", etc.

An additional "Google CSE results" block can be enabled, assigned to a region, and set to display on certain paths. This block allows any page on your site to host a self-contained CSE search form and results display. When entering search terms, the user will be returned to the same page (via GET request) and the results will be displayed.

YUI Rich Text Editor

This module integrates the YUI Rich Text Editor into drupal to edit content. Similar to a WYSIWYG editor.

World Clock

Features

  • Displays any number of locations (countries/areas).
  • Automatically adjust for DST of each location.
  • Many customizable options, such as display time format, DST mode, footnote, etc.
  • 107 countries/areas are supported right now.

CAPTCHA

A CAPTCHA is a challenge-response test most often placed within web forms to determine whether the user is human. The purpose of CAPTCHA is to block form submissions from spambots – automated scripts that harvest email address from publicly available web forms.

The CAPTCHA module provides this feature to virtually any user facing web form on a Drupal site. The administration settings for CAPTCHA are available at admin/user/captcha.

Cumulus

Cumulus allows you to display your site's tags using Flash that rotates them beautifully in 3D. It works like a regular tag cloud, but is more visually exciting. Cumulus depends on the Tagadelic. Tagadelic is a small module, without any databases, or configuration, that generates a page with weighted tags. Cumulus also requires a JS script called SWFObject. This script is licensed under the MIT license and can't be hosted on Drupal.org. So, you need to get the file from http://pratul.in/files/cumulus.js and put it in your Cumulus folder in your modules directory. module.







Drupal 6.6+ and Proxy related issues


To solve proxy related issues in drupal 6.X follow issues addressed at http://drupal.org/node/7881.

or

Step: 1
++++++
Apply patch: (http://drupal.org/files/issues/proxy6.6.patch)

--- includes/common.inc Wed Oct 22 20:26:02 2008
+++ includes/common.inc Fri Oct 24 10:22:30 2008
@@ -416,6 +416,11 @@
function drupal_http_request($url, $headers = array(), $method = 'GET', $data = NULL, $retry = 3) {
static $self_test = FALSE;
$result = new stdClass();
+
+ //PROXYHACK
+ $proxy_not_required = TRUE;
+ ///PROXYHACK
+
// Try to clear the drupal_http_request_fails variable if it's set. We
// can't tie this call to any error because there is no surefire way to
// tell whether a request has failed, so we add the check to places where
@@ -449,7 +454,19 @@
case 'http':
$port = isset($uri['port']) ? $uri['port'] : 80;
$host = $uri['host'] . ($port != 80 ? ':'. $port : '');
+ //PROXYHACK
+ $proxy_not_required = is_in_no_proxy_list($uri['host']);
+ if ((variable_get('proxy_server', '') != '') && (FALSE == $proxy_not_required)) {
+ $proxy_server = variable_get('proxy_server', '');
+ $proxy_port = variable_get('proxy_port', 8080);
+ $fp = @fsockopen($proxy_server, $proxy_port, $errno, $errstr, 15);
+ }
+ else {
+ ///PROXYHACK
$fp = @fsockopen($uri['host'], $port, $errno, $errstr, 15);
+ //PROXYHACK
+ }
+ ///PROXYHACK
break;
case 'https':
// Note: Only works for PHP 4.3 compiled with OpenSSL.
@@ -472,10 +489,19 @@
}

// Construct the path to act on.
+ //PROXYHACK
+ if ((variable_get('proxy_server', '') != '') && (FALSE == $proxy_not_required)) {
+ $path = $url;
+ }
+ else {
+ ///PROXYHACK
$path = isset($uri['path']) ? $uri['path'] : '/';
if (isset($uri['query'])) {
$path .= '?'. $uri['query'];
}
+ //PROXYHACK
+ }
+ ///PROXYHACK

// Create HTTP request.
$defaults = array(
@@ -492,6 +518,15 @@
$defaults['Authorization'] = 'Authorization: Basic '. base64_encode($uri['user'] . (!empty($uri['pass']) ? ":". $uri['pass'] : ''));
}

+ //PROXYHACK
+ if ((variable_get('proxy_username', '') != '') && (FALSE == $proxy_not_required)) {
+ $username = variable_get('proxy_username', '');
+ $password = variable_get('proxy_password', '');
+ $auth_string = base64_encode($username . ($password != '' ? ':'. $password : ''));
+ $defaults['Proxy-Authorization'] = 'Proxy-Authorization: Basic '. $auth_string ."\r\n";
+ }
+ ///PROXYHACK
+
foreach ($headers as $header => $value) {
$defaults[$header] = $header .': '. $value;
}
@@ -569,6 +604,25 @@
$result->code = $code;
return $result;
}
+//PROXY_HACK
+function is_in_no_proxy_list($host) {
+ $rv = FALSE;
+
+ $proxy_exceptions = variable_get('proxy_exceptions', '');
+ if (FALSE == empty($proxy_exceptions)) {
+ $patterns = explode(",",$proxy_exceptions);
+ foreach ($patterns as $pattern) {
+ $pattern = trim($pattern, " ");
+ if (strstr($host,$pattern)) {
+ $rv = TRUE;
+ break;
+ }
+ }
+ }
+ return $rv;
+}
+///PROXY_HACK
+
/**
* @} End of "HTTP handling".
*/
--- modules/system/system.admin.inc Thu Oct 16 21:23:38 2008
+++ modules/system/system.admin.inc Fri Oct 24 10:19:54 2008
@@ -1362,6 +1362,79 @@
drupal_set_message(t('Caches cleared.'));
}

+//PROXYHACK
+/**
+ * Form builder; Configure the site proxy settings.
+ *
+ * @ingroup forms
+ * @see system_settings_form()
+ */
+function system_proxy_settings() {
+
+ $form['forward_proxy'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Forward Proxy Settings'),
+ '#description' => t('The proxy server used when Drupal needs to connect to other sites on the Internet.'),
+ );
+ $form['forward_proxy']['proxy_server'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Proxy host name'),
+ '#default_value' => variable_get('proxy_server', ''),
+ '#description' => t('The host name of the proxy server, eg. localhost. If this is empty Drupal will connect directly to the internet.')
+ );
+ $form['forward_proxy']['proxy_port'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Proxy port number'),
+ '#default_value' => variable_get('proxy_port', 8080),
+ '#description' => t('The port number of the proxy server, eg. 8080'),
+ );
+ $form['forward_proxy']['proxy_username'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Proxy username'),
+ '#default_value' => variable_get('proxy_username', ''),
+ '#description' => t('The username used to authenticate with the proxy server.'),
+ );
+ $form['forward_proxy']['proxy_password'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Proxy password'),
+ '#default_value' => variable_get('proxy_password', ''),
+ '#description' => t('The password used to connect to the proxy server. This is kept as plain text.', '')
+ );
+ $form['forward_proxy']['proxy_exceptions'] = array(
+ '#type' => 'textfield',
+ '#title' => t('No proxy for'),
+ '#default_value' => variable_get('proxy_exceptions', 'localhost'),
+ '#description' => t('Example: .example.com,localhost,192.168.1.2', '')
+ );
+ $form['forward_proxy']['proxy_skip_selftest'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Skip HTTP self test'),
+ '#description' => t('Skip HTTP request self test.'),
+ '#default_value' => variable_get('proxy_skip_selftest', '0'),
+ );
+ $form['#validate'][] = 'system_proxy_settings_validate';
+
+ return system_settings_form($form);
+}
+
+/**
+ * Validate the submitted proxy form.
+ */
+function system_proxy_settings_validate($form, &$form_state) {
+ // Validate the proxy settings
+ $form_state['values']['proxy_server'] = trim($form_state['values']['proxy_server']);
+ if ($form_state['values']['proxy_server'] != '') {
+ // TCP allows the port to be between 0 and 65536 inclusive
+ if (!is_numeric($form_state['values']['proxy_port'])) {
+ form_set_error('proxy_port', t('The proxy port is invalid. It must be a number between 0 and 65535.'));
+ }
+ elseif ($form_state['values']['proxy_port'] <>= 65536) {
+ form_set_error('proxy_port', t('The proxy port is invalid. It must be between 0 and 65535.'));
+ }
+ }
+}
+///PROXY_HACK
+
/**
* Form builder; Configure the site file handling.
*
--- modules/system/system.module Wed Oct 22 20:26:02 2008
+++ modules/system/system.module Fri Oct 24 10:20:54 2008
@@ -406,6 +406,16 @@
'access arguments' => array('administer site configuration'),
'file' => 'system.admin.inc',
);
+ //PROXYHACK
+ $items['admin/settings/proxy'] = array(
+ 'title' => 'Proxy Server',
+ 'description' => 'Configure settings when the site is behind a proxy server.',
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('system_proxy_settings'),
+ 'access arguments' => array('administer site configuration'),
+ 'file' => 'system.admin.inc',
+ );
+ ///PROXY_HACK
$items['admin/settings/file-system'] = array(
'title' => 'File system',
'description' => 'Tell Drupal where to store uploaded files and how they are accessed.',
@@ -1877,6 +1887,10 @@
// Check whether we can do any request at all. First get the results for
// a very simple page which has access TRUE set via the menu system. Then,
// try to drupal_http_request() the same page and compare.
+ //PROXYHACK
+ $skip_selftest = variable_get('proxy_skip_selftest', '0');
+ if (0 == $skip_selftest) {
+ ///PROXYHACK
ob_start();
$path = 'admin/reports/request-test';
menu_execute_active_handler($path);
@@ -1884,6 +1898,12 @@
ob_end_clean();
$result = drupal_http_request(url($path, array('absolute' => TRUE)));
$works = isset($result->data) && $result->data == $nothing;
+ //PROXYHACK
+ }
+ else {
+ $works = TRUE;
+ }
+ ///PROXYHACK
variable_set('drupal_http_request_fails', !$works);
return $works;
}

Step:2
++++++
Then download the module "Http Request Fail Reset" from 'http://drupal.org/project/http_request_fail_reset' and enable it.


Step:3
+++++
You will find a 'Proxy Server' link under Home / Administer / Site configuration


Enter proxy details and save your configurations !!!!!!!

Thursday, 25 December 2008

Rounded / curvy corners in Photoshop !


Check this nice way to accomplish this effect by Matt Thommes.

Perfect, simple and effective.

http://matthom.com/archive/2004/09/10/fast-rounded-corners-in-photoshop