24 May

Java termwork connect Access Database and operations

Prologue:
Long back there were golden days of post graduation in the “great” DDIT (Now Dharamsinh Desai University), Nadiad.
Assignments, termwork and journals or everything similar was in demand – I attempted a java code as my termwork on Monday, October 03, 2005. [That’s created date of .java file, I don’t remember anything.]
A “variable check” became very famous, notorious actually, for some unmentionable reasons. It was recently mentioned by Utkarsh AKA Bapu.
Later I decided to scan each bit of my harddisk and get that 8582 code.
So here is that java code and it was working 5 years back.
I don’t remember / have termwork’s definition but code is here. Seems a simple java program to connect DB and do regular activities.

Now,
This post is a remembrance for my colleagues and the great 8582 check.

For the rest go ahead and test Java-Access-Database connectivity code.
Download TermWork.

[ad#ad-2-300×250]


Epilogue:
I’m no more working with Java, I understand logic and nothing else. So if atall you face any errors, go through it – you can solve it, post it here too.
Enjoy.
10 May

Extreme Movie Review: Housefull 2010

Housefull!! The best movie, the best comedy, the best dialogues, the best jokes…

So in this first line of Housefull review “I’m a joking

Actually it’s totally reverse. If you’ve got little sense of humor, you will not like this at all – just donot go for this movie.

Story is about Akshay “the Panauti” and his life. Throughout the movie, whatever he does turn into disaster and with that Mr. Sajid assumed film would be hilarious.

There are countable scenes where I laughed due to movie.
Like: When Akshay gets back Dipika’s mobile from monkey,
The way Akshay ends Lara’s pet and brings a tiger as a pet.

The theme of the film – Akshay as “Panauti” seems really a panauti for the movie Housefull :)

At places I hated dipika for exclusive over acting. All the drama is extremely pathetic. This comedy film is more of a tragedy. Dressing in the film is just not good. Seems like director has tried to cover up the film with “expose” formula.
The movie is full of mindless creatures and very much predictable “what’s next” scenes atleast for me. E.g. In the case of Jiah and Akshay’s wedding and “how she could be”.
The N2O [laughing gas] scene at the end; I felt it as a “forced” laughter. I don’t understand why??!! [Why I saw this film]
“Because every body is laughing in movie, audience will laugh” – very much wrong thinking… Despite of it was a bit serious scene, Sajid tried to force comedy in it.
Also, I expected atleast one joke when Santa-Banta showed up, but “panauti” was there too. :)))

