Wednesday, December 3, 2008

MySQL Stored Procedure Error

In our project we had many many stored procedures and many parameters passes to those sps. But in only one sp it gives error message something like this;

"Incorrect number of arguments for PROCEDURE sproc_t_l_Contract_Select_BySearchCriteria; expected 3, got 2”

Work long time on this sp but coudnt find it. So i tried to write it again from the begining. In this time it was work perfectly.This problem occurs because of the space between data type and its length.

Ex.
pName varchar(50) - working
pName varchar (50) - Not working

But it does not mention syntax error or something.So this error message make us vulnerable.

MSSQL to MySQL Part II

We could able to finish our MSSQL to MySQL conversion project successful. During this
project we had to used many client tools because each tool having pros and cons. we used following client tools;

mysql-gui-tools-5.0
HeidiSQL
SQLyog
Toad for MySQL
Nevicat 8.0 Lite

Among those tools SQLyog Community edition the best tool even though Toad for MySQL provides many features.Toad for MySQL sometimes gives errors when running a query.Nevicat 8.0 Lite is simple and good.But it has not much features. HeidiSQL is also good but it doesn't show other database objects such as stored procedures,view. Only tables are displayed.

Tuesday, November 25, 2008

MSSQL to MySQL

To day i was struggling to catch a error inside a stored procedure using MySQL. Faced lot of difficulties and still not found good result. There is no equal function in MySql to RAISERROR in MSSQL.

As a solution for this what we can we do is, we can call a function as this way
CALL RaiseError();

There for because of the none existence of this function this will be raise an error.
So it is very logical..:-)

So procedure will be work very fine.....Great...

Example:

