Friday, May 30, 2014

android Error : Dx trouble processing "javax/crypto/IllegalBlockSizeException.class": Dx 1 error; aborting Conversion to Dalvik format failed with error 1

Error :
Dx  trouble processing "javax/crypto/IllegalBlockSizeException.class":
Dx 1 error; aborting
Conversion to Dalvik format failed with error 1


Solution :
  uncheck all the libraries (android private libraries and maven dependencies if u have ) from BuilPath->Configure Build Path -> order and export 
  clean the projet and run it 

Wednesday, February 5, 2014

inserting record from xsjs to HANA DB

// sample to insert a record in Database  (Very basic code to insert a record)

// create a connection
var conn = $.db.getConnection();

// prepare the statement 
var stmt =  "insert into \"WORKSHOPA_00\".\"workshop.sessiona.00.data::address\" values('65','chennai','chennai','Tamil Nadu')";

// syntax for the above  stmt 
   //  "insert into <schema name >.<table> values('','','') "

// execute the statement 
conn.prepareStatement(stmt).execute();

// commit it in order to reflect the data chnages in hana DB
conn.commit(); 

// and finally close the connection
conn.close(); 




Thursday, January 30, 2014

Remove view from dialog : Error

I have created a dialog and did setview(view) for that dialog.
very first time this view attached to that dialog and dialog is popping up without any problem.

but the second time , when you do setview(view) .. it will throw the below error. 

Error :The specified child already has a parent. You must call removeView() on the child's parent first.


Solution:

      Create a layout and add imageview in that xml. 
      inflate the xml and set that imageview in the alertdialog.

   View dialoglayout = inflater.inflate(R.layout.scale_image, null);
   ImageView view2 =  (ImageView) dialoglayout.findViewById(R.id.enlargeImage);
   view2.setImageBitmap(scaledBitmap);
   

       alertdialog.setView(dialoglayout);
            alertdialog.show();



Above piece of code solved my issue .



Saturday, January 25, 2014

Repository: Internal error during statement execution and Error : HANA Stdio is not at all lauching

Error  1 :   Repository: Internal error during statement execution

please see the database error traces for additional details The csv file:
workshop.sessiona.00.data:sales.csv doesn't match to target table: workshop.sessiona.00.data::sales.
The type of at least one entry in record 982 does not match to the type of columns. column: date(6)entry: 20020229.


Cause :  I was generating some random data to test the hana App , in that I am generating DATE also .
while generating  date ,I generated all the month has 31 days .
HANA server checks this  and rejecting the data .

Error 2 :   HANA Stdio is not at all lauching
   Soln : delete hdbstudio from C:\Users\Administrator\
     after deleting this , you will get a fresh development setup
Reason : might be studio is not exited gracefully 

Monday, September 30, 2013

SAP HANA exercise coding

Sample code



.xsaccess

{
"exposed":true,
"authentication":[{"method":"LogonTicket"},{"method":"Basic"}]

}



header.hdbtable

table.schemaName = "WorkshopA_00";
table.tableType = COLUMNSTORE ;
table.description = "workshop order header";
table.columns = [
{name = "orderID" ;sqlType = NVARCHAR ;nullable = false ;length = 10 ;},
{name = "Createdby" ;sqlType = NVARCHAR ;nullable = false ;length = 10 ;},
{name = "Createdat" ;sqlType = DATE ;nullable = false ;},
{name = "Currency" ;sqlType = NVARCHAR ;nullable = false ;length = 10 ;},
{name = "Total" ;sqlType = DECIMAL ;nullable = false ;length = 10 ;
                                                   defaultValue = "0";}
];


table.primaryKey.pkcolumns = ["orderID"];


item.hdbtable

table.schemaName = "WorkshopG_00";
table.tableType = COLUMNSTORE ;
table.description = "workshop order item";
table.columns = [
{name = "orderID" ;sqlType = NVARCHAR ;nullable = false ;length = 10 ;},
{name = "OrderItem" ;sqlType = NVARCHAR ;nullable = false ;length = 10 ;},
{name = "ProductId" ;sqlType = NVARCHAR ;nullable = false ;length = 10 ;},
{name = "Quantity" ;sqlType = NVARCHAR ;nullable = false ;length = 5 ;},
{name = "QuantityUnit" ;sqlType = NVARCHAR ;nullable = false ;length = 5;}
];