[ad#ad-2-300×250]

Normally I describe film section wise and review but here I just don’t feel like writing in detail.

I hate the songs of the film; lyrically nonsense. Eg. “papa sleepin'”… What a crap… I feel like abusing but I controlled. There are pitiful jokes on “Gay” and “dostana” as usual but worthless.
“I’m a joking” is Chanki’s punch line, but none of his jokes are worth your smile.

I feel ashamed of saying that I’ve seen this movie; hence I wrote this review to cover up and convey my choice.

It’d be a waste of money to watch such a bore comedy. I’ve heard people getting headaches after this movie.

Sajid has a bad HouseFull with poor comedy, and tried to sell hard. I’ll say DON’T BUY IT. This is NOT even worth for free.

It’s bad bad movie and I AM NOT JOKING.

05 May

MySQL Stored procedure to Generate-Extract Insert Statement

A lot of places I saw people asking for ways to generate Insert statements.

We do have GUI Tools which can extract insert statements for us readily. of the time I choose the MySQLDump way to generate insert statements.

mysqldump -uroot -ppassword –complete-insert –no-create-info DATABASE TABLENAME > TABLENAME.sql

But mind is very unstable and hungry, we don’t stop at one solution.
So to remove my mind’s starvation for the Stored Procedure way to extract Insert statement I created following routine.

As you can see this is really a simple procedure revolves around Information_schema mainly to get details of any table and then fires the simple sql query.

The procedure I named: InsGen
Input parameters:

in_db: Database name of the table for which you want to generate insert statements
in_table: Tabel name
in_file: complete file path [eg: C:/mysqlInserts.sql or /var/lib/data/mysqlInserts.sql]

DELIMITER $$

DROP PROCEDURE IF EXISTS `InsGen` $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `InsGen`(in_db varchar(20),in_table varchar(20),in_file varchar(100))
BEGIN

declare Whrs varchar(500);
declare Sels varchar(500);
declare Inserts varchar(2000);
declare tablename varchar(20);

set tablename=in_table;
select tablename;
# Comma separated column names – used for Select
select group_concat(concat(‘concat(\'”\’,’,’ifnull(‘,column_name,’,””)’,’,\'”\’)’)) INTO @Sels from information_schema.columns where table_schema=in_db and table_name=tablename;

# Comma separated column names – used for Group By
select group_concat(‘`’,column_name,’`’) INTO @Whrs from information_schema.columns where table_schema=in_db and table_name=tablename;

#Main Select Statement for fetching comma separated table values
set @Inserts=concat(“select concat(‘insert into “, in_db,”.”,tablename,” values(‘,concat_ws(‘,’,”,@Sels,”),’);’) from “, in_db,”.”,tablename,” group by “,@Whrs, ” INTO OUTFILE ‘”, in_file ,”‘”);

PREPARE Inserts FROM @Inserts;
EXECUTE Inserts;

END $$

DELIMITER ;

Sample output:

Generate-Inserts-mysql

Generate Inserts mysql

Download sql script to generate insert statements: InsGen.sql

I have not considered each and every scenarios yet, but this works for normal tables and it does error if file exists.
My mind is no more hungry atleast in this regard.

I hope it helps.

04 May

My Digital confusion for Camera

In the huge task of selecting a digital camera, one more day has passed.
I’m still not decided.

Yes, I have now felt an extreme need of purchasing a digital camera and I’m trying hard to wrap-up this chapter by end of this week.

I started getting idea from Ashish as he knows much more in cameras and he’s good at capturing as well.
After finishing his analysis and study he suggested me Sony DSC-W380 in my suggested price band of Rs. 15000.

Mean while I went on Sony store where I found and compared it with DSC-W370 and again get back to Mr. Ashish. W370 is having higher optical zoom (7X) as compared to 5x of W380 but still it was cheaper!! I learned that the processor is a main distinction between them W380 has BIONZ while W370 is having Sony-Processor.

Well the afternoon I happen to talk to Vic. Who owns Canon 400D and want to sell it and buy 5D.
According to him, all these Sony S8000, CoolPix or DSC series are “Ladies” cameras :) He suggested me to raise the price band or buy a “pink” camera. Proper SLRs I will not get below 30K and I’m not much interested in jumping to that range.
Any ways Vic, I’m not gonna get Pink for sure, it’ll be Black, My favorite :)

Readers, do check Vic’s flicker here: www.flickr.com/photos/vicky300374

[ad#ad-2-300×250]

My need is simple, maximum value for minimum money [Is it possible for free?] ;)
A camera having good zoom (at least 10x), Higher Pixels (at least 10) with some good lens and processor is my target.

In the evening Rakesh aka Raka aka Sabu told me to go for higher configuration and said some lens name “Carl Zuuuuuuiss” or something. I found the exact spelling later, he meant “Carl Zeiss”.

Then came the Hardik aka the Hard One (title given by Mr. Paul). He recollected my needs and started searching. Well since past two days I’ve visited almost all camera vendor’s sites and camera details; but seems like when Hardik again came to rescue, I started hunting for my DG-cam again.

Hardik come up with suggesting Sony’s DSC-H20 and Nikon’s Coolpix P100. Earlier we had discussed about Nikon S8000, but I was not much confident to go for it. I compared them with Sony DSC-H55/B and W370.
Now Nikon’s Coolpix P100 has got 26X Optical zoom but the price difference is almost 10,000.
Later I found Nikon’s COOLPIX L110 with 15X Optical Zoom with 12.1 MP @ ~15000.  Seems like I might have to settled for somewhere in 20K budget.
I didn’t stop here, I Googled for lens details and went on comparing Carl Zeiss VS Nikkor Lenses and their performance. At places I heard Carl Zeiss over Nikkor and anyways I have heard more about Zeiss :) I’m not much in to that.

My friends, who have ever been to shopping with me, know such “indecisive” attribute about choosing things, but I need help.

Anyways I’m still not done with deciding which one to buy and I hope I pick a good one.

04 May

Steps to Move Copy Rename MySQL Database

Moving, copying or renaming database is a very basic activity. I have just noted a few commands for reference to quickly follow the required operation.

1. Rename database on Linux Machine:

A. Use RENAME DATABASE Command [MySQL 5.1].

RENAME DATABASE db_name TO new_db_name;

B.

mysql -uroot -pPASSWORD -e “drop database if exists NEW-DB-NAME; create database NEW-DB-NAME” && mysqldump -uroot -pPASSWORD SOURCE-DB-NAME | mysql -uroot -pPASSWORD NEW-DB-NAME && mysql -uroot -pPASSWORD -e “drop database SOURCE-DB-NAME”

2. Create Duplicate of a database:

mysql -uroot -ppassword -e “drop database if exists DB_TO_BE_CREATED;create database DB_TO_BE_CREATED;” | mysqldump -uroot -ppassword DB_TO_BE_COPIED | mysql -uroot -ppassword DB_TO_BE_CREATED

3. Copy MySQL Database to Remote MySQL Server:

[ad#ad-2-300×250]

3A. By using -h (hostname) option.

Create MySQL Dump:

mysqldump -uroot -ppassword –databases DB_TO_BE_COPIED > DB_TO_BE_COPIED.sql

Load MySQL Dump:

mysql -uroot -ppassword -hHOSTNAME < DB_TO_BE_COPIED.sql OR Using Single Command: mysql -uroot -ppassword -e “drop database if exists DB_TO_BE_CREATED;create database DB_TO_BE_CREATED;” | mysqldump -uroot -ppassword DB_TO_BE_COPIED | mysql -uroot -ppassword -hHOSTNAME DB_TO_BE_CREATED 3B. By moving dump file to remote server. Create MySQL Dump: mysqldump -uroot -ppassword –databases DB_TO_BE_COPIED > DB_TO_BE_COPIED.sql

Copy SQL file to remote MySQL Server:

scp DB_TO_BE_COPIED.sql username@remote-machin:/path/to/copy

Login to remote-machin.

Load MySQL Dump:

mysql -uroot -ppassword DB_TO_BE_CREATED < /path/to/copy/DB_TO_BE_COPIED.sql

Here, I haven’t considered copying and moving data-files for MyISAM databases as these are just the commands-way.

-- Kedar Vaijanapurkar --