DROP PROCEDURE IF EXISTS `dbname`.`procedureName` $$
CREATE DEFINER=`root`@`%` PROCEDURE `edbname`.`procedureName`(
pId bigint,
pName varchar(50)

BEGIN

IF EXISTS
(SELECT
1
FROM
tableName
WHERE
((Id = pId)
)
THEN

UPDATE
tableName
SET
Name = pName,

WHERE
(Id = pId);

ELSE
CALL RaiseError();
/*There is no RaiseError metho in MySql.
Because of that reason here call nonexistent method which is 'RaiseError()'.There for this will produce an error*/

END IF;

END $$

DELIMITER ;

Friday, November 21, 2008

Orgnized well


When buying things like clothes, set a rule for yourself that you can only buy something new, to replace something you already have. For example, from a practical point of view, let’s say you need to have 15 business shirts. Set a ‘budget’ of having 15 shirts, and then when you want to buy one, first throw away (or give to charity) the worst of the other. Can’t make a choice which one to throw out? Guess what: you won’t need a new shirt.

[http://www.iwillteachyoutoberich.com/blog/tip-9-only-buy-new-things-when-replacing-something-old]

Codesmith problem

In my mechine i have installed Codesmith and when trying to connect to Mysql DB it is not allowed to access it. Basically it doesnt enable the connection establishing window.


Even if you mannually typethe connection string and click on 'Test' button it will say Mysql.data.dll not exist.

This is because of compatibility issue...

To sortout this.....:-)

So i had t installed earlier version. It also did not work. So copy 'MySql.Data.dll'
to bin folder of codesmith (C:\Program Files\CodeSmith\v5.0\bin). Mannaully type the connction string and test. Then it will works fine................................

Convert MSSQL DB to MySql

Today started work on converting the MSSQL database to MySql .All the sql script and sp's has to convert. Used Codesmith to generate to SP. It succeeded and have to create remaining scripts....

Convert VB to C# or C# to VB

This will help you to convert.Therefore you can try many examples without considering language(C#,VB) .
http://converter.telerik.com/

XRay

You can view the CSS setting of the web controls.It really show the XRay of selected control.
http://westciv.com/xray/index.html

SQL Designer

Today i found a very interesting which is web based Entity Relationship Designer.Enjoy this...http://ondras.zarovi.cz/sql/demo/

Thursday, November 20, 2008

Add column to mid of table

In sql Server you cant add a column to mid of a table .If you add a new column to existing table then it will append end of the table. But in case of adding a column to to mid of the table you can do it like as follows;
  • Create a new table with the required columns,
  • Copy the data from the old table into the new table
  • Delete the old table
  • Then rename the new table.
Sample Code
---Old table
Create Table A
(col1 varchar(50) null,
col2 varchar(50) null)

--Add new column col3
Begin Transaction

Create Table B
(
col1 varchar(50) null,
col3 varchar(50) null, -- NEW COLUMN IN MIDDLE (NULLABLE)
col2 varchar(50) null
)
go
if exists(select * from A)
exec('insert into B (col1, col2)
select col1, col2 from A with (holdlock tablockx)')
go
drop table A
go
execute sp_rename 'B', 'A', 'object'
go

commit


Wednesday, November 19, 2008

NHibernate

This is new topic for me and I started to work on that few days ago. It is interesting to play and I learn lot during the days. :-) .Learning curve of the NHibernate is bit long and few resources are available. But using trial and error could be able to solve lot of problems.


What is ?


NHibernate is ORM solution and is intended for transparent binding .NET classes to database tables.Commonly we have mismatch beween the relational database and our objects. The aim of the NHibernate is reducing time efforts to switch application to another database provider .Basically it provides low overhead .


“NHibernate increases your performance as a developer”.







Monday, November 17, 2008

Back to Blogging

Last few months i could not able to continue my blog..:-( ..Again i hope to continue it......:-)

Sunday, June 1, 2008

Research

Last week i play with COM object in dot net.That is very cool.
Using COM objects you can read the word document.By doing following thing you can achieve it.


Steps you should follow;
Add a COM reference to the project by right clicking in
the solution explorer on References->Add Reference. Click on the COM
tab and look for the Microsoft Word 9.0/
Microsoft Word 11.0/ Microsoft Word 12.0 Object Library. Click Select and OK.
In here the object library version depends on your MS.office package what you have installed in your machine .example: If it s Office 2007 the Microsoft Word 12.0 Object Library
<--------Source Code-------------->
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.ComponentModel;
using Word = Microsoft.Office.Interop.Word;



public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnSubmit_Click(object sender, EventArgs e)
{

object missing = System.Reflection.Missing.Value;
Word.ApplicationClass wordApp = new Word.ApplicationClass();

// Input box is used to get the path of the file which has to be
//uploaded into textbox.

string filePath = filePath.Text;

object file = filePath;


object nullobj = System.Reflection.Missing.Value;

// here on Document.Open there should be 16 arg.

Word.Document doc = wordApp.Documents.Open(ref fileName, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);



Word.Document doc1 = wordApp.ActiveDocument;

string m_Content = doc1.Content.Text;

// the content is stored into the textbox.
txtDisplay.Text = m_Content;

doc.Close(ref nullobj, ref nullobj, ref nullobj);
}
}
<----------------Source code -------->


Enjoy and play with COM objects.

Tuesday, February 19, 2008

Power of Information visualization

Ben Shneiderman is a giant person in information visualization field and he has contributed for many theories in this field. He has coined what he calls information visualization mantra that leads to information seeking behavior:

Overview first, zoom and filter, then details on demand”

The important point is that a good computer-based visualization is an interface that can support all of these activities. According to this mantra; system should represent the overview of the entire collection, any interested item should be able to zoom, able to filter out uninteresting items, and also able to select an item or group and
get details when needed. Any system which follows this mantra can be representing the high volume of information in an effective manner. Figure 1 shows application (Ex: Spotfire) which built upon using this mantra. In this application entire item collection are displayed and any item can be


Monday, January 21, 2008

went for a RMS's session

Last friday i went for Richard Stallment session who is launched the GNU project.Actually it was very interesting session.And he emphsised the what should be the purpose of the free software and he furter said we should dicatate linux as GNU-slash Linux.Becuase linux main part is the GNU.

Tuesday, January 15, 2008

internal DataTable GetConformedResults(string spName, string fName, string lName) { DataTable dt = new DataTable(); SqlConnection con = new SqlConnection("Data Source=BUDDHIKA-PC\\SQLEXPRESS;Initial Catalog=VertualDoctor;Integrated Security=True"); con.Open(); SqlCommand SqlCmd = new SqlCommand(spName, con); SqlCmd.Parameters.Add("@vcFistName", DbType.String).Value = fName; SqlCmd.CommandType = CommandType.StoredProcedure; SqlCmd.Parameters.Add("@vcLastName", DbType.String).Value = lName; SqlCmd.CommandType = CommandType.StoredProcedure; SqlDataAdapter DataAdp = new SqlDataAdapter(); DataAdp.SelectCommand = SqlCmd; DataSet result = new DataSet(); //Create a dataset DataAdp.Fill(result, "result"); //Fill the dataset dt = result.Tables["result"]; con.Close(); con.Dispose(); return dt; }

Thursday, January 10, 2008

Nature-inspired visualization

Visualizations of complex interrelationships have the potential to be complex and require a lot of cognitive input. When creating new approaches for visualization we can derive analogues from natural systems. People interact with the nature very closely Hence natural inspired concepts can be used to cognitive amplification , moving the load from the user's cognitive to their perceptual systems and thus allowing them to focus their cognitive resources where they are most appropriate There are two systems as follows:

  1. physical-based model
  2. biological inspiration

Lot of day today actions are happening mediated by technology. So these action can be recorded and analyzed .At that point we will be able to find some interesting patterns and interesting thing about the data. These result can be used for yielding insights into our behavior, desires and goals, providing marketing companies with identified opportunities to sell new products into, or medical companies with information on appropriate healthcare, or governments with information on their citizens and enemies, the spread of disease, the social networks of texting and blogging.We want to find the effective methods to represent those findings.

In 1973, Herman Chernoff introduced a visualization technique to illustrate trends in multidimensional data. Normally we change our expression time to time. But we can easily identify them if there is slightly different. This concept is the base for Chernoff faces technique. Different data dimensions were mapped to different facial features, for example the face width, the level of the ears, the radius of the ears, the length or curvature of the mouth, the length of the nose, etc. Chernoff faces are just a cartoon like faces. With this faces we can display complex multivariate data. They draw upon the human mind's natural ability to recognize small differences in facial characteristics and to understand many facial characteristics at once. Several Variables can be assigned to facial characteristic and according the condition expressions can be generated.




As an example, here are some team statistics from the 2005 baseball season represented in a table and then as a series of Chernoff Faces:(Go)

2005 National League

PCTHHRBBSB
ARI.4751419191606 67
ATL.5561453184534 92
CHI.4881506194419 65
CIN.4511453222611 72
COL.4141477150509 65
FLO.5121499128512 96
HOU.5491400161481115
LAD.4381374149541 58
MIL.5001413175531 79
NYM.5121421175486153
PHI.5431494167639116
PIT.4141445139471 73
SDP.5061416130600 99
SFG.4631427128431 71
STL.6171494170534 83
WAS.5001367117491 45


Working with Agent Technology

Currently i am doing my 4th year project based on Agent Technology.It is really cool and also new experinece.Basically the output will be the intelligent agent who is living in your operting sysem and you can command to him wtih Natural Language.
In here we are using JADE flatform and Protege to develp the the system.

Akeelah and the Bee



A heart-warming, triumph-over adversity drama, AKEELA AND THE BEE centers on a precocious eleven-years-old girl, Akeelah Anderson, form south Los Angels, who is discovered to have a talent for words. In spite of the objections of her mother Wanda,Keke enters a spelling contest. Her gift takes her to compete in the National Spelling Bee, the most famous competition of its kind in the world….




One of fabulous phrase attached with this film

“Pulchritude-its derive form Latin word pulcher meaning Beautiful .Isn’t it?

You know that feeling where everything feels right? Where you don't have to worry about tomorrow or yesterday, where you feel safe and know you're doing the best you can? There's a word for that, it's called love.

L-O-V-E.

Friday, January 4, 2008

Information visulization


Information visualizaion can be states as follows:

The use of computer-supported, interactive, visual representations of abstract data to amplify cognition.

I feel if Ptolemy did not find a way to represent a location still we don't know where we are in this world. This is a simple example which shows, to amplify our cognition there should be a stimuli.

Then information visualization is highly efficient way for the mind to directly perceive data and discover knowledge and insight from it. So lots of researches are going on this area. The reasons for that is

  • Human beings are tremendously influenced by sensory perceptions
  • The way that we learn, grow, understand, and adapt is based on our ability to view, perceive, and conceptualize thoughts and ideas
  • The power to visualize and graphically represent results, ideas, solutions, and problems in multiple dimensions, as well as to manipulate data and virtually collaborate with others, is the next big revolution in technology.
  • This will help to user to reach a decision without much effort.

These reasons may be the root course to born following Chinese proverb

Tell me and I’ll forget…

Show me and I may remember…

Involve me and I’ll understand.”

That is why information visualization plays major role in following areas.

Medical Science,Financial Sector,Data mining,Software visualization,Geographic visualization,Forecasting,Morphological analysis,Cave Automatic Virtual Environment.

There are lot of dimensional types exist in information visualization

• Temporal
One-dimensional (1D)
Two-dimensional (2D)
Three-dimensional (3D)
Multi-dimensional (MultiD)
Tree
Network
Workspace

More detail of about this dimension are available at On-line Library of information visualization Environment at http://www.otal.umd.edu/Olive/


Thursday, January 3, 2008

Start to blogging.....

I created this blog bit earlier.But i didn't use it until today.With the dawn of 2008 hope to continue blogging.Its just like beginning to use a house which was not used for a long time . So hope to enjoy by blogging the things.


"Since human beings themselves are not fully debugged yet, there will be bugs in your code no matter what you do."