table.primaryKey.pkcolumns = ["orderID"];


.hdbview
to join the tables

schema="WorkshopA_00";
query="select T0.\"orderID\",
              T1.\"OrderItem\",
              T0.\"Createdby\",
              T0.\"Createdat\",
              T1.\"ProductId\",
              T1.\"Quantity\",
              T1.\"QuantityUnit\"
        from \"WorkshopA_00\".\"<package>::header\" T0
        left outer join \"WorkshopA_00\".\"<package>::item\" T1
        on T0.\"orderID\" = T1.\"orderID\"
        order by T0.\"orderID\" ASC";
        depends_on_table =["<package>::header","<package>::item"];



header.hdbsequence

schema = "WorkshopA_00";
start_with = 1 ;

depends_on_table = "package::header";



.xsprivileges

{
    "privileges":[
        {
            "name": "Basic",
            "description":"Basic usage privileges"
        },
        {
            "name": "Admin",
            "description":"Administration privileges"
        }

             ]
}

workshopAdmin.hdbrole

role <package>::workshopAdmin
 extends role <package>::workshopUser
{
catalog schema "WorkshopA_00": SELECT ,INSERT ,UPDATE ,DELETE ,DROP ;
application privilege : <package>::Admin;
}

workshopUser.hdbrole 

role <package>::workshopUser {

catalog schema "WorkshopA_00": SELECT ;
application privilege : <package>::Basic;
}


To Activate role
call "_SYS_REPO"."GRANT_ACTIVATED_ROLE" ('package::workshopAdmin','uname');

SAP HANA Error / Solution

Recently I have encountered a problem while create table in SAP HANA  , I had no clue about the error .. I was getting the error from below

table.columns = [
{name = "orderID" ;sqlType = NVARCHAR ;nullable = false ;length = 10 ;},
{name = "Createdby" ;sqlType = NVARCHAR ;nullable = false ;length = 10 ;},
{name = "Createdat" ;sqlType = DATE ;nullable = false ;},
{name = "Currency" ;sqlType = NVARCHAR ;nullable = false ;length = 10 ;},
{name = "Total" ;sqlType = DECIMAL ;nullable = false ;length = 10 ;
                                                   defaultValue = "0";}

];

Error is "unable to parse  '{' expected "  .

later I found that , there is an empty line between the data and the square bracket ..

I just deleted the empty line and starting working .. quite strange :(
Hope this helps someone who is facing this issue.




Similar problem I come across recent days is that

Error : The processing instruction target matching "[xX][mM][lL]" is not allowed.

above error is occured while parsing the xml file by the application

Soln :  you might have added some space in the beginning of the application , just remove the space and f5 .



Wednesday, September 25, 2013

Encryption / decryption of DB in android ( Sqlchiper )

Encrypting database 

below link will help you , how to encrypt your data

http://sqlcipher.net/sqlcipher-for-android/


Decryption of database 

once you encrypted your db , you may need to decrypt your database .
follow below steps to decrypt your database

you need linux system to decrypt your database  or follow
http://thebugfreeblog.blogspot.in/2012/08/compiling-sqlcipher-for-windows.html  this link

download sqlcipher_2.1.1.orig.tar.gz from the below site
https://launchpad.net/ubuntu/+source/sqlcipher/2.1.1-2

or run
$ wget https://launchpad.net/ubuntu/+archive/primary/+files/sqlcipher_2.1.1.orig.tar.gz
#untar using below command
$ tar -zxvf sqlcipher_2.1.1.orig.tar.gz
$ apt-get install build-essential
$ sudo apt-get install libssl-dev
# $ cd sqlcipher-2.1.1  , go to that folder
$  ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto"
$  make
$ ./sqlite3 encrypted.db ;

sqlite> PRAGMA key = 'password';   -- you need to pass the password which is used while creating db.
sqlite> ATTACH DATABASE 'plaintext.db' AS plaintext KEY '';  -- empty key will disable encryption
sqlite> SELECT sqlcipher_export('plaintext');
sqlite> DETACH DATABASE plaintext;


you will get plaintext.db , you can view in SQLite Database Browser