jump to navigation

pedit – simple text editor December 20, 2009

Posted by prasada in Uncategorized.
add a comment

I’m happy to make available to source-code of my memorable text editor (pedit) that was developed as part of my Graduation (semester) project.

pedit is written using ncurses library and C++ language, with Object Oriented Programming concepts.

Give a try and feel free to extend it. If you have any feedback do keep me posted.

Prototypejs 1.6 clash with JSON !! November 12, 2009

Posted by prasada in Uncategorized.
add a comment

Prototypejs 1.6 could break your JSON API usage, be careful !

This article could be a time-saver, prototype.js breaks Firefox 3.5 native JSON

Prototype – Event.fire exception to be handled for IE November 2, 2009

Posted by prasada in Uncategorized.
add a comment

Prototype 1.6 has introduced Event.fire API that works pretty well in Firefox but experienced a problem in IE (7).

Exception was being thrown in Event.fire API that needed a special treat.

The highlighted workaround worked for me:

fire: function(element, eventName, memo) {
    // ...
    if (document.createEvent) {
        element.dispatchEvent(event);
    } else {
        try{
        element.fireEvent(event.eventType, event);
        } catch(error) {
        // Error: No such interface supported (IE)
      	    element.fireEvent(event.eventType);
        }
    }
    return event;
}

Example:

Event.fire('myhidden_element_id', 'custom:change');

mysql-java-connector: ResultSet getObject failure on Timestamp column if null October 31, 2009

Posted by prasada in Uncategorized.
add a comment

I had strange situation working with ResultSet when fetching Timestamp column from MyTable.

import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
Class.forname("com.mysql.jdbc.Driver");
Connection connection = DriverManager.getConnection(
"jdbc:mysql://host:port/database",
"username", "password");
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery("SELECT timestamp_column FROM mytable");
while(rs.next()) {
rs.getObject("timestamp_column");
}

The cause of the failure was due to null value in timestamp_column !

The solution suggested about (zeroDateTimeBehavior=convertToNull) in the article, helped me overcome the failure.

All you need to do is:
Connection connection = DriverManager.getConnection(
"jdbc:mysql://host:port/database?zeroDateTimeBehavior=convertToNull",
"username", "password");

Eclipse Editor – Setting Line Delimiter Style October 29, 2009

Posted by prasada in Uncategorized.
add a comment

Was going crazy with my eclipse as line delimiter was different than other editors. This was causing issue with SVN commits (mixed line delimiters!)

Finally, found the way of setting the line preferences for Eclipse.

It is located under: Windows > Preferences > General > Workspace

eclipse-newline-delimiter.png

Lynx – Text only browser for Windows ! September 15, 2009

Posted by prasada in Uncategorized.
add a comment

Text only browser could speed up your work specially if you are on a low-speed internet connection and getting distracted with graphics on the web applications :)

Got hold of Lynx on windows, which is a cool text browser I have been using on remote servers!

Well, its easy to get started, download and configure the lynx.bat and lynx.cfg files.

PHPTAL – Template Attribute Language for PHP September 11, 2009

Posted by prasada in Uncategorized.
add a comment

It was fun to work with PHPTAL and walk team with a basic introduction today :) . [Download here]

Doc Comment could be a source of data!!! August 27, 2009

Posted by prasada in Uncategorized.
add a comment

While discussing ways of using PHP as data storage file, we passed over this interesting possibility.

PHP data file: CommentDataClass.php

<?php
/**
Doc Comment could be a SOURCE OF DATA
This could be your data in string format!!
*/
class CommentDataClass { }

?>

Retrieving data: Data.php

<?php
include_once 'CommentDataClass.php';

// Taking advantage of PHP 5.x Reflection,
// Refer: http://in.php.net/oop5.reflection

$reflectedClass =
     new ReflectionClass('CommentDataClass');

if(preg_match("/\/\*\*(.*)\*\//s",
     $reflectedClass->getDocComment(), $matches)) {
 $data = $matches[1];
 $data = trim($data);

 var_dump(explode("\n", $data));
}
?>

Well, this is just for fun, we don’t recommend it for serious use :)

Apache 2.0 with PHP 5.3.0 on Windows July 31, 2009

Posted by prasada in Uncategorized.
add a comment

It took me sometime today to get my Apache 2.0 to run with PHP 5.3.0. The builds for windows is available at http://windows.php.net/download/

Download the VC6 x86 Build of PHP 5.3.0 build and unzip.

NOTE: VC9 x86 Build of PHP 5.3.0 build might not work with Apache 2.0 !!

You will need to make the following changes in your httpd.conf

LoadModule php5_module “c:/path_to_your/5.3.0/php5apache2.dll”
PhpIniDir “c:/path_to_your/5.3.0″
ScriptAlias /php/ “c:/path_to_your/5.3.0″

Playing with Camtasia project file July 2, 2009

Posted by prasada in Uncategorized.
add a comment

I had created a video using Camtasia last night using screenshot and planned to upload in the morning. Before turning off the system, I moved the images into another drive.

In the morning, I opened the .camproj (Camtasia project) file and to my surprise all the images in it gone missing :(

A dialog box was presented to search and point location for each image. I had almost 50+ images!

With curiosity I opened (Introduction.camproj) in text editor it was a simple XML file :)

The imported images were looking like:
<clipbin_object>
<clipname>C:\Users\power\Desktop\MoreOnProduct\Step1.png</clipname>
</clipbin_object>

To keep things simple, I copied (Introduction.camproj) to the folder where all screenshots were present under directory images/

Opened Introduction.camproj in gvim and triggered the following command

:%s/C:\\Users\\power\\Desktop\\MoreOnProduct\\Step1.png/images/g

It reflected as:
<clipbin_object>
<clipname>images\Step1.png</clipname>
</clipbin_object>

Finally I got the video to the original